/* src/web/base.css */
:root {
  --buncss-light: initial;
  --buncss-dark: ;
  color-scheme: light dark;
  -webkit-font-smoothing: antialiased;
  --bg: #f4f5ee;
  --surface: #fffef9;
  --ink: #192820;
  --muted: #5e6d63;
  --line: #d9e0d7;
  --accent: #176a42;
  --accent-ink: #fff;
  --soft: #e7f3e7;
  --danger: #a93227;
  --amber: #e6aa3a;
  --ready: #64df93;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Noto Sans, Ubuntu, Cantarell, Helvetica Neue, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --buncss-light: ;
    --buncss-dark: initial;
  }
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  margin: 0;
}

button, input, select {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

:where(a, button, input, select, summary):focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.site-header {
  display: flex;
  padding: 1rem max(1rem, calc((100vw - var(--page, 1020px)) / 2));
  border-bottom: 1px solid var(--line);
  justify-content: space-between;
  align-items:  center;
  gap: 1rem;
}

.brand {
  letter-spacing: -.03em;
  text-decoration: none;
  font-size: 1.13rem;
  font-weight: 800;
}

.brand span {
  color: var(--accent);
}

.header-note {
  color: var(--muted);
  letter-spacing: .1em;
  text-transform: uppercase;
  font-size: .75rem;
  font-weight: 700;
}

.eyebrow {
  color: var(--accent);
  letter-spacing: .12em;
  text-transform: uppercase;
  margin: 0 0 .65rem;
  font-size: .78rem;
  font-weight: 800;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.2rem;
  box-shadow: 0 4px 18px #0e2d1b0a;
}

.card h2 {
  letter-spacing: -.02em;
  margin: 0;
  font-size: 1.15rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1510;
    --surface: #17231a;
    --ink: #ebf3e9;
    --muted: #a4b9a7;
    --line: #314536;
    --accent: #8bdca2;
    --accent-ink: #0e2114;
    --soft: #203d2a;
    --danger: #ff8a7e;
  }

  .card {
    box-shadow: none;
  }
}

:root:not([data-advanced]) .advanced-only {
  display: none !important;
}

/* src/web/try.css */
.view-card:focus-within .view-content {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.hand-options input:focus-visible + span {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

main {
  width: min(100%, 1052px);
  margin-inline-start: auto;
  margin-inline-end: auto;
  padding: 1.5rem 1rem 3rem;
}

:root[data-login="true"] #setup, :root[data-login="true"] #live {
  display: none;
}

.login-screen {
  display: grid;
  place-items:  center;
  min-height: calc(100svh - 110px);
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  width: min(100%, 390px);
  padding: 1.5rem;
  box-shadow: 0 4px 18px #0e2d1b0a;
}

.login-card h1 {
  font-size: clamp(2.2rem, 9vw, 3.4rem);
}

.login-card > p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.45;
}

.login-card form {
  display: grid;
  gap: .7rem;
}

.login-card label {
  font-size: .85rem;
  font-weight: 800;
}

.login-card input {
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  width: 100%;
  padding: .85rem;
}

.login-card button {
  margin-top: .3rem;
}

#login-error {
  color: var(--danger);
  min-height: 1.3em;
  margin: 0;
  font-size: .85rem;
}

.intro {
  max-width: 690px;
}

.step-number, .message-label {
  color: var(--accent);
  letter-spacing: .12em;
  text-transform: uppercase;
  font-size: .78rem;
  font-weight: 800;
}

h1 {
  letter-spacing: -.06em;
  max-width: 12ch;
  margin: 0;
  font-size: clamp(2.35rem, 7.7vw, 4.3rem);
  line-height: 1.02;
}

.lede {
  color: var(--muted);
  max-width: 38rem;
  margin: 1.1rem 0 1.6rem;
  font-size: clamp(1rem, 2vw, 1.2rem);
  line-height: 1.45;
}

.setup-grid {
  display: grid;
  gap: .85rem;
}

.needs ul {
  list-style: none;
  display: grid;
  gap: .9rem;
  margin: 1.1rem 0 0;
  padding: 0;
}

.needs li {
  display: flex;
  align-items:  center;
  gap: .85rem;
  line-height: 1.35;
}

.number {
  display: inline-grid;
  color: var(--accent);
  background: var(--soft);
  border-radius: 50%;
  flex: 0 0 2rem;
  place-items:  center;
  width: 2rem;
  height: 2rem;
  font-size: .82rem;
  font-weight: 800;
}

