/* Flarelight - css/game.css
 * Visual identity: a survey vessel's instrument suite. Machine readouts are set
 * in a monospaced utility face; the ship's log is set in a serif, because a
 * person writes it. Amber phosphor for state, signal cyan for anything you can
 * act on, and nothing else competes.
 */

:root {
  --hull: #080d14;
  --panel: #121b25;
  --panel-2: #18242f;
  --rule: #2b3b4a;
  --amber: #ffb547;
  --amber-dim: #a2703a;
  --cyan: #6fd8de;
  --cyan-dim: #3d7f84;
  --alert: #e05353;
  --bone: #d7dde3;
  --muted: #7d8b98;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", "Consolas", "Liberation Mono", monospace;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --notch: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
}

/* An author rule that sets display beats the browser's own [hidden] rule, so
   the attribute is made authoritative here. */
[hidden] { display: none !important; }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--hull);
  color: var(--bone);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.45;
}

body {
  background-image:
    radial-gradient(circle at 18% 8%, rgba(111, 216, 222, 0.06), transparent 45%),
    radial-gradient(circle at 82% 92%, rgba(255, 181, 71, 0.05), transparent 40%);
}

.app {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  max-width: 1500px;
  margin: 0 auto;
  padding: 10px;
  gap: 10px;
}

/* ------------------------------------------------------------- top bar */

.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--rule);
  clip-path: var(--notch);
  padding: 8px 14px;
}

.brand { display: flex; align-items: center; gap: 10px; }

.brand-mark {
  width: 16px; height: 16px;
  border: 2px solid var(--amber);
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(255, 181, 71, 0.55), inset 0 0 6px rgba(255, 181, 71, 0.4);
}

.brand-name {
  font-weight: 700;
  letter-spacing: 0.42em;
  color: var(--amber);
  font-size: 15px;
}

.gauges {
  display: flex;
  flex: 1 1 auto;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
}

.gauge { min-width: 74px; }
.gauge .k {
  display: block;
  font-size: 9.5px;
  letter-spacing: 0.2em;
  color: var(--muted);
  text-transform: uppercase;
}
.gauge .v { display: block; font-size: 15px; color: var(--bone); }
.gauge .v.warn { color: var(--amber); }
.gauge .v.bad { color: var(--alert); }

/* the flare index: the one piece of ornament in the interface, and it is a
   readout, not decoration */
.flare-arc { display: flex; align-items: center; gap: 8px; }
.flare-arc svg { display: block; }

.topbtns { display: flex; gap: 6px; }

button {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--cyan);
  background: #10202a;
  border: 1px solid var(--cyan-dim);
  padding: 6px 10px;
  cursor: pointer;
  transition: background 120ms linear, color 120ms linear;
}
button:hover:not(:disabled) { background: #17323d; color: #b8f3f6; }
button:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
button:disabled { color: #4b5a66; border-color: #2b3b4a; cursor: not-allowed; }
button.mini { padding: 4px 8px; font-size: 11px; }
button.primary { color: var(--amber); border-color: var(--amber-dim); background: #241a0e; }
button.primary:hover:not(:disabled) { background: #382713; color: #ffd28f; }
button.danger { color: var(--alert); border-color: #7a2f2f; background: #2a1212; }

/* -------------------------------------------------------------- frame */

.frame {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr) 280px;
  gap: 10px;
  align-items: start;
}

.col {
  background: var(--panel);
  border: 1px solid var(--rule);
  clip-path: var(--notch);
  padding: 10px 12px 14px;
  min-height: 200px;
}

.col-mid { padding-bottom: 10px; }

.panel-title {
  margin: 4px 0 8px;
  font-size: 10px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--amber-dim);
  border-bottom: 1px solid var(--rule);
  padding-bottom: 5px;
  font-weight: 600;
}

/* --------------------------------------------------------------- crew */

.crew-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 6px;
  padding: 5px 0;
  border-bottom: 1px dotted #22303c;
}
.crew-post {
  font-size: 9.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  grid-column: 1 / -1;
}
.crew-name { color: var(--bone); }
.crew-skill { color: var(--amber); }
.crew-name.hurt { color: var(--alert); }

.hold-list { font-size: 12.5px; }
.hold-row { display: flex; justify-content: space-between; padding: 2px 0; color: var(--muted); }
.hold-row b { color: var(--bone); font-weight: 400; }
.hold-empty { color: #56636e; font-style: italic; }

/* ----------------------------------------------------------- viewport */

.viewport-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 6px;
  margin-bottom: 8px;
}
.view-name {
  font-size: 13px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--amber);
}
.view-sub { font-size: 11.5px; color: var(--muted); }

.canvas-wrap {
  position: relative;
  background: #050a10;
  border: 1px solid var(--rule);
  overflow: hidden;
}
.canvas-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    180deg, rgba(255, 255, 255, 0.022) 0 1px, transparent 1px 3px);
}
#screen { display: block; width: 100%; height: auto; cursor: crosshair; }

