:root {
  --bg: #e8e3d8;
  --panel: rgba(252, 250, 246, 0.92);
  --panel-soft: #f3efe6;
  --ink: #1f1c18;
  --muted: #69635d;
  --line: rgba(50, 44, 38, 0.14);
  --shadow: 0 22px 55px rgba(50, 39, 28, 0.12);
  --accent: #3b3937;
  --overlay: rgba(31, 28, 24, 0.72);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.5), transparent 25%),
    linear-gradient(180deg, #f2ede4 0%, #e4dccf 100%);
  color: var(--ink);
  font-family: "Segoe UI", "Aptos", "Trebuchet MS", sans-serif;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 600;
}

p {
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

.app {
  width: min(1360px, calc(100% - 36px));
  margin: 0 auto;
  padding: 28px 0 34px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 22px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 10px;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.intro {
  max-width: 740px;
  color: var(--muted);
  line-height: 1.6;
  margin-top: 12px;
}

.header-actions {
  display: grid;
  gap: 12px;
  justify-items: end;
  min-width: 0;
}

.top-nav {
  display: flex;
  flex-wrap: nowrap;
  gap: 0;
  justify-content: flex-end;
  align-items: center;
}

.top-nav-link {
  padding: 0 12px;
  color: var(--ink);
  font-size: 0.91rem;
  line-height: 1;
  border-right: 1px solid rgba(50, 44, 38, 0.18);
  transition: color 180ms ease, opacity 180ms ease;
}

.top-nav-link:first-child {
  padding-left: 0;
}

.top-nav-link:last-child {
  padding-right: 0;
  border-right: 0;
}

.top-nav-link:hover {
  color: #c96a3d;
}

.top-nav-link.is-current {
  opacity: 0.52;
  pointer-events: none;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.header-controls {
  justify-content: flex-end;
}

.social-links {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.social-link {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(50, 44, 38, 0.1);
  background: rgba(255, 255, 255, 0.38);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease, opacity 140ms ease;
}

.social-link:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.62);
  border-color: rgba(30, 25, 20, 0.2);
  opacity: 0.92;
}

.social-link svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
  display: block;
}

#fileInput {
  display: none;
}

.button,
.button-secondary {
  border-radius: 999px;
  padding: 13px 18px;
  border: 1px solid var(--line);
  cursor: pointer;
  font: inherit;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.button {
  background: var(--ink);
  color: #f7f4ee;
}

.button-secondary {
  background: rgba(255, 255, 255, 0.55);
  color: var(--ink);
}

.premium-unlock-button {
  background: #c96a3d;
  color: #ffffff;
  border-color: rgba(201, 106, 61, 0.3);
  box-shadow: 0 14px 28px rgba(201, 106, 61, 0.22);
  font-weight: 800;
  letter-spacing: 0.01em;
}

.button:hover,
.button-secondary:hover {
  transform: translateY(-1px);
  border-color: rgba(30, 25, 20, 0.28);
}

.premium-unlock-button:hover {
  transform: translateY(-1px);
  background: #cf7348;
  border-color: rgba(201, 106, 61, 0.4);
  box-shadow: 0 16px 30px rgba(201, 106, 61, 0.26);
}

.button[disabled],
.button-secondary[disabled] {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

.mode-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 22px;
  padding: 7px;
  width: fit-content;
  max-width: 100%;
  border-radius: 22px;
  background: rgba(250, 247, 240, 0.58);
  border: 1px solid rgba(61, 51, 40, 0.08);
  box-shadow: 0 14px 34px rgba(50, 39, 28, 0.06);
}

.primary-switcher {
  margin-bottom: 12px;
}

.secondary-switcher {
  margin-top: 0;
  margin-bottom: 22px;
  background: rgba(255, 255, 255, 0.44);
  box-shadow: 0 10px 24px rgba(50, 39, 28, 0.04);
}

.tab-button {
  border-radius: 999px;
  padding: 11px 16px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  transition: transform 220ms ease, border-color 220ms ease, background 220ms ease, color 220ms ease, box-shadow 220ms ease;
}

.tab-button:hover {
  transform: translateY(-1px);
  background: rgba(201, 106, 61, 0.08);
  color: #c96a3d;
  border-color: rgba(201, 106, 61, 0.2);
}

.tab-button.active {
  background: #c96a3d;
  color: #ffffff;
  border-color: rgba(201, 106, 61, 0.26);
  box-shadow: 0 10px 24px rgba(201, 106, 61, 0.18);
}
.home-tab-button {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 999px;
  background: #1f1c18;
  border: 1px solid #1f1c18;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 18px rgba(50, 39, 28, 0.16);
  flex: 0 0 auto;
}

.home-tab-button:hover {
  background: #1f1c18;
  border-color: #1f1c18;
  color: #ffffff;
}

.home-tab-button svg {
  width: 18px;
  height: 18px;
  display: block;
  stroke: currentColor;
  stroke-width: 1.9;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  margin: 0;
  flex: 0 0 auto;
}


.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.95fr);
  gap: 22px;
  align-items: start;
}

