/* Shared layout and interaction rules. Loaded after either theme so structural
   fixes cannot disappear when the user switches between Classic and Soft. */
:root {
  --ui-text: #f3f6ff;
  --ui-muted: #a9afbf;
  --ui-line: rgba(221, 229, 255, .16);
  --ui-surface: rgba(19, 24, 38, .9);
  --ui-accent: #f8b480;
  --ui-focus: #8de9ff;
}
:root[data-theme="soft"] {
  --ui-text: #26211d;
  --ui-muted: #6e655c;
  --ui-line: rgba(38, 33, 29, .14);
  --ui-surface: rgba(255, 255, 255, .94);
  --ui-accent: #ae491e;
  --ui-focus: #006b87;
}
button, input, select, textarea { font: inherit; }
:is(button, a, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--ui-focus);
  outline-offset: 4px;
}
.screen:focus, .screen h1:focus, .screen h2:focus { outline: none; }
button:disabled { cursor: not-allowed; }
.card-body { min-width: 0; }
.card-title, .card-desc { overflow-wrap: anywhere; }
.back-btn, .lang-mini .lang-btn, .step-btn { min-height: 44px; }
.step-btn { min-width: 44px; }
.setup-content > *, .tips-content > *, .result-content > * { flex-shrink: 0; }
.setup-content, .tips-content, .result-content {
  padding-top: max(20px, env(safe-area-inset-top));
  padding-bottom: max(32px, env(safe-area-inset-bottom));
  overscroll-behavior-y: contain;
}
.result-content { justify-content: safe center; }

