/* ============================================================
   Skyline Courier — interface styling
   ============================================================ */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --ink:        #e9f1f7;
  --ink-dim:    #8fa3b4;
  --panel:      rgba(11, 18, 28, 0.62);
  --panel-line: rgba(150, 200, 240, 0.16);
  --accent:     #45e0c0;
  --accent-2:   #ffc857;
  --bad:        #ff6b5e;
  --font: "Inter", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "SF Mono", ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;
}

html, body {
  height: 100%;
  background: #05080e;
  color: var(--ink);
  font-family: var(--font);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

#app { position: fixed; inset: 0; }

canvas#game { display: block; width: 100%; height: 100%; touch-action: none; }

.hidden { display: none !important; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---------------- HUD ---------------- */

#hud {
  position: absolute; inset: 0;
  pointer-events: none;
  padding: 18px 20px;
  display: flex; flex-direction: column; justify-content: space-between;
}

.hud-top, .hud-bottom { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.hud-bottom { align-items: flex-end; }

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 12px;
  padding: 9px 13px;
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  min-width: 118px;
}

.panel .label {
  font-size: 9.5px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--ink-dim); margin-bottom: 3px;
}
.panel .value { font-size: 15px; font-weight: 600; line-height: 1.25; }
.panel .sub   { font-size: 11px; color: var(--ink-dim); margin-top: 2px; }

.objective { max-width: 340px; }
.objective .value { color: var(--accent); }
.timer { text-align: right; }