.card {
  background: var(--panel);
  border: 1px solid rgba(61, 51, 40, 0.1);
  border-radius: 26px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  padding: 20px;
}

.workspace-card {
  display: grid;
  gap: 16px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
}

.workspace-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.section-label {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 8px;
}

.hint {
  color: var(--muted);
  font-size: 0.92rem;
}

.overlay-color-control {
  position: relative;
  flex: 0 0 auto;
}

.overlay-color-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border-radius: 999px;
  padding: 10px 14px;
  border: 1px solid rgba(50, 44, 38, 0.12);
  background: rgba(255, 255, 255, 0.62);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  transition: transform 220ms ease, border-color 220ms ease, background 220ms ease, box-shadow 220ms ease;
}

.overlay-color-button:hover {
  transform: translateY(-1px);
  border-color: rgba(201, 106, 61, 0.24);
  background: rgba(255, 255, 255, 0.78);
}

.overlay-color-preview,
.overlay-swatch {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 1px solid rgba(31, 28, 24, 0.22);
  display: inline-block;
  flex: 0 0 auto;
}

.overlay-color-black {
  background: #1f1c18;
}

.overlay-color-white {
  background: #ffffff;
}

.overlay-color-red {
  background: #c96a3d;
}

.overlay-color-label {
  font-size: 0.88rem;
}

.overlay-color-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 18px;
  background: rgba(252, 250, 246, 0.95);
  border: 1px solid rgba(50, 44, 38, 0.1);
  box-shadow: 0 16px 36px rgba(50, 39, 28, 0.12);
  z-index: 4;
}

.overlay-swatch {
  width: 22px;
  height: 22px;
  cursor: pointer;
  padding: 0;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.overlay-swatch-black {
  background: #1f1c18;
}

.overlay-swatch-white {
  background: #ffffff;
  border-color: rgba(31, 28, 24, 0.26);
}

.overlay-swatch-red {
  background: #d34b2f;
}

.overlay-swatch:hover {
  transform: scale(1.06);
  border-color: rgba(31, 28, 24, 0.34);
}

.overlay-swatch.active {
  box-shadow: 0 0 0 3px rgba(201, 106, 61, 0.22);
  border-color: rgba(201, 106, 61, 0.62);
}

.canvas-wrap {
  position: relative;
  min-height: 620px;
  border-radius: 22px;
  border: 1px dashed rgba(62, 54, 47, 0.18);
  overflow: hidden;
  cursor: pointer;
  background:
    repeating-linear-gradient(
      45deg,
      rgba(85, 76, 66, 0.05) 0,
      rgba(85, 76, 66, 0.05) 14px,
      transparent 14px,
      transparent 28px
    ),
    linear-gradient(180deg, rgba(255, 255, 255, 0.45), rgba(241, 235, 225, 0.8));
  display: grid;
  place-items: center;
}

.composition-stage {
  position: relative;
  display: inline-block;
  max-width: 100%;
  line-height: 0;
}

.workspace-image {
  display: none;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 75vh;
  object-fit: contain;
  vertical-align: top;
  opacity: 0;
  transition: opacity 240ms ease;
}

.workspace-image.is-loaded {
  opacity: 1;
}

.overlay-canvas {
  display: none;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: auto;
}

.overlay-canvas.notes-mode {
  cursor: grab;
}

.image-loading-overlay {
  position: absolute;
  inset: 18px;
  display: grid;
  place-items: center;
  padding: 22px;
  border-radius: 18px;
  background: rgba(247, 242, 235, 0.78);
  border: 1px solid rgba(61, 51, 40, 0.1);
  box-shadow: 0 18px 36px rgba(50, 39, 28, 0.08);
  backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
  z-index: 4;
}

.canvas-wrap.is-loading .image-loading-overlay,
.canvas-wrap.has-load-error .image-loading-overlay {
  opacity: 1;
}

.image-loading-copy {
  display: grid;
  gap: 8px;
  justify-items: center;
  text-align: center;
  color: var(--ink);
}

.image-loading-title {
  font-size: 1rem;
  font-weight: 700;
}

.image-loading-subcopy {
  color: var(--muted);
  font-size: 0.88rem;
}

.empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  padding: 24px;
  line-height: 1.6;
}

