/* Vision180 design (colours, fonts and shapes of the Windows app and the phone app, Ui.kt). */
@font-face { font-family: "Orbitron"; src: url("../fonts/Orbitron.ttf") format("truetype"); font-weight: 400 900; font-display: swap; }
@font-face { font-family: "Space Grotesk"; src: url("../fonts/SpaceGrotesk.ttf") format("truetype"); font-weight: 300 700; font-display: swap; }

:root {
  --bg: #0A0D14; --bar: #0B0F17; --card: #111723; --card-hi: #172033; --field: #161E2D;
  --line: #222C3D; --line-hi: #34445E; --text: #F3F6FB; --sub: #C3CEDE; --muted: #8A96A8;
  --red: #E5484D; --red-hi: #F05A5F; --red-dark: #2C1318; --cyan: #3EC6FF; --cyan-light: #69DAFF;
  --green: #3DDC97; --amber: #F5B54A;
  --display: "Orbitron", "Space Grotesk", system-ui, sans-serif;
  --body: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--body); font-size: 15px; line-height: 1.4; overscroll-behavior: none; -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }
p { margin: 0; }
h1, h2 { margin: 0; font-family: var(--display); }

#app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left); }

.bar { flex: none; display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 16px 0 12px; background: var(--bar); border-bottom: 1px solid var(--line); }
.bar h1 { flex: 1; min-width: 0; font-size: 16px; letter-spacing: .06em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-logo { width: 38px; height: 38px; object-fit: contain; }
.bar-account { color: var(--sub); font-size: 13px; max-width: 34vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-button { width: 40px; height: 40px; padding: 6px; border: 0; border-radius: 10px; background: transparent; color: #fff; }
.icon-button:active { background: rgba(255, 255, 255, .14); }
.icon-button svg { width: 100%; height: 100%; display: block; }
.dot { flex: none; display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }

#content { flex: 1; min-height: 0; position: relative; }
.screen { position: absolute; inset: 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); }
.scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.caption { color: var(--muted); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }
.title { font-size: 22px; color: #fff; }
.sub { color: var(--sub); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.center { text-align: center; }
.pre { white-space: pre-line; overflow-wrap: anywhere; }
.label { margin-top: 12px; font-size: 15px; }
.display { font-family: var(--display); }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 10px 16px; width: 100%;
  border: 1px solid var(--line); border-radius: 12px; background: var(--field); color: #fff; font: 700 15px var(--body); touch-action: manipulation; }
.button:active { filter: brightness(1.25); }
.button.primary { background: var(--red); border-color: var(--red); }
.button.big { min-height: 76px; font: 700 22px var(--display); }
.button:disabled { opacity: .4; }
.row { display: flex; gap: 8px; margin-top: 10px; }
.row .button { flex: 1; min-width: 0; padding: 10px 8px; }

.field { display: block; width: 100%; margin-top: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--field); color: #fff; font: 16px var(--body); }
.field:focus { outline: none; border-color: var(--cyan); }
select.field { appearance: none; -webkit-appearance: none; }

.links { display: flex; flex-direction: column; margin-top: 8px; }
.links a { padding: 7px 0; color: var(--cyan-light); font-weight: 700; font-size: 14px; text-decoration: none; }

/* account */
.account-card { max-width: 460px; margin: 0 auto; border-radius: 20px; display: flex; flex-direction: column; gap: 6px; }
.account-card form .button, #logout-form .button { margin-top: 14px; }
.logo-medium { width: 96px; height: 96px; object-fit: contain; align-self: center; }
.logo-large { width: 150px; height: 150px; object-fit: contain; align-self: center; }

/* home and settings: side by side in landscape, one below the other in portrait */
.split { display: flex; gap: 16px; align-items: flex-start; }
.split > * { flex: 1; min-width: 0; }
.column, .tiles { display: flex; flex-direction: column; gap: 12px; }
.hero { display: flex; flex-direction: column; gap: 6px; border-radius: 20px; border-color: #4A1F25; background: linear-gradient(135deg, #1D1016, #0D121C); }
.hero .big { margin-top: 10px; }
.hero > .small { margin-top: 10px; }
.tile-value { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 15px; }
.tile-value b { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-detail:empty { display: none; }

/* live */
.live { display: flex; gap: 14px; padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); }
.stage { position: relative; flex: 1; min-width: 0; min-height: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: #07090E; touch-action: manipulation; }
.stage video, .stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.stage video { object-fit: contain; }
.stage-hint { position: absolute; left: 14px; top: 12px; right: 14px; font-weight: 700; font-size: 17px; color: #fff; text-shadow: 0 0 6px #000, 0 0 2px #000; pointer-events: none; }
.paused-cover { position: absolute; inset: 0; width: 100%; border: 0; background: rgba(7, 9, 14, .86); color: #fff; font: 700 18px var(--display); }
.panel { flex: none; width: 330px; display: flex; flex-direction: column; gap: 10px; }
.panel > div { display: flex; flex-direction: column; gap: 10px; }
.panel .row { margin-top: 0; }
.status { font-size: 17px; font-weight: 700; color: #fff; }
.status.alert { color: #FF7878; }
.dart-row { display: flex; align-items: center; gap: 12px; margin-top: 8px; padding: 8px 12px 8px 10px; border: 1px solid #1C2433; border-radius: 12px; background: #0F141E; }
.dart-row.set { border-color: #2B3850; }
.dart-row div { display: flex; flex-direction: column; }
.chip { flex: none; width: 40px; height: 40px; border-radius: 10px; background: var(--field); color: var(--muted); font-weight: 700; display: flex; align-items: center; justify-content: center; }
.hit { font: 700 22px var(--display); color: #5F6B7E; }
.dart-row.set .hit { color: #fff; }
.darts { padding: 12px; }
.darts-head { display: flex; align-items: center; justify-content: space-between; }
.sum { display: flex; align-items: baseline; gap: 10px; }
.sum b { font: 700 30px/1 var(--display); color: #fff; }
.dart-rows { display: flex; flex-direction: column; }
.stepper { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.stepper .button { width: 56px; min-height: 48px; flex: none; font-size: 20px; }
.stepper b { flex: 1; text-align: center; }

/* setup check */
#setup-card .check-title { font: 700 20px var(--display); padding: 4px 0 6px; }
#setup-card .check-row { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 13px; }
#setup-card .check-row b { flex: none; width: 104px; color: var(--sub); }
#setup-card .check-row span:last-child { color: var(--muted); }
#setup-card .check-hint { padding-top: 6px; font-size: 13px; color: #fff; }

/* settings */
.switch { display: flex; align-items: center; gap: 12px; padding: 10px 0 2px; }
.switch span { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.switch small { color: var(--muted); font-size: 12.5px; }
.switch input { appearance: none; -webkit-appearance: none; flex: none; width: 52px; height: 30px; border-radius: 15px; background: var(--field); border: 1px solid var(--line); position: relative; transition: background .15s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--muted); transition: transform .15s, background .15s; }
.switch input:checked { background: var(--red-dark); border-color: var(--red); }
.switch input:checked::after { transform: translateX(22px); background: var(--red); }

/* dialog */
.dialog { position: fixed; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(3, 5, 9, .78); }
/* the text scrolls, the buttons always stay visible (small phone held sideways) */
.dialog-box { width: 100%; max-width: 460px; max-height: 100%; overflow: hidden; border-color: var(--line-hi); display: flex; flex-direction: column; gap: 12px; }
#dialog-message { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.dialog-buttons { flex: none; display: flex; flex-direction: column; gap: 8px; }
.small-button { min-height: 40px; font-size: 13px; font-weight: 500; }
@media (orientation: landscape) and (max-height: 430px) {
  .dialog { padding: 8px; }
  .dialog-box { max-width: 640px; padding: 12px; gap: 8px; }
  .dialog-buttons { flex-direction: row; }
  .dialog-buttons .button { min-height: 44px; font-size: 13px; padding: 6px 8px; }
}

.row .button { font-size: 14px; }

@media (orientation: portrait) {
  .split { flex-direction: column; align-items: stretch; }
  .live { flex-direction: column; gap: 12px; }
  .stage { flex: 1.25; }
  .panel { flex: 1; width: auto; min-height: 0; }
  /* upright phone: the three darts side by side, so that everything fits without scrolling */
  .dart-rows { flex-direction: row; gap: 8px; }
  .dart-row { flex: 1; min-width: 0; flex-direction: column; align-items: flex-start; gap: 4px; padding: 8px; }
  .dart-row .chip { width: 26px; height: 26px; border-radius: 8px; font-size: 13px; }
  .hit { font-size: 19px; }
}
@media (orientation: landscape) and (max-height: 430px) {
  .bar { height: 44px; }
  .bar-logo { width: 30px; height: 30px; }
  .panel { width: 300px; }
  .logo-large { width: 96px; height: 96px; }
}