.gauges { min-width: 210px; display: flex; flex-direction: column; gap: 8px; }
.gauge-head {
  display: flex; justify-content: space-between;
  font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-dim); margin-bottom: 4px;
}
.bar {
  height: 7px; border-radius: 4px; overflow: hidden;
  background: rgba(255,255,255,.10);
}
.fill { display: block; height: 100%; width: 100%; border-radius: 4px; transition: width .12s linear, background .3s; }
.fill.batt { background: linear-gradient(90deg, #2fd6a8, #7ef0c4); }
.fill.hull { background: linear-gradient(90deg, #5aa9ff, #a9d4ff); }
.fill.low  { background: linear-gradient(90deg, #ff5f52, #ff9d6e); }

.readout { text-align: right; min-width: 150px; }
.readout .row {
  display: flex; justify-content: space-between; gap: 16px;
  font-size: 11px; color: var(--ink-dim); line-height: 1.7;
  letter-spacing: .08em;
}
.readout .row b { color: var(--ink); font-weight: 600; }
.readout .cargo b { color: var(--ink-dim); }
.readout .cargo.loaded b { color: var(--accent-2); }

.toast {
  position: absolute; left: 50%; top: 22%;
  transform: translate(-50%, -8px);
  font-size: 22px; font-weight: 700; letter-spacing: .01em;
  text-shadow: 0 3px 18px rgba(0,0,0,.7);
  opacity: 0; transition: opacity .25s, transform .25s;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.good { color: var(--accent); }
.toast.warn { color: var(--accent-2); }
.toast.bad  { color: var(--bad); }

.warn {
  position: absolute; left: 50%; top: 12%; transform: translateX(-50%);
  color: var(--bad); font-weight: 700; letter-spacing: .22em; font-size: 13px;
  animation: blink 1s steps(2, end) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ---------------- Overlays ---------------- */

.overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 40%, rgba(6,12,22,.72), rgba(3,6,12,.94));
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  padding: 24px;
  z-index: 5;
}

.sheet {
  width: min(860px, 100%);
  max-height: 100%;
  overflow-y: auto;
  background: rgba(10, 16, 26, .84);
  border: 1px solid var(--panel-line);
  border-radius: 20px;
  padding: 30px 34px 26px;
  box-shadow: 0 30px 90px rgba(0,0,0,.6);
  text-align: center;
  animation: rise .28s cubic-bezier(.2,.9,.3,1);
}
.sheet.narrow { width: min(430px, 100%); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

h1 {
  font-size: 44px; font-weight: 800; letter-spacing: -.02em; line-height: 1;
  margin-bottom: 8px;
}
h1 span { color: var(--accent); }
h1 span::before { content: " "; }
h2 { font-size: 25px; font-weight: 700; letter-spacing: -.01em; margin-bottom: 10px; }

.tag { color: var(--ink-dim); font-size: 13.5px; line-height: 1.55; margin-bottom: 20px; }

.eyebrow {
  font-size: 10px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--ink-dim); margin-bottom: 6px;
}
.eyebrow.good { color: var(--accent); }
.eyebrow.bad  { color: var(--bad); }

/* level cards */
.level-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 11px; margin-bottom: 22px; text-align: left;
}
.card {
  background: rgba(255,255,255,.045);
  border: 1px solid var(--panel-line);
  border-radius: 13px; padding: 13px 14px;
  cursor: pointer; transition: transform .14s, border-color .14s, background .14s;
  position: relative;
}
.card:hover:not(.locked) { transform: translateY(-3px); border-color: rgba(69,224,192,.55); background: rgba(69,224,192,.09); }
.card.locked { opacity: .38; cursor: not-allowed; }
.card .num { font-size: 10px; letter-spacing: .18em; color: var(--ink-dim); text-transform: uppercase; }
.card .nm  { font-size: 14.5px; font-weight: 650; margin: 3px 0 6px; }
.card .meta{ font-size: 11px; color: var(--ink-dim); font-family: var(--mono); }
.card .cstars { color: var(--accent-2); font-size: 12px; letter-spacing: 2px; height: 14px; }

.controls-hint {
  display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: center;
  font-size: 11.5px; color: var(--ink-dim);
  border-top: 1px solid var(--panel-line); padding-top: 16px;
}
kbd {
  display: inline-block; font-family: var(--mono); font-size: 10px;
  background: rgba(255,255,255,.09); border: 1px solid var(--panel-line);
  border-bottom-width: 2px; border-radius: 5px; padding: 2px 6px; margin-right: 3px;
  color: var(--ink);
}

.brief-stats { list-style: none; margin-bottom: 22px; text-align: left; }
.brief-stats li {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 8px 2px; border-bottom: 1px solid rgba(255,255,255,.07);
  font-size: 12.5px; color: var(--ink-dim);
}
.brief-stats li b { color: var(--ink); font-weight: 600; font-family: var(--mono); }
.brief-stats li.total { border-bottom: none; font-size: 14px; padding-top: 12px; }
.brief-stats li.total b { color: var(--accent); font-size: 17px; }

.stars { font-size: 30px; letter-spacing: 8px; color: var(--accent-2); margin-bottom: 16px; height: 38px; }
.stars .off { color: rgba(255,255,255,.14); }

.btn {
  display: block; width: 100%; margin-top: 9px;
  padding: 11px 18px; border-radius: 11px; border: 1px solid var(--panel-line);
  background: rgba(255,255,255,.07); color: var(--ink);
  font-family: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer;
  transition: background .14s, transform .1s, border-color .14s;
}
.btn:hover { background: rgba(255,255,255,.13); }
.btn:active { transform: scale(.985); }
.btn.primary {
  background: var(--accent); color: #04211c; border-color: transparent;
}
.btn.primary:hover { background: #6ff0d6; }
.btn.ghost { background: none; color: var(--ink-dim); border-color: transparent; }
.btn.ghost:hover { color: var(--ink); background: rgba(255,255,255,.06); }

/* ---------------- touch ---------------- */
#touch { position: absolute; inset: auto 0 0 0; height: 130px; z-index: 3; pointer-events: none; }
.tbtn {
  position: absolute; bottom: 18px;
  width: 74px; height: 74px; border-radius: 50%;
  background: rgba(255,255,255,.10); border: 1px solid var(--panel-line);
  color: var(--ink); font-size: 20px; font-family: inherit;
  pointer-events: auto; user-select: none; -webkit-user-select: none;
  backdrop-filter: blur(6px);
}
.tbtn:active { background: rgba(69,224,192,.35); }
.tbtn[data-key="left"]  { left: 20px; }
.tbtn[data-key="right"] { left: 108px; }
.tbtn.thrust { right: 20px; width: 96px; height: 96px; font-size: 12px; letter-spacing: .1em; font-weight: 700; }

@media (max-width: 620px) {
  h1 { font-size: 33px; }
  .sheet { padding: 22px 20px; border-radius: 16px; }
  .panel { min-width: 0; padding: 7px 10px; }
  .gauges { min-width: 150px; }
  .objective { max-width: 190px; }
  .objective .value { font-size: 13px; }
  .objective .sub, .readout .row { font-size: 10px; }

  /* Keep the bottom panels clear of the thumb controls. */
  #hud { padding: 14px 14px 132px; }
  .tbtn { width: 64px; height: 64px; bottom: 16px; }
  .tbtn[data-key="left"] { left: 16px; }
  .tbtn[data-key="right"] { left: 92px; }
  .tbtn.thrust { right: 16px; width: 84px; height: 84px; font-size: 11px; }
}