.upload-empty-state {
  pointer-events: none;
}

.upload-empty-state-inner {
  display: grid;
  justify-items: center;
  gap: 14px;
}

.upload-empty-icon {
  width: 72px;
  height: 72px;
  border-radius: 999px;
  border: 1px solid rgba(62, 54, 47, 0.14);
  background: rgba(255, 255, 255, 0.48);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    0 10px 24px rgba(50, 39, 28, 0.06);
  display: grid;
  place-items: center;
}

.upload-empty-icon svg {
  width: 26px;
  height: 26px;
  stroke: rgba(31, 28, 24, 0.78);
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
}

.upload-empty-label {
  font-size: 0.96rem;
  letter-spacing: 0.01em;
  color: rgba(69, 63, 57, 0.92);
}

.analysis-grid,
.placeholder-panel,
.side-panel {
  display: grid;
  gap: 16px;
}

.placeholder-card,
.detail-card {
  padding: 18px;
  border-radius: 18px;
  background: var(--panel-soft);
  border: 1px solid rgba(59, 52, 45, 0.08);
}

.placeholder-card {
  color: var(--muted);
  line-height: 1.7;
}

.detail-copy {
  color: var(--muted);
  line-height: 1.65;
}

.control-stack {
  display: grid;
  gap: 16px;
}

.control-group {
  display: grid;
  gap: 10px;
}

.control-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.control-label,
.control-value {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--ink);
}

.control-value {
  color: var(--muted);
}

.control-button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.spiral-control-button,
.spiral-display-button {
  min-width: 52px;
  padding-inline: 14px;
}

.control-slider {
  width: 100%;
  accent-color: #c96a3d;
}

.control-hint {
  font-size: 0.92rem;
}

.control-reset {
  width: fit-content;
}

.analysis-download-button {
  width: 100%;
  justify-content: center;
}

.grid-overlay-info {
  position: absolute;
  top: 14px;
  left: 14px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(252, 250, 246, 0.74);
  border: 1px solid rgba(59, 52, 45, 0.08);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1;
  pointer-events: none;
  z-index: 2;
}
.grid-transfer-inputs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.grid-transfer-field {
  display: grid;
  gap: 8px;
}
.grid-transfer-input-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  min-height: 46px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(59, 52, 45, 0.08);
}
.grid-transfer-input {
  width: 100%;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font: inherit;
}
.grid-transfer-input::-webkit-outer-spin-button,
.grid-transfer-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.grid-transfer-input[type="number"] {
  -moz-appearance: textfield;
}
.grid-transfer-unit {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}
.grid-transfer-result {
  min-height: 1.65em;
}

.dynamic-score {
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.02rem;
  font-weight: 700;
}

.toggle-control {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.4;
}

.toggle-control input {
  accent-color: #c96a3d;
}

.dynamic-tooltip {
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.52);
  border: 1px solid rgba(50, 44, 38, 0.08);
}

.thirds-reading-stack {
  gap: 12px;
}

.thirds-reading-grid {
  display: grid;
  gap: 8px;
}

.thirds-reading-grid .detail-copy {
  margin: 0;
}

.thirds-reading-grid strong {
  color: var(--ink);
  font-weight: 700;
}

#thirdsClickReadout {
  margin: 0;
  color: var(--ink);
  font-weight: 600;
}

.center-reading-stack {
  gap: 12px;
}

#centerClickReadout {
  margin: 0;
  color: var(--ink);
  font-weight: 600;
}

.center-fix-card {
  position: relative;
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.44);
  border: 1px solid rgba(50, 44, 38, 0.08);
  overflow: hidden;
}

.center-fix-list {
  display: grid;
  gap: 8px;
}

