/* The Terminal style's live screen, after the app's terminal_cards.dart and terminal_parts.dart. */
.tm { font-family: 'PixelifySans', monospace; line-height: 1.15; }

/* The screen: scanlines and a darker rim (dark), green-bar paper (light). */
:root[data-style="terminal"][data-mode="dark"] body::after { content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 30;
  background: repeating-linear-gradient(0deg, #00000026 0 1px, transparent 1px 3px),
    radial-gradient(85% 85% at 50% 50%, transparent 70%, #00000066); }
:root[data-style="terminal"][data-mode="light"] body::after { content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 30;
  background: repeating-linear-gradient(0deg, #1f6b2e0c 0 32px, transparent 32px 64px); }

/* A frame of thin lines with its title in the top line. */
.tm-box { position: relative; margin-top: 9px; padding: 14px 12px 12px; background: var(--bg); border: 1.2px solid var(--muted); }
.tm-box .legend { position: absolute; left: 10px; right: 10px; top: -10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tm-box .ttl { padding: 0 6px; background: var(--bg); color: var(--fg); font-size: 13px; text-transform: uppercase;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tm-cells { padding-top: 18px; }
.tm-key { min-height: 32px; min-width: 56px; padding: 0 6px; border: 0; background: var(--bg); color: var(--fg); cursor: pointer;
  font: 13px 'PixelifySans', monospace; }
.tm-key[aria-pressed="true"] { background: var(--fg); color: var(--bg); }

/* The status line, the charge and its bar. */
.tm .status { display: flex; align-items: center; gap: 4px; font-size: 21px; color: var(--fg); }
.tm .status .type { display: inline-grid; }
.tm .status .type > * { grid-area: 1 / 1; white-space: nowrap; }
.tm .status .ghost { visibility: hidden; }
.tm-cursor { width: 11.5px; height: 19px; background: var(--fg); }
.tm-cursor.blink { animation: tmBlink 1s step-end infinite; }
@keyframes tmBlink { 50% { opacity: 0; } }
.tm .fig { display: flex; align-items: baseline; gap: 12px; margin-top: 10px; }
.tm .soc { font-size: 72px; line-height: 1; color: var(--fg); }
.tm .soc.low { color: var(--warn); }
:root[data-mode="dark"] .tm .soc { text-shadow: 0 0 12px color-mix(in srgb, currentColor 60%, transparent); }
.tm .arrows { font-size: 26px; color: var(--muted); }
@media (max-width: 420px) { .tm .soc { font-size: 54px; } .tm .status { font-size: 18px; } }

/* A bar of blocks between brackets. */
.tm-bar { --ink: var(--fg); position: relative; height: 20px; margin-top: 6px;
  border: 1.5px solid var(--muted); border-top-color: transparent; border-bottom-color: transparent;
  background: linear-gradient(var(--muted), var(--muted)) left top / 4px 1.5px no-repeat, linear-gradient(var(--muted), var(--muted)) left bottom / 4px 1.5px no-repeat,
    linear-gradient(var(--muted), var(--muted)) right top / 4px 1.5px no-repeat, linear-gradient(var(--muted), var(--muted)) right bottom / 4px 1.5px no-repeat; }
.tm-bar .cells { position: absolute; left: 4.5px; right: 4.5px; top: 3px; bottom: 3px; display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 2px; }
.tm-bar i { background: var(--line); }
.tm-bar i.on { background: var(--ink); }
.tm-bar i.lead { animation: tmLead .625s step-end infinite; }
@keyframes tmLead { 50% { opacity: .2; } }
.tm-bar .stop { position: absolute; top: -2px; bottom: -2px; width: 0; border-left: 1.5px dashed var(--warn); }
.tm-bar .mid { position: absolute; left: calc(50% - .75px); top: 0; bottom: 0; width: 1.5px; background: var(--muted); display: none; }
.tm-bar.centred .mid { display: block; }

/* Dot leaders. */
.tm-dots { display: flex; align-items: flex-end; gap: 6px; font-size: 16px; }
.tm-dots .k { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.tm-dots i { flex: 1; height: 2px; margin-bottom: .28em; background: repeating-linear-gradient(90deg, var(--line) 0 2px, transparent 2px 6px); }
.tm-dots .v { color: var(--fg); white-space: nowrap; }
.tm-dots .v.muted { color: var(--muted); }
.tm-dots .v.bad { color: var(--danger); }
.tm-dots .v.warm { color: var(--warn); }
.tm-dots.big { margin-top: 12px; font-size: 20px; }

/* Square lamps: filled while on, an outline while off; the alarm blinks. */
.tm .lamps { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 10px; }
.tm-lamp { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); }
.tm-lamp .sq { width: 12px; height: 12px; border: 1.5px solid var(--muted); }
.tm-lamp.on { color: var(--fg); }
.tm-lamp.on .sq { background: var(--fg); border-color: var(--fg); }
.tm-lamp.alarm { color: var(--danger); }
.tm-lamp.alarm .sq { background: var(--danger); border-color: var(--danger); animation: tmAlarm .833s step-end infinite; }
@keyframes tmAlarm { 50% { opacity: .15; } }
.tm .ok { margin-top: 8px; font-size: 14px; color: var(--muted); }

/* Cells: a bar of blocks per cell. */
.tm-cells .stopline { font-size: 15px; color: var(--fg); }
.tm-cells .stopline.near { color: var(--warn); }
.tm-cells .note { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.tm-cells .rows { container-type: inline-size; column-gap: 14px; }
@media (min-width: 400px) { .tm-cells .rows.two { columns: 2; } }
.tm-cell { --ink: var(--fg); display: flex; align-items: center; gap: 6px; height: 24px; break-inside: avoid; font-size: 14px; }
.tm-cell .n { width: 30px; color: var(--muted); }
.tm-cell .tm-bar { flex: 1; height: 14px; margin: 0; }
.tm-cell .v { width: 48px; text-align: right; color: var(--ink); }
.tm-cell .bal { width: 12px; text-align: right; color: var(--warn); }
.tm-cell.bad { --ink: var(--danger); } .tm-cell.odd { --ink: var(--warn); }
.tm-cell.ringed .v { background: var(--fg); color: var(--bg); }

/* The alert in inverse video. */
.tm-alert { background: var(--bg); border: 1.5px solid var(--danger); }
.tm-alert .head { display: flex; gap: 8px; padding: 6px 10px; background: var(--danger); color: var(--bg); font-size: 18px; font-weight: 600; }
.tm-alert .marks { animation: tmBlink 1s step-end infinite; }
.tm-alert .detail { padding: 8px 10px 10px; font-size: 15px; color: var(--fg); }
