/* Mockup: flight plan, flight and debrief screens */
html, body { height: 100%; }
body { display: flex; flex-direction: column; }
.small { font-size: .85rem; }
.pad { padding: 1rem 1.1rem; }

.steps { display: flex; gap: .25rem; }
.steps button {
  border: 0; background: transparent; color: rgba(255, 255, 255, .72); padding: .4rem .75rem; border-radius: 7px; font-weight: 600;
}
.steps button b {
  display: inline-grid; place-items: center; width: 1.35em; height: 1.35em; margin-right: .35em; border-radius: 50%;
  background: rgba(255, 255, 255, .16); font-size: .8em;
}
.steps button:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.steps button.on { color: #fff; background: rgba(255, 255, 255, .16); }
.steps button.on b { background: #fff; color: var(--navy); }

.screen { display: none; flex: 1; min-height: 0; }
.screen.on { display: flex; flex-direction: column; }

.map { width: 100%; height: 100%; background: #e8edf2; }

/* ---------- Flight plan ---------- */
.plan-grid { display: grid; grid-template-columns: minmax(320px, 430px) 1fr; gap: 1rem; padding: 1rem; flex: 1; min-height: 0; }
.plan-side { display: flex; flex-direction: column; gap: 1rem; overflow-y: auto; min-height: 0; padding-bottom: .5rem; }
.plan-main { display: flex; flex-direction: column; gap: 1rem; min-height: 0; }
.plan-map-card { flex: 1; min-height: 320px; overflow: hidden; }
.row-end { display: flex; justify-content: flex-end; margin-top: .6rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem .8rem; margin-bottom: .9rem; }
.hint-line { font-size: .8rem; color: var(--muted); margin-top: .25rem; }
.hint-line.ok { color: var(--ok); }
.hint-line.bad { color: var(--critical); }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .55rem; }
.chip {
  display: inline-flex; align-items: center; gap: .35em; padding: .25em .4em .25em .65em; border-radius: 999px;
  background: var(--me-bg); border: 1px solid var(--me-line); font: 600 .85rem var(--mono);
}
.chip.user { background: #f3eefe; border-color: #dccdfa; }
.chip .ok { color: var(--ok); font-family: var(--sans); }
.chip button { border: 0; background: transparent; color: var(--muted); padding: 0 .25em; font-size: 1rem; line-height: 1; }
.chip button:hover { color: var(--critical); }
.add-point { display: flex; gap: .5rem; }
.add-point input { text-transform: uppercase; font-family: var(--mono); }
.check { display: flex; gap: .55rem; align-items: flex-start; margin-bottom: .55rem; font-size: .92rem; }
.check input { margin-top: .25em; }
.opt-row { display: flex; align-items: center; gap: .75rem; }
.opt-row .field { margin: 0; }
.opt-row select { width: auto; }
textarea { resize: vertical; }
.flash { animation: flash 1.2s ease-out; }
@keyframes flash { 0% { background: #fff4c2; } 100% { background: #fff; } }

.plan-summary { display: flex; flex-direction: column; gap: .7rem; }
.sum-figures { display: flex; gap: 2rem; flex-wrap: wrap; }
.sum-figures div { display: flex; flex-direction: column; }
.sum-figures .k { font-size: .78rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.sum-figures .v { font-size: 1.35rem; font-weight: 700; }
.units-list summary { cursor: pointer; font-weight: 600; }
.units-list ol { margin: .5rem 0 0; padding-left: 1.3rem; columns: 2; column-gap: 2rem; font-size: .9rem; }
.units-list li { break-inside: avoid; }
.units-list .mono { color: var(--muted); }
.btn-big { padding: .75em 1.2em; font-size: 1.05rem; align-self: flex-start; }

/* Waypoint and aircraft markers (HTML markers work with any map style) */
.wpt { display: flex; align-items: center; gap: 5px; pointer-events: none; }
.wpt .dot { width: 10px; height: 10px; border-radius: 2px; background: #fff; border: 2.5px solid var(--accent); transform: rotate(45deg); }
.wpt.airport .dot { width: 14px; height: 14px; border-radius: 50%; border-color: var(--navy); background: #fff; transform: none; }
.wpt.user .dot { border-color: #7c4dda; }
.wpt .lbl {
  font: 700 11px/1 var(--mono); color: var(--navy); background: rgba(255, 255, 255, .88); padding: 2px 4px; border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(14, 36, 64, .12);
}
.aircraft svg { width: 30px; height: 30px; display: block; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .35)); }
.evt-marker { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--atc); background: rgba(255, 246, 234, .7); position: relative; }
.evt-marker::after {
  content: ""; position: absolute; inset: -9px; border-radius: 50%; border: 2px solid var(--atc); opacity: 0;
  animation: ping 1.8s ease-out infinite;
}
@keyframes ping { 0% { transform: scale(.5); opacity: .8; } 100% { transform: scale(1.3); opacity: 0; } }
.evt-label {
  position: absolute; left: 26px; top: -2px; white-space: nowrap; font: 600 11px/1.2 var(--sans); color: var(--atc);
  background: rgba(255, 255, 255, .92); padding: 2px 6px; border-radius: 4px; box-shadow: 0 0 0 1px var(--atc-line);
}

/* ---------- Flight ---------- */
.flightbar {
  display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; padding: .5rem 1rem;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.fb-id { display: flex; flex-direction: column; line-height: 1.15; }
.fb-id span { font-size: .8rem; color: var(--muted); }
.fb-clock { font-size: 1.05rem; font-weight: 700; padding: .2em .55em; background: #f0f3f7; border-radius: 6px; }
.fb-speed { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; }
.fb-speed button { border: 0; background: #fff; padding: .35em .6em; font-weight: 700; font-size: .85rem; border-left: 1px solid var(--line); }
.fb-speed button:first-child { border-left: 0; }
.fb-speed button.on { background: var(--navy); color: #fff; }
.fb-slowed { font-size: .78rem; font-weight: 600; color: var(--atc); background: var(--atc-bg); border: 1px solid var(--atc-line); padding: .15em .5em; border-radius: 999px; visibility: hidden; }
.fb-slowed.show { visibility: visible; }
.flightbar .spacer { flex: 1; }

.flight-grid { display: grid; grid-template-columns: 1fr minmax(340px, 400px); flex: 1; min-height: 0; }
.map-wrap { position: relative; min-height: 0; }
.map-hint {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%); max-width: min(560px, calc(100% - 24px));
  padding: .5rem .85rem; border-radius: 8px; background: rgba(14, 36, 64, .92); color: #fff; font-weight: 600; font-size: .92rem;
  box-shadow: var(--shadow); text-align: center; pointer-events: none; transition: opacity .3s;
}
.map-hint:empty { opacity: 0; }
.status-strip {
  position: absolute; left: 12px; right: 12px; bottom: 26px; display: flex; flex-wrap: wrap; gap: 0;
  background: rgba(255, 255, 255, .95); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); overflow: hidden;
}
.status-strip > div { flex: 1 1 80px; padding: .4rem .7rem; border-left: 1px solid var(--line); display: flex; flex-direction: column; }
.status-strip > div:first-child { border-left: 0; }
.status-strip .k { font-size: .68rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.status-strip .v { font-size: 1rem; font-weight: 700; white-space: nowrap; }
.map-overlay { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(243, 245, 248, .7); z-index: 5; }
.map-overlay .card { max-width: 360px; text-align: center; }

.side { display: flex; flex-direction: column; gap: .75rem; padding: .75rem; min-height: 0; border-left: 1px solid var(--line); background: var(--bg); }
.radio { padding: .8rem .9rem 1rem; background: linear-gradient(180deg, #12263f, #0d1d31); color: #e6edf5; border-color: #0b1a2c; }
.radio-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: .55rem; }
.radio-name { font-weight: 800; letter-spacing: .08em; font-size: .8rem; color: #9fb4cc; }
.radio-listen { font-size: .78rem; color: #9fb4cc; }
.freqs { display: grid; grid-template-columns: 1fr auto 1fr; gap: .5rem; align-items: stretch; }
.freq { background: #06111f; border: 1px solid #23405f; border-radius: 8px; padding: .4rem .6rem; display: flex; flex-direction: column; min-width: 0; }
.freq-label { font-size: .64rem; font-weight: 800; letter-spacing: .1em; color: #6f8aa8; }
.freq-value { font-size: 1.45rem; font-weight: 700; color: #7cf0a4; background: transparent; border: 0; padding: 0; width: 100%; letter-spacing: .02em; }
.freq.standby .freq-value { color: #f5c46b; }
.freq input.freq-value { background: transparent; border: 0; border-radius: 3px; padding: 0; width: 100%; }
.freq.standby input.freq-value:focus { outline: 1px dashed #f5c46b; outline-offset: 2px; }
.freq.standby input.freq-value.bad { color: #ff8a80; }
.freq-name { font-size: .72rem; color: #9fb4cc; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 1.1em; }
.swap { align-self: center; width: 40px; height: 40px; border-radius: 50%; border: 1px solid #2d5076; background: #183454; color: #fff; font-size: 1.15rem; }
.swap:hover { background: #21456d; }

.ptt-area { display: flex; flex-direction: column; align-items: center; gap: .55rem; margin-top: .9rem; }
.ptt {
  position: relative; width: 132px; height: 132px; border-radius: 50%; border: 0; padding: 0; background: transparent;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.ptt-ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: #23405f; stroke-width: 6; }
.ring-fg { fill: none; stroke: #f5c46b; stroke-width: 6; stroke-linecap: round; stroke-dasharray: 339.3; stroke-dashoffset: 339.3; transition: stroke .2s; }
.ring-fg.urgent { stroke: #ff8a80; }
.ptt-inner {
  position: absolute; inset: 12px; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 35%, #2b5785, #183454); border: 1px solid #3a6795; color: #fff;
  box-shadow: 0 4px 0 #08182a, inset 0 1px 0 rgba(255, 255, 255, .15); transition: transform .08s, background .15s, box-shadow .08s;
}
.ptt:hover .ptt-inner { background: radial-gradient(circle at 50% 35%, #326498, #1d3d61); }
.ptt.tx .ptt-inner { background: radial-gradient(circle at 50% 35%, #ef5a4c, #b3261e); border-color: #ff8a80; transform: translateY(3px); box-shadow: 0 1px 0 #08182a; }
.ptt.busy .ptt-inner { background: radial-gradient(circle at 50% 35%, #3b4d63, #26364a); border-color: #44586f; color: #9fb4cc; }
.ptt-icon { font-size: 1.4rem; line-height: 1; }
.ptt-label { font-weight: 800; font-size: .92rem; margin-top: .2rem; }
.ptt-sub { font-size: .7rem; color: #b9cbe0; }
.ptt.tx .ptt-sub { color: #ffe1dd; }
.radio-status { min-height: 2.6em; text-align: center; font-size: .86rem; color: #dbe6f2; max-width: 300px; }
.radio-status b { color: #f5c46b; }
.meter { display: flex; gap: 3px; height: 14px; align-items: flex-end; opacity: 0; transition: opacity .2s; }
.meter.on { opacity: 1; }
.meter i { width: 5px; background: #7cf0a4; border-radius: 2px; height: 3px; }

.log-card { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.log-head { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; padding: .7rem .9rem .4rem; border-bottom: 1px solid var(--line); }
.log-head h2 { margin: 0; font-size: 1rem; }
.log { list-style: none; margin: 0; padding: .5rem .6rem .8rem; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: .45rem; }
.entry { border-radius: 8px; padding: .45rem .6rem; border: 1px solid var(--line); background: #fff; font-size: .9rem; animation: enter .25s ease-out; }
@keyframes enter { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.entry .who { display: flex; align-items: center; gap: .45rem; font-size: .76rem; font-weight: 700; color: var(--muted); margin-bottom: .15rem; flex-wrap: wrap; }
.entry .who time { margin-left: auto; font-weight: 500; font-family: var(--mono); }
.entry.atc { background: var(--atc-bg); border-color: var(--atc-line); }
.entry.atc .who { color: var(--atc); }
.entry.atc.unheard { opacity: .6; }
.entry.me { background: var(--me-bg); border-color: var(--me-line); cursor: pointer; }
.entry.me .who { color: var(--me); }
.entry.sys { background: transparent; border-style: dashed; color: var(--muted); font-size: .84rem; }
.entry .heard { font-size: .72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-right: .3em; }
.tune {
  display: inline-block; font: 700 .86em var(--mono); padding: 0 .35em; border-radius: 4px; border: 1px solid var(--atc-line);
  background: #fff; color: var(--atc); cursor: pointer;
}
.tune:hover { background: var(--atc); color: #fff; }
.badge { display: inline-block; padding: .05em .5em; border-radius: 999px; font-size: .72rem; font-weight: 700; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.minor { background: var(--minor-bg); color: var(--minor); }
.badge.major { background: var(--major-bg); color: var(--major); }
.badge.critical { background: var(--critical-bg); color: var(--critical); }
.issues { display: none; margin-top: .45rem; border-top: 1px solid var(--me-line); padding-top: .45rem; }
.entry.open .issues { display: block; }
.issue { margin-bottom: .5rem; font-size: .85rem; }
.issue:last-child { margin-bottom: 0; }
.issue .cat { font-weight: 700; }
.issue .said, .issue .correct { display: block; font-family: var(--mono); font-size: .8rem; padding: .2rem .4rem; border-radius: 4px; margin: .2rem 0; }
.issue .said { background: var(--critical-bg); }
.issue .correct { background: var(--ok-bg); }
.issue .why { color: var(--muted); }
.entry.me .expand-hint { font-size: .72rem; color: var(--me); font-weight: 600; }
.entry.open .expand-hint { display: none; }

/* ---------- Debrief ---------- */
.debrief { width: 100%; max-width: 1080px; margin: 0 auto; padding: 1rem; display: flex; flex-direction: column; gap: 1rem; overflow-y: auto; }
#screen-debrief { overflow-y: auto; }
.db-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.db-head h1 { margin-bottom: .2rem; }
.db-head p { margin: 0; }
.score-big { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 110px; height: 110px; border-radius: 50%; border: 8px solid var(--accent); }
.score-big span { font-size: 2.2rem; font-weight: 800; line-height: 1; }
.score-big small { font-size: .72rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.db-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 1rem; }
.cats { display: flex; flex-direction: column; gap: .55rem; }
.cat-row { display: grid; grid-template-columns: 150px 1fr 40px; align-items: center; gap: .6rem; font-size: .9rem; }
.cat-row .bar { height: 10px; border-radius: 999px; background: #e8edf3; overflow: hidden; }
.cat-row .bar i { display: block; height: 100%; border-radius: 999px; background: var(--ok); transition: width .5s; }
.cat-row .bar i.mid { background: #d49a06; }
.cat-row .bar i.low { background: var(--critical); }
.cat-row .n { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.top3 { margin: 0; padding-left: 1.2rem; display: flex; flex-direction: column; gap: .6rem; }
.top3 li b { display: block; }
.top3 li span { color: var(--muted); font-size: .88rem; }
.timeline { display: flex; flex-direction: column; gap: .9rem; }
.tl-group { border-left: 3px solid var(--line); padding-left: .9rem; }
.tl-unit { font-size: .78rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: .35rem; }
.tl-line { display: flex; gap: .6rem; align-items: flex-start; margin-bottom: .35rem; font-size: .92rem; }
.tl-line .tl-who { flex: 0 0 52px; font-size: .75rem; font-weight: 700; padding-top: .1rem; }
.tl-line.atc .tl-who { color: var(--atc); }
.tl-line.me .tl-who { color: var(--me); }
.tl-line .tl-text { flex: 1; }
.play { border: 1px solid var(--me-line); background: var(--me-bg); color: var(--me); border-radius: 999px; padding: 0 .55em; font-size: .78rem; font-weight: 700; }
.tl-issue { margin: .25rem 0 .55rem 3.6rem; padding: .5rem .65rem; border-radius: 8px; background: #fafbfc; border: 1px solid var(--line); font-size: .86rem; }
.tl-issue.excluded { opacity: .45; text-decoration: line-through; }
.tl-issue .row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-bottom: .2rem; }
.tl-issue .said, .tl-issue .correct { display: block; font-family: var(--mono); font-size: .8rem; padding: .2rem .4rem; border-radius: 4px; margin: .2rem 0; }
.tl-issue .said { background: var(--critical-bg); }
.tl-issue .correct { background: var(--ok-bg); }
.tl-issue .why { color: var(--muted); }
.notsaid { margin-left: auto; border: 0; background: transparent; color: var(--accent); font-size: .78rem; font-weight: 600; text-decoration: underline; }

/* ---------- Narrow screens ---------- */
@media (max-width: 980px) {
  /* One scrolling column: grid rows take their content's height */
  .plan-grid, .flight-grid { flex: none; }
  .plan-side, .plan-main, .side { min-height: auto; }
  .plan-grid { grid-template-columns: 1fr; }
  .plan-side { overflow: visible; }
  .plan-map-card { min-height: 300px; height: 300px; flex: none; }
  .screen.on { overflow-y: auto; }
  .flight-grid { grid-template-columns: 1fr; }
  .map-wrap { height: 52vh; min-height: 320px; }
  .side { border-left: 0; }
  .log-card { min-height: 320px; }
  .db-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .topbar { gap: .5rem; }
  .steps button { padding: .35rem .45rem; font-size: .85rem; }
  .topbar .pill { display: none; }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .units-list ol { columns: 1; }
  .flightbar { gap: .5rem; padding: .5rem .75rem; }
  .fb-id span { display: none; }
  .status-strip > div { flex-basis: 25%; padding: .3rem .5rem; }
  .status-strip .v { font-size: .9rem; }
  .cat-row { grid-template-columns: 110px 1fr 36px; }
  .tl-issue { margin-left: 0; }
  .db-head { flex-direction: column-reverse; align-items: flex-start; }
}
