:root {
  --ink: #101814;
  --moss: #c4d0c8;
  --sage: #aebdb3;
  --mist: #d8e2da;
  --paper: #000000;
  --cream: #f2efe6;
  --clay: #d27b5e;
  --sun: #efca75;
  --lake: #7fa2a4;
  --panel: rgba(24, 34, 29, .96);
  --panel-soft: rgba(20, 30, 25, .92);
  --line: rgba(232, 240, 234, .42);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 600px;
  height: 600px;
  overflow: hidden;
  background: var(--paper);
  color: var(--cream);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button { font: inherit; color: inherit; }

.app-shell {
  position: relative;
  width: 600px;
  height: 600px;
  overflow: hidden;
  background: #000;
}

.app-shell::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .12;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 120 120' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.07'/%3E%3C/svg%3E");
}

.screen { position: relative; z-index: 1; width: 100%; height: 100%; overflow: hidden; padding: 28px 32px; }
.screen.compact { padding: 22px 26px; }

.eyebrow {
  color: var(--clay);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
}

h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; font-weight: 600; }
h1 { margin-top: 5px; font-size: 40px; line-height: .95; letter-spacing: -.03em; }
h2 { font-size: 29px; line-height: 1; }
h3 { font-size: 22px; }
.subcopy { margin-top: 8px; color: var(--moss); font-size: 16px; line-height: 1.3; }

.home-header { height: 112px; }
.home-header .subcopy { max-width: 455px; }
.home-grid { display: grid; grid-template-columns: 1fr 1.12fr; grid-template-rows: repeat(3, 1fr); gap: 10px; height: 414px; }

.menu-card, .sound-card, .space-card, .tool-button, .pill-button {
  border: 1px solid var(--line);
  background: var(--panel-soft);
  box-shadow: none;
}

