:root {
  --ink: #0E1116;
  --paper: #F7F9FA;
  --blue: #12508F;
  --blue-deep: #0D3B6E;
  --yellow: #FFD24A;
  --concrete: #B9BEC2;
  --green: #6FA85A;
  --orange: #E4552B;
  --sky: #7FC6D9;
  --line: rgba(14, 17, 22, 0.18);
  --shadow: 4px 4px 0 rgba(14, 17, 22, 0.22);
  --display: "Archivo", "Arial Black", sans-serif;
  --text: "Hanken Grotesk", "Trebuchet MS", sans-serif;
  --num: "Chakra Petch", "Courier New", monospace;
  --cut: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #CFE6F2; }
body {
  font-family: var(--text);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  user-select: none;
  touch-action: manipulation;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
#stage { position: fixed; inset: 0; overflow: hidden; background: #CFE6F2; }
#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.you-tag {
  position: absolute; left: 0; top: 0; display: none; pointer-events: none; z-index: 4;
  transform: translate(-50%, -100%);
  background: var(--yellow); color: var(--ink);
  font-family: var(--font-num, "Chakra Petch", monospace);
  font-weight: 700; font-size: 11px; letter-spacing: 0.14em; white-space: nowrap;
  padding: 3px 7px; border: 2px solid var(--ink); box-shadow: 2px 2px 0 var(--ink);
}
.you-tag::after {
  content: ""; position: absolute; left: 50%; top: 100%; width: 0; height: 0;
  transform: translateX(-50%);
  border: 6px solid transparent; border-top-color: var(--ink);
}
.you-tag.show { display: block; }
#hud.onfoot .you-tag { display: none !important; }

.hazard { height: 8px; background: repeating-linear-gradient(45deg, var(--yellow) 0 9px, var(--ink) 9px 18px); }
kbd {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--num);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  box-shadow: inset 0 0 0 1px rgba(14, 17, 22, 0.25);
}

.sign-header {
  font-family: var(--display);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13px 20px;
  border: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--display);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: inset 0 0 0 2px var(--ink), var(--shadow);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%);
  transition: transform 80ms linear, background 80ms linear, color 80ms linear;
}
.btn:hover { background: var(--yellow); }
.btn:active { transform: translate(3px, 3px); box-shadow: inset 0 0 0 2px var(--ink); background: var(--ink); color: var(--paper); }
.btn.primary { background: var(--blue); color: var(--paper); box-shadow: inset 0 0 0 2px var(--ink), var(--shadow); }
.btn.primary:hover { background: var(--blue-deep); }
.btn.danger { background: var(--orange); color: var(--paper); }
.btn.small { padding: 9px 13px; font-size: 11px; }
.btn .hazard { height: 8px; background: repeating-linear-gradient(45deg, var(--yellow) 0 9px, var(--ink) 9px 18px); }
kbd { background: var(--yellow); color: var(--ink); }

/* ---------------- screens ---------------- */
.screen {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  padding: max(14px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 140ms linear, visibility 140ms linear;
}
.screen.show { opacity: 1; visibility: visible; pointer-events: auto; }

/* ---------------- top bar ---------------- */
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; z-index: 3; }
.role-rail { display: flex; gap: 6px; flex-wrap: wrap; }
.role-badge {
  position: relative;
  width: 104px;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--paper);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  font-family: var(--display);
  font-size: 8px;
  letter-spacing: 0.08em;
  text-align: left;
}
.role-badge svg {
  width: 100%;
  height: 54px;
  display: block;
  background: var(--blue);
  box-shadow: inset 0 0 0 2px var(--ink);
  padding: 8px;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 7px), calc(100% - 7px) 100%, 0 100%);
}
.role-badge span {
  display: block;
  background: var(--ink);
  padding: 4px 5px 5px;
  font-size: 7px;
  letter-spacing: 0.04em;
  line-height: 1.05;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}
