/* Unified emulator shell — shared between the picker view and every
 * per-console boot card. Identity colors (Genesis red, Famicom red,
 * Game Boy violet) come from the registry via inline custom-property
 * overrides set by launch.js, so this file stays brand-agnostic. */

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

:root {
  --bg: var(--surface-0);
  --surface: var(--surface-1);
  --surface2: var(--surface-2);
  --accent: var(--accent-primary);
  /* These three get overridden by launch.js per-console. Sega red is
   * the fallback so the page still has identity when the registry
   * fails to load (e.g. blocked CDN, dropped CSP). */
  --accent-bright: #e94560;
  --accent-bright-soft: rgba(233, 69, 96, 0.08);
  --accent-bright-ring: rgba(233, 69, 96, 0.25);
  --accent-gold: #c2410c;
  --text: var(--text-1);
  --text-dim: var(--text-2);
  --border: var(--hairline-strong);
  --card-bg: var(--surface-1);
}

html,
body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  overflow: hidden;
}

#boot {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
  overflow-y: auto;
}

#boot.hidden {
  display: none;
}

.brand {
  text-align: center;
  margin-bottom: 32px;
}

.brand-logo {
  font-size: 72px;
  line-height: 1;
  margin-bottom: 12px;
  display: block;
}

.brand h1 {
  font-size: clamp(28px, 5vw, 42px);
  font-weight: 900;
  letter-spacing: 2px;
  text-transform: uppercase;
  /* Hero wordmark uses the identity accent on both ends of the
   * gradient so a console swap re-tints the title without
   * touching this file. Identity-text gradients are an explicit
   * BRAND.md carve-out for hero wordmarks. */
  background: linear-gradient(
    135deg,
    var(--accent-bright) 0%,
    var(--accent-gold) 50%,
    var(--accent-bright) 100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.brand .sub {
  display: block;
  font-size: 11px;
  letter-spacing: 4px;
  color: var(--text-dim);
  font-weight: 400;
  margin-top: 6px;
  -webkit-text-fill-color: var(--text-dim);
  background: none;
}

.boot-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 520px;
  width: 100%;
  box-shadow: var(--shadow-card);
}

.boot-card h2 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 20px;
  border-radius: 8px;
  border: none;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent-bright);
  color: var(--text-on-accent);
  border: 1px solid var(--accent-bright);
  transition: filter 0.2s, transform 0.2s;
}

.btn-primary:hover {
  transform: translateY(-1px);
  filter: brightness(0.88);
}

.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--accent);
  border-color: var(--accent-bright);
}

.btn-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.btn-stack rom-browser {
  display: block;
  width: 100%;
}

.divider {
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
  letter-spacing: 2px;
  margin: 4px 0;
  position: relative;
}

.divider::before,
.divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 42%;
  height: 1px;
  background: var(--border);
}

.divider::before {
  left: 0;
}
.divider::after {
  right: 0;
}

.controls-info {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.controls-info summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--text-dim);
  letter-spacing: 1px;
  text-transform: uppercase;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

.controls-info summary::-webkit-details-marker {
  display: none;
}

.controls-info summary::before {
  content: '▶';
  font-size: 9px;
  transition: transform 0.2s;
}

.controls-info[open] summary::before {
  transform: rotate(90deg);
}

.controls-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-size: 13px;
}

.controls-grid .key-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 10px;
  background: var(--surface);
  border-radius: 6px;
}

.controls-grid .key-row span {
  color: var(--text-dim);
}

kbd {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 11px;
  font-family: monospace;
  color: var(--accent-gold);
}

.hidden-input {
  display: none;
}

#game-container {
  position: fixed;
  inset: 0;
  background: #000;
  display: none;
}

#game-container.visible {
  display: block;
}

#game {
  width: 100%;
  height: 100%;
}

.share-overlay {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 200;
}

.seo-intro {
  display: none;
}

/* Picker (when no ?console= is set) — three tiles that mirror the
 * boot-card identity language. Hover behavior matches .btn-primary
 * so the affordance reads the same. */
.picker-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (min-width: 540px) {
  .picker-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.picker-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 20px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.15s, border-color 0.15s, background-color 0.15s;
}

.picker-tile:hover {
  transform: translateY(-2px);
  border-color: var(--accent-bright);
  background: var(--accent-bright-soft);
}

.picker-emoji {
  font-size: 36px;
  line-height: 1;
}

.picker-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.picker-sub {
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
  letter-spacing: 0.5px;
}

.picker-help {
  margin-top: 16px;
  font-size: 12px;
  color: var(--text-dim);
  text-align: center;
  line-height: 1.5;
}

@media (max-width: 480px) {
  .brand-logo {
    font-size: 52px;
  }
  .boot-card {
    padding: 20px;
  }
  .controls-grid {
    grid-template-columns: 1fr;
  }
}
