* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #0b1622; color: #e8eef4; overflow: hidden;
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
canvas#view { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; display: block; touch-action: none; }
button { font: inherit; color: #e8eef4; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.25);
  border-radius: 10px; padding: .65em 1.1em; cursor: pointer; touch-action: manipulation; }
button:hover { background: rgba(255,255,255,.16); }
button:focus-visible { outline: 2px solid #ffb12e; outline-offset: 2px; }
button.primary { background: #d98a14; border-color: #ffb12e; color: #111; font-weight: 700; }
button.primary:hover { background: #f0a020; }
code, .mono { font-family: ui-monospace, Menlo, Consolas, monospace; }

#topbar { position: fixed; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 6px; z-index: 5;
  padding: calc(env(safe-area-inset-top) + 6px) calc(env(safe-area-inset-right) + 8px) 6px calc(env(safe-area-inset-left) + 8px);
  pointer-events: none; }
#topbar .spacer { flex: 0 0 4px; }
#topbar button { flex: none; }
#topbar button { pointer-events: auto; padding: .4em .65em; font-size: 11px; letter-spacing: .06em; border-radius: 7px;
  background: rgba(0,0,0,.5); border-color: rgba(255,255,255,.4); }
#topbar button.off { opacity: .45; text-decoration: line-through; }
#passinfo { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 12px ui-monospace, Menlo, Consolas, monospace; color: #9fd8a8; text-shadow: 0 1px 2px #000; }

#subtitle { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom) + 22%);
  z-index: 4; max-width: 90vw; padding: .35em .8em; border-radius: 8px; background: rgba(0,0,0,.55);
  font: 600 17px ui-monospace, Menlo, Consolas, monospace; color: #ffe2a8; opacity: 0; transition: opacity .25s; pointer-events: none;
  white-space: nowrap; }
#subtitle.show { opacity: 1; }
#subtitle.pilot { color: #b8e0ff; }
#subtitle.urgent { color: #ff6a5a; font-size: 21px; }
#alert { position: fixed; left: 50%; top: 30%; transform: translate(-50%, -50%); z-index: 4; pointer-events: none;
  font: 800 clamp(22px, 6vw, 44px) system-ui, sans-serif; letter-spacing: .06em; color: #ff5a4a; text-shadow: 0 2px 8px #000;
  opacity: 0; transition: opacity .2s; text-align: center; }
#alert.show { opacity: 1; }
#alert small { display: block; font-size: .45em; color: #fff; letter-spacing: .1em; }

#thumb { position: fixed; width: 96px; height: 96px; margin: -48px 0 0 -48px; border-radius: 50%;
  border: 2px solid rgba(160,255,170,.35); pointer-events: none; z-index: 3; display: none; }
#thumbDot { position: absolute; width: 34px; height: 34px; left: 31px; top: 31px; border-radius: 50%; background: rgba(160,255,170,.35); }

.screen { position: fixed; inset: 0; z-index: 10; display: none; align-items: center; justify-content: center;
  padding: calc(env(safe-area-inset-top) + 12px) 12px calc(env(safe-area-inset-bottom) + 12px);
  background: radial-gradient(ellipse at center, rgba(5,12,20,.55), rgba(5,12,20,.85)); overflow-y: auto; }
