/* Game Console Flasher: app-specific styles (shared styles: /assets/css/site.css) */

:root {
  --accent: #d23f31;           /* WCH red */
  --accent-dark: #a92f24;
  --ok: #2ea043;
  --busy: #e0a800;
  --danger: #b3261e;
}

.app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 1rem 1.5rem;
  align-items: start;
}
.app-head, .banner { grid-column: 1 / -1; }
.app-head { max-width: 76ch; }
.app-head h1 { margin: 0 0 0.35rem; font-size: 2rem; color: var(--brand); }
.app-head p { margin: 0; color: var(--ink-soft); }
.banner { margin: 0; padding: 0.75rem 1rem; background: #fdecea; border-left: 4px solid var(--danger); border-radius: 4px; color: #7a1c1c; font-weight: 700; }

.work, .side { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.panel { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.1rem 1.1rem; min-width: 0; }
.panel h2 { margin: 0 0 0.75rem; font-size: 1.0625rem; color: var(--brand); }

/* ---------- Controls ---------- */

.btn {
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid #c5c8d4;
  border-radius: 5px;
  padding: 0.5rem 0.9rem;
  cursor: pointer;
}
.btn:hover:not(:disabled) { border-color: var(--accent); background: #fdf1f0; }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn-primary { color: #fff; background: var(--accent); border-color: var(--accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-big { font-size: 1rem; padding: 0.65rem 1.3rem; }
.btn-wide { width: 100%; }
.stack { display: flex; flex-direction: column; gap: 0.5rem; }
.hint { margin: 0.75rem 0 0; font-size: 0.875rem; color: var(--ink-soft); }
.small { font-size: 0.875rem; color: var(--ink-soft); margin: 0.6rem 0; }

.progress { margin-top: 0.85rem; height: 14px; border-radius: 7px; background: #eceef3; overflow: hidden; }
.progress div { height: 100%; width: 0; background: var(--ok); transition: width 0.1s linear; }

.more { margin-top: 1rem; }
.more summary { cursor: pointer; font-weight: 700; color: var(--brand); font-size: 0.9375rem; }
.more[open] summary { margin-bottom: 0.75rem; }

/* ---------- Side ---------- */

.conn { display: flex; align-items: center; gap: 0.5rem; margin: 0 0 0.4rem; font-weight: 700; }
.dot { width: 0.7rem; height: 0.7rem; border-radius: 50%; background: #b9bccb; flex: none; }
.conn.connected .dot { background: var(--ok); }
.conn.busy .dot { background: var(--busy); }
.conn.arm .dot { background: #2f6fe0; }
.link-note { margin: 0 0 0.85rem; font-size: 0.875rem; color: var(--ink-soft); min-height: 1.2em; }
.link-note.warn { color: #8a5a00; font-weight: 700; }
.code { margin: 0.4rem 0 0.75rem; padding: 0.6rem; background: #f4f4f9; border: 1px solid var(--line); border-radius: 4px; font-size: 0.6875rem; white-space: pre-wrap; overflow-wrap: anywhere; }


.log { list-style: none; margin: 0; padding: 0; max-height: 300px; overflow: auto; font-size: 0.8125rem; }
.log li { padding: 0.2rem 0; border-bottom: 1px solid var(--line); color: var(--ink-soft); }
.log li:last-child { border-bottom: 0; }
.log time { color: var(--ink); font-variant-numeric: tabular-nums; margin-right: 0.4rem; }
.log li.error { color: var(--danger); }
.log li.ok { color: #1d6b2a; }
.log:empty::before { content: "Nothing yet."; color: var(--ink-soft); }


/* ---------- Game list ---------- */

.games { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.6rem; }
.game-card {
  font: inherit;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.15rem;
  padding: 0.45rem 0.45rem 0.55rem;
  text-align: left;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
}
.game-card img { width: 100%; height: auto; aspect-ratio: 2 / 1; object-fit: cover; background: #0b0d12; border-radius: 3px; image-rendering: pixelated; margin-bottom: 0.3rem; }
.game-card strong { font-size: 0.9375rem; }
.game-card span { font-size: 0.8125rem; color: var(--ink-soft); }
.game-card:hover { border-color: var(--accent); background: #fdf1f0; }
.game-card.selected { border-color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); background: #fdf1f0; }

/* ---------- Selected game ---------- */

.game-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.game-head h2 { margin: 0; font-size: 1.375rem; }
.game-meta { margin: 0.2rem 0 0; font-size: 0.875rem; color: var(--ink-soft); }
.game-src { font-size: 0.875rem; font-weight: 700; white-space: nowrap; }
.game-text { margin: 0.75rem 0 0; max-width: 70ch; }
.game-tip { margin: 0.5rem 0 0; font-size: 0.9375rem; color: var(--ink-soft); }
.shots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; margin-top: 1rem; }
.shots figure { margin: 0; background: #0b0d12; border-radius: 6px; padding: 6px; }
.shots img { display: block; width: 100%; height: auto; aspect-ratio: 2 / 1; object-fit: contain; image-rendering: pixelated; }
.shots figure.missing { display: flex; align-items: center; justify-content: center; aspect-ratio: 2 / 1; }
.shots figure.missing img { display: none; }
.shots figure.missing::after { content: "Screenshot not available"; color: #9aa0ab; font-size: 0.875rem; }

/* ---------- Flash ---------- */

.flash-game { margin: 0 0 0.75rem; font-weight: 700; }
.wiring { width: 100%; border-collapse: collapse; margin: 1rem 0 0; font-size: 0.875rem; }
.wiring th, .wiring td { text-align: left; padding: 0.25rem 0.4rem; border-bottom: 1px solid var(--line); }
.wiring th { color: var(--ink-soft); font-weight: 700; }

@media (max-width: 960px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .app-head h1 { font-size: 1.6rem; }
}

@media (max-width: 560px) {
  .shots { grid-template-columns: minmax(0, 1fr); }
  .games { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
