:root {
  --bg: #f6efe7;
  --paper: #fffaf4;
  --card: rgba(255, 250, 244, 0.92);
  --line: rgba(101, 71, 42, 0.14);
  --text: #1f1a16;
  --muted: #6d5d4f;
  --accent: #bc6c25;
  --accent-deep: #8d4f15;
  --success: #2f7d32;
  --danger: #b42318;
  --shadow: 0 24px 60px rgba(85, 50, 17, 0.12);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body.modal-open {
  overflow: hidden;
}

body {
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top right, rgba(241, 168, 88, 0.26), transparent 28%),
    radial-gradient(circle at left center, rgba(94, 140, 128, 0.18), transparent 26%),
    linear-gradient(180deg, #f8f1ea 0%, #f5ece2 48%, #f2e9df 100%);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea {
  font: inherit;
}

.page {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.photo-tool-body .page {
  width: calc(100% - 20px);
  max-width: none;
}

.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin: 8px 0 16px;
  flex-wrap: wrap;
}

.badge-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.import-trigger {
  position: relative;
  display: inline-flex;
  z-index: 320;
}

.import-trigger::after {
  content: "";
  position: absolute;
  left: 0;
  top: 100%;
  width: 100%;
  height: 12px;
}

.btn-import {
  background: linear-gradient(180deg, #4f8fff 0%, #2f6df3 58%, #2458cf 100%);
  border: 1px solid rgba(28, 84, 207, 0.55);
  border-radius: 40px;
  padding: 8px 24px;
  font-weight: 600;
  font-size: 0.9rem;
  color: white;
  cursor: pointer;
  transition: 0.2s;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 10px 22px rgba(47, 109, 243, 0.28),
    0 3px 0 rgba(24, 67, 166, 0.9);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-import:hover {
  background: linear-gradient(180deg, #5a99ff 0%, #3a79fb 58%, #2a63dc 100%);
  transform: translateY(-2px);
}

.btn-import:active {
  transform: translateY(1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 6px 14px rgba(47, 109, 243, 0.24),
    0 1px 0 rgba(24, 67, 166, 0.9);
}

.import-menu {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  min-width: 180px;
  padding: 8px;
  background: rgba(255, 250, 244, 0.98);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  display: none;
  flex-direction: column;
  gap: 6px;
  z-index: 1200;
}

.import-menu.open {
  display: flex;
}

.import-menu button {
  border: 0;
  border-radius: 14px;
  background: rgba(245, 238, 228, 0.9);
  color: var(--text);
  padding: 10px 12px;
  text-align: left;
  font-size: 0.86rem;
  cursor: pointer;
}

.import-menu button:hover {
  background: rgba(236, 226, 214, 0.95);
}

.import-duplicate-warning {
  max-width: min(620px, 60vw);
  color: var(--danger);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.45;
}

.import-duplicate-warning.hidden {
  display: none;
}

.topbar {
  padding: 24px 0 14px;
}

body[data-page="home"] .topbar {
  margin-left: 50%;
  transform: translateX(-50%);
  width: min(1680px, calc(100vw - 32px));
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  width: 56px;
  height: 56px;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 6px 14px rgba(77, 50, 24, 0.22));
}

.brand-text strong {
  display: block;
  font-size: 18px;
  letter-spacing: 0.02em;
  text-shadow: 0 2px 10px rgba(77, 50, 24, 0.16);
}

.brand-text span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

body[data-page="home"] .nav-actions {
  flex: 1 1 auto;
  flex-wrap: nowrap;
  gap: 8px;
  justify-content: flex-start;
  min-width: 0;
  overflow-x: auto;
  padding: 2px 0 4px;
  scrollbar-width: none;
}

body[data-page="home"] .nav-actions::-webkit-scrollbar {
  display: none;
}

body[data-page="home"] .nav-actions .list-inline {
  flex: 0 0 auto;
  flex-wrap: nowrap;
  gap: 8px;
}

body[data-page="home"] .nav-actions .list-inline.hidden {
  display: none;
}

body[data-page="home"] .nav-actions .btn,
body[data-page="home"] .nav-actions .tag {
  align-items: center;
  display: inline-flex;
  flex: 0 0 auto;
  height: 40px;
  justify-content: center;
  line-height: 1;
  padding: 0 14px;
  white-space: nowrap;
}

body[data-page="home"] .nav-actions .tag {
  gap: 6px;
  padding: 0 12px;
}

body[data-page="home"] .nav-actions .locale-switcher {
  flex: 0 0 auto;
  min-height: 40px;
}

body[data-page="home"] .nav-actions .locale-option {
  align-items: center;
  display: inline-flex;
  height: 30px;
  justify-content: center;
  min-height: 30px;
}

.locale-switcher {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
}

.locale-option {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  min-height: 28px;
  padding: 6px 8px;
  white-space: nowrap;
}

.locale-option:hover,
.locale-option.is-active {
  background: rgba(188, 108, 37, 0.14);
  color: var(--accent-deep);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease, background 0.2s ease;
  font-size: 14px;
}

.btn:hover {
  transform: translateY(-1px);
  background: var(--accent-deep);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--line);
  color: var(--text);
}

.btn-sm {
  background: #f0e7dd;
  border: 1px solid #cfc2b2;
  padding: 8px 14px;
  border-radius: 44px;
  font-weight: 500;
  cursor: pointer;
  transition: 0.2s;
  color: #3b332a;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  font-size: 0.82rem;
}

.btn-sm:hover {
  background: #e6dbce;
  transform: translateY(-1px);
}

.btn-sm:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

.btn-tool-entry {
  background: linear-gradient(180deg, #4f8fff 0%, #2f6df3 58%, #2458cf 100%);
  border: 1px solid rgba(28, 84, 207, 0.55);
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 10px 22px rgba(47, 109, 243, 0.28),
    0 3px 0 rgba(24, 67, 166, 0.9);
}

.btn-tool-entry:hover {
  background: linear-gradient(180deg, #5a99ff 0%, #3a79fb 58%, #2a63dc 100%);
  transform: translateY(-2px);
}

.btn-tool-entry:active {
  transform: translateY(1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 6px 14px rgba(47, 109, 243, 0.24),
    0 1px 0 rgba(24, 67, 166, 0.9);
}

.btn-photo-entry {
  background: linear-gradient(180deg, #ffb36a 0%, #f08a25 58%, #c86812 100%);
  border: 1px solid rgba(181, 91, 17, 0.5);
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.32),
    0 10px 22px rgba(212, 116, 29, 0.24),
    0 3px 0 rgba(155, 71, 10, 0.88);
}

.btn-photo-entry:hover {
  background: linear-gradient(180deg, #ffbf7f 0%, #f6993d 58%, #d2761d 100%);
  transform: translateY(-2px);
}

.btn-photo-entry:active {
  transform: translateY(1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.24),
    0 6px 14px rgba(212, 116, 29, 0.2),
    0 1px 0 rgba(155, 71, 10, 0.88);
}

.hero {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 26px;
  padding: 26px 0 18px;
}

.photo-tool-grid {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.photo-tool-workspace,
.photo-tool-side-stack,
.photo-tool-main-stack {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.photo-tool-main-stack.has-local-result {
  gap: 6px;
}

.photo-tool-top-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(360px, 0.82fr);
  gap: 12px;
  align-items: stretch;
}

.photo-tool-results-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: start;
}

.photo-tool-results-grid.is-whole-image {
  grid-template-columns: 1fr;
}

.photo-tool-list {
  display: grid;
  gap: 10px;
  height: 640px;
  max-height: 640px;
  align-content: start;
  grid-auto-rows: min-content;
  overflow-y: auto;
}

.photo-tool-item {
  padding: 12px 14px;
  border-radius: 20px;
  background: rgba(255, 255, 245, 0.9);
  border: 1px solid #e1d5c7;
  cursor: pointer;
}

.photo-tool-item.is-active {
  border-left: 5px solid #f08a25;
  background: #ffffff;
}

.photo-tool-item.is-done {
  border-color: #cde6d6;
}

.photo-tool-item.is-processing {
  border-color: #cdddfd;
}

.photo-tool-item-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.photo-tool-item-name {
  display: block;
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.photo-tool-status {
  font-size: 0.68rem;
  line-height: 1;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid #e3d6c8;
  background: #f5eee4;
  color: #6d5e4f;
  white-space: nowrap;
}

.photo-tool-status.done {
  background: #ebf7ee;
  color: #26784a;
  border-color: #cde6d6;
}

.photo-tool-status.processing {
  background: #eaf2ff;
  color: #2456c8;
  border-color: #cdddfd;
}

.photo-tool-status.failed {
  background: #fff0f0;
  color: #b74242;
  border-color: #f0cccc;
}

.photo-tool-canvas-wrap,
.photo-tool-result {
  min-height: 360px;
  height: 360px;
  border-radius: 24px;
  border: 1px dashed rgba(109, 93, 79, 0.24);
  background: rgba(255, 255, 255, 0.48);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.photo-tool-canvas-wrap {
  position: relative;
  min-height: 520px;
}

.photo-tool-selection-canvas {
  max-width: 100%;
  max-height: 520px;
  cursor: crosshair;
}

.photo-tool-selection-box {
  position: absolute;
  border: 2px solid #f08a25;
  background: rgba(240, 138, 37, 0.14);
  box-shadow: 0 0 0 9999px rgba(20, 18, 15, 0.18);
  pointer-events: none;
}

.photo-tool-canvas-wrap img,
.photo-tool-result img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.chart-empty.compact {
  min-height: 42px;
  font-size: 0.78rem;
}

.photo-local-result-history {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.photo-local-result-row {
  display: grid;
  grid-template-columns: auto minmax(120px, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid #e2d5c6;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.62);
  color: #6d5e4f;
  font-size: 0.78rem;
}

.photo-local-result-meta {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.photo-local-result-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.photo-local-result-actions .btn-sm {
  min-height: 28px;
  padding: 5px 9px;
  font-size: 0.74rem;
}

.photo-local-result-clear-btn {
  justify-self: start;
}

.photo-image-preview-modal-panel {
  width: min(1080px, 100%);
  max-height: min(82vh, 760px);
  padding: 14px;
}

.image-preview-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.image-preview-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.image-preview-shell {
  position: relative;
  height: min(66vh, 620px);
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(109, 93, 79, 0.18);
  background: rgba(244, 239, 232, 0.92);
}

.image-preview-stage {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
}

.image-preview-stage img {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: top left;
  max-width: none;
  max-height: none;
  user-select: none;
  pointer-events: none;
}

.image-preview-stage.dragging {
  cursor: grabbing;
}

.image-preview-stage.dragging img {
  cursor: grabbing;
}

.photo-tool-body .shell-panel {
  padding: 18px;
}

.photo-tool-body .shell-panel h2 {
  margin: 4px 0 0;
  font-size: 0.9rem;
  line-height: 1.35;
  font-weight: 600;
  color: #3a3228;
}

.photo-tool-body .panel-head {
  align-items: center;
  gap: 10px;
}

.panel-head-compact {
  margin-bottom: 8px;
}

.photo-tool-action-row {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.photo-tool-selection-preview {
  min-height: 240px;
  border-radius: 20px;
  border: 1px dashed rgba(109, 93, 79, 0.22);
  background: rgba(255, 255, 255, 0.46);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.photo-tool-selection-preview img {
  display: block;
  max-width: 100%;
  max-height: 280px;
  object-fit: contain;
}

.photo-tool-selection-size-text {
  margin-top: 8px;
  margin-bottom: 2px;
}

.photo-tool-prompt {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px;
  resize: vertical;
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  font: inherit;
}

.photo-reference-strip {
  margin-top: 12px;
}

.photo-reference-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.photo-reference-list {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.photo-reference-upload,
.photo-reference-thumb {
  width: 76px;
  height: 76px;
  flex: 0 0 76px;
  border-radius: 18px;
  border: 1px dashed rgba(109, 93, 79, 0.24);
  background: rgba(255, 255, 255, 0.62);
  display: grid;
  place-items: center;
  overflow: hidden;
  cursor: pointer;
  position: relative;
}

.photo-reference-upload span {
  font-size: 26px;
  line-height: 1;
  color: #8f8171;
}

.photo-reference-upload small {
  position: absolute;
  bottom: 7px;
  font-size: 11px;
  color: #8f8171;
}

.photo-reference-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-reference-remove {
  position: absolute;
  right: 5px;
  top: 5px;
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 50%;
  background: rgba(31, 26, 22, 0.78);
  color: #fff;
  cursor: pointer;
}

.photo-editor-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(31, 26, 22, 0.48);
}

.photo-editor-modal.open {
  display: flex;
}

.photo-editor-panel {
  width: min(1320px, calc(100vw - 32px));
  max-height: min(90vh, 980px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 24px;
  background: #fffaf4;
  border: 1px solid rgba(255, 255, 255, 0.76);
  box-shadow: var(--shadow);
  padding: 16px;
}

.photo-editor-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.photo-editor-title {
  font-size: 1rem;
  font-weight: 700;
  color: #2c251f;
  margin-bottom: 6px;
}

.photo-editor-copy {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.photo-editor-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.photo-editor-canvas-wrap {
  min-height: 360px;
  border-radius: 18px;
  border: 1px solid #e2d6c7;
  background: rgba(255, 255, 255, 0.62);
  overflow: auto;
}

.projection-editor-toolbar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(247, 241, 232, 0.88);
  border: 1px solid #e2d6c7;
  margin-bottom: 14px;
}

.projection-editor-toolbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.projection-editor-toolbar-row-controls {
  align-items: flex-start;
}

.projection-editor-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.projection-editor-hint {
  font-size: 0.8rem;
  color: #6a5b4d;
  flex: 1 1 320px;
}

.projection-editor-workspace {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 14px;
  flex: 1 1 auto;
  min-height: 320px;
  align-items: stretch;
}

.projection-editor-sidebar,
.projection-editor-inspector {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(247, 241, 232, 0.88);
  border: 1px solid #e2d6c7;
  min-height: 0;
}

.projection-editor-panel-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #4a3b2d;
  letter-spacing: 0.04em;
}

.projection-editor-shape-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: auto;
  min-height: 120px;
}

.projection-editor-shape-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 12px;
  border: 1px solid rgba(116, 95, 70, 0.16);
  background: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  transition: 0.18s ease;
  color: #433629;
  text-align: left;
}

.projection-editor-shape-item:hover,
.projection-editor-shape-item.is-active {
  border-color: rgba(64, 49, 34, 0.55);
  background: rgba(255, 248, 239, 1);
  box-shadow: inset 0 0 0 2px rgba(64, 49, 34, 0.12), 0 8px 18px rgba(54, 40, 28, 0.08);
}

.projection-editor-shape-no {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #2f2419;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  flex: none;
}

.projection-editor-shape-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  flex: 1;
  min-width: 0;
}

.projection-editor-active-meta {
  font-size: 0.82rem;
  line-height: 1.6;
  color: #5f5347;
  white-space: normal;
  flex: 1 1 240px;
  min-width: 220px;
}

.projection-editor-inspector-actions,
.projection-editor-color-palette {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.projection-editor-hidden {
  display: none !important;
}

.projection-editor-color-chip {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 2px solid rgba(47, 36, 25, 0.18);
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(33, 27, 21, 0.08);
}

.projection-editor-color-chip.is-active {
  border-color: #2f2419;
  box-shadow: 0 0 0 2px rgba(47, 36, 25, 0.12);
}

.projection-editor-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.projection-editor-options-inline {
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
}

.projection-editor-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: #5e5246;
}

.projection-editor-option input[type="range"] {
  width: 180px;
}

.projection-editor-option input[type="number"],
.projection-editor-option input[type="text"] {
  width: 90px;
  border-radius: 12px;
  border: 1px solid #d6c8b7;
  padding: 6px 10px;
  background: #fff;
  color: #2d241b;
}

.projection-editor-option input[type="color"] {
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
}

.projection-tool-btn.is-active {
  background: #2f2419;
  color: #fff;
  border-color: rgba(47, 36, 25, 0.9);
}

.projection-editor-shell {
  height: min(62vh, 640px);
  min-height: 320px;
  overflow: auto;
  padding: 14px;
}

.projection-editor-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-width: 100%;
  min-height: 100%;
}

.projection-editor-canvas-wrap {
  position: relative;
  display: inline-block;
  line-height: 0;
}

.projection-editor-image {
  display: block;
  max-width: none;
  max-height: none;
  border-radius: 16px;
  box-shadow: 0 18px 42px rgba(33, 27, 21, 0.16);
}

.projection-editor-overlay {
  position: absolute;
  inset: 0;
  cursor: crosshair;
  touch-action: none;
}

.projection-editor-overlay.is-selecting {
  cursor: grab;
}

@media (max-width: 1150px) {
  .projection-editor-workspace {
    grid-template-columns: 1fr;
  }

  .projection-editor-toolbar-row,
  .projection-editor-toolbar-row-controls {
    align-items: flex-start;
  }
}

.photo-tool-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.photo-tool-controls label {
  display: grid;
  gap: 6px;
}

.photo-tool-controls select,
.photo-tool-controls input {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  font: inherit;
}

.photo-tool-result-stack {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

@media (max-width: 1100px) {
  .photo-tool-grid,
  .photo-tool-top-grid,
  .photo-tool-results-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  body.photo-tool-body .photo-tool-glass {
    padding: 16px;
    border-radius: 28px;
  }

  body.photo-tool-body .status-bar {
    border-radius: 28px;
    padding: 12px;
  }

  body.photo-tool-body .badge,
  body.photo-tool-body .status-bar .btn-secondary,
  body.photo-tool-body .btn-import {
    width: 100%;
    justify-content: center;
  }

  body.photo-tool-body .tool-nav,
  body.photo-tool-body .import-trigger,
  body.photo-tool-body .tool-credit-bar {
    width: 100%;
  }

  body.photo-tool-body .photo-tool-top-meta {
    justify-content: flex-start;
  }

  .photo-tool-download-final-inline {
    margin-left: 0;
  }
}

.card,
.info-panel,
.shell-panel {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}

.hero-panel {
  padding: 38px;
  position: relative;
  overflow: hidden;
  background: transparent;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  border-radius: 0;
}

.eyebrow {
  display: inline-flex;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(188, 108, 37, 0.1);
  color: var(--accent-deep);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.hero h1 {
  margin: 18px 0 12px;
  font-size: clamp(34px, 4vw, 56px);
  line-height: 1.05;
  display: grid;
  gap: 6px;
}

.hero-title-top {
  display: block;
  font-size: clamp(32px, 3.9vw, 52px);
  letter-spacing: 0.01em;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.65),
    0 8px 20px rgba(78, 49, 20, 0.16);
}

.hero-title-main {
  display: block;
  font-size: 35px;
  font-weight: 800;
  letter-spacing: 0.01em;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.62),
    0 3px 0 rgba(132, 83, 36, 0.28),
    0 12px 24px rgba(78, 49, 20, 0.18);
}

.hero p {
  margin: 0;
  max-width: 680px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.75;
}

.hero-copy-emphasis {
  color: #7f3f0f;
  font-weight: 800;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.55);
}

.hero-actions,
.stack,
.list-inline {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.action-inline {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  align-items: center;
}

.action-inline .btn {
  padding: 8px 12px;
  font-size: 13px;
  line-height: 1.2;
}

.action-inline {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  align-items: center;
}

.action-inline .btn {
  padding: 8px 12px;
  font-size: 13px;
  line-height: 1.2;
}

.hero-actions {
  margin-top: 24px;
}

.hero-cta-animated {
  opacity: 0;
  transform: translateY(32px);
  animation: hero-cta-rise 1s ease forwards;
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 24px;
}

.metric {
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
}

.metric strong {
  display: block;
  font-size: 26px;
}

.metric span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.info-panel {
  padding: 24px;
}

.info-panel-animated {
  animation: panel-fade-up 0.9s ease both;
}

.seo-visual img {
  display: block;
  width: 100%;
  height: auto;
}

.info-panel h3 {
  margin: 0 0 16px;
  font-size: 22px;
}

.home-tool-grid {
  display: grid;
  gap: 14px;
}

.home-tool-card {
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid var(--line);
}

.home-tool-card-top {
  display: grid;
  gap: 8px;
  margin-bottom: 8px;
}

.home-tool-card-top strong {
  font-size: 20px;
  line-height: 1.35;
}

.home-hero-visual {
  margin-top: 16px;
}

.step-list {
  display: grid;
  gap: 14px;
}

.step {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 12px;
  align-items: start;
}

.step-animated {
  opacity: 0;
  animation: step-fade-in 0.7s ease forwards;
}

.step-animated:nth-child(1) { animation-delay: 0.22s; }
.step-animated:nth-child(2) { animation-delay: 0.38s; }
.step-animated:nth-child(3) { animation-delay: 0.54s; }
.step-animated:nth-child(4) { animation-delay: 0.7s; }
.step-animated:nth-child(5) { animation-delay: 0.86s; }

.step-index {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: rgba(188, 108, 37, 0.12);
  color: var(--accent-deep);
  font-weight: 700;
}

@keyframes panel-fade-up {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes step-fade-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes hero-cta-rise {
  0% {
    opacity: 0;
    transform: translateY(32px);
    filter: blur(6px);
  }
  45% {
    opacity: 0.58;
    transform: translateY(12px);
    filter: blur(2px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

.section {
  padding: 16px 0 32px;
}

.section-title {
  margin-bottom: 18px;
}

.section-title h2 {
  margin: 10px 0 8px;
  font-size: 30px;
}

.section-title p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.seo-copy-panel {
  padding: 28px 30px;
}

.seo-copy-title {
  margin-bottom: 20px;
}

.seo-copy-grid .card {
  height: 100%;
}

.seo-visual {
  margin-top: 22px;
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow);
}

.home-scene-panel {
  padding: 30px;
}

.home-scene-grid .card,
.home-process-grid .card {
  height: 100%;
}

.home-cta-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: center;
}

.home-cta-copy h2 {
  margin-bottom: 10px;
}

.home-cta-copy p {
  margin: 0;
}

.home-cta-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.grid-3,
.grid-2 {
  display: grid;
  gap: 16px;
}

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.card {
  padding: 22px;
}

.card h3,
.card h4 {
  margin: 0 0 10px;
}

.muted {
  color: var(--muted);
  line-height: 1.7;
}

.shell-panel {
  padding: 28px;
}

.shell-panel h2 {
  margin: 0 0 14px;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-top: 18px;
}

.stats-row-3 {
  grid-template-columns: repeat(3, 1fr);
}

.stats-row-1 {
  grid-template-columns: 1fr;
}

.stats-row-4 {
  grid-template-columns: repeat(4, 1fr);
}

.stats-row-5 {
  grid-template-columns: repeat(5, 1fr);
}

.stats-row-6 {
  grid-template-columns: repeat(6, 1fr);
}

.stat-box {
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid var(--line);
}

.stat-box-green {
  background: linear-gradient(180deg, rgba(80, 168, 88, 0.18), rgba(47, 125, 50, 0.1));
  border-color: rgba(47, 125, 50, 0.26);
}

.stat-box-gold {
  background: linear-gradient(180deg, rgba(230, 163, 78, 0.2), rgba(188, 108, 37, 0.1));
  border-color: rgba(188, 108, 37, 0.28);
}

.stat-box-red {
  background: linear-gradient(180deg, rgba(220, 102, 90, 0.18), rgba(180, 35, 24, 0.1));
  border-color: rgba(180, 35, 24, 0.24);
}

.stat-box-blue {
  background: linear-gradient(180deg, rgba(86, 140, 206, 0.18), rgba(43, 102, 179, 0.1));
  border-color: rgba(43, 102, 179, 0.24);
}

.stat-box-green strong {
  color: #2f7d32;
}

.stat-box-gold strong {
  color: #b66822;
}

.stat-box-red strong {
  color: #b42318;
}

.stat-box-blue strong {
  color: #2b66b3;
}

.stat-box strong {
  display: block;
  font-size: 24px;
}

.stat-box span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.stat-box-action {
  position: relative;
  padding-bottom: 52px;
}

.stat-action-btn {
  position: absolute;
  right: 16px;
  bottom: 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field,
.field-full {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-full {
  grid-column: 1 / -1;
}

.field label,
.field-full label {
  font-size: 14px;
  color: var(--muted);
}

.field input,
.field-full input,
.field-full textarea {
  width: 100%;
  padding: 13px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  color: var(--text);
}

.field-full textarea {
  min-height: 92px;
  resize: vertical;
}

.form-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.note {
  font-size: 13px;
  color: var(--muted);
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.filter-inline,
.filter-grid {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-inline label,
.filter-grid label {
  font-size: 13px;
  color: var(--muted);
}

.filter-inline input,
.filter-inline select,
.filter-grid input,
.filter-grid select {
  min-width: 150px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
}

.input-clear-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.input-clear-wrap input {
  padding-right: 40px;
}

.input-clear-btn {
  position: absolute;
  right: 10px;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 50%;
  background: rgba(109, 93, 79, 0.12);
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
}

.input-clear-btn:hover {
  background: rgba(188, 108, 37, 0.12);
  color: var(--accent-deep);
}

.section-tight {
  padding-top: 16px;
}

.chart-card {
  margin-top: 18px;
  padding: 18px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
}

.mini-bar-chart,
.mini-line-chart {
  display: flex;
  align-items: end;
  gap: 8px;
  min-height: 220px;
  overflow-x: auto;
}

.chart-empty {
  color: var(--muted);
  font-size: 14px;
}

.chart-group {
  display: flex;
  justify-content: center;
  align-items: end;
  gap: 4px;
  height: 180px;
}

.chart-bar-wrap {
  position: relative;
  display: flex;
  align-items: end;
  justify-content: center;
  width: 8px;
  height: 100%;
}


.chart-day {
  flex: 0 0 36px;
  width: 36px;
  display: flex;
  flex-direction: column;
  justify-content: end;
  align-items: stretch;
  gap: 4px;
  position: relative;
}

.chart-bar {
  border-radius: 10px 10px 4px 4px;
  min-height: 2px;
  width: 8px;
  transition: transform 0.18s ease, filter 0.18s ease;
}

.chart-bar-wrap:hover .chart-bar {
  transform: translateY(-2px);
  filter: saturate(1.08);
}

.chart-bar-green {
  background: linear-gradient(180deg, #62c069, #2f7d32);
}

.chart-bar-gold {
  background: linear-gradient(180deg, #f0a751, #bc6c25);
}

.chart-bar-red {
  background: linear-gradient(180deg, #e36e61, #b42318);
}

.chart-bar-blue {
  background: linear-gradient(180deg, #68a1ea, #2b66b3);
}

.chart-label {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.chart-tooltip-inline {
  position: absolute;
  left: calc(100% + 10px);
  bottom: 12px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(32, 27, 23, 0.94);
  color: #fff7ef;
  box-shadow: 0 10px 24px rgba(26, 18, 12, 0.18);
  font-size: 12px;
  line-height: 1.4;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  z-index: 4;
  transform: translateY(4px);
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.chart-bar-wrap:hover .chart-tooltip-inline {
  opacity: 1;
  transform: translateY(0);
}

.trend-list {
  display: grid;
  gap: 10px;
}

.trend-row {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 12px;
  align-items: center;
}

.trend-bars {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.trend-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(109, 93, 79, 0.12);
  overflow: hidden;
}

.trend-fill {
  height: 100%;
  border-radius: inherit;
}

.trend-fill-money {
  background: linear-gradient(90deg, #bc6c25, #d7904d);
}

.trend-fill-points {
  background: linear-gradient(90deg, #b42318, #dd7a73);
}

.trend-fill-user-register {
  background: linear-gradient(90deg, #2b66b3, #68a1ea);
}

.trend-fill-user-recharge {
  background: linear-gradient(90deg, #b42318, #dd7a73);
}

.user-growth-chart {
  display: flex;
  align-items: end;
  gap: 14px;
  min-height: 190px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.user-growth-day {
  flex: 0 0 42px;
  width: 42px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.user-growth-bars {
  height: 150px;
  display: flex;
  align-items: end;
  gap: 6px;
}

.user-growth-bar-wrap {
  position: relative;
  display: flex;
  align-items: end;
  justify-content: center;
}

.user-growth-bar {
  width: 12px;
  min-height: 4px;
  border-radius: 10px 10px 4px 4px;
}

.user-growth-bar-wrap:hover .chart-tooltip-inline {
  opacity: 1;
  transform: translateY(0);
}

.user-growth-bar-register {
  background: linear-gradient(180deg, #68a1ea, #2b66b3);
}

.user-growth-bar-recharge {
  background: linear-gradient(180deg, #e36e61, #b42318);
}

.user-growth-label {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  white-space: nowrap;
}

.trend-legend {
  display: flex;
  gap: 18px;
  align-items: center;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.trend-legend span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.trend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.trend-dot-blue {
  background: #4d87d8;
}

.trend-dot-red {
  background: #cf5d52;
}

.compact-table table {
  min-width: 100%;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(109, 93, 79, 0.12);
  color: var(--muted);
  font-size: 12px;
}

.status-chip-success {
  background: rgba(47, 125, 50, 0.12);
  color: var(--success);
}

.status-chip-failed {
  background: rgba(180, 35, 24, 0.12);
  color: var(--danger);
}

.status-chip-pending {
  background: rgba(188, 108, 37, 0.12);
  color: var(--accent-deep);
}

.txn-plus {
  color: var(--success);
  font-weight: 700;
}

.txn-minus {
  color: var(--danger);
  font-weight: 700;
}

.ellipsis {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pager {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.pager button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
}

.tab-strip {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tab-chip {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
}

.tab-chip.is-active {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
}

.ranking-bars {
  margin: 18px 0 8px;
  display: grid;
  gap: 8px;
}

.ranking-bar-row {
  display: grid;
  grid-template-columns: 160px 1fr 72px;
  gap: 12px;
  align-items: center;
}

.ranking-bar-label {
  font-size: 13px;
  color: var(--muted);
}

.ranking-bar-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(109, 93, 79, 0.12);
  overflow: hidden;
}

.ranking-bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #bc6c25, #d7904d);
}

.danger-row {
  background: rgba(180, 35, 24, 0.04);
}

.admin-modal-panel {
  width: min(980px, 100%);
  max-height: min(82vh, 760px);
  overflow: auto;
}

.admin-transactions-modal-panel {
  width: min(1680px, calc(100% - 24px));
}

.modal-card-list {
  display: grid;
  gap: 12px;
}

.modal-card {
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
}

.modal-table-wrap {
  max-height: min(62vh, 560px);
  overflow: auto;
}

.notice,
.error,
.success {
  margin-top: 14px;
  padding: 13px 14px;
  border-radius: 16px;
  font-size: 14px;
}

.notice {
  background: rgba(188, 108, 37, 0.08);
  color: var(--accent-deep);
}

.success {
  background: rgba(47, 125, 50, 0.12);
  color: var(--success);
}

.error {
  background: rgba(180, 35, 24, 0.1);
  color: var(--danger);
}

.hidden {
  display: none !important;
}

.settings-form.is-hidden-by-mode {
  display: none !important;
}

.table-wrap {
  overflow-x: auto;
  margin-top: 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  padding: 12px 10px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

th {
  color: var(--muted);
  font-weight: 600;
}

.locale-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  font-weight: 700;
  color: var(--text);
}

.locale-flag {
  font-size: 15px;
  line-height: 1;
}

.footer {
  padding: 18px 0 34px;
  color: var(--muted);
  font-size: 13px;
  display: grid;
  gap: 6px;
}

.footer-link {
  color: var(--accent-deep);
  text-decoration: underline;
  text-underline-offset: 2px;
}

body.photo-tool-body .status-bar {
  position: relative;
  z-index: 220;
  margin: 0 0 28px;
  padding: 12px 20px;
  background: rgba(255, 255, 245, 0.8);
  border-radius: 60px;
  backdrop-filter: blur(4px);
  border: 1px solid rgba(200, 182, 160, 0.5);
  overflow: visible;
}

body.photo-tool-body .status-bar .btn-secondary {
  background: #f0e7dd;
  border: 1px solid #cfc2b2;
  padding: 10px 20px;
  border-radius: 44px;
  font-weight: 500;
  cursor: pointer;
  transition: 0.2s;
  color: #3b332a;
}

body.photo-tool-body .photo-tool-glass {
  margin: 0 auto;
  background: rgba(255, 252, 245, 0.68);
  backdrop-filter: blur(2px);
  border-radius: 48px;
  box-shadow:
    0 25px 50px -12px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
  padding: 24px 28px;
  border: 1px solid rgba(215, 200, 180, 0.5);
  overflow: visible;
}

body.photo-tool-body .photo-tool-glass .section {
  padding: 0;
}

body.photo-tool-body .photo-tool-top-meta {
  justify-content: flex-end;
  max-width: min(980px, 100%);
}

body.photo-tool-body .photo-tool-locale-slot {
  display: flex;
  justify-content: flex-end;
  margin-left: auto;
}

body.photo-tool-body .badge {
  background: #ffffffcc;
  backdrop-filter: blur(4px);
  padding: 8px 16px;
  border-radius: 40px;
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid #e2d6ca;
  color: #3e362e;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

body.photo-tool-body .badge strong {
  font-weight: 700;
  color: #1f2b46;
  background: #f0ece3;
  padding: 2px 10px;
  border-radius: 30px;
  margin-left: 4px;
}

.tool-nav,
.tool-credit-bar {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.tool-credit-warning {
  color: #b54708;
  font-size: 0.82rem;
  font-weight: 600;
}

.meta-text {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.45;
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.panel-content {
  display: flex;
  align-items: center;
  color: var(--muted);
  line-height: 1.5;
}

body.photo-tool-body .photo-tool-grid {
  grid-template-columns: 232px minmax(0, 1fr);
}

body.photo-tool-body #photo-tool-list.queue-scroll {
  height: 640px;
  max-height: 640px;
}

body.photo-tool-body #photo-tool-drop-guide,
body.photo-tool-body #photo-tool-cache-panel {
  margin: 12px 12px 0;
  padding: 10px 12px;
  border: 1px dashed #c9b79f;
  border-radius: 16px;
  background: rgba(255, 250, 242, 0.86);
  color: #5e5246;
}

body.photo-tool-body #photo-tool-drop-guide.is-drag-over,
body.photo-tool-body #photo-tool-cache-panel.is-drag-over,
body.photo-tool-body #photo-tool-list.is-drag-over {
  border-color: #f08a25;
  background: rgba(255, 245, 229, 0.96);
  box-shadow: inset 0 0 0 2px rgba(240, 138, 37, 0.18);
}

body.photo-tool-body #photo-tool-drop-guide .queue-drop-title {
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.35;
}

body.photo-tool-body #photo-tool-drop-guide .queue-drop-text,
body.photo-tool-body #photo-tool-cache-panel .queue-drop-text {
  margin-top: 4px;
  font-size: 0.68rem;
  line-height: 1.45;
  color: #897766;
}

body.photo-tool-body #photo-tool-cache-panel {
  align-items: center;
  gap: 8px;
}

body.photo-tool-body #photo-tool-cache-panel .btn-sm {
  min-height: 26px;
  padding: 4px 10px;
  border-radius: 16px;
  font-size: 0.68rem;
  line-height: 1.2;
  font-weight: 600;
}

body.photo-tool-body #photo-tool-cache-panel .queue-drop-text {
  margin-top: 0;
}

.card-soft {
  background: rgba(255, 252, 245, 0.86);
  backdrop-filter: blur(2px);
  border-radius: 32px;
  border: 1px solid rgba(195, 178, 155, 0.5);
  overflow: hidden;
}

.card-header {
  padding: 18px 20px 8px 20px;
  font-weight: 600;
  font-size: 0.9rem;
  color: #3a3228;
  border-bottom: 1px solid #e8dfd4;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.queue-scroll {
  max-height: 640px;
  overflow-y: auto;
  padding: 12px 12px 20px;
}

.queue-item {
  background: rgba(255, 255, 245, 0.9);
  border-radius: 20px;
  padding: 12px 14px;
  margin-bottom: 10px;
  border: 1px solid #e1d5c7;
  cursor: pointer;
  overflow: hidden;
}

.queue-item.active {
  border-left: 5px solid #f08a25;
  background: #ffffff;
}

.queue-item.is-done {
  border-color: #cde6d6;
}

.queue-item.is-processing {
  border-color: #cdddfd;
}

.queue-item.locked {
  border-color: #f0cbc7;
  background: #fff8f7;
}

.queue-item strong {
  font-weight: 600;
  display: block;
  font-size: 0.9rem;
}

.queue-item-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.queue-item-name {
  display: block;
  min-width: 0;
  max-width: 100%;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.queue-item-name.is-duplicate-name {
  color: var(--danger);
}

.queue-item-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.queue-status {
  font-size: 0.68rem;
  line-height: 1;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid #e3d6c8;
  background: #f5eee4;
  color: #6d5e4f;
  white-space: nowrap;
  flex-shrink: 0;
}

.queue-status.done {
  background: #ebf7ee;
  color: #26784a;
  border-color: #cde6d6;
}

.queue-status.processing {
  background: #eaf2ff;
  color: #2456c8;
  border-color: #cdddfd;
}

.queue-status.locked,
.queue-status.pending.locked,
.queue-status.ready.locked,
.queue-status.failed.locked {
  background: #fff1f0;
  color: #b42318;
  border-color: #f4c7c3;
}

.queue-remove-btn {
  border: 1px solid #d9c7b6;
  background: #fff;
  color: #8a4d14;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 0.68rem;
  line-height: 1;
  cursor: pointer;
  transition: 0.2s;
  flex-shrink: 0;
}

.queue-remove-btn:hover {
  background: #fff3ea;
  border-color: #f0c7a4;
  color: #b35e17;
}

.queue-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.queue-status.failed {
  background: #fff0f0;
  color: #b74242;
  border-color: #f0cccc;
}

body.photo-tool-body .photo-tool-side-stack > .shell-panel:not(.photo-tool-stage-block) {
  background: #ffffffd9;
  border-radius: 28px;
  padding: 14px 16px;
}

body.photo-tool-body .photo-tool-side-stack.has-local-result {
  grid-template-rows: auto minmax(0, 1fr);
}

body.photo-tool-body .photo-tool-prompt-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

body.photo-tool-body .photo-tool-prompt-tip {
  margin-top: 8px;
  color: #cf3f36;
  font-size: 0.84rem;
  line-height: 1.5;
  font-weight: 600;
}

body.photo-tool-body .photo-tool-prompt {
  margin-top: 8px;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 0.85rem;
  line-height: 1.65;
  min-height: 172px;
}

body.photo-tool-body .photo-tool-side-stack.has-local-result .photo-tool-prompt {
  min-height: 252px;
}

body.photo-tool-body .photo-reference-list {
  gap: 8px;
  flex-wrap: wrap;
  overflow-x: visible;
  padding-bottom: 0;
}

.photo-reference-limit-copy {
  width: 100%;
  font-size: 0.72rem;
  line-height: 1.65;
  color: #907f6d;
  margin-top: 8px;
}

.photo-reference-warning-text {
  display: none;
  width: 100%;
  margin-top: 6px;
  font-size: 0.74rem;
  line-height: 1.6;
  color: #c73f3f;
  font-weight: 600;
  white-space: pre-line;
}

.photo-reference-warning-text.show {
  display: block;
}

body.photo-tool-body .photo-reference-upload,
body.photo-tool-body .photo-reference-thumb {
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
  border-radius: 14px;
  border: 1.5px dashed #99adc9;
  background: rgba(247, 248, 253, 0.86);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

body.photo-tool-body .photo-reference-upload {
  border: 0;
}

body.photo-tool-body .photo-reference-upload .reference-upload-tile {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  border: 1.5px dashed #99adc9;
  background: rgba(247, 248, 253, 0.86);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  cursor: pointer;
}

body.photo-tool-body .photo-reference-upload small {
  position: static;
  margin-top: 3px;
  color: #7f8fa5;
  font-size: 0.6rem;
  font-weight: 600;
}

.photo-reference-index {
  position: absolute;
  left: 5px;
  bottom: 5px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(33, 41, 54, 0.82);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.62rem;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(0,0,0,0.18);
}

.photo-model-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 12px;
}

.photo-model-row .model-select-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 0 1 360px;
}

.photo-model-label {
  flex: none;
  white-space: nowrap;
  font-size: 0.78rem;
  color: #6d5d4f;
}

.model-select {
  width: min(320px, 100%);
  min-width: 0;
  flex: 0 1 320px;
  border: 1px solid #ded0be;
  border-radius: 16px;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 0.82rem;
  background: #fffdf9;
  color: #433a31;
}

.photo-model-row .model-helper-text {
  margin-top: 0;
  flex: 1 1 220px;
  min-width: 180px;
}

.photo-prompt-size-panel {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.photo-prompt-size-tip {
  font-size: 0.74rem;
  color: #8b7a67;
  line-height: 1.6;
}

.photo-prompt-size-tip.warn {
  color: #b54708;
  font-weight: 600;
}

.photo-prompt-size-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.photo-prompt-size-label {
  font-size: 0.78rem;
  color: #6d5d4f;
  min-width: 34px;
}

.photo-pill-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.photo-pill-btn {
  border: 1px solid #d8c9b6;
  background: #fffaf4;
  color: #5e4f3f;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.75rem;
  line-height: 1;
  cursor: pointer;
}

.photo-pill-btn.active {
  border-color: #c27a2f;
  background: #fff0de;
  color: #8d4f15;
  font-weight: 700;
}

.photo-pill-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.photo-tool-run-row {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
}

.model-helper-text {
  margin-top: 8px;
  font-size: 0.72rem;
  line-height: 1.65;
  color: #8b7a67;
}

.photo-tool-progress {
  justify-content: center;
  min-height: 24px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.82rem;
}

.size-control {
  background: rgba(245, 240, 230, 0.7);
  border-radius: 28px;
  padding: 12px 20px;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  border: 1px solid #e2d5c6;
}

.photo-tool-download-final-inline {
  margin-left: auto;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
}

.batch-toggle-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.batch-inline-tip {
  position: fixed;
  left: 16px;
  top: 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: min(360px, calc(100vw - 48px));
  padding: 6px 9px;
  border: 1px solid rgba(188, 108, 37, 0.24);
  border-radius: 8px;
  background: #fff7ed;
  color: var(--accent-deep);
  box-shadow: 0 10px 22px rgba(85, 50, 17, 0.12);
  font-size: 12px;
  line-height: 1.45;
  z-index: 10000;
  pointer-events: auto;
}

.batch-inline-tip button {
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(141, 79, 21, 0.12);
  color: var(--accent-deep);
  cursor: pointer;
  font-size: 14px;
  line-height: 18px;
}

.photo-tool-custom-size-panel {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  opacity: 0.5;
  transition: 0.2s;
}

.photo-tool-custom-size-panel.is-active {
  opacity: 1;
}

.size-input-group {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255,255,245,0.8);
  padding: 6px 16px;
  border-radius: 48px;
}

.size-input-group input {
  width: 110px;
  background: white;
  border: 1px solid #cfc2b2;
  border-radius: 30px;
  padding: 6px 12px;
  font-size: 0.85rem;
  text-align: center;
}

.size-input-group span {
  font-size: 0.8rem;
  color: #5a4f42;
}

.ratio-badge {
  font-size: 0.7rem;
  background: #e8e0d5;
  padding: 4px 10px;
  border-radius: 30px;
  color: #4f453a;
}

body.photo-tool-body .projection-editor-image {
  max-width: none;
  height: auto;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(31, 26, 22, 0.42);
  backdrop-filter: blur(6px);
}

.modal-panel {
  position: relative;
  width: min(560px, 100%);
  padding: 16px 16px 14px;
  border-radius: 24px;
  background: rgba(255, 250, 244, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.78);
  box-shadow: 0 28px 70px rgba(49, 30, 12, 0.26);
}

.modal-panel.admin-transactions-modal-panel {
  width: min(1760px, calc(100% - 24px));
  max-width: min(1760px, calc(100% - 24px));
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.modal-head h2 {
  margin: 2px 0 0;
  font-size: 24px;
}

.modal-close-btn {
  flex: 0 0 auto;
  min-width: 72px;
  align-self: flex-start;
  justify-content: center;
}

.auth-switch {
  display: inline-flex;
  gap: 8px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(188, 108, 37, 0.08);
  margin-bottom: 12px;
}

.auth-tab {
  border: none;
  border-radius: 999px;
  padding: 8px 14px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
}

.auth-tab.is-active {
  background: var(--accent);
  color: white;
}

.auth-panel {
  animation: fade-up 0.2s ease;
}

.auth-panel .muted {
  margin: 0 0 10px;
  font-size: 14px;
  line-height: 1.6;
}

.auth-panel .form-grid {
  grid-template-columns: minmax(0, 1.35fr) minmax(150px, 0.65fr);
  gap: 10px;
}

.auth-panel .auth-phone-field {
  grid-column: 1 / -1;
}

.auth-panel .auth-short-field {
  grid-column: auto;
}

.auth-panel .field label {
  font-size: 13px;
}

.auth-panel .field input {
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 14px;
}

.inline-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.inline-field input {
  margin: 0;
}

.inline-send-btn {
  white-space: nowrap;
  padding: 10px 14px;
}

.auth-agreement {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.auth-agreement a {
  color: var(--accent-deep);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.auth-panel .form-actions {
  gap: 10px;
  margin-top: 10px;
}

.auth-panel .notice,
.auth-panel .error,
.auth-panel .success {
  margin-top: 10px;
  padding: 11px 12px;
  border-radius: 14px;
  font-size: 13px;
}

.modal-copy-block {
  display: grid;
  gap: 10px;
}

.modal-copy-block .muted {
  margin: 0;
}

.captcha-panel {
  width: min(420px, 100%);
}

.captcha-scene {
  position: relative;
  height: 142px;
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid rgba(122, 72, 28, 0.14);
  background: #f8efe4;
}

.captcha-bg {
  position: absolute;
  inset: 0;
}

.captcha-hole,
.captcha-piece {
  position: absolute;
  top: 50px;
  width: 42px;
  height: 42px;
  border-radius: 10px;
}

.captcha-hole {
  background: rgba(31, 26, 22, 0.24);
  border: 2px dashed rgba(255, 255, 255, 0.9);
  box-shadow: inset 0 0 0 1px rgba(31, 26, 22, 0.14);
}

.captcha-piece {
  left: 0;
  border: 2px solid rgba(255, 255, 255, 0.88);
  box-shadow: 0 10px 22px rgba(31, 26, 22, 0.22);
}

.captcha-slider {
  position: relative;
  height: 46px;
  margin-top: 14px;
  border-radius: 999px;
  background: rgba(188, 108, 37, 0.1);
  border: 1px solid rgba(122, 72, 28, 0.14);
  overflow: hidden;
}

.captcha-slider-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: rgba(67, 145, 130, 0.24);
}

.captcha-handle {
  position: absolute;
  left: 0;
  top: 3px;
  width: 56px;
  height: 40px;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  cursor: grab;
  box-shadow: 0 8px 20px rgba(144, 72, 15, 0.26);
  touch-action: none;
}

.captcha-handle:active {
  cursor: grabbing;
}

#captcha-message {
  margin-top: 10px;
  padding: 11px 12px;
  border-radius: 14px;
  font-size: 13px;
}

.photo-tool-batch-modal-copy {
  white-space: pre-line;
  line-height: 1.7;
  color: var(--text);
}

.photo-tool-batch-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.policy-content {
  max-height: min(70vh, 620px);
  overflow-y: auto;
  padding-right: 6px;
}

.policy-content p {
  margin: 0 0 12px;
  color: var(--text);
  line-height: 1.75;
}

.account-settings-stack {
  display: grid;
  gap: 12px;
}

.settings-form {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
}

.settings-form-head {
  margin-bottom: 8px;
}

.settings-form-head h3 {
  margin: 0 0 4px;
  font-size: 17px;
}

.settings-form-head .muted {
  margin: 0;
  font-size: 13px;
}

.settings-form .field label {
  font-size: 13px;
}

.settings-form .field input,
.settings-form .field-full input {
  padding: 10px 12px;
  border-radius: 14px;
}

.settings-form .field-full > .inline-send-btn {
  align-self: flex-start;
  margin-bottom: 2px;
}

.settings-form .notice {
  margin-top: 8px;
}

.pricing-grid {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.pricing-option {
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  padding: 16px;
  cursor: pointer;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.pricing-copy {
  display: grid;
  gap: 6px;
}

.pricing-option strong {
  font-size: 18px;
}

.pricing-copy span {
  color: var(--muted);
  line-height: 1.6;
}

.pricing-cta {
  display: inline-flex;
  justify-self: end;
  align-self: center;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff !important;
  font-size: 13px;
  font-weight: 700;
}

.pricing-option:hover {
  transform: translateY(-1px);
  border-color: rgba(188, 108, 37, 0.4);
}

.pricing-option.is-active {
  border-color: rgba(188, 108, 37, 0.58);
  box-shadow: 0 12px 26px rgba(188, 108, 37, 0.12);
  background: rgba(255, 247, 238, 0.92);
}

.pricing-action-row {
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.tool-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  color: var(--accent-deep);
  font-weight: 700;
}

@media (max-width: 980px) {
  .hero,
  .grid-3,
  .grid-2,
  .stats-row,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .stats-row-3,
  .stats-row-4,
  .stats-row-5 {
    grid-template-columns: 1fr;
  }

  .topbar-inner {
    align-items: flex-start;
    flex-direction: column;
  }

  .locale-switcher {
    max-width: 100%;
    overflow-x: auto;
  }

  .locale-option {
    font-size: 11px;
    padding: 6px 7px;
  }

  .hero-panel,
  .info-panel,
  .shell-panel,
  .card,
  .modal-panel {
    padding: 22px;
  }

  .ranking-bar-row {
    grid-template-columns: 1fr;
  }

  .home-cta-band {
    grid-template-columns: 1fr;
  }

  .home-cta-actions {
    justify-content: flex-start;
  }
}
