/* petd — ops-equipment handheld, amber phosphor LCD */
:root {
  --room: #0c0d10;
  --chassis: #1b1e24;
  --chassis-hi: #262a32;
  --chassis-lo: #101216;
  --silk: #79818e;
  --lcd-bg: #1a130c;
  --lcd-dim: #4a3419;
  --amber: #ffb454;
  --amber-hi: #ffd9a0;
  --ok: #7dd58a;
  --warn: #ff5d5d;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--room);
  background-image:
    radial-gradient(ellipse 80% 60% at 50% 30%, #14161c 0%, var(--room) 70%),
    repeating-linear-gradient(0deg, transparent 0 31px, #ffffff05 31px 32px),
    repeating-linear-gradient(90deg, transparent 0 31px, #ffffff05 31px 32px);
  color: var(--silk);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 4vh 16px 8vh;
}

.room {
  display: flex;
  gap: 40px;
  align-items: flex-start;
  flex-wrap: wrap;
  justify-content: center;
}

/* ---------------- the device ---------------- */
.device {
  width: 380px;
  background: linear-gradient(160deg, var(--chassis-hi), var(--chassis) 30%, var(--chassis-lo));
  border-radius: 26px;
  padding: 18px 22px 20px;
  box-shadow:
    0 30px 60px #000c,
    inset 0 1px 0 #ffffff14,
    inset 0 -2px 0 #0008;
  border: 1px solid #000;
}

.device-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.brand {
  font-family: "Silkscreen", monospace;
  font-size: 13px;
  letter-spacing: 2px;
  color: var(--silk);
}

.leds { display: flex; gap: 8px; }
.led {
  width: 8px; height: 8px; border-radius: 50%;
  background: #333; display: inline-block;
  box-shadow: inset 0 1px 2px #000;
}
.led.on-ok  { background: var(--ok);   box-shadow: 0 0 6px var(--ok); }
.led.on-warn{ background: var(--warn); box-shadow: 0 0 6px var(--warn); animation: blinkled 1.2s steps(2) infinite; }
@keyframes blinkled { 50% { opacity: .35; } }

.bezel {
  background: #0a0b0d;
  border-radius: 14px;
  padding: 10px;
  box-shadow: inset 0 2px 8px #000, inset 0 -1px 0 #ffffff0a;
}

.screen {
  position: relative;
  background: var(--lcd-bg);
  border-radius: 6px;
  padding: 8px 10px 6px;
  overflow: hidden;
  box-shadow: inset 0 0 24px #000a;
}
.screen.lights-off { filter: brightness(.55) saturate(.8); }

.scanlines {
  position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, #0000 0 2px, #00000022 2px 3px);
  mix-blend-mode: multiply;
}

.lcd-row {
  display: flex; justify-content: space-between;
  font-family: "VT323", monospace;
  color: var(--amber);
  text-shadow: 0 0 6px #ffb45444;
}
.lcd-head { font-size: 18px; letter-spacing: 1px; }

#lcd {
  display: block;
  width: 100%;
  image-rendering: pixelated;
  margin: 2px 0;
}

.lcd-bars { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 14px; margin: 2px 0 4px; }
.bar { display: flex; align-items: center; gap: 6px; }
.bar label {
  font-family: "VT323", monospace; font-size: 14px;
  color: var(--lcd-dim); width: 34px;
}
.segs { display: flex; gap: 2px; flex: 1; }
.seg {
  height: 8px; flex: 1; background: #2a1e10; border-radius: 1px;
}
.seg.lit { background: var(--amber); box-shadow: 0 0 4px #ffb45455; }
.seg.lit.low { background: var(--warn); box-shadow: 0 0 4px #ff5d5d55; }

.lcd-ticker {
  font-family: "VT323", monospace;
  font-size: 15px;
  color: var(--lcd-dim);
  white-space: nowrap;
  overflow: hidden;
  border-top: 1px solid #ffffff0d;
  padding-top: 3px;
}
#ticker { display: inline-block; padding-left: 100%; animation: tick 22s linear infinite; }
@keyframes tick { to { transform: translateX(-100%); } }

.lcd-overlay[hidden] { display: none; }
.lcd-overlay {
  position: absolute; inset: 0;
  background: #1a130cf2;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 10px;
  font-family: "VT323", monospace;
  color: var(--amber); font-size: 20px;
  z-index: 2; text-align: center; padding: 10px;
}
.lcd-overlay button {
  font-family: "VT323", monospace; font-size: 20px;
  background: none; border: 1px solid var(--amber);
  color: var(--amber); padding: 4px 14px; border-radius: 4px;
  cursor: pointer;
}
.lcd-overlay button:hover { background: #ffb45422; }
.lcd-overlay .row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

.msgline {
  font-family: "VT323", monospace;
  font-size: 17px;
  color: var(--amber);
  min-height: 22px;
  text-align: center;
  margin: 10px 0 6px;
  opacity: .9;
}

/* ---------------- buttons ---------------- */
.controls { display: flex; gap: 12px; justify-content: center; margin-top: 6px; }
.controls.minor { margin-top: 10px; }

.key {
  flex: 1; max-width: 84px;
  padding: 0; border: none; cursor: pointer;
  background: linear-gradient(180deg, #2e333c, #21252c 40%, #181b20);
  border-radius: 10px;
  box-shadow: 0 4px 0 #0b0c0f, inset 0 1px 0 #ffffff1c;
  transition: transform .05s, box-shadow .05s;
}
.key:active { transform: translateY(3px); box-shadow: 0 1px 0 #0b0c0f, inset 0 1px 0 #ffffff10; }
.key .cap {
  display: block; padding: 11px 0 10px;
  font-family: "Silkscreen", monospace;
  font-size: 10px; letter-spacing: 1px;
  color: #aeb6c2;
}
.key.small { max-width: 70px; }
.key.small .cap { padding: 7px 0 6px; font-size: 9px; }
.key.ctx { background: linear-gradient(180deg, #4a3220, #38251a 40%, #241812); }
.key.ctx .cap { color: var(--amber); }

.device-foot {
  display: flex; justify-content: space-between;
  margin-top: 16px;
}
.silk { font-size: 10px; letter-spacing: .5px; color: #565d68; }

/* ---------------- side panel ---------------- */
.panel {
  width: 320px;
  padding-top: 8px;
}
.panel h2 {
  font-family: "Silkscreen", monospace;
  font-size: 11px; letter-spacing: 2px;
  color: #565d68; font-weight: 400;
  border-bottom: 1px solid #ffffff12;
  padding-bottom: 8px;
}
#carelog { list-style: none; padding: 0; margin: 0; font-size: 12px; }
#carelog li {
  padding: 5px 0; border-bottom: 1px solid #ffffff08;
  display: flex; gap: 10px;
}
#carelog .t { color: #4a505a; flex-shrink: 0; }
#graveyard-box { margin-top: 18px; font-size: 12px; }
#graveyard-box summary {
  cursor: pointer; color: #565d68;
  font-family: "Silkscreen", monospace; font-size: 10px; letter-spacing: 1px;
}
#graveyard { list-style: none; padding: 8px 0 0; margin: 0; }
#graveyard li { padding: 4px 0; color: #6b7280; }
#graveyard li::before { content: "✝ "; color: #4a505a; }

@media (max-width: 800px) {
  .room { gap: 24px; }
  .panel { width: 380px; max-width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  #ticker, .led.on-warn { animation: none; }
}