.screen.show { display: flex; }
#scrTitle { align-items: flex-end; background: linear-gradient(to bottom, rgba(5,12,20,0) 0%, rgba(5,12,20,.25) 40%, rgba(5,12,20,.85) 75%); }
@media (min-aspect-ratio: 4/3) { #scrTitle { align-items: center; justify-content: flex-start; background: linear-gradient(to right, rgba(5,12,20,.85) 0%, rgba(5,12,20,.6) 45%, rgba(5,12,20,0) 75%); } #scrTitle .panel { margin: auto auto auto 4vw; } }
.panel { width: min(560px, 100%); margin: auto; background: rgba(12,24,36,.88); border: 1px solid rgba(255,255,255,.12);
  border-radius: 16px; padding: 22px 22px 18px; box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.panel.wide { width: min(720px, 100%); }
h1 { margin: .1em 0 .2em; font-size: clamp(34px, 9vw, 58px); letter-spacing: .08em; line-height: 1; color: #ffb12e;
  text-shadow: 0 0 24px rgba(255,177,46,.35); }
h2 { margin: .1em 0 .4em; font-size: 24px; }
.kicker { margin: 0; text-transform: uppercase; letter-spacing: .14em; font-size: 12px; color: #b5d3e8; }
.lead { color: #cfdbe6; }
.small { font-size: 13px; color: #9fb4c6; }
.row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.how { padding-left: 1.1em; margin: .6em 0; }
.how li { margin: .45em 0; }
.how code { background: rgba(255,255,255,.08); padding: 0 .3em; border-radius: 4px; }
.controls { font-size: 13px; color: #b9c9d6; display: grid; gap: 4px; background: rgba(255,255,255,.04); padding: 8px 10px; border-radius: 8px; }
.lenses { display: flex; gap: 8px; justify-content: space-between; }
.lenses figure { margin: 0; flex: 1; text-align: center; font-size: 12px; color: #b9c9d6; }
.lens { width: 100%; max-width: 150px; background: #050a10; border-radius: 8px; }
.levels { display: grid; gap: 8px; }
.levels button { text-align: left; display: flex; flex-direction: column; }
.levels button span { font-size: 12px; color: #9fb4c6; }

.gradeRow { display: flex; gap: 14px; align-items: center; margin: 8px 0 6px; }
.gradeName { font-size: 26px; font-weight: 800; }
.shorthand { display: inline-block; margin-top: 6px; font-size: 16px; color: #ffe2a8; background: rgba(0,0,0,.35);
  padding: .2em .5em; border-radius: 6px; white-space: pre-wrap; }
.shorthand u, .comments u { text-decoration-thickness: 2px; }
.comments { margin: 8px 0; padding-left: 0; list-style: none; font-size: 14px; }
.comments li { padding: 3px 0; border-bottom: 1px dashed rgba(255,255,255,.08); }
.comments li code { display: inline-block; min-width: 72px; color: #ffe2a8; }
.tip { background: rgba(255,177,46,.1); border-left: 3px solid #ffb12e; padding: 8px 10px; border-radius: 4px; font-size: 14px; }

.board { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.tile { width: 48px; height: 48px; border-radius: 6px; display: flex; flex-direction: column; align-items: center;
  justify-content: center; font: 800 14px ui-monospace, Menlo, Consolas, monospace; color: #111; border: 2px solid rgba(0,0,0,.4); }
.tile small { font-size: 10px; font-weight: 600; }
.tile.big { width: 84px; height: 84px; font-size: 24px; flex: none; }
.tile.empty { background: rgba(255,255,255,.06); border: 2px dashed rgba(255,255,255,.2); }
.tile.okU, .tile.ok { background: #35b04f; }
.tile.okU { box-shadow: 0 0 14px #5dff7c; }
.tile.fair { background: #e8c62e; }
.tile.ng { background: #8a5a32; color: #f4e6d6; }
.tile.bolter { background: #2f74d6; color: #fff; }
.tile.wo { background: #d23a30; color: #fff; }
.tile.cut { background: #111; color: #ff5a4a; border-color: #d23a30; }
.tile .u { text-decoration: underline; text-decoration-thickness: 2px; }

@media (max-width: 480px) {
  .panel { padding: 16px 14px 14px; }
  .lenses figcaption { font-size: 11px; }
  #subtitle { font-size: 15px; bottom: calc(env(safe-area-inset-bottom) + 26%); }
}
@media (prefers-reduced-motion: reduce) {
  #subtitle, #alert { transition: none; }
}

.row button { flex: 1 1 140px; }
.row #btnCruise { flex-basis: 100%; }
.small { color: #b9c4cc; }

/* Touch: never scroll/bounce/zoom the page while playing */
html, body { position: fixed; inset: 0; width: 100%; overscroll-behavior: none; touch-action: none; -webkit-touch-callout: none; }
body * { touch-action: none; }
button, a { touch-action: manipulation; }
.screen, .screen *, .panel, .scroll { touch-action: pan-y; overscroll-behavior: contain; }