.menu-card {
  position: relative;
  overflow: hidden;
  padding: 12px 16px;
  border-radius: 26px 26px 14px 26px;
  text-align: left;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.menu-card:nth-child(2), .menu-card:nth-child(3) { border-radius: 14px 26px 26px 26px; }
.menu-card:nth-child(1) { grid-column: 1; grid-row: 1; }
.menu-card:nth-child(2) { grid-column: 1; grid-row: 2; }
.menu-card:nth-child(3) { grid-column: 1; grid-row: 3; }
.menu-card.primary { grid-column: 2; grid-row: 1 / span 3; border-radius: 26px 14px 26px 26px; background: rgba(27, 41, 34, .86); color: var(--cream); }
.menu-card .card-index { position: absolute; right: 17px; top: 15px; color: var(--sage); font-size: 14px; }
.menu-card .line-icon { width: 32px; height: 32px; margin-bottom: 2px; }
.menu-card.primary .line-icon { width: 58px; height: 58px; margin: 48px 0 26px; }
.menu-card h2 { font-size: 23px; }
.menu-card.primary h2 { font-size: 32px; }
.menu-card p { margin-top: 4px; max-width: 330px; color: var(--moss); font-size: 14px; line-height: 1.25; overflow-wrap: anywhere; }
.menu-card.primary p { color: var(--mist); }

.focusable:focus { outline: none; }
.focusable:focus.menu-card, .focusable:focus.sound-card, .focusable:focus.space-card,
.focusable:focus.tool-button, .focusable:focus.pill-button {
  border-color: var(--clay);
  background: #17241e;
  transform: translateY(-3px);
  box-shadow: 0 0 0 2px rgba(210,123,94,.16);
}
.focusable:focus.menu-card.primary { background: #22342b; }

.page-header { display: flex; align-items: flex-start; justify-content: space-between; height: 80px; }
.page-header > div { min-width: 0; padding-right: 12px; }
.page-header .subcopy { max-width: 440px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.back-button { width: 46px; height: 46px; border: 1px solid var(--line); border-radius: 50%; background: transparent; font-size: 22px; }
.back-button:focus { outline: 3px solid rgba(183,101,74,.25); border-color: var(--clay); }

.list-stack { display: grid; gap: 10px; }
.space-card {
  min-height: 104px;
  display: grid;
  grid-template-columns: 76px 1fr 48px;
  align-items: center;
  gap: 14px;
  padding: 13px;
  border-radius: 20px 20px 10px 20px;
  text-align: left;
}
.space-card .mini-orbit { width: 70px; height: 70px; }
.space-card > div, .your-space-card > div { min-width: 0; }
.space-card h3, .your-space-card h3 { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.space-card p { margin-top: 3px; color: var(--moss); font-size: 14px; }
.space-card .duration { color: #ef9a7d; font-size: 14px; font-weight: 700; }
.space-card .arrow { font-size: 20px; }
.your-space-card {
  min-height: 112px; display: grid; grid-template-columns: 72px 1fr 70px; align-items: center; gap: 12px;
  padding: 12px; border: 1px solid var(--line); border-radius: 20px 20px 10px 20px; background: var(--panel-soft);
}
.your-space-card p { color: var(--moss); font-size: 14px; }
.space-actions { display: grid; gap: 6px; }
.space-actions button { height: 42px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel); font-size: 14px; font-weight: 700; }
.space-actions button:focus { outline: none; color: var(--cream); border-color: var(--clay); background: var(--clay); }

.create-screen { padding: 0; background: #000; }
.create-header {
  position: absolute; z-index: 5; top: 0; left: 0; right: 0; height: 70px;
  display: flex; align-items: center; justify-content: space-between; padding: 16px 22px;
}
.create-title h2 { font-size: 24px; }
.mode-chip { max-width: 180px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding: 9px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--cream); font-size: 14px; font-weight: 700; letter-spacing: .02em; }
#scene { position: absolute; inset: 0; width: 600px; height: 600px; display: block; }
.scene-hint {
  position: absolute; z-index: 4; left: 50%; top: 76px; transform: translateX(-50%);
  max-width: calc(100% - 40px); overflow: hidden; text-overflow: ellipsis;
  padding: 8px 13px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel);
  color: var(--cream); font-size: 14px; font-weight: 600; white-space: nowrap;
}
.source-readout {
  position: absolute; z-index: 4; top: 104px; left: 22px; width: 142px;
  padding: 12px 13px; border-left: 2px solid var(--clay); background: var(--panel);
}
.source-readout strong { display: block; overflow-wrap: anywhere; font-family: Georgia, "Times New Roman", serif; font-size: 22px; line-height: 1.05; }
.source-readout span { display: block; margin-top: 5px; color: var(--moss); font-size: 14px; font-weight: 600; }

.toolbar {
  position: absolute; z-index: 6; left: 18px; right: 18px; bottom: 16px;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
}
.tool-button, .pill-button { min-width: 0; height: 88px; overflow: hidden; border: 2px solid rgba(242, 239, 230, .62); border-radius: 18px 18px 9px 18px; background: rgba(30, 43, 36, .98); color: #fff; font-size: 17px; font-weight: 750; white-space: nowrap; text-overflow: ellipsis; }
.tool-button svg { width: 28px; vertical-align: middle; margin-right: 7px; stroke-width: 2.5; }
.toolbar.is-dim { opacity: .76; }

.picker {
  position: absolute; z-index: 8; inset: 72px 16px 14px; padding: 18px;
  border: 1px solid var(--line); border-radius: 28px 28px 14px 28px;
  background: rgba(3, 7, 5, .97); backdrop-filter: blur(12px);
}
.picker-header { display: flex; justify-content: space-between; align-items: end; margin-bottom: 14px; }
.picker-header p { color: var(--moss); font-size: 14px; }
.sound-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.sound-card { min-width: 0; height: 116px; overflow: hidden; padding: 10px 12px; border-radius: 18px 18px 8px 18px; text-align: left; }
.sound-icon { display: block; width: 36px; height: 36px; margin-bottom: 4px; }
.sound-card strong { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-family: Georgia, "Times New Roman", serif; font-size: 18px; line-height: 1.05; }
.sound-card span { display: block; margin-top: 2px; color: var(--moss); font-size: 14px; line-height: 1.1; }

.toast {
  position: absolute; z-index: 20; left: 50%; bottom: 92px; transform: translateX(-50%);
  max-width: calc(100% - 36px); overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  padding: 10px 15px; border: 1px solid var(--line); border-radius: 999px; background: #1d2d25; color: var(--cream); font-size: 15px;
}

.experience { background: #000; color: var(--cream); text-align: center; }
.experience .back-button { position: absolute; left: 24px; top: 22px; color: var(--cream); border-color: rgba(255,255,255,.2); }
.experience-copy { padding-top: 38px; }
.experience-copy .eyebrow { color: var(--sun); }
.experience-copy h1 { font-size: 36px; }
.breath-field { position: relative; height: 390px; display: grid; place-items: center; }
.breath-orbit { width: 330px; height: 220px; overflow: visible; }
.breath-track { fill: none; stroke: rgba(223,231,223,.25); stroke-width: 7; }
.breath-dot { fill: var(--sun); }
.breath-label { position: absolute; font-family: Georgia, "Times New Roman", serif; font-size: 31px; }
.breath-time { color: var(--moss); font-size: 16px; }

.empty-state { height: 410px; display: grid; place-items: center; text-align: center; color: var(--moss); }
.empty-state .line-icon { width: 74px; margin: 0 auto 10px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
