/* ── Paramount brand fonts ── */
@font-face {
  font-family: 'Vista Sans';
  src: url('../hub/fonts/ParamountVistaSans-CondensedBold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Peak Sans';
  src: url('../hub/fonts/Peak-Sans_Light.otf') format('opentype');
  font-weight: 300;
  font-display: swap;
}
@font-face {
  font-family: 'Peak Sans';
  src: url('../hub/fonts/PeakSans_Regular.otf') format('opentype');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Peak Sans';
  src: url('../hub/fonts/PeakSans_Bold.otf') format('opentype');
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: 'Peak Sans';
  src: url('../hub/fonts/PeakSans_Black.otf') format('opentype');
  font-weight: 900;
  font-display: swap;
}

/* ── Paramount brand tokens ── */
:root {
  --bg:       #000a3c;
  --surface:  #0d1525;
  --surface2: #1a2a45;
  --text:     #d9dae2;
  --muted:    #8e8e91;
  --border:   #1a2a45;
  --blue:     #0064ff;
  --gold:     #ffd400;
  --cell-size: 22px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Peak Sans', 'Segoe UI', Arial, sans-serif;
  font-weight: 400;
  min-height: 100vh;
  overflow-x: hidden;
}

.back-to-hub {
  position: fixed;
  top: 10px;
  left: 12px;
  z-index: 1000;
  color: #fff;
  text-decoration: none;
  font-size: 1.4rem;
  padding: 6px 10px;
  background: rgba(0,0,0,0.55);
  border-radius: 6px;
  touch-action: manipulation;
  line-height: 1;
}
.back-to-hub:hover { background: rgba(0,0,0,0.8); }

.screen { display: none; }
.screen.active { display: flex; flex-direction: column; }

button { touch-action: manipulation; }

/* ── MENU ── */
#screen-menu {
  min-height: 100vh;
  padding: 60px 16px 32px;
  align-items: center;
  gap: 20px;
}

.menu-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.paramount-logo {
  height: 40px;
  width: auto;
  opacity: 0.95;
}

.menu-header h1 {
  font-family: 'Vista Sans', 'Arial Narrow', Arial, sans-serif;
  font-weight: 700;
  font-size: 3.4rem;
  letter-spacing: 4px;
  color: #fff;
  line-height: 1;
  text-transform: uppercase;
  text-shadow: 0 2px 16px rgba(0, 100, 255, 0.45);
}

.menu-header p {
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-weight: 400;
}

#puzzle-menu {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
  max-width: 560px;
}

.puzzle-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent, #1a2a45);
  border-radius: 6px;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 64px;
  transition: background 0.12s, transform 0.08s;
}
.puzzle-card:hover {
  background: var(--surface2);
  transform: translateY(-1px);
}
.puzzle-card:active { transform: translateY(0); }

.card-num {
  font-size: 0.62rem;
  color: var(--muted);
  font-weight: 400;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
.card-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
  font-family: 'Peak Sans', sans-serif;
}
.card-sub {
  font-size: 0.67rem;
  color: var(--muted);
  line-height: 1.2;
  font-weight: 300;
}

/* ── GAME ── */
#screen-game {
  min-height: 100vh;
  padding: 0 0 16px;
  align-items: center;
}

.game-topbar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--surface);
  border-bottom: 2px solid var(--blue);
  min-height: 48px;
  gap: 8px;
}

.btn-back-menu {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.72rem;
  font-family: 'Peak Sans', sans-serif;
  font-weight: 400;
  padding: 6px 10px;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  min-height: 34px;
  letter-spacing: 0.5px;
}
.btn-back-menu:hover { color: var(--text); border-color: var(--blue); }

.topbar-center {
  flex: 1;
  text-align: center;
  overflow: hidden;
}
.topbar-center h2 {
  font-family: 'Vista Sans', 'Arial Narrow', Arial, sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: 1.5px;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: uppercase;
}
.topbar-center p {
  font-size: 0.62rem;
  color: var(--muted);
  letter-spacing: 0.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 300;
}