.role-badge i { position: absolute; left: 0; right: 0; top: 50px; height: 3px; background: var(--yellow); opacity: 0.55; }
.role-badge.active i { height: 5px; opacity: 1; }
.role-badge.active svg { background: var(--blue-deep); }
.role-badge.active span { background: var(--blue); }
.role-badge:hover svg { background: var(--blue-deep); }
.role-badge.soon span { color: #9AA3A8; }
.role-badge.soon::after {
  content: "STEP " attr(data-step);
  position: absolute;
  top: 22px; left: 0; right: 0;
  text-align: center;
  font-size: 7px;
  letter-spacing: 0.12em;
  background: var(--yellow);
  color: var(--ink);
  padding: 2px 0;
}

.weather-rail { display: flex; gap: 5px; align-items: flex-start; }
.wdisc {
  width: 46px;
  background: transparent;
  border: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--ink);
  font-family: var(--display);
  font-size: 7px;
  letter-spacing: 0.08em;
}
.wdisc svg {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: inset 0 0 0 2px var(--paper), 0 0 0 2px var(--ink);
  padding: 5px;
}
.wdisc span { opacity: 0.8; white-space: nowrap; }
.wdisc:hover svg { background: var(--blue); }
.wdisc.active svg { background: var(--blue); box-shadow: inset 0 0 0 2px var(--yellow), 0 0 0 2px var(--ink); }
.wdisc.auto svg { background: #3B464E; }
.wdisc.auto span::after { content: " AUTO"; }

/* ---------------- start hero ---------------- */
.hero { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 26px; align-items: center; max-width: 1460px; width: 100%; margin: 0 auto; z-index: 2; }
.hero-sign {
  position: relative;
  background: var(--paper);
  box-shadow: inset 0 0 0 2px var(--ink), 10px 10px 0 rgba(14, 17, 22, 0.25);
  padding: 0 0 26px;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 26px), calc(100% - 26px) 100%, 0 100%);
  max-width: 780px;
}
.hero-sign .sign-header { background: var(--blue); color: var(--paper); padding: 10px 18px; }
.hero-sign h1 {
  margin: 18px 18px 0;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(44px, 7.3vw, 104px);
  line-height: 0.84;
  letter-spacing: 0.005em;
  text-transform: uppercase;
}
.hero-year {
  display: inline-block;
  margin: 14px 18px 0;
  background: var(--yellow);
  color: var(--ink);
  font-family: var(--num);
  font-weight: 700;
  font-size: clamp(18px, 2.2vw, 28px);
  letter-spacing: 0.18em;
  padding: 4px 12px 5px;
  box-shadow: inset 0 0 0 2px var(--ink);
}
.hero-copy {
  max-width: 590px;
  margin: 14px 18px 20px;
  font-size: clamp(13px, 1.25vw, 16px);
  line-height: 1.45;
  color: #26313A;
}
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; margin: 0 18px; }
.hero-meta { display: flex; gap: 8px; flex-wrap: wrap; margin: 18px 18px 0; }
.hero-meta span {
  font-family: var(--num);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.12em;
  padding: 4px 8px;
  background: var(--concrete);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
}
.hero-side { display: flex; flex-direction: column; gap: 14px; }
.side-plate { background: var(--paper); box-shadow: inset 0 0 0 2px var(--ink), var(--shadow); padding: 0 0 12px; }
.side-plate .sign-header { background: var(--ink); color: var(--paper); padding: 8px 12px; }
.side-rows { padding: 8px 12px; display: grid; gap: 0; }
.side-rows div { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--line); padding: 7px 0; font-size: 12px; }
.side-rows div:last-child { border-bottom: 0; }
.side-rows b { font-family: var(--num); font-size: 10px; letter-spacing: 0.08em; color: var(--blue); }
.side-rows span { text-align: right; }
.side-note { padding: 6px 12px 0; font-size: 11px; line-height: 1.35; color: #3B464E; }
.side-ticket { position: relative; background: var(--paper); box-shadow: inset 0 0 0 2px var(--ink), var(--shadow); padding: 10px 12px 10px 24px; display: flex; flex-direction: column; gap: 3px; clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 0 72%, 7px 66%, 0 60%); }
.ticket-bar { position: absolute; left: 8px; top: 8px; bottom: 8px; width: 8px; }
.ticket-name { font-family: var(--display); font-weight: 700; font-size: 13px; letter-spacing: 0.08em; }
.ticket-code { font-family: var(--num); font-size: 11px; letter-spacing: 0.14em; color: var(--blue); }
.ticket-punch { position: absolute; right: 14px; top: 50%; width: 12px; height: 12px; margin-top: -6px; border-radius: 50%; background: #CFE6F2; box-shadow: inset 0 0 0 2px var(--ink); }
.start-foot { display: flex; justify-content: space-between; gap: 12px; padding: 10px 4px 0; font-family: var(--num); font-size: 9px; letter-spacing: 0.14em; z-index: 2; }
.foot-note.right { text-align: right; }

/* ---------------- setup ---------------- */
.setup-screen { background: rgba(207, 230, 242, 0.46); }
.setup-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; padding: 6px 12px 10px; border-bottom: 3px solid var(--ink); background: rgba(247, 249, 250, 0.94); }
.setup-title h2 { margin: 4px 0 0; font-family: var(--display); font-weight: 800; font-size: clamp(26px, 3.4vw, 46px); letter-spacing: 0.02em; line-height: 0.9; }
.setup-title .sign-header { color: var(--blue); font-size: 10px; }
.setup-grid { flex: 1; display: grid; grid-template-columns: 292px minmax(0, 1fr) 282px; gap: 16px; min-height: 0; min-width: 0; padding: 14px 0 0; }
.fleet-col, .airline-col, .preview-col, .aircraft-list, .airline-list { min-width: 0; }
.col-head { display: flex; justify-content: space-between; gap: 8px; background: var(--ink); color: var(--paper); padding: 7px 10px; font-family: var(--num); font-size: 10px; letter-spacing: 0.12em; }
.fleet-col, .airline-col { display: flex; flex-direction: column; min-height: 0; background: var(--paper); box-shadow: inset 0 0 0 2px var(--ink), var(--shadow); }
.aircraft-list, .airline-list { overflow-y: auto; overflow-x: hidden; padding: 6px; display: flex; flex-direction: column; gap: 4px; scrollbar-width: thin; }
.aircraft-item {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr);
  gap: 6px;
  align-items: center;
  border: 0;
  background: #E9EEF0;
  box-shadow: inset 0 0 0 1px rgba(14, 17, 22, 0.25);
  padding: 4px;
  position: relative;
  text-align: left;
}
.aircraft-item svg { width: 50px; height: 50px; display: block; background: #DDE4E7; }
.aircraft-item b { display: block; font-family: var(--display); font-weight: 700; font-size: 11.5px; letter-spacing: 0.03em; line-height: 1.05; }
.aircraft-item span { display: block; font-family: var(--num); font-size: 9.5px; letter-spacing: 0.06em; color: #465159; margin-top: 2px; }
.aircraft-item::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: var(--yellow); }
.aircraft-item:hover { background: #F7F9FA; }
.aircraft-item.active { background: var(--paper); box-shadow: inset 0 0 0 2px var(--blue); }
.aircraft-item.active::after { height: 4px; }
.aircraft-item.active b { color: var(--blue); }
.preview-col { display: flex; flex-direction: column; justify-content: flex-end; gap: 14px; min-height: 0; padding-top: 12px; }
.preview-plate { background: var(--paper); box-shadow: inset 0 0 0 2px var(--ink), 10px 10px 0 rgba(14,17,22,0.18); padding: 0 0 16px; clip-path: polygon(0 0, 100% 0, 100% calc(100% - 18px), calc(100% - 18px) 100%, 0 100%); }
.preview-plate .sign-header { background: var(--blue); color: var(--paper); padding: 9px 16px; }
.preview-name { margin: 16px 16px 0; font-family: var(--display); font-weight: 800; font-size: clamp(30px, 4.2vw, 58px); line-height: 0.9; letter-spacing: 0.01em; text-transform: uppercase; }
.preview-sub { margin: 8px 16px 0; font-family: var(--display); font-weight: 700; font-size: 13px; letter-spacing: 0.14em; color: var(--blue); text-transform: uppercase; }
.preview-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin: 16px 16px 0; background: var(--ink); }
.preview-stats div { background: var(--paper); padding: 8px 10px 9px; }
.preview-stats span { display: block; font-family: var(--num); font-size: 9px; letter-spacing: 0.12em; color: #5C6870; }
.preview-stats b { font-family: var(--num); font-size: clamp(18px, 2.4vw, 27px); line-height: 1; }
.preview-stats i { font-style: normal; font-family: var(--num); font-size: 9px; color: #5C6870; margin-left: 2px; }
.preview-note { margin: 12px 16px 0; font-family: var(--num); font-size: 10px; letter-spacing: 0.12em; color: #3B464E; }
.setup-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; background: rgba(247, 249, 250, 0.92); box-shadow: inset 0 0 0 2px var(--ink); padding: 10px; }
.callsign { display: inline-flex; align-items: center; gap: 7px; font-family: var(--num); font-size: 10px; letter-spacing: 0.1em; }
.callsign input { width: 108px; border: 0; box-shadow: inset 0 0 0 2px var(--ink); background: var(--paper); padding: 9px 8px; font-family: var(--num); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.callsign input:focus { outline: 3px solid var(--yellow); }
.airline-item {
  position: relative;
  border: 0;
  background: var(--paper);
  box-shadow: inset 0 0 0 1px rgba(14,17,22,0.22);
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  gap: 7px;
  align-items: center;
  text-align: left;
  padding: 6px 8px 6px 5px;
  min-height: 34px;
}
.airline-item i { display: block; align-self: stretch; background: var(--tail); }
.airline-item > span { display: block; min-width: 0; overflow: hidden; }
.airline-item b { display: block; font-family: var(--display); font-weight: 700; font-size: 10.5px; letter-spacing: 0.02em; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.airline-item em { display: block; width: 26px; height: 3px; background: var(--accent); margin-top: 3px; }
.airline-item:hover { background: #EEF2F3; }
.airline-item.active { background: var(--paper); box-shadow: inset 0 0 0 2px var(--blue); clip-path: polygon(0 0, 100% 0, 100% 100%, 10px 100%, 10px 50%, 0 50%); }
.airline-item.active i { transform: scaleX(1.45); transform-origin: left; }
.airline-item.active b { color: var(--blue); }
.setup-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 12px; border-top: 3px solid var(--ink); margin-top: 10px; background: rgba(247, 249, 250, 0.9); }
.legend-mini { display: flex; flex-wrap: wrap; gap: 10px; font-family: var(--num); font-size: 9px; letter-spacing: 0.08em; }
.legend-mini span { display: inline-flex; align-items: center; gap: 3px; }

/* ---------------- lobby ---------------- */
.lobby-screen { background: rgba(207, 230, 242, 0.62); }
.lobby-grid { flex: 1; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr); gap: 22px; align-items: center; max-width: 1100px; width: 100%; margin: 0 auto; }
.pass-card {
  position: relative;
  background: var(--paper);
  box-shadow: inset 0 0 0 2px var(--ink), 12px 12px 0 rgba(14,17,22,0.22);
  padding: 0;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 22px), calc(100% - 22px) 100%, 0 100%);
}
.pass-top { display: flex; justify-content: space-between; background: var(--blue); color: var(--paper); padding: 10px 18px; font-family: var(--display); font-weight: 700; font-size: 11px; letter-spacing: 0.14em; }
.pass-main { padding: 22px 20px 18px; background-image: repeating-linear-gradient(90deg, rgba(18,80,143,0.09) 0 1px, transparent 1px 9px); }
.pass-label { font-family: var(--num); font-size: 10px; letter-spacing: 0.18em; color: var(--blue); }
.room-code { font-family: var(--num); font-weight: 700; font-size: clamp(40px, 7vw, 76px); line-height: 1; letter-spacing: 0.12em; color: var(--ink); margin-top: 4px; }
.room-sub { margin-top: 8px; font-family: var(--display); font-size: 11px; letter-spacing: 0.12em; color: #3B464E; }
.pass-tear { height: 0; border-top: 3px dashed var(--ink); margin: 0 0; position: relative; }
.pass-tear::before, .pass-tear::after { content: ""; position: absolute; top: -14px; width: 26px; height: 26px; border-radius: 50%; background: #CFE6F2; box-shadow: inset 0 0 0 2px var(--ink); }
.pass-tear::before { left: -15px; }
.pass-tear::after { right: -15px; }
.pass-bottom { padding: 16px 20px 20px; display: grid; gap: 10px; }
.link-line { display: grid; gap: 4px; }
.link-line span { font-family: var(--num); font-size: 9px; letter-spacing: 0.18em; color: var(--blue); }
.link-line input { border: 0; background: #E9EEF0; padding: 9px 10px; font-family: var(--num); font-size: 11px; color: var(--ink); box-shadow: inset 0 0 0 1px rgba(14,17,22,0.3); width: 100%; }
.pass-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.seat-col { display: flex; flex-direction: column; gap: 12px; }
.seat-list { display: grid; gap: 8px; }
.seat-card { background: var(--paper); box-shadow: inset 0 0 0 2px var(--ink); padding: 10px 12px; display: grid; grid-template-columns: 44px minmax(0,1fr) auto; gap: 10px; align-items: center; }
.seat-card .seat-no { font-family: var(--num); font-weight: 700; font-size: 26px; background: var(--blue); color: var(--paper); text-align: center; padding: 4px 0; }
.seat-card .seat-who b { display: block; font-family: var(--display); font-size: 13px; letter-spacing: 0.04em; }
.seat-card .seat-who span { display: block; font-family: var(--num); font-size: 9.5px; letter-spacing: 0.08em; color: #49555C; margin-top: 2px; }
.seat-card .seat-state { font-family: var(--num); font-size: 9px; letter-spacing: 0.1em; background: var(--yellow); color: var(--ink); padding: 3px 6px; }
.seat-card.empty { opacity: 0.72; border-style: dashed; }
.seat-card.empty .seat-no { background: var(--concrete); color: #3B464E; }
.lobby-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.lobby-note { font-size: 12px; line-height: 1.4; color: #26313A; margin: 0; }

/* ---------------- HUD ---------------- */
#hud { position: absolute; inset: 0; z-index: 10; pointer-events: none; }
.hud-grain { position: absolute; inset: 0; background: none; }
.split-rule { position: absolute; top: 0; bottom: 0; left: 50%; width: 6px; margin-left: -3px; background: var(--yellow); box-shadow: 0 0 0 2px rgba(14,17,22,0.75); display: none; z-index: 5; }
.split .split-rule { display: block; }
.split-stacked .split-rule { left: 0; right: 0; top: 50%; bottom: auto; height: 6px; width: auto; margin: 0; box-shadow: 0 0 0 2px rgba(14,17,22,0.75); }

.pilot-strip {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 34px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  background: var(--blue);
  color: var(--paper);
  border-bottom: 3px solid var(--ink);
  font-family: var(--num);
  font-size: 11px;
  letter-spacing: 0.06em;
  z-index: 6;
}
.pilot-strip b { font-family: var(--display); font-size: 12px; letter-spacing: 0.08em; }
.pilot-strip .strip-seat { background: var(--ink); padding: 3px 6px; font-size: 9px; }
.pilot-strip .strip-spot { margin-left: auto; background: var(--yellow); color: var(--ink); padding: 3px 7px; font-weight: 700; }
.pilot-strip #stripType1, .pilot-strip #stripType2 { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pilot-strip .strip-tag { background: var(--paper); color: var(--ink); padding: 3px 6px; font-size: 9px; }
.split .pilot-strip.p1 { right: 50%; border-right: 3px solid var(--ink); }
.split .pilot-strip.p2 { left: 50%; }
.split-stacked .pilot-strip.p1 { right: 0; top: 0; border-right: 0; }
.split-stacked .pilot-strip.p2 { left: 0; top: 50%; }
.pilot-strip.p2 { background: var(--blue-deep); }

.hud-left { position: absolute; top: 44px; left: 12px; display: flex; flex-direction: column; gap: 7px; max-width: 280px; }
.plate { background: var(--paper); box-shadow: inset 0 0 0 2px var(--ink); text-align: left; border: 0; padding: 0; }
.plate-header { background: var(--blue); color: var(--paper); font-family: var(--display); font-weight: 700; font-size: 9px; letter-spacing: 0.13em; padding: 5px 9px; display: flex; justify-content: space-between; align-items: center; }
.plate-header .hazard { height: 8px; background: repeating-linear-gradient(45deg, var(--yellow) 0 9px, var(--ink) 9px 18px); }
kbd { height: 16px; min-width: 16px; font-size: 9px; }
.plate-body { padding: 7px 9px 8px; display: flex; gap: 8px; align-items: center; font-family: var(--num); font-size: 10.5px; letter-spacing: 0.07em; }
.role-plate { max-width: 220px; }
.role-plate .role-dot { width: 7px; height: 7px; background: var(--green); box-shadow: 0 0 0 1px var(--ink); }
.plan-plate { min-width: 230px; }
.plan-body { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 8px; padding: 7px 9px 9px; }
.plan-body span { display: flex; gap: 5px; align-items: center; font-size: 9px; color: #5B666D; }
.plan-body span b { display: inline-grid; place-items: center; width: 13px; height: 13px; background: #D8DEE1; color: var(--ink); font-size: 8px; }
.plan-body span.on { color: var(--ink); }
.plan-body span.on b { background: var(--yellow); }
.plan-body span.done b { background: var(--blue); color: var(--paper); }
.status-plate { max-width: 230px; }
.status-body { flex-direction: column; align-items: flex-start; gap: 3px; font-size: 9.5px; }
.status-body span { color: #4C575E; }
.status-body span.on { color: var(--blue); font-weight: 700; }
.status-body span.warn { color: var(--orange); font-weight: 700; }

.hud-top-right { position: absolute; top: 44px; right: 12px; display: flex; flex-direction: column; gap: 7px; align-items: flex-end; }
.weather-plate { pointer-events: auto; min-width: 190px; cursor: pointer; }
.weather-body { justify-content: space-between; }
.weather-body span:first-child { font-family: var(--display); font-weight: 700; letter-spacing: 0.1em; }
.weather-body span:last-child { font-family: var(--num); font-size: 16px; }
.tower-plate { min-width: 190px; opacity: 0.92; }
.tower-body { flex-direction: column; align-items: flex-start; gap: 2px; font-size: 9.5px; color: #49555C; }

.instruments {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: flex;
  gap: 1px;
  background: var(--ink);
  box-shadow: inset 0 0 0 2px var(--ink), var(--shadow);
  z-index: 7;
}
.gauge { background: #101820; color: var(--paper); padding: 6px 9px 7px; min-width: 64px; display: grid; grid-template-columns: auto auto; align-items: end; column-gap: 3px; }
.gauge span { grid-column: 1 / -1; font-family: var(--num); font-size: 8px; letter-spacing: 0.16em; color: #87949E; }
.gauge b { font-family: var(--num); font-weight: 700; font-size: 20px; line-height: 1; color: var(--yellow); letter-spacing: 0.02em; }
.gauge i { font-style: normal; font-family: var(--num); font-size: 8px; color: #87949E; }
.gauge.wide { min-width: 96px; }
.gauge.wide em { grid-column: 1 / -1; display: block; height: 5px; background: #26333D; margin-top: 4px; }
.gauge.wide em u { display: block; height: 100%; width: 0; background: var(--orange); }

.key-legend {
  position: absolute;
  left: 12px;
  bottom: 12px;
  background: rgba(221, 228, 231, 0.96);
  box-shadow: inset 0 0 0 2px var(--ink), var(--shadow);
  padding: 7px 9px 8px;
  max-width: 380px;
  z-index: 7;
}
.legend-title { font-family: var(--display); font-weight: 700; font-size: 9px; letter-spacing: 0.14em; color: var(--blue); margin-bottom: 5px; }
.legend-rows { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 10px; }
.legend-rows div { display: flex; align-items: center; gap: 5px; font-size: 9.5px; line-height: 1.1; }
.legend-rows .hazard { height: 8px; background: repeating-linear-gradient(45deg, var(--yellow) 0 9px, var(--ink) 9px 18px); }
kbd { min-width: 18px; height: 18px; font-size: 9px; }
.legend-note { margin-top: 5px; font-family: var(--num); font-size: 8px; letter-spacing: 0.1em; color: #5B666D; }

.hud-hint {
  position: absolute;
  left: 50%;
  bottom: 88px;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--paper);
  font-family: var(--num);
  font-size: 11px;
  letter-spacing: 0.08em;
  padding: 7px 12px;
  box-shadow: inset 0 0 0 2px var(--yellow);
  z-index: 8;
  max-width: 520px;
  text-align: center;
  transition: opacity 400ms linear;
}
.hud-hint.fade { opacity: 0; }
.mask-note {
  position: absolute;
  left: 50%;
  top: 52px;
  transform: translateX(-50%);
  background: var(--orange);
  color: var(--paper);
  font-family: var(--display);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.14em;
  padding: 6px 14px;
  box-shadow: inset 0 0 0 2px var(--ink);
  z-index: 8;
}
.snd-badge {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  font-family: var(--num); font-size: 8px; letter-spacing: 0.14em;
  background: rgba(14,17,22,0.7); color: var(--paper); padding: 4px 6px; opacity: 0; transition: opacity 300ms;
}
.snd-badge.show { opacity: 1; }

.split .hud-left { max-width: min(280px, calc(50vw - 24px)); }
.split .key-legend { max-width: min(380px, calc(50vw - 24px)); }
.split .instruments { right: calc(50% + 12px); }
.split .hud-top-right { right: calc(50% + 12px); }
.split .gps { right: calc(50% + 12px); }
.split .hud-hint { left: 25%; max-width: calc(50vw - 28px); }
.split .mask-note { left: 25%; }
.split-stacked .mask-note { left: 50%; }
.split-stacked .hud-left { max-width: calc(50vw - 20px); }
.split-stacked .key-legend { max-width: calc(50vw - 20px); }
.split-stacked .instruments { right: 12px; bottom: calc(50% + 10px); top: auto; }
.split-stacked .hud-top-right { right: 12px; top: 40px; }
.split-stacked .key-legend { left: 12px; bottom: calc(50% + 10px); }
.split-stacked .hud-hint { left: 50%; bottom: calc(50% + 80px); }
.split-stacked .gps { right: 12px; top: 80px; transform: none; }

/* mini radar */
.mini-radar {
  position: absolute;
  right: 12px;
  bottom: 76px;
  width: 184px;
  background: var(--paper);
  box-shadow: inset 0 0 0 2px var(--ink), var(--shadow);
  z-index: 13;
  pointer-events: none;
  cursor: default;
}
.mini-head { width: 100%; border: 0; background: var(--blue); color: var(--paper); font-family: var(--display); font-weight: 700; font-size: 8.5px; letter-spacing: 0.12em; padding: 5px 8px; display: flex; justify-content: space-between; align-items: center; gap: 6px; pointer-events: auto; cursor: pointer; }
.mini-head kbd { height: 15px; min-width: 15px; font-size: 8px; }
.mini-radar canvas { display: block; width: 100%; height: auto; background: #0E2946; }
@media (max-width: 1100px) and (pointer: fine) { .mini-radar { display: none; } }
@media (max-aspect-ratio: 1/1) { .mini-radar { display: none; } }
.split .mini-radar { display: none; }
@media (orientation: landscape) {
  body.touch #hud:not(.split) .mini-radar { left: auto; right: 8px; top: 88px; bottom: auto; transform: none; width: 92px; }
  body.touch #hud:not(.split) .mini-head { font-size: 6.6px; padding: 3px 5px; letter-spacing: 0.08em; }
  body.touch #hud:not(.split) .mini-head kbd { height: 12px; min-width: 12px; font-size: 7px; }
  body.touch #hud:not(.split) .instruments { top: 40px; bottom: auto; left: 10px; right: auto; transform: scale(0.62); transform-origin: top left; }
  body.touch #hud:not(.split) .gps { width: min(188px, 23vw, 50vh); }
  body.touch #hud:not(.split) .hud-hint { top: 90px; bottom: auto; max-width: min(48vw, 420px); font-size: 9px; padding: 5px 8px; }
}

/* gps */
.gps {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: min(420px, 42vw, 74vh);
  background: var(--paper);
  box-shadow: inset 0 0 0 2px var(--ink), 8px 8px 0 rgba(14,17,22,0.22);
  z-index: 9;
  padding: 0 0 8px;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 16px), calc(100% - 16px) 100%, 0 100%);
}
.gps .plate-header { background: var(--blue); }
.gps canvas { display: block; width: 100%; height: auto; background: #0E2946; }
.gps-foot { padding: 6px 9px 0; font-family: var(--num); font-size: 9px; letter-spacing: 0.1em; color: #465159; }
.gps-close { pointer-events: auto; margin-left: auto; border: 0; background: var(--yellow); color: var(--ink); font-family: var(--num); font-size: 8px; font-weight: 700; letter-spacing: 0.08em; padding: 3px 6px; cursor: pointer; }
#hud.onfoot .instruments, #hud.onfoot .mini-radar, #hud.onfoot .hud-left, #hud.onfoot .hud-top-right, #hud.onfoot .key-legend { display: none !important; }
#hud.onfoot .hud-hint { font-size: 9px; padding: 4px 8px; max-width: 280px; bottom: 12px; left: 50%; transform: translateX(-50%); }
#hud.onfoot .gps { width: min(210px, 28vw, 60vh); }

/* touch controls */
.touch-controls { display: none; position: absolute; inset: 0; z-index: 12; pointer-events: none; }
.touch-left, .touch-right, .touch-top { position: absolute; display: flex; gap: 8px; pointer-events: auto; }
.touch-left { left: 14px; bottom: 16px; }
.touch-right { right: 14px; bottom: 16px; }
.touch-top { right: 14px; top: 44px; }
.tbtn {
  width: 62px; height: 62px;
  border: 0;
  border-radius: 4px;
  background: rgba(247,249,250,0.94);
  color: var(--ink);
  box-shadow: inset 0 0 0 2px var(--ink), 3px 3px 0 rgba(14,17,22,0.25);
  font-family: var(--display); font-weight: 700; font-size: 18px;
  pointer-events: auto;
  touch-action: none;
}
.tbtn:active { background: var(--blue); color: var(--paper); transform: translate(2px,2px); box-shadow: inset 0 0 0 2px var(--ink); }
.tbtn.big { width: 72px; height: 72px; font-size: 24px; background: var(--blue); color: var(--paper); }
.tbtn.small { width: 50px; height: 40px; font-size: 10px; font-family: var(--num); letter-spacing: 0.08em; }
body.touch .touch-controls { display: block; }
body.touch .key-legend { display: none; }
body.touch .hud-left, body.touch .hud-top-right { display: none; }
body.touch .instruments { bottom: 100px; }
body.touch .hud-hint { bottom: 190px; }
body.touch #hud.split .instruments { bottom: 96px; }
body.touch #hud.split .touch-top { left: 12px; right: auto; top: 44px; }
body.touch #hud.split .touch-right { right: calc(50% + 12px); left: auto; }
body.touch #hud.split-stacked .instruments { top: 38px; bottom: auto; right: 6px; }
body.touch #hud.split-stacked .touch-top { top: 88px; left: 6px; }
body.touch #hud.split-stacked .touch-left, body.touch #hud.split-stacked .touch-right { bottom: calc(50% + 10px); }
body.touch #hud.split-stacked .touch-right { right: 12px; left: auto; }
body.touch #hud.split-stacked .hud-hint { top: 140px; bottom: auto; left: 50%; transform: translateX(-50%); width: 70%; }

/* ---------------- pause + end ---------------- */
.pause-screen, .end-screen { align-items: center; justify-content: center; background: rgba(14, 17, 22, 0.32); }
.pause-card, .end-card {
  width: min(620px, 94vw);
  background: var(--paper);
  box-shadow: inset 0 0 0 2px var(--ink), 12px 12px 0 rgba(14,17,22,0.28);
  padding: 0 0 18px;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 20px), calc(100% - 20px) 100%, 0 100%);
}
.pause-card .sign-header, .end-card .sign-header { background: var(--blue); color: var(--paper); padding: 9px 16px; }
.pause-card h2, .end-card h2 { margin: 12px 16px 8px; font-family: var(--display); font-weight: 800; font-size: clamp(28px, 4vw, 46px); line-height: 0.9; }
.pause-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 8px 16px 0; }
.pause-grid .btn { width: 100%; }
.pause-legend { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 16px 0; font-family: var(--num); font-size: 9px; letter-spacing: 0.08em; }
.end-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--ink); margin: 12px 16px 0; }
.end-stats div { background: var(--paper); padding: 10px; }
.end-stats span { display: block; font-family: var(--num); font-size: 8.5px; letter-spacing: 0.12em; color: #5B666D; }
.end-stats b { font-family: var(--num); font-size: clamp(16px, 2.2vw, 24px); }
.end-actions { display: flex; gap: 8px; padding: 16px 16px 2px; flex-wrap: wrap; }

/* ---------------- toast, weather card, boot ---------------- */
.toast {
  position: absolute;
  top: 50px; left: 50%;
  transform: translate(-50%, -12px);
  background: var(--ink);
  color: var(--paper);
  padding: 9px 14px;
  box-shadow: inset 0 0 0 2px var(--yellow);
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms linear, transform 160ms linear;
  max-width: 88vw;
  display: flex; gap: 10px; align-items: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast span:first-child { font-family: var(--display); font-weight: 700; font-size: 10px; letter-spacing: 0.12em; color: var(--yellow); }
.toast span:last-child { font-size: 12px; }
.weather-card {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%) scale(0.96);
  background: var(--paper);
  box-shadow: inset 0 0 0 2px var(--ink), 10px 10px 0 rgba(14,17,22,0.28);
  padding: 0 0 16px;
  width: min(420px, 90vw);
  z-index: 55;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms linear, transform 180ms linear;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 18px), calc(100% - 18px) 100%, 0 100%);
}
.weather-card.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.weather-card .sign-header { background: var(--blue); color: var(--paper); padding: 8px 14px; }
.weather-card h3 { margin: 12px 14px 0; font-family: var(--display); font-weight: 800; font-size: 34px; line-height: 0.9; }
.weather-card p { margin: 8px 14px 0; font-family: var(--num); font-size: 11px; letter-spacing: 0.1em; color: #465159; }
.boot {
  position: absolute; inset: 0; z-index: 100;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: #CFE6F2;
  transition: opacity 400ms linear, visibility 400ms linear;
}
.boot.gone { opacity: 0; visibility: hidden; }
.boot-sign { background: var(--blue); color: var(--paper); padding: 18px 26px; box-shadow: inset 0 0 0 3px var(--ink), 10px 10px 0 rgba(14,17,22,0.25); display: grid; gap: 6px; text-align: center; }
.boot-sign span { font-family: var(--display); font-weight: 800; font-size: clamp(18px, 3vw, 32px); letter-spacing: 0.06em; }
.boot-sign b { font-family: var(--num); font-size: 14px; letter-spacing: 0.24em; color: var(--yellow); }
.boot-sign i { height: 4px; background: var(--yellow); }
.boot-bar { width: 220px; height: 6px; background: var(--ink); margin-top: 18px; }
.boot-bar u { display: block; height: 100%; width: 0; background: var(--blue); animation: boot 1.2s linear forwards; }
@keyframes boot { to { width: 100%; } }

/* ---------------- blink ---------------- */
#blink { position: absolute; inset: 0; background: #0E1116; opacity: 0; pointer-events: none; z-index: 15; transition: opacity 90ms linear; }
#blink.on { opacity: 0.92; }

/* ---------------- responsive ---------------- */
@media (max-width: 1120px) {
  .hero { grid-template-columns: minmax(0, 1fr) 250px; gap: 16px; }
  .setup-grid { grid-template-columns: 240px minmax(0, 1fr) 232px; gap: 10px; }
  .role-badge { width: 92px; }
}
@media (max-width: 900px) {
  .screen { padding: 10px 12px; }
  .role-badge { width: 78px; }
  .role-badge svg { height: 44px; }
  .role-badge i { top: 40px; }
  .role-badge span { font-size: 6.5px; }
  .wdisc { width: 36px; }
  .wdisc svg { width: 27px; height: 27px; }
  .wdisc span { display: none; }
  .hero { grid-template-columns: 1fr; align-items: center; }
  .hero-side { display: none; }
  .hero-sign h1 { font-size: clamp(38px, 10vw, 72px); }
  .lobby-grid { grid-template-columns: 1fr; align-content: center; gap: 12px; overflow-y: auto; }
  .pass-card { max-width: 560px; margin: 0 auto; width: 100%; }
  .seat-col { max-width: 560px; margin: 0 auto; width: 100%; }
  .instruments { transform-origin: right bottom; }
  .key-legend { max-width: 300px; }
  .legend-rows { grid-template-columns: 1fr; }
  .hud-left .status-plate { display: none; }
}
@media (max-width: 760px) {
  .setup-grid { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(120px, 1fr) auto; overflow-y: auto; overflow-x: hidden; }
  .fleet-col { max-height: 168px; }
  .aircraft-list { flex-direction: row; overflow-x: auto; }
  .aircraft-item { min-width: 210px; }
  .airline-col { max-height: 150px; }
  .airline-list { flex-direction: row; overflow-x: auto; }
  .airline-item { min-width: 160px; }
  .preview-col { padding-top: 0; }
  .preview-name { font-size: clamp(26px, 7vw, 44px); }
}
@media (max-height: 500px) {
  .setup-screen { padding: 6px 8px; }
  .setup-head { padding: 3px 8px 4px; gap: 8px; }
  .setup-title .sign-header { font-size: 8px; }
  .setup-title h2 { font-size: 22px; margin: 2px 0 0; }
  .setup-head .btn.small { padding: 5px 8px; font-size: 9px; }
  .setup-grid { padding-top: 5px; gap: 8px; }
  .col-head { padding: 4px 6px; font-size: 8px; }
  .aircraft-list { padding: 4px; gap: 3px; }
  .aircraft-item { grid-template-columns: 28px minmax(0, 1fr); gap: 3px; padding: 1px 2px; }
  .aircraft-item svg { width: 28px; height: 28px; }
  .aircraft-item b { font-size: 8.5px; line-height: 1; }
  .aircraft-item span { font-size: 7px; margin-top: 1px; letter-spacing: 0.02em; }
  .airline-list { padding: 4px; gap: 2px; }
  .airline-item { min-height: 22px; padding: 2px 5px; grid-template-columns: 8px minmax(0, 1fr); gap: 5px; }
  .airline-item b { font-size: 8.5px; }
  .airline-item em { height: 2px; margin-top: 1px; }
  .preview-col { padding-top: 0; gap: 5px; }
  .preview-plate { padding-bottom: 6px; }
  .preview-plate .sign-header { padding: 4px 8px; font-size: 8px; }
  .preview-name { font-size: clamp(20px, 3.2vw, 30px); margin: 6px 10px 0; }
  .preview-sub { font-size: 9px; margin: 3px 10px 0; }
  .preview-stats { margin: 6px 10px 0; }
  .preview-stats div { padding: 3px 6px; }
  .preview-stats span { font-size: 6.5px; }
  .preview-stats b { font-size: 14px; }
  .preview-stats i { font-size: 7px; }
  .preview-note { display: none; }
  .setup-actions { padding: 5px 6px; gap: 5px; }
  .callsign { font-size: 8px; gap: 4px; }
  .callsign input { width: 70px; padding: 5px 4px; font-size: 9px; }
  .btn { padding: 6px 8px; font-size: 9px; gap: 5px; }
  .btn kbd { height: 14px; min-width: 14px; font-size: 7px; }
  .setup-foot { padding: 4px 8px; margin-top: 4px; }
  .legend-mini { font-size: 7px; gap: 6px; }
  .setup-foot .foot-note { display: none; }
  .lobby-grid { grid-template-columns: 1.1fr 0.9fr; gap: 10px; align-items: center; }
  .pass-card { max-width: none; margin: 0; }
  .seat-col { max-width: none; margin: 0; }
  .pass-main { padding: 10px 12px 8px; }
  .room-code { font-size: clamp(28px, 5vw, 48px); }
  .pass-bottom { padding: 8px 12px 10px; }
  .seat-card { padding: 6px 8px; grid-template-columns: 34px minmax(0,1fr) auto; }
  .seat-card .seat-no { font-size: 18px; }
  .lobby-note { font-size: 10px; }
  .setup-head .btn { padding: 5px 8px; font-size: 9px; }
}
@media (max-width: 620px) {
  .gps { width: calc(100vw - 24px); max-width: none; right: 6px; top: 78px; transform: none; }
  .topbar { gap: 6px; }
  .role-rail { gap: 3px; }
  .role-badge { width: 58px; }
  .role-badge svg { height: 34px; padding: 5px; }
  .role-badge i { top: 30px; height: 3px; }
  .role-badge span { font-size: 5.5px; padding: 3px 3px; }
  .weather-rail { gap: 2px; }
  .wdisc { width: 27px; }
  .wdisc svg { width: 22px; height: 22px; padding: 3px; }
  .weather-rail .wdisc.auto { display: none; }
  .hero-sign h1 { font-size: clamp(34px, 11vw, 58px); }
  .hero-copy { font-size: 12px; }
  .btn { padding: 11px 13px; font-size: 11px; }
  .setup-grid { gap: 8px; }
  .fleet-col { max-height: 142px; }
  .airline-col { max-height: 124px; }
  .setup-actions { gap: 6px; padding: 8px; }
  .callsign input { width: 84px; }
  .preview-stats { grid-template-columns: 1fr 1fr; }
  .setup-foot { align-items: flex-start; }
  .setup-foot .foot-note { display: none; }
  .hud-left { top: 40px; left: 6px; max-width: 150px; }
  .plan-plate { min-width: 0; }
  .plan-body { grid-template-columns: 1fr; }
  .hud-top-right { top: 40px; right: 6px; }
  .weather-plate, .tower-plate { min-width: 0; max-width: 138px; }
  .tower-plate { display: none; }
  .instruments { right: 6px; bottom: 6px; }
  .gauge { min-width: 46px; padding: 4px 6px; }
  .gauge b { font-size: 15px; }
  .gauge.wide { min-width: 62px; }
  .key-legend { left: 6px; bottom: 6px; padding: 5px 6px; }
  .legend-rows div { font-size: 8px; }
  .legend-note { display: none; }
  .pilot-strip { font-size: 9px; gap: 5px; padding: 0 6px; height: 30px; }
  .pilot-strip b { font-size: 10px; }
  .pilot-strip .strip-type, .pilot-strip .strip-seat { display: none; }
  .split .hud-left { max-width: calc(50vw - 12px); }
  .split .key-legend { max-width: calc(50vw - 12px); }
  .split-stacked .hud-left { max-width: calc(50vw - 12px); }
  .split-stacked .key-legend { max-width: calc(50vw - 12px); }
  .toast { top: 38px; }
  .weather-card h3 { font-size: 26px; }
}

@media (orientation: landscape) {
  body.touch #hud:not(.split) .instruments { top: 40px; bottom: auto; left: 10px; right: auto; }
}
@media (max-width: 380px) {
  .touch-top { gap: 3px; right: 6px; }
  .touch-top .tbtn.small { width: 40px; height: 34px; font-size: 7.5px; }
  .instruments { right: 6px; }
  .gauge { min-width: 42px; padding: 4px 5px; }
  .gauge b { font-size: 14px; }
}
@media (max-height: 620px) {
  .hero-sign { padding-bottom: 14px; }
  .hero-sign h1 { font-size: clamp(32px, 7vh, 62px); }
  .hero-copy { display: none; }
  .hero-meta { margin-top: 10px; }
  .start-foot { display: none; }
  .preview-note { display: none; }
  .preview-stats { margin-top: 8px; }
  .key-legend { max-width: 340px; }
}

/* ---------------- job roles ---------------- */
.role-screen { background: rgba(207, 230, 242, 0.5); }
.role-brief { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 16px; min-height: 0; padding: 14px 0 0; }
.role-copy { background: rgba(247, 249, 250, 0.96); box-shadow: inset 0 0 0 2px var(--ink), var(--shadow); padding: 18px 20px; overflow-y: auto; }
.role-lead { margin: 0 0 16px; font-size: clamp(14px, 1.35vw, 18px); line-height: 1.5; max-width: 68ch; color: #1B252D; }
.role-choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 9px; }
.role-choice {
  display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 9px; align-items: center;
  border: 0; background: #E9EEF0; color: var(--ink); padding: 8px;
  box-shadow: inset 0 0 0 2px rgba(14, 17, 22, 0.28); text-align: left; position: relative;
}
.role-choice svg { width: 44px; height: 36px; display: block; background: #D6DEE2; padding: 3px; }
.role-choice b { display: block; font-family: var(--display); font-size: 12px; letter-spacing: 0.04em; line-height: 1.05; }
.role-choice span { display: block; font-family: var(--num); font-size: 9px; letter-spacing: 0.07em; color: #4C575E; margin-top: 3px; }
.role-choice::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: var(--yellow); }
.role-choice.active { background: var(--paper); box-shadow: inset 0 0 0 2px var(--ink); }
.role-choice.active::after { height: 5px; }
.role-side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.role-keys-plate { background: var(--paper); }
.role-key-list { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; padding: 9px 10px 11px; }
.role-key-list div { display: flex; align-items: center; gap: 6px; font-size: 10px; line-height: 1.15; }
.role-key-list kbd { flex: 0 0 auto; }
.role-side-note { font-size: 11px; line-height: 1.4; color: #33414A; background: rgba(247, 249, 250, 0.78); padding: 9px 11px; box-shadow: inset 0 0 0 1px rgba(14,17,22,0.2); }

.role-hud { position: absolute; inset: 0; z-index: 10; pointer-events: none; }
.rh-top {
  position: absolute; top: 0; left: 0; right: 0; min-height: 34px;
  display: flex; align-items: center; gap: 10px; padding: 0 12px;
  background: var(--blue); color: var(--paper); border-bottom: 3px solid var(--ink);
  font-family: var(--num); font-size: 11px; letter-spacing: 0.06em; z-index: 6;
}
.rh-top b { font-family: var(--display); font-size: 12px; letter-spacing: 0.06em; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rh-top .rh-tag { background: var(--ink); padding: 3px 7px; font-size: 9px; letter-spacing: 0.12em; }
.rh-top .rh-time { margin-left: auto; background: var(--yellow); color: var(--ink); padding: 3px 8px; font-weight: 700; }
.rh-top #rhMenu { pointer-events: auto; }

.rh-panel {
  position: absolute; top: 44px; background: rgba(247, 249, 250, 0.96);
  box-shadow: inset 0 0 0 2px var(--ink), var(--shadow); padding: 0;
  min-width: 210px; max-width: 260px; z-index: 7; font-family: var(--num); font-size: 10px; letter-spacing: 0.05em;
}
.rh-panel:empty { display: none; }
.rh-left { left: 12px; }
.rh-right { right: 12px; }
.rh-panel .rh-head { background: var(--blue); color: var(--paper); font-family: var(--display); font-weight: 700; font-size: 9px; letter-spacing: 0.13em; padding: 5px 9px; display: flex; justify-content: space-between; gap: 8px; }
.rh-panel .rh-body { padding: 7px 9px 9px; display: grid; gap: 4px; }
.rh-panel .rh-row { display: flex; justify-content: space-between; gap: 10px; font-size: 10px; color: #38444C; }
.rh-panel .rh-row b { color: var(--ink); font-family: var(--num); font-weight: 700; }
.rh-panel .rh-row.on b { color: var(--blue); }
.rh-panel .rh-lead { font-family: var(--text); font-size: 11px; line-height: 1.35; color: #26313A; }
.rh-check { display: flex; gap: 7px; align-items: center; font-size: 10px; color: #5B666D; }
.rh-check i { width: 9px; height: 9px; background: #C9D1D5; box-shadow: inset 0 0 0 1px var(--ink); display: inline-block; }
.rh-check.done { color: var(--ink); }
.rh-check.done i { background: var(--green); }
.rh-bar { height: 7px; background: #D8DEE1; box-shadow: inset 0 0 0 1px rgba(14,17,22,0.25); }
.rh-bar u { display: block; height: 100%; width: 0; background: var(--yellow); }
.rh-radar { display: block; width: 100%; height: auto; background: #0E2946; }

.rh-hint {
  position: absolute; left: 50%; bottom: 86px; transform: translateX(-50%);
  background: var(--ink); color: var(--paper); font-family: var(--num);
  font-size: 10.5px; letter-spacing: 0.07em; padding: 7px 12px;
  box-shadow: inset 0 0 0 2px var(--yellow); z-index: 8; max-width: min(560px, 92vw); text-align: center;
}
.rh-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 9; transition: opacity 120ms linear; }
.rh-flash.on { opacity: 0.85; transition: none; }

.rh-photos { position: absolute; left: 12px; bottom: 12px; display: flex; gap: 5px; z-index: 8; }
.rh-photos img { width: 74px; height: 46px; object-fit: cover; box-shadow: inset 0 0 0 2px var(--ink), var(--shadow); background: #0E2946; }

.rh-touch { position: absolute; inset: 0; z-index: 12; pointer-events: none; }
.rh-touch .rt-left, .rh-touch .rt-right, .rh-touch .rt-actions { position: absolute; display: flex; gap: 8px; pointer-events: auto; }
.rh-touch .rt-left { left: 14px; bottom: 16px; }
.rh-touch .rt-right { right: 14px; bottom: 16px; }
.rh-touch .rt-actions { right: 14px; top: 44px; flex-wrap: wrap; justify-content: flex-end; max-width: 60vw; }
.rt-btn {
  pointer-events: auto; border: 0; background: var(--paper); color: var(--ink);
  box-shadow: inset 0 0 0 2px var(--ink), var(--shadow);
  font-family: var(--display); font-weight: 700; font-size: 11px; letter-spacing: 0.06em;
  min-width: 54px; height: 54px; padding: 0 10px; display: grid; place-items: center;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%);
}
.rt-btn.big { min-width: 74px; height: 64px; background: var(--yellow); }
.rt-btn.go { background: var(--orange); color: var(--paper); }
.rt-btn:active { transform: translate(2px, 2px); box-shadow: inset 0 0 0 2px var(--ink); }
.rh-touch:empty { display: none; }

.roledone-screen { align-items: center; justify-content: center; background: rgba(14, 17, 22, 0.32); }

@media (max-width: 900px) {
  .role-brief { grid-template-columns: minmax(0, 1fr); overflow-y: auto; }
  .role-side { flex-direction: row; flex-wrap: wrap; align-items: flex-start; }
  .role-keys-plate { flex: 1 1 260px; }
  .rh-panel { max-width: 200px; min-width: 0; }
  .rh-panel .rh-row { font-size: 9px; }
  .rh-hint { bottom: 140px; }
  body:not(.touch) .rh-touch { display: none; }
}
@media (max-width: 560px) {
  .rh-panel { display: none; }
  .rh-top b { display: none; }
  .rh-hint { bottom: 92px; font-size: 9px; }
  .rh-photos img { width: 58px; height: 36px; }
}
@media (orientation: landscape) and (max-height: 560px) {
  .rh-panel { top: 40px; }
  .rh-hint { bottom: 74px; }
  .rh-touch .rt-left { bottom: 10px; left: 10px; }
  .rh-touch .rt-right { bottom: 10px; right: 10px; }
}
.role-plan-head { grid-column: 1 / -1; font-family: var(--display); font-weight: 700; font-size: 10px; letter-spacing: 0.14em; color: var(--blue); }
.role-choice.static { cursor: default; }
.role-choice.static:hover { background: #E9EEF0; }
body:not(.touch) .rh-touch { display: none; }
body.touch .rh-photos { bottom: 92px; }