.hint {
  color: var(--muted);
  margin: .3rem 0 1rem;
  font-size: .9rem;
}

.view-options {
  display: grid;
  gap: .65rem;
}

.view-card {
  display: block;
  cursor: pointer;
}

.view-card input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.view-content {
  display: grid;
  grid-template-columns: 125px 1fr;
  border: 2px solid var(--line);
  border-radius: 13px;
  align-items:  center;
  gap: .75rem;
  min-height: 105px;
  padding: .35rem .75rem .35rem .2rem;
  transition: border-color .15s, background-color .15s;
}

.view-card input:checked + .view-content {
  border-color: var(--accent);
  background: var(--soft);
}

.view-content strong, .view-content small {
  display: block;
}

.view-content strong {
  font-size: .98rem;
}

.view-content small {
  color: var(--muted);
  margin-top: .2rem;
  line-height: 1.25;
}

.view-content svg {
  display: block;
  width: 100%;
}

.view-content svg text {
  fill: var(--muted);
  letter-spacing: .06em;
  font: 700 8px ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Noto Sans, Ubuntu, Cantarell, Helvetica Neue, sans-serif;
}

.target, .sight {
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
  stroke-linecap: round;
}

.sight {
  stroke: var(--accent);
  stroke-dasharray: 3 3;
}

.golfer {
  fill: var(--accent);
}

.shoulders {
  fill: none;
  stroke: var(--accent);
  stroke-width: 5;
  stroke-linecap: round;
}

.ball {
  fill: #e4ae37;
}

.phone {
  fill: var(--ink);
}

.hand-options {
  display: flex;
  border: 0;
  flex-wrap: wrap;
  gap: .5rem;
  margin: 1.15rem 0 0;
  padding: 0;
}

.hand-options legend {
  color: var(--muted);
  margin-bottom: .45rem;
  font-size: .8rem;
  font-weight: 700;
}

.hand-options label {
  position: relative;
  cursor: pointer;
}

.hand-options input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.hand-options span {
  display: block;
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: .55rem .9rem;
  font-size: .9rem;
}

.hand-options input:checked + span {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--soft);
  font-weight: 700;
}

.start-area {
  margin-top: 1rem;
}

.primary {
  display: flex;
  color: var(--accent-ink);
  background: var(--accent);
  border: 0;
  border-radius: 12px;
  justify-content: space-between;
  align-items:  center;
  width: 100%;
  padding: .95rem 1.2rem;
  font-size: 1.14rem;
  font-weight: 800;
}

.primary:hover {
  filter: brightness(1.08);
}

.primary span {
  font-size: 1.5rem;
  line-height: .7;
}

.primary:disabled {
  opacity: .55;
  cursor: wait;
}

.setup-message {
  margin: .75rem 0 .3rem;
  font-size: .88rem;
  font-weight: 650;
}

.privacy {
  color: var(--muted);
  margin: .5rem 0 0;
  font-size: .76rem;
  line-height: 1.35;
}

.sound-check {
  display: grid;
  grid-template-columns: 68px 1fr;
  align-items:  center;
  gap: .8rem 1rem;
  margin-top: .85rem;
}

.sound-test {
  display: grid;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 50%;
  place-items:  center;
  width: 68px;
  height: 68px;
  box-shadow: 0 7px 17px #176a423d;
}

.sound-test:active {
  transform: scale(.94);
}

.sound-test svg {
  display: block;
  fill: currentColor;
  width: 30px;
  height: 30px;
}

.sound-copy h2 {
  display: flex;
  flex-wrap: wrap;
  align-items:  center;
  gap: .2rem;
  margin: 0;
  font-size: 1.14rem;
}

.sound-copy p {
  color: var(--muted);
  margin: .25rem 0 0;
  font-size: .9rem;
  line-height: 1.3;
}

.sound-bars {
  display: inline-flex;
  align-items:  end;
  gap: 3px;
  height: 18px;
  margin-left: .35rem;
}

.sound-bars i {
  background: var(--accent);
  opacity: .35;
  border-radius: 2px;
  width: 3px;
  height: 30%;
}

.sound-check.playing .sound-bars i {
  opacity: 1;
  animation: sound-bars .7s ease-in-out infinite alternate;
}

