/* ShootingTargets7 Shot Timer — palette, fonts and buttons mirror the ST7 Target Angle Indicator */
:root {
  --bg: #0a0a0a;
  --fg: #f5f5f5;
  --muted: #9a9a9a;
  --soft: #d4d4d4;
  --brand: #e30613;
  --surface: #161616;
  --border: rgba(245, 245, 245, 0.12);
  --border-strong: rgba(245, 245, 245, 0.22);
  --ok: #3ddc84;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--fg);
  font-family: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }

.app {
  max-width: 30rem;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 0.75rem) 1rem calc(env(safe-area-inset-bottom) + 1rem);
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}
header.top { display: flex; flex-direction: column; align-items: center; gap: 0.25rem; }
header.top img { width: 4rem; height: 4rem; border-radius: 999px; display: block; }
h1 {
  margin: 0;
  font-family: "Barlow Condensed", "Segoe UI", sans-serif;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.vet { margin: 0; font-size: 0.9rem; color: var(--soft); }

.screen { display: flex; flex-direction: column; gap: 0.75rem; margin-top: 1rem; flex: 1; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 3rem;
  padding: 0 1rem;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--fg);
  font-size: 1rem;
  font-weight: 500;
  text-align: center;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
.btn:active { filter: brightness(1.25); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-xl {
  min-height: 6rem;
  font-family: "Barlow Condensed", "Segoe UI", sans-serif;
  font-size: 2.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.btn-lg { min-height: 3.75rem; font-size: 1.2rem; font-weight: 600; }
.btn-danger { color: #ff6b6b; border-color: rgba(255, 107, 107, 0.5); }
.btn-shop { margin-top: 0.25rem; }

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }

.caveat {
  margin: 0;
  padding: 0.75rem 0.9rem;
  border-left: 4px solid var(--brand);
  background: var(--surface);
  border-radius: 6px;
  color: var(--fg);
  font-size: 0.95rem;
  line-height: 1.4;
}
.err { margin: 0; color: #ff6b6b; font-weight: 600; text-align: center; line-height: 1.4; }
.hint { margin: 0; font-size: 0.9rem; color: var(--soft); line-height: 1.35; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.card-title {
  font-family: "Barlow Condensed", "Segoe UI", sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.field { display: flex; flex-direction: column; gap: 0.35rem; font-size: 1rem; }
.field b { color: var(--fg); }
.field input[type=number] {
  font: inherit;
  font-size: 1.25rem;
  min-height: 3rem;
  padding: 0 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--fg);
  width: 100%;
}
input[type=range] { width: 100%; height: 2.5rem; accent-color: var(--brand); }
.toggle { display: flex; align-items: center; gap: 0.75rem; min-height: 3rem; font-size: 1.05rem; }
.toggle input { width: 1.75rem; height: 1.75rem; accent-color: var(--brand); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }

.meter {
  position: relative;
  height: 1.5rem;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  overflow: hidden;
}
.meter-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--ok); transition: width 40ms linear; }
.meter-fill.hot { background: var(--brand); }
.meter-thr { position: absolute; top: 0; bottom: 0; width: 3px; background: #fff; left: 50%; }
.meter-row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; font-variant-numeric: tabular-nums; }

/* Run / review readouts */
.status {
  margin: 0;
  text-align: center;
  font-family: "Barlow Condensed", "Segoe UI", sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}
.status.go { color: var(--brand); }
.big {
  margin: 0;
  text-align: center;
  font-family: "Barlow Condensed", "Segoe UI", sans-serif;
  font-size: clamp(5rem, 28vw, 8rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
.stats div {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
}
.stats span { font-size: 0.9rem; color: var(--soft); }
.stats b {
  font-family: "Barlow Condensed", "Segoe UI", sans-serif;
  font-size: 2.4rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.par-line { margin: 0; text-align: center; font-size: 1.1rem; font-weight: 600; }

.shots, .hist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.shots li {
  display: grid;
  grid-template-columns: 2.5rem 1fr 1fr auto;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.35rem 0.6rem;
  font-variant-numeric: tabular-nums;
  font-size: 1.15rem;
  min-height: 3.25rem;
}
.shots li .n { color: var(--soft); font-weight: 600; }
.shots li .t { font-weight: 600; }
.shots li .s { color: var(--fg); }
.shots li .s small, .shots li .t small { color: var(--soft); font-size: 0.8rem; display: block; }
.shots li.over .t { color: #ffb020; }
.del {
  width: 3rem; height: 3rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 107, 107, 0.5);
  background: transparent;
  color: #ff6b6b;
  font-size: 1.4rem;
  font-weight: 700;
}
.hist li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  font-variant-numeric: tabular-nums;
}
.hist .h-top { display: flex; justify-content: space-between; gap: 0.5rem; font-weight: 600; font-size: 1.05rem; }
.hist .h-date { color: var(--soft); font-size: 0.9rem; }
.hist .h-splits { margin-top: 0.3rem; font-size: 0.95rem; color: var(--fg); word-break: break-word; }
.hist .empty { color: var(--soft); }

.help h2 { margin: 0.4rem 0 0; font-family: "Barlow Condensed", "Segoe UI", sans-serif; font-size: 1.3rem; }
.help ol, .help ul { margin: 0; padding-left: 1.25rem; line-height: 1.45; display: flex; flex-direction: column; gap: 0.35rem; }
.help p { margin: 0; }
.link { text-decoration: underline; font-weight: 600; }

.foot { margin-top: 1rem; display: flex; justify-content: center; }
.shop {
  display: flex;
  min-height: 2.75rem;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  color: var(--muted);
}
body.running .foot, body.running header.top .vet { display: none; }

/* How-to video button + modal */
.btn-howto { border-color: var(--brand); font-weight: 600; }
.btn-howto .play { color: var(--brand); font-size: 0.85rem; }
.link-btn { background: none; border: 0; padding: 0.5rem 0; color: var(--fg); font-size: 1rem; text-align: left; min-height: 2.75rem; }
.modal {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--fg);
  width: 100%;
  max-width: 30rem;
  max-height: 100dvh;
  margin: auto;
}
.modal::backdrop { background: rgba(0, 0, 0, 0.85); }
.modal-box {
  margin: 0 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.35rem 0.35rem 0.35rem 0.9rem; }
.modal-head h2 { margin: 0; font-family: "Barlow Condensed", "Segoe UI", sans-serif; font-size: 1.3rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em; }
.modal-close { width: 3rem; height: 3rem; flex: none; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--bg); color: var(--fg); font-size: 1.3rem; font-weight: 700; }
.modal video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 9 / 16;
  max-height: calc(100dvh - 5.5rem);
  background: #000;
  object-fit: contain;
}
body.modal-open { overflow: hidden; }

/* Secondary buttons: How-to, Install, Share */
.sec-btns { display: flex; flex-direction: column; gap: 0.5rem; }
.sec-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); gap: 0.5rem; }
.btn-sec { min-height: 2.75rem; font-size: 0.95rem; font-weight: 600; padding: 0 0.75rem; }
.btn-sec .ico { color: var(--brand); font-weight: 700; }
.help-links { display: flex; flex-direction: column; }

