:root {
  color-scheme: light;
  --ink: #191b1f;
  --muted: #6c6f76;
  --paper: #f7f5ef;
  --panel: #ffffff;
  --line: #ded8cb;
  --teal: #1f7773;
  --teal-dark: #135754;
  --rose: #b75061;
  --gold: #af7b24;
  --violet: #6d5e94;
  --shadow: 0 18px 48px rgba(25, 27, 31, 0.08);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 16%, rgba(31, 119, 115, 0.12), transparent 24rem),
    radial-gradient(circle at 88% 7%, rgba(183, 80, 97, 0.12), transparent 22rem),
    linear-gradient(135deg, #f7f5ef 0%, #f1eee6 100%);
  overflow-x: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  width: 100%;
  max-width: 100vw;
  min-height: 100vh;
  overflow-x: hidden;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 28px 22px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.64);
  backdrop-filter: blur(18px);
}

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

.brand-mark {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(25, 27, 31, 0.12);
  border-radius: 8px;
  background:
    linear-gradient(135deg, transparent 46%, rgba(255, 255, 255, 0.72) 47% 53%, transparent 54%),
    radial-gradient(circle at 64% 36%, #fff 0 4px, transparent 5px),
    linear-gradient(135deg, var(--teal), var(--rose));
  box-shadow: var(--shadow);
}

.brand-kicker,
.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.brand h1,
.topbar h2,
.panel h3 {
  margin: 0;
  letter-spacing: 0;
}

.brand h1 {
  font-size: 22px;
  line-height: 1.1;
}

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

.nav-item {
  min-height: 40px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
}

.nav-item.active,
.nav-item:hover {
  color: var(--ink);
  background: #fff;
  border-color: var(--line);
}

.privacy-note {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--teal);
}

.workspace {
  min-width: 0;
  width: 100%;
  max-width: 100%;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.topbar h2 {
  font-size: clamp(24px, 4vw, 40px);
  line-height: 1.1;
}

.icon-button {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fff;
}

.icon-button:hover {
  color: #fff;
  background: var(--rose);
  border-color: var(--rose);
}

.main-grid {
  display: grid;
  width: 100%;
  max-width: 100%;
  grid-template-columns: minmax(300px, 0.95fr) minmax(340px, 1.1fr) minmax(280px, 0.78fr);
  gap: 16px;
  align-items: start;
}

.panel {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

.entry-panel,
.result-panel,
.share-panel,
.insight-panel,
.history-panel {
  padding: 18px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 32px;
  margin-bottom: 16px;
}

.panel-heading h3 {
  font-size: 16px;
}

.panel-heading span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
}

.field span,
.score-grid span {
  color: var(--muted);
  font-size: 12px;
}

textarea,
input,
select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

textarea,
input[type="text"],
select {
  min-height: 42px;
  padding: 10px 12px;
}

textarea {
  resize: vertical;
}

input[type="range"] {
  accent-color: var(--teal);
}

.split-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.actions {
  display: flex;
  gap: 10px;
}

.primary-button,
.secondary-button {
  min-height: 42px;
  border-radius: 8px;
  padding: 0 16px;
  border: 1px solid transparent;
  font-weight: 700;
}

.primary-button {
  color: #fff;
  background: var(--teal);
}

.primary-button:hover {
  background: var(--teal-dark);
}

.secondary-button {
  color: var(--ink);
  background: #fff;
  border-color: var(--line);
}

.secondary-button:hover {
  border-color: var(--gold);
}

.full {
  width: 100%;
}

.empty-state {
  display: grid;
  min-width: 0;
  min-height: 270px;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(222, 216, 203, 0.72);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(31, 119, 115, 0.06), rgba(109, 94, 148, 0.06)),
    #fff;
}

#dreamMap {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
}

.result-content {
  display: grid;
  gap: 14px;
}

.summary {
  padding: 14px;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(135deg, var(--teal), var(--violet));
}

.summary h4,
.section-block h4 {
  margin: 0 0 8px;
  font-size: 14px;
}

.summary p,
.section-block p {
  margin: 0;
  line-height: 1.75;
}

.section-block {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

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

.meaning-item {
  display: grid;
  gap: 5px;
  padding: 10px 0;
  border-top: 1px solid rgba(222, 216, 203, 0.7);
}

.meaning-item:first-child {
  padding-top: 0;
  border-top: 0;
}

.meaning-item strong {
  font-size: 14px;
}

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

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: #fbfaf7;
  font-size: 13px;
}