.center-fix-line {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.center-fix-card.is-locked .center-fix-line {
  filter: blur(3px);
  user-select: none;
}

.center-fix-lock {
  position: absolute;
  inset: auto 12px 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(252, 250, 246, 0.88);
  color: var(--ink);
  font-weight: 700;
  text-align: center;
  box-shadow: 0 12px 26px rgba(50, 39, 28, 0.12);
}
@media (max-width: 720px) {
  .grid-transfer-inputs {
    grid-template-columns: 1fr;
  }
}

.hidden {
  display: none;
}

.premium-toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 1200;
  width: min(420px, calc(100% - 28px));
  padding: 12px 16px;
  border-radius: 18px;
  border: 1px solid rgba(201, 106, 61, 0.26);
  background: rgba(34, 28, 24, 0.94);
  color: #f8f3ec;
  box-shadow: 0 20px 36px rgba(20, 16, 13, 0.24);
  font-size: 0.95rem;
  line-height: 1.45;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.premium-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.status-toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 1250;
  max-width: min(320px, calc(100% - 28px));
  padding: 11px 14px;
  border-radius: 16px;
  border: 1px solid rgba(61, 51, 40, 0.12);
  background: rgba(252, 250, 246, 0.95);
  color: var(--ink);
  box-shadow: 0 16px 32px rgba(50, 39, 28, 0.12);
  font-size: 0.9rem;
  line-height: 1.4;
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.status-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.feedback-helper {
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
}
.feedback-cta {
  display: grid;
  gap: 14px;
  padding: 20px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.68), rgba(243, 239, 230, 0.94));
  border: 1px solid rgba(59, 52, 45, 0.1);
  box-shadow: 0 16px 34px rgba(50, 39, 28, 0.08);
}
.feedback-badge {
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(201, 106, 61, 0.1);
  color: #9a562f;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.feedback-title {
  font-size: 1.28rem;
  line-height: 1.2;
}
.feedback-description,
.feedback-button-note {
  color: var(--muted);
  line-height: 1.65;
}
.feedback-list {
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
}
.feedback-list li {
  position: relative;
  padding-left: 16px;
  line-height: 1.55;
}
.feedback-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.7em;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(201, 106, 61, 0.74);
  transform: translateY(-50%);
}
.feedback-cta-button {
  justify-self: start;
  opacity: 1;
  cursor: pointer;
  background: #c96a3d;
  color: #ffffff;
  border-color: rgba(201, 106, 61, 0.26);
  box-shadow: 0 10px 24px rgba(201, 106, 61, 0.18);
}
.feedback-cta-button:hover {
  transform: translateY(-1px);
  border-color: rgba(201, 106, 61, 0.36);
  background: #cf7348;
}
.feedback-button-note {
  font-size: 0.84rem;
}

.footer {
  margin-top: 28px;
  padding: 20px 24px;
  border-radius: 22px;
  border: 1px solid rgba(59, 52, 45, 0.1);
  background: rgba(255, 255, 255, 0.42);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}

.footer-copy {
  color: var(--muted);
  line-height: 1.65;
}

.footer-links {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  gap: 16px;
  align-items: center;
}

.footer-link {
  color: var(--ink);
  font-size: 0.94rem;
}

.footer-link:hover {
  color: #c96a3d;
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .canvas-wrap {
    min-height: 480px;
  }
}

@media (max-width: 720px) {
  .app {
    width: min(100% - 22px, 1360px);
    padding-top: 22px;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .controls,
  .button,
  .button-secondary,
  .tab-button {
    width: 100%;
  }

  .workspace-meta,
  .overlay-color-control,
  .overlay-color-button {
    width: 100%;
  }

  .overlay-color-button {
    justify-content: center;
  }

  .overlay-color-menu {
    left: 0;
    right: auto;
  }

  .control-button-row {
    width: 100%;
  }

  .spiral-control-button,
  .spiral-display-button,
  .analysis-download-button,
  .control-reset {
    width: 100%;
  }

  .header-actions,
  .top-nav,
  .social-links {
    width: 100%;
    justify-items: stretch;
    justify-content: flex-start;
  }

  .canvas-wrap {
    min-height: 360px;
  }

  .image-loading-overlay {
    inset: 14px;
  }

  .status-toast {
    right: 14px;
    bottom: 14px;
  }

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

  .footer-links {
    grid-auto-flow: row;
    gap: 8px;
  }
}