/* Install modal */
.install-body { padding: 0 0.9rem 0.9rem; display: flex; flex-direction: column; gap: 0.75rem; overflow-y: auto; max-height: calc(100dvh - 5rem); }
.inapp { border-left: 4px solid #ffb020; background: var(--bg); border-radius: 6px; padding: 0.75rem 0.9rem; display: flex; flex-direction: column; gap: 0.6rem; }
.inapp p { margin: 0; line-height: 1.4; }
.install-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.install-steps li { display: flex; flex-direction: column; gap: 0.2rem; padding: 0.65rem 0.8rem; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); line-height: 1.4; color: var(--soft); }
.install-steps li b { color: var(--fg); font-size: 1.02rem; }
.install-steps li .badge { display: none; align-self: flex-start; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; background: var(--brand); color: #fff; border-radius: 4px; padding: 0.1rem 0.4rem; }
.install-steps li.current { border: 2px solid var(--brand); color: var(--fg); }
.install-steps li.current .badge { display: inline-block; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 1.5rem); transform: translate(-50%, 1rem); background: var(--fg); color: var(--bg); font-weight: 600; padding: 0.7rem 1.1rem; border-radius: 999px; opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; z-index: 1000; max-width: calc(100% - 2rem); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* How-to video player: full screen on tap; this full-viewport overlay is the fallback.
   The video is 9:16 with a flat #0a0a0a background, so every surface behind it uses that same colour: on phones
   taller than 9:16 the letterbox blends into the frame (no visible bars) and nothing is cropped. */
:root { --vid-bg: #0a0a0a; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.modal.player {
  position: fixed;
  inset: 0;
  width: 100vw; width: 100dvw;
  height: 100vh; height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--vid-bg);
  overflow: hidden;
}
.modal.player::backdrop { background: var(--vid-bg); }
.player-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  background: var(--vid-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.player-wrap video,
.modal.player video {
  display: block;
  width: 100%;
  height: 100%;
  max-height: none;
  aspect-ratio: auto;
  object-fit: contain;
  background: var(--vid-bg);
}
.player-wrap:fullscreen { width: 100%; height: 100%; background: var(--vid-bg); }
.player-wrap:-webkit-full-screen { width: 100%; height: 100%; background: var(--vid-bg); }
#howto-video:fullscreen, #howto-video:-webkit-full-screen { background: var(--vid-bg); object-fit: contain; }
.player-wrap::backdrop, #howto-video::backdrop { background: var(--vid-bg); }
.player-close {
  position: absolute;
  top: calc(env(safe-area-inset-top) + 0.6rem);
  right: calc(env(safe-area-inset-right) + 0.6rem);
  z-index: 2;
  width: 3.25rem;
  height: 3.25rem;
  min-width: 44px;
  min-height: 44px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.6);
}
.player-close:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