.safety {
  border-color: rgba(183, 80, 97, 0.35);
  background: rgba(183, 80, 97, 0.08);
}

.feedback {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.score-grid label {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.side-stack {
  display: grid;
  min-width: 0;
  gap: 16px;
}

.share-card {
  display: grid;
  gap: 8px;
  min-height: 160px;
  padding: 16px;
  border-radius: 8px;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(31, 119, 115, 0.94), rgba(183, 80, 97, 0.9)),
    #1f7773;
}

.share-card strong {
  font-size: 20px;
  line-height: 1.25;
}

.share-card span {
  line-height: 1.55;
}

.share-kicker {
  margin: 0;
  font-size: 12px;
  opacity: 0.8;
}

.share-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.share-tags span {
  min-height: 26px;
  padding: 3px 8px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 999px;
  font-size: 12px;
}

.muted-card {
  color: var(--muted);
  background: #fff;
  border: 1px dashed var(--line);
}

.muted-card strong {
  color: var(--ink);
}

.share-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.share-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.share-page {
  min-height: 100vh;
  overflow-x: hidden;
}

.share-landing {
  width: min(1120px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  margin: 0 auto;
  padding: 28px 0;
  overflow-x: hidden;
}

.share-hero {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 1fr);
  gap: 24px;
  align-items: center;
  padding-bottom: 28px;
}

.share-brand {
  grid-column: 1 / -1;
  align-self: start;
}

.public-card {
  display: grid;
  gap: 14px;
  min-height: 360px;
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.46);
  border-radius: 8px;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(31, 119, 115, 0.96), rgba(183, 80, 97, 0.92)),
    #1f7773;
  box-shadow: var(--shadow);
}

.public-card strong {
  font-size: clamp(32px, 6vw, 56px);
  line-height: 1.08;
  overflow-wrap: anywhere;
}

.public-card small {
  align-self: end;
  opacity: 0.78;
}

.public-card span {
  overflow-wrap: anywhere;
}

.share-copy {
  display: grid;
  gap: 12px;
}

.share-copy h2 {
  margin: 0;
  font-size: clamp(34px, 6vw, 68px);
  line-height: 1.05;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.share-copy p:not(.eyebrow) {
  max-width: 560px;
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.8;
}

.try-panel,
.download-band {
  margin-top: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

.try-panel {
  display: grid;
  gap: 14px;
  padding: 20px;
}

.try-panel h3,
.download-band h3 {
  margin: 0;
  font-size: 24px;
}

.guest-result {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.guest-result strong {
  font-size: 20px;
}

.guest-result span {
  color: var(--muted);
}

.app-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.download-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px;
}

.download-band p {
  margin: 6px 0 0;
  color: var(--muted);
}

.insight-list,
.history-list {
  display: grid;
  gap: 10px;
}

.metric-row,
.history-item {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.metric-row strong,
.history-item strong {
  font-size: 14px;
}

.metric-row span,
.history-item span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.history-item button {
  justify-self: start;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--teal-dark);
  background: #fff;
}

.hidden {
  display: none;
}

@media (max-width: 1180px) {
  .main-grid {
    grid-template-columns: minmax(300px, 0.9fr) minmax(340px, 1fr);
  }

  .side-stack {
    grid-column: 1 / -1;
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 820px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    width: 100%;
    max-width: 100vw;
    min-width: 0;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: 12px;
    overflow-x: auto;
  }

  .brand-kicker {
    display: none;
  }

  .brand {
    gap: 8px;
    flex-shrink: 0;
  }

  .brand h1 {
    font-size: 18px;
  }

  .nav-list {
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    gap: 6px;
  }

  .nav-item {
    min-height: 36px;
    padding-inline: 9px;
    font-size: 14px;
  }

  .privacy-note {
    display: none;
  }

  .workspace {
    width: 100%;
    max-width: 100vw;
    padding: 18px 12px 28px;
    overflow-x: hidden;
  }

  .main-grid,
  .side-stack {
    width: 100%;
    max-width: 100%;
    grid-template-columns: 1fr;
  }

  .share-landing {
    width: min(366px, calc(100vw - 24px));
    max-width: min(366px, calc(100vw - 24px));
    padding: 16px 0 28px;
  }

  .share-hero {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .public-card {
    min-height: 300px;
  }

  .download-band {
    align-items: stretch;
    flex-direction: column;
  }

  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .split-fields,
  .score-grid,
  .share-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .brand-kicker {
    display: none;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
  }

  .nav-item {
    min-height: 36px;
    padding-inline: 10px;
  }

  .actions {
    flex-direction: column;
  }
}