.sound-check.playing .sound-bars i:nth-child(2) {
  animation-delay: -200ms;
}

.sound-check.playing .sound-bars i:nth-child(3) {
  animation-delay: -450ms;
}

.sound-check.playing .sound-bars i:nth-child(4) {
  animation-delay: -100ms;
}

@keyframes sound-bars {
  to {
    height: 100%;
  }
}

.sound-result {
  grid-column: 1 / -1;
  margin: 0;
  font-size: .9rem;
  line-height: 1.3;
}

.sound-result:empty {
  display: none;
}

.sound-result.ok, .sound-result.bad {
  border-radius: 10px;
  padding: .7rem .8rem;
}

.sound-result.ok {
  background: var(--soft);
}

.sound-result.bad {
  color: #7c2d24;
  background: #fff0ea;
}

.live-page {
  max-width: 850px;
  margin-inline-start: auto;
  margin-inline-end: auto;
}

.session-bar {
  display: flex;
  justify-content: space-between;
  align-items:  center;
  gap: .5rem;
  margin-bottom: .75rem;
}

.session-actions {
  display: inline-flex;
  gap: .35rem;
}

.remaining {
  font-variant-numeric: tabular-nums;
  font-size: .86rem;
  font-weight: 800;
}

.quiet-button {
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--surface);
  border-radius: 8px;
  padding: .45rem .75rem;
  font-size: .83rem;
}

.step-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(110px, 25%);
  color: #fff;
  background: #1b3426;
  border-radius: 16px;
  align-items:  center;
  gap: .7rem;
  margin-bottom: .7rem;
  padding: 1rem 1.2rem 1.15rem;
}

.step-card .step-number {
  display: flex;
  color: #9be3aa;
  align-items:  center;
  gap: .6rem;
  margin: 0 0 .4rem;
}

.step-ticks {
  display: inline-flex;
  gap: 4px;
}

.step-ticks i {
  background: #ffffff40;
  border-radius: 9px;
  width: 20px;
  height: 5px;
}

.step-ticks i.on {
  background: var(--ready);
}

.step-card h2 {
  letter-spacing: -.045em;
  margin: 0;
  font-size: clamp(2rem, 6vw, 3.2rem);
  font-weight: 850;
  line-height: 1.04;
}

.step-card .step-copy > p:last-child {
  margin: .55rem 0 0;
  font-size: clamp(1.05rem, 3.4vw, 1.45rem);
  line-height: 1.2;
}

.step-plan {
  display: grid;
  background: #ffffff14;
  border-radius: 12px;
  justify-items: center;
  gap: .2rem;
  padding: .2rem;
}

.step-plan svg {
  width: 100%;
  height: auto;
  max-height: 126px;
}

.step-plan .plan-line, .step-card[data-view="down-the-line"] .plan-face {
  display: none;
}

.step-card[data-view="down-the-line"] .plan-line {
  display: block;
}

.step-plan > span {
  color: #d2e5d8;
  text-align: center;
  font-size: .64rem;
  line-height: 1.1;
}

.plan-target, .plan-sight {
  fill: none;
  stroke: #b2cbb9;
  stroke-width: 2;
  stroke-linecap: round;
}

.plan-sight {
  stroke-dasharray: 4 3;
}

.plan-golfer, .plan-shoulders {
  fill: #92d6a9;
  stroke: #92d6a9;
  stroke-width: 4;
  stroke-linecap: round;
}

.plan-ball {
  fill: #e6aa3a;
}

.plan-phone {
  fill: #f4fff5;
}

.plan-ring {
  fill: none;
  stroke: var(--ready);
  stroke-width: 3;
  animation: plan-ring 1.6s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}

.step-card[data-focus="phone"] .ring-golfer, .step-card[data-focus="golfer"] .ring-phone {
  display: none;
}

@keyframes plan-ring {
  50% {
    transform: scale(1.15);
    opacity: .35;
  }
}

.message-card, .cue-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  margin-bottom: .7rem;
  padding: .9rem 1rem;
}

.message-card {
  display: grid;
  grid-template-columns: 9px 1fr;
  gap: 0 .8rem;
}

.message-card:before {
  content: "";
  grid-row: 1 / span 2;
  background: var(--amber);
  border-radius: 99px;
}

.message-card[data-tone="ready"]:before {
  background: var(--ready);
}