.canvas-hint {
  position: absolute;
  left: 8px;
  bottom: 8px;
  font-size: 11px;
  color: var(--cyan);
  background: rgba(5, 10, 16, 0.82);
  border: 1px solid var(--cyan-dim);
  padding: 3px 7px;
  pointer-events: none;
  max-width: 70%;
}

.message {
  margin-top: 8px;
  min-height: 20px;
  color: var(--amber);
  font-size: 13px;
}
.message.bad { color: var(--alert); }

.log {
  margin-top: 6px;
  max-height: 132px;
  overflow-y: auto;
  border-top: 1px solid var(--rule);
  padding-top: 6px;
  font-family: var(--serif);
  font-size: 14px;
  line-height: 1.5;
  color: #b9c4ce;
}
.log p { margin: 0 0 5px; }
.log .stamp {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--amber-dim);
  margin-right: 7px;
}

/* ------------------------------------------------------------ actions */

.actions { display: flex; flex-direction: column; gap: 6px; }
.actions button { text-align: left; width: 100%; }
.actions .group {
  margin-top: 8px;
  font-size: 9.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--rule);
  padding-bottom: 3px;
}

.detail { margin-top: 12px; font-size: 12.5px; }
.detail h4 {
  margin: 10px 0 5px;
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--amber-dim);
}
.detail .kv { display: flex; justify-content: space-between; gap: 8px; padding: 1px 0; }
.detail .kv span:first-child { color: var(--muted); }
.detail p { margin: 6px 0; font-family: var(--serif); font-size: 13.5px; color: #b9c4ce; }
.bar {
  height: 6px;
  background: #0d1720;
  border: 1px solid var(--rule);
  margin: 3px 0 7px;
}
.bar > i { display: block; height: 100%; background: var(--cyan); }
.bar > i.amber { background: var(--amber); }
.bar > i.alert { background: var(--alert); }

.transcript {
  max-height: 190px;
  overflow-y: auto;
  font-family: var(--serif);
  font-size: 13.5px;
}
.transcript .who {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--amber-dim);
  display: block;
}
.transcript p { margin: 0 0 8px; }

/* -------------------------------------------------------------- modal */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(3, 7, 12, 0.86);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 40;
}
.modal-box {
  background: var(--panel);
  border: 1px solid var(--amber-dim);
  clip-path: var(--notch);
  padding: 20px 24px;
  max-width: 620px;
  width: 100%;
  max-height: 86vh;
  overflow-y: auto;
}
.modal-box h3 {
  margin: 0 0 10px;
  font-size: 13px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--amber);
}
.modal-body { font-family: var(--serif); font-size: 14.5px; color: #c3ccd5; }
.modal-body h4 {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--amber-dim);
  margin: 14px 0 4px;
}
.modal-body ul { margin: 4px 0 4px 18px; padding: 0; }
.modal-body table { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 12px; }
.modal-body td, .modal-body th { text-align: left; padding: 3px 6px; border-bottom: 1px solid var(--rule); }
.modal-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }

.boot-error {
  margin: 40px auto;
  max-width: 640px;
  border: 1px solid var(--alert);
  padding: 18px;
  color: var(--alert);
  font-family: var(--mono);
}

/* --------------------------------------------------------- responsive */

@media (max-width: 1100px) {
  .frame { grid-template-columns: 1fr; }
  .col-left { order: 2; }
  .col-mid { order: 1; }
  .col-right { order: 3; }
  .log { max-height: 110px; }
}

@media (max-width: 640px) {
  html, body { font-size: 13px; }
  .brand-name { letter-spacing: 0.26em; font-size: 13px; }
  .app { padding: 6px; }
  .col { padding: 8px 10px 12px; }
}

@media (prefers-reduced-motion: reduce) {
  button { transition: none; }
  .canvas-wrap::after { display: none; }
}