/* Home: a clear daily action, visible essentials, room to breathe on desktop. */
#screen-menu .menu-content {
  padding: max(24px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-left)) max(24px, env(safe-area-inset-bottom));
  overscroll-behavior-y: contain;
  scrollbar-color: var(--ui-line) transparent;
}
#screen-menu .menu-top, .home-heading, .home-workspace, .home-footer {
  width: 100%; max-width: 520px; margin-inline: auto; flex-shrink: 0;
}
#screen-menu .menu-top { align-items: center; margin-top: 0; margin-bottom: 28px; }
.home-brand { display: flex; flex-direction: column; gap: 5px; }
#screen-menu .brand-mark { color: var(--ui-text); font-size: 23px; letter-spacing: -.06em; line-height: 1; }
.brand-period { color: var(--ui-accent); }
#screen-menu .brand-tag { font-size: 8px; color: var(--ui-muted); letter-spacing: .17em; }
.home-toolbar { display: flex; align-items: center; gap: 10px; }
.home-toolbar .lang-mini { margin: 0; gap: 3px; }
.home-toolbar .lang-btn { padding: 0 9px; font-size: 11px; }
#screen-menu .menu-card.menu-shortcut {
  display: grid; place-items: center; flex: none; min-width: 44px; min-height: 44px;
  padding: 10px; border-radius: 14px; animation: none;
  background: var(--ui-surface); border: 1px solid var(--ui-line); color: var(--ui-text);
}
#screen-menu .menu-shortcut::before, #screen-menu .menu-shortcut::after { display: none; }
.home-heading { margin-bottom: 22px; }
.home-eyebrow { color: var(--ui-accent); font-size: 9px; font-weight: 800; letter-spacing: .18em; margin-bottom: 10px; }
.home-heading h1 { color: var(--ui-text); font-size: clamp(24px, 6vw, 32px); line-height: 1.25; letter-spacing: -.045em; font-weight: 800; }
.home-subtitle { color: var(--ui-muted); font-size: 12px; line-height: 1.7; margin-top: 8px; }
.home-workspace { display: flex; flex-direction: column; gap: 16px; }
/* The companion and camera-free choices lead on a phone; the visual sits alongside on desktop. */
#screen-menu .home-workspace > .menu-hero { order: 2; }
.home-companion { grid-column: 1 / -1; padding: 18px; border: 1px solid var(--ui-line); border-radius: 20px; background: var(--ui-surface); color: var(--ui-text); }
.companion-hello { display: grid; grid-template-columns: 88px minmax(0, 1fr); align-items: center; gap: 14px; }
#companion-mascot { width: 88px; height: 92px; object-fit: contain; filter: drop-shadow(0 8px 10px rgba(0,0,0,.13)); }
.companion-kicker { display: block; color: var(--ui-accent); font-size: 9px; font-weight: 800; letter-spacing: .1em; }
#companion-greeting { margin: 7px 0 0; font-size: 16px; font-weight: 750; line-height: 1.6; }
#companion-question { margin: 16px 0 10px; font-size: 14px; line-height: 1.6; letter-spacing: 0; }
.companion-choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.companion-choices button { min-width: 0; min-height: 44px; padding: 8px 4px; border: 1px solid var(--ui-line); border-radius: 12px; background: transparent; color: var(--ui-text); font: inherit; font-size: 12px; line-height: 1.4; cursor: pointer; }
.companion-choices button[aria-pressed="true"] { color: #422a1b; background: #f8b480; border-color: #f8b480; font-weight: 800; box-shadow: inset 0 -3px 0 rgba(66,42,27,.13); }
.companion-choices button:hover { border-color: var(--ui-accent); }
.companion-reply { position: relative; margin: 14px 0 10px; padding: 11px 13px; border-radius: 3px 13px 13px; color: var(--ui-text); background: color-mix(in srgb, var(--ui-accent) 9%, transparent); font-size: 12px; line-height: 1.75; min-height: 64px; }
.companion-note { margin: 0; color: var(--ui-muted); font-size: 10px; line-height: 1.7; }
.home-camera-free { grid-column: 1 / -1; padding: 16px; border: 1px solid var(--ui-line); border-radius: 18px; color: var(--ui-text); }
.home-camera-free h2 { margin: 0; font-size: 15px; line-height: 1.5; letter-spacing: -.02em; }
.home-camera-free > p { margin: 5px 0 10px; font-size: 11px; line-height: 1.7; color: var(--ui-muted); }
#screen-menu .home-camera-free .home-essential .menu-card { padding: 10px 4px; min-height: 60px; align-items: flex-start; }
#screen-menu .home-camera-free .home-essential .card-icon { width: 25px; height: 28px; }
#screen-menu .home-camera-free .home-essential .card-desc { display: block; color: var(--ui-muted); font-size: 10px; line-height: 1.6; margin-top: 4px; }
/* Gym cues can be auditioned before starting a camera-free session. */
.gym-sounds { margin: 0 2px 20px; padding: 16px; border: 1px solid var(--ui-line); border-radius: 16px; background: var(--ui-surface); text-align: left; color: var(--ui-text); }
.gym-sound-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.gym-sound-heading h3 { margin: 0; font-size: 16px; line-height: 1.4; }
.gym-sound-heading button { min-height: 44px; padding: 8px 10px; border: 1px solid var(--ui-line); border-radius: 10px; background: transparent; color: var(--ui-muted); font: inherit; font-size: 12px; cursor: pointer; }
.gym-sounds > p { margin: 8px 0 14px; font-size: 12px; line-height: 1.7; color: var(--ui-muted); }
.gym-sound-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.gym-sound-grid button { display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; padding: 9px 8px; border: 1px solid var(--ui-line); border-radius: 11px; background: var(--ui-surface); color: var(--ui-text); font: inherit; font-size: 12px; cursor: pointer; }
.gym-sound-grid .ui-icon { width: 17px; height: 17px; flex-shrink: 0; color: var(--ui-accent); }
.gym-sound-grid button:hover { border-color: var(--ui-accent); }
.gym-sound-grid button:active { transform: translateY(1px); }
.gym-volume-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; align-items: center; margin-top: 16px; font-size: 12px; }
.gym-volume-row span { grid-column: 1 / -1; color: var(--ui-muted); }
.gym-volume-row input { width: 100%; min-width: 0; min-height: 32px; accent-color: var(--ui-accent); }
.gym-volume-row output { min-width: 38px; text-align: right; font-variant-numeric: tabular-nums; }
#screen-menu .home-workspace .menu-hero { max-width: none; margin: 0; width: 100%; height: 210px; flex-shrink: 0; }
#screen-menu .home-workspace .menu-hero::before {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(0deg, rgba(7, 12, 25, .94), transparent 70%);
}
#screen-menu .hero3d .hero-copy { left: 22px; right: 22px; bottom: 20px; }
#screen-menu .hero3d .hero-copy h2 { font-size: clamp(24px, 6.4vw, 28px); line-height: 1.25; margin-bottom: 10px; letter-spacing: -.035em; }
#screen-menu .hero3d .hero-copy h2 em {
  color: #ffc28f; -webkit-text-fill-color: currentColor; background: none;
  font-style: normal; animation: none;
}
#screen-menu .hero3d .hero-copy p { color: #d0dbea; font-size: 12px; }
#screen-menu .home-workspace .menu-cards { max-width: none; margin: 0; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
#screen-menu .menu-card { font-family: inherit; }
#screen-menu #menu-today-card {
  display: grid; grid-template-columns: 42px minmax(0, 1fr); column-gap: 14px; row-gap: 10px;
  padding: 22px; border: 1px solid #ffcda9 !important; border-radius: 20px;
  background: #f8b480 !important; color: #291d17; box-shadow: 0 8px 28px rgba(0, 0, 0, .12);
}
#screen-menu #menu-today-card::before, #screen-menu #menu-today-card::after { display: none; }
#screen-menu #menu-today-card .today-kicker { position: static; grid-column: 1 / -1; color: #663918; font-size: 10px; font-weight: 800; letter-spacing: .16em; }
#screen-menu #menu-today-card .card-icon { grid-column: 1; width: 42px; height: 42px; color: #663918; background: rgba(255,255,255,.28); box-shadow: none; border: 1px solid rgba(102,57,24,.18); }
#screen-menu #menu-today-card .card-body { grid-column: 2; align-self: center; }
#screen-menu #menu-today-card .card-title { color: #291d17; font-size: 20px; line-height: 1.4; letter-spacing: -.025em; }
#screen-menu #menu-today-card .card-desc { color: #623a24; font-size: 12px; line-height: 1.6; opacity: 1; }
#screen-menu #menu-today-card .today-meta { grid-column: 1 / -1; color: #623a24; margin: 0; font-size: 11px; }
.home-start { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; padding-top: 12px; margin-top: 2px; border-top: 1px solid rgba(102,57,24,.2); font-size: 13px; font-weight: 800; }
.home-start > :last-child { font-size: 22px; line-height: 1; }
.home-progress { grid-column: 1 / -1; padding: 4px 2px 8px; }
.home-progress-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--ui-muted); font-size: 11px; line-height: 1.6; }
.home-progress-value { white-space: nowrap; font-variant-numeric: tabular-nums; }
.home-progress-value b { color: var(--ui-text); font-size: 15px; }
.home-progress-track { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; margin-top: 9px; }
.home-progress-track span { height: 5px; border-radius: 5px; background: var(--ui-line); }
.home-progress-track .is-complete { background: var(--ui-accent); }
.menu-secondary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#screen-menu .menu-secondary .menu-card { grid-column: auto; flex-direction: column; align-items: flex-start; min-height: 112px; padding: 16px; background: var(--ui-surface); border: 1px solid var(--ui-line); box-shadow: none; }
#screen-menu .menu-secondary .card-icon { width: 38px; height: 38px; }
#screen-menu .menu-secondary .card-icon svg { color: inherit; width: 23px; height: 23px; }
#screen-menu .menu-secondary .card-title { color: var(--ui-text); font-size: 14px; letter-spacing: -.02em; }
#screen-menu .menu-secondary .card-desc { color: var(--ui-muted); opacity: 1; font-size: 11px; }
.home-essential { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
#screen-menu .home-essential .menu-card { flex-direction: row; align-items: center; padding: 13px 5px; gap: 9px; border-radius: 10px; background: transparent; border: 0; box-shadow: none; backdrop-filter: none; }
#screen-menu .home-essential .menu-card::before { display: none; }
#screen-menu .home-essential .card-icon { width: 32px; height: 32px; border: 0; color: var(--ui-muted); background: transparent; box-shadow: none; }
#screen-menu .home-essential .card-title { color: var(--ui-text); margin: 0; font-size: 12px; letter-spacing: -.02em; }
#screen-menu .home-essential .card-desc { display: none; }
.menu-more { overflow: hidden; }
.menu-more-sum { list-style: none; display: flex; align-items: center; justify-content: space-between; min-height: 48px; padding: 14px 16px; cursor: pointer; font-size: 13px; font-weight: 700; }
.menu-more-sum::-webkit-details-marker { display: none; }
.menu-more-chev { transition: transform .18s ease; }
.menu-more[open] .menu-more-chev { transform: rotate(180deg); }
#screen-menu .menu-more-sum { color: var(--ui-muted); }
.menu-more-grid .menu-card.hidden { display: none !important; }
.home-footer { margin-block: 24px 0; text-align: center; color: var(--ui-muted); font-size: 10px; letter-spacing: .03em; }

/* The camera permission gate must cover the guide in both themes. */
.setup-cam-gate { position: absolute; inset: 0; z-index: 6; display: flex; align-items: center; justify-content: center; padding: 20px; padding-bottom: max(20px, env(safe-area-inset-bottom)); }
.setup-cam-gate.hidden { display: none; }
.setup-cam-gate-card { width: min(420px, 100%); max-height: 100%; overflow-y: auto; border-radius: 18px; padding: 18px 18px 20px; overscroll-behavior: contain; }
.setup-cam-gate-card .back-btn { margin-bottom: 8px; }
.setup-cam-gate-card .setup-guide-title { margin: 4px 0 14px; text-align: left; }
.setup-comfort-list { margin: 0 0 16px; padding-left: 1.15em; font-size: 14px; line-height: 1.65; }
.setup-comfort-list li { margin: 6px 0; }
.setup-ambient-pref { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; font-size: 13px; font-weight: 600; text-align: left; width: 100%; }
.setup-ambient-inline { max-width: 400px; margin: 4px auto; justify-content: flex-start; }
.setup-comfort-note { font-size: 11.5px; line-height: 1.5; margin: 0 0 14px; text-align: left; }
[data-theme="soft"] .setup-comfort-note { color: var(--ui-muted); }
.setup-cam-gate-card .primary-btn { width: 100%; }
#setup-guide-main.is-gated { visibility: hidden; pointer-events: none; }
.billing-modal { padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
.billing-modal-card { max-height: 100%; overflow-y: auto; overscroll-behavior: contain; }
.billing-modal-card:focus { outline: none; }
.setup-mic-error { width: 100%; max-width: 420px; margin: 8px auto 12px; padding: 12px 14px; border: 1px solid #ffab91; border-radius: 12px; color: #ffe9e2; background: #582e27; font-size: 13px; line-height: 1.65; text-align: left; }
.app-notice { position: fixed; left: 50%; bottom: max(56px, calc(20px + env(safe-area-inset-bottom))); transform: translateX(-50%); z-index: 10000; width: max-content; max-width: calc(100% - 40px); padding: 13px 20px; border: 1px solid var(--ui-line); border-radius: 14px; background: var(--ui-surface); color: var(--ui-text); box-shadow: 0 8px 32px #0004; font-size: 13px; font-weight: 700; line-height: 1.6; text-align: center; pointer-events: none; }

/* Keep the complete stance visible in the studio demonstrations. */
.tut-cats { flex-wrap: wrap; overflow: visible; }
.tut-cat { min-height: 44px; }
#screen-tutorial .tut-holo { object-fit: contain; mix-blend-mode: normal; -webkit-mask-image: none; mask-image: none; }
.tut-hand-toggle { display: flex; justify-content: center; gap: 8px; margin: 12px 16px 0; flex-shrink: 0; }
#screen-tutorial .tut-pending-badge.is-reworking {
  top: 50%; bottom: auto; transform: translate(-50%, -50%);
  width: min(340px, calc(100% - 40px)); box-sizing: border-box;
  padding: 24px; border-radius: 18px; white-space: pre-line;
  font-size: 15px; line-height: 1.9; text-align: center;
  color: #f4f7f5; background: #162620; border-color: #658476;
  box-shadow: none;
}
.tut-hand-btn { min-height: 44px; padding: 9px 22px; border: 1px solid var(--ui-line); border-radius: 12px; background: var(--ui-surface); color: var(--ui-muted); cursor: pointer; font-size: 13px; font-weight: 700; }
.tut-hand-btn.active { border-color: var(--ui-accent); color: var(--ui-accent); }
.tutorial-controls { flex-wrap: wrap; flex-shrink: 0; }
.tut-ctrl, .tut-stance-btn { min-height: 44px; }
[data-theme="soft"] #screen-tutorial #tut-play-pause { color: var(--ui-text); }
#screen-tutorial .tutorial-error { z-index: 3; background: rgba(10, 16, 27, .92); color: #f3f6ff; gap: 12px; overflow-y: auto; text-align: center; }
#screen-tutorial .tutorial-error .primary-btn { width: auto; margin: 0; padding-inline: 24px; flex-shrink: 0; }
#screen-tutorial .tut-3d-caveat { font-size: 12px; line-height: 1.7; font-weight: 500; color: var(--ui-muted); border-color: var(--ui-line); background: var(--ui-surface); }
.tut-study-controls { margin: 0 20px 18px; color: var(--ui-text); flex-shrink: 0; }
.tut-study-controls label { display: block; margin-bottom: 8px; font-size: 12px; color: var(--ui-muted); }
.tut-scrub-row { display: flex; align-items: center; gap: 10px; }
.tut-scrub-row .tut-ctrl { flex: 0 0 44px; min-height: 44px; font-size: 25px; line-height: 1; }
.tut-scrub-row input { flex: 1; width: 0; min-width: 40px; min-height: 44px; accent-color: var(--ui-accent); }
.tut-scrub-row output { flex: 0 0 48px; font-size: 12px; font-variant-numeric: tabular-nums; }
.tut-scrub-row :disabled { opacity: .4; cursor: default; }
.tut-observation { padding: 16px; margin: 20px 0; border-left: 3px solid #52bdcb; background: rgba(82,189,203,.07); border-radius: 0 12px 12px 0; }
.tut-observation p { margin: 8px 0 0; line-height: 1.8; font-size: 14px; }
.tut-pro-study { margin: 24px 0 16px; padding: 22px; border: 1px solid rgba(82,189,203,.25); border-radius: 18px; background: linear-gradient(135deg,rgba(82,189,203,.1),transparent); }
.tut-pro-eyebrow { font-size: 10px; letter-spacing: .12em; color: var(--ui-muted); }
.tut-pro-study h4 { margin: 8px 0 12px; font-size: 18px; line-height: 1.5; }
.tut-pro-study p { margin: 0; font-size: 13px; line-height: 1.8; }
.tut-pro-study .tut-reference { margin: 16px 0; }
.tut-pro-study small { display: block; font-size: 11px; line-height: 1.7; color: var(--ui-muted); }

/* Result/first-session structures formerly defined in Classic only. */
.result-challenge { margin: 10px auto 6px; max-width: 340px; width: 100%; padding: 12px 14px; border-radius: 14px; border-style: solid; border-width: 1px; text-align: center; }
.rc-label { font-size: 10px; font-weight: 800; letter-spacing: .16em; margin-bottom: 8px; }
.rc-dots { margin: 0 0 8px !important; gap: 6px !important; }
.rc-dots .ch-dot { width: 28px; height: 28px; font-size: 12px; }
.rc-line { font-size: 13px; font-weight: 700; line-height: 1.4; }
.result-next { margin: 8px auto 4px; max-width: 340px; padding: 10px 14px; border-radius: 12px; border-style: solid; border-width: 1px; font-size: 13px; font-weight: 700; line-height: 1.45; text-align: center; }
.aha-quest { position: absolute; left: 50%; top: 22%; transform: translateX(-50%); z-index: 8; width: min(92vw, 360px); pointer-events: none; text-align: center; }
.aha-quest-inner { border-width: 1px; border-style: solid; border-radius: 16px; padding: 14px 16px; }
.aha-quest-kicker { font-size: 11px; font-weight: 800; letter-spacing: .2em; margin-bottom: 4px; }
.aha-quest-title { font-size: 18px; font-weight: 800; line-height: 1.3; }
.aha-quest-sub { font-size: 12.5px; margin-top: 6px; line-height: 1.45; }
[data-theme="soft"] .aha-quest-sub { color: var(--ui-muted); }

@media (min-width: 900px) {
  #screen-menu .menu-content { padding: 32px 48px; }
  #screen-menu .menu-top, .home-heading, .home-workspace, .home-footer { max-width: 1080px; }
  #screen-menu .menu-top { margin-bottom: 42px; }
  .home-heading { margin-bottom: 28px; }
  .home-heading h1 { font-size: 40px; }
  .home-subtitle { font-size: 14px; }
  .home-workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; align-items: start; }
  #screen-menu .home-workspace > .menu-hero { order: 0; }
  #screen-menu .home-workspace .menu-hero { height: 530px; position: sticky; top: 0; border-radius: 24px; }
  #screen-menu .hero3d .hero-copy { left: 32px; right: 32px; bottom: 32px; }
  #screen-menu .hero3d .hero-copy h2 { font-size: 42px; }
  #screen-menu .hero3d .hero-copy p { font-size: 14px; line-height: 1.8; }
  .hero-holo { object-position: 50% 25%; }
  #screen-menu #menu-today-card { padding: 24px; }
  #screen-menu #menu-today-card .card-title { font-size: 22px; }
}
@media (max-width: 359px) {
  #screen-menu .menu-content { padding-inline: 14px; }
  #screen-menu .brand-tag { font-size: 7px; }
  .home-toolbar { gap: 5px; }
  .home-toolbar .lang-btn { padding-inline: 7px; }
  #screen-menu #menu-today-card { padding: 18px; }
  #screen-menu .menu-secondary .menu-card { padding: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