.message-card .message-label {
  color: var(--ink);
  letter-spacing: -.04em;
  text-transform: none;
  font-size: clamp(2rem, 6.7vw, 3rem);
  font-weight: 850;
  line-height: 1.04;
}

.spoken-line {
  margin: .4rem 0 0;
  font-size: clamp(1.06rem, 3.5vw, 1.45rem);
  font-weight: 650;
  line-height: 1.2;
}

.camera-wrap {
  position: relative;
  overflow: hidden;
  background: #070e09;
  border-radius: 14px;
  min-height: 200px;
  margin-bottom: .7rem;
}

.camera-wrap video {
  display: block;
  object-fit: contain;
  width: 100%;
  max-height: min(58vh, 690px);
}

.camera-wrap canvas {
  position: absolute;
  pointer-events: none;
  width: 100%;
  height: 100%;
  inset: 0;
}

.camera-tag {
  position: absolute;
  color: #fff;
  letter-spacing: .09em;
  background: #0009;
  border-radius: 99px;
  padding: .35rem .55rem;
  font-size: .65rem;
  font-weight: 800;
  top: .7rem;
  right: .7rem;
}

.edge-bar {
  position: absolute;
  z-index: 2;
  background: var(--danger);
  box-shadow: 0 0 12px var(--danger);
  pointer-events: none;
}

.edge-bar.top {
  height: 9px;
  top: 0;
  left: 0;
  right: 0;
}

.edge-bar.bottom {
  height: 9px;
  bottom: 0;
  left: 0;
  right: 0;
}

.edge-bar.left {
  width: 9px;
  top: 0;
  bottom: 0;
  left: 0;
}

.edge-bar.right {
  width: 9px;
  top: 0;
  bottom: 0;
  right: 0;
}

.cue-card {
  border-color: var(--accent);
}

.cue-line {
  margin: .35rem 0 0;
  font-size: clamp(1.4rem, 5vw, 2rem);
  font-weight: 800;
  line-height: 1.15;
}

.resting {
  color: var(--muted);
  margin: .5rem 0;
  font-size: .86rem;
}

@media (min-width: 760px) {
  main {
    padding-top: 2.1rem;
  }

  .setup-grid {
    grid-template-columns: .8fr 1.2fr;
    align-items: stretch;
  }

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

  .view-content {
    display: block;
    min-height: 0;
    padding: .4rem;
  }

  .view-content svg {
    height: 105px;
  }

  .view-content span {
    display: block;
    padding: .25rem .5rem .5rem;
  }

  .start-area {
    max-width: 400px;
  }

  .live-page {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 270px;
    gap: .75rem;
  }

  .session-bar, .step-card, .camera-wrap {
    grid-column: 1;
  }

  .session-bar {
    grid-row: 1;
  }

  .step-card {
    grid-row: 2;
  }

  .camera-wrap {
    grid-row: 3 / span 3;
    align-self:  start;
  }

  .message-card {
    grid-column: 2;
    grid-row: 2;
  }

  .cue-card {
    grid-column: 2;
    grid-row: 3;
    align-self:  start;
  }

  .resting {
    grid-column: 2;
    grid-row: 4;
  }
}

@media (max-width: 759px) {
  .live-page {
    display: flex;
    flex-direction: column;
  }

  .step-card {
    grid-template-columns: minmax(0, 1fr) 110px;
  }

  .message-card {
    order: 1;
  }

  .camera-wrap {
    order: 2;
  }

  .cue-card {
    order: 3;
  }

  .resting {
    order: 4;
  }
}

:root[data-try-live="true"] {
  --buncss-light: ;
  --buncss-dark: initial;
  color-scheme: dark;
  --bg: #0b140e;
  --surface: #18251b;
  --ink: #eef9ef;
  --muted: #a8c4ad;
  --line: #34503b;
  --soft: #203b29;
}

:root[data-try-live="true"] .site-header {
  display: none;
}

:root[data-try-live="true"] main {
  padding-top: .8rem;
}

:root[data-try-live="true"] .step-card {
  background: #1b3426;
}

:root[data-try-live="true"] .quiet-button {
  color: #eef9ef;
  background: #1b3426;
}

@media (prefers-reduced-motion: reduce) {
  .sound-check.playing .sound-bars i, .plan-ring {
    animation: none;
  }
}

@media (prefers-color-scheme: dark) {
  .step-card {
    background: #243c2b;
  }

  .step-card .step-number {
    color: #adebbb;
  }
}