.topbar-right {
  text-align: right;
  white-space: nowrap;
  flex-shrink: 0;
}
.progress-count {
  font-size: 1rem;
  font-weight: 700;
  color: var(--blue);
  display: block;
  line-height: 1;
  font-family: 'Peak Sans', sans-serif;
}
.progress-label {
  font-size: 0.58rem;
  color: var(--muted);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.game-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  gap: 12px;
  padding: 10px 8px 0;
}

#grid-wrapper {
  position: relative;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

#grid-svg {
  position: absolute;
  top: 2px;
  left: 2px;
  pointer-events: none;
  overflow: visible;
}

#grid {
  display: grid;
  grid-template-columns: repeat(15, var(--cell-size));
  grid-template-rows: repeat(15, var(--cell-size));
  border: 2px solid var(--surface2);
  border-radius: 4px;
  overflow: hidden;
  cursor: crosshair;
  background: var(--surface);
}

.cell {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(var(--cell-size) * 0.52);
  font-weight: 700;
  font-family: 'Peak Sans', 'Segoe UI', Arial, sans-serif;
  color: var(--text);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  position: relative;
  transition: background-color 0.1s;
}

.cell.found {
  font-weight: 900;
}

#word-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: calc(var(--cell-size) * 15 + 4px);
  padding-bottom: 24px;
}

.word-item {
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--muted);
  padding: 7px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  line-height: 1.45;
  transition: border-color 0.2s, background 0.2s;
  font-family: 'Peak Sans', sans-serif;
}

.word-item.found {
  background: var(--surface2);
  border-color: var(--border);
}

.clue-text { display: block; }

.clue-answer {
  font-weight: 900;
  letter-spacing: 1.5px;
  font-size: 0.85em;
  font-family: 'Vista Sans', 'Arial Narrow', Arial, sans-serif;
}

/* ── WIN ── */
#screen-win {
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 12px;
  padding: 40px 24px;
}

.win-emoji {
  font-size: 4rem;
  line-height: 1;
}

.win-title {
  font-family: 'Vista Sans', 'Arial Narrow', Arial, sans-serif;
  font-weight: 700;
  font-size: 3.4rem;
  letter-spacing: 5px;
  color: #fff;
  text-transform: uppercase;
  text-shadow: 0 0 24px rgba(255, 212, 0, 0.55);
}

.win-theme {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  font-family: 'Peak Sans', sans-serif;
}

.win-num {
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-weight: 300;
}

.win-time-label {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-top: 8px;
  font-weight: 300;
}

.win-time {
  font-size: 2.6rem;
  font-weight: 700;
  color: var(--gold);
  line-height: 1;
  font-family: 'Vista Sans', 'Arial Narrow', Arial, sans-serif;
  letter-spacing: 2px;
}

.win-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 8px;
}

.btn {
  padding: 12px 28px;
  border-radius: 4px;
  font-size: 0.88rem;
  font-weight: 700;
  font-family: 'Peak Sans', 'Segoe UI', Arial, sans-serif;
  cursor: pointer;
  border: none;
  min-height: 48px;
  touch-action: manipulation;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: #0050cc; }
.btn-secondary {
  background: var(--surface);
  border: 2px solid var(--surface2);
  color: var(--text);
}
.btn-secondary:hover { border-color: var(--blue); }

/* ── DESKTOP ── */
@media (min-width: 700px) {
  .game-body {
    flex-direction: row;
    align-items: flex-start;
    justify-content: center;
    gap: 20px;
    padding: 16px 24px 0;
  }

  #word-list {
    width: 260px;
    gap: 6px;
    margin-top: 2px;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    padding-bottom: 8px;
  }
}

@media (min-width: 1100px) {
  #puzzle-menu { grid-template-columns: 1fr 1fr 1fr; max-width: 820px; }
}
