/* PHNX Minesweeper styles
 *
 * Brand palette (matches phnx2048):
 *   Vivid Tangelo  #EE7526   Primary — accents
 *   Mustard        #FBD652   Flag bg, num color 4
 *   Vermilion      #D74820   Hover, loss-trigger outline, num 3
 *   Persian Plum   #77161C   Borders, num 1
 *   Rich Black     #030519   Body text, num 5+, mine fill
 *   Cream          #F5EEE5   Warm board surface
 *   Beige          #EFEDE9   Alt warm
 *   Off-white      #F5F5F5   Unrevealed cell fill
 *
 * Light theme default; no dark variant for v0.
 */

:root {
  --tangelo:     #EE7526;
  --mustard:     #FBD652;
  --vermilion:   #D74820;
  --plum:        #77161C;
  --rich-black:  #030519;
  --cream:       #F5EEE5;
  --beige:       #EFEDE9;
  --off-white:   #F5F5F5;
  --pastel-grey: #5C5C5C;

  --bg:          #FFFFFF;
  --panel:       var(--off-white);
  --panel-2:     #FFFFFF;
  --border:      var(--plum);
  --fg:          var(--pastel-grey);
  --fg-strong:   var(--rich-black);
  --fg-muted:    #8A8A8A;
  --fg-faint:    #BFBFBF;

  --accent:        var(--tangelo);
  --accent-hover:  var(--vermilion);

  --radius:    12px;
  --radius-sm: 8px;
  --shadow:    0 6px 20px rgba(3, 5, 25, 0.06), 0 1px 2px rgba(3, 5, 25, 0.04);

  --cell-size: 30px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }

body {
  background:
    radial-gradient(1100px 500px at 20% -150px, rgba(238, 117, 38, 0.06) 0%, transparent 60%),
    radial-gradient(900px 500px at 110% 0%, rgba(251, 214, 82, 0.08) 0%, transparent 60%),
    var(--bg);
  color: var(--fg);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Inter, sans-serif;
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
  min-height: 100dvh;
}

#app {
  max-width: 720px;
  margin: 0 auto;
  padding: 18px 14px 80px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ---- Header ---- */
.header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--fg-strong);
}
.title .accent { color: var(--accent); }
.title .accent-2 { color: var(--vermilion); }
.subtitle {
  color: var(--fg-faint);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ---- Toolbar (size tabs) ---- */
.toolbar {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.tab {
  flex: 1 0 auto;
  background: transparent;
  color: var(--fg-muted);
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 120ms ease, color 120ms ease;
}
.tab:hover { color: var(--fg-strong); }
.tab[aria-selected="true"] {
  background: var(--accent);
  color: #FFFFFF;
}

/* ---- HUD ---- */
.hud {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: center;
}
.hud-box {
  background: var(--cream);
  color: var(--rich-black);
  border: 1px solid var(--plum);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-self: stretch;
  min-width: 0;
}
.hud-box:first-child { justify-self: start; }
.hud-box:last-child  { justify-self: end; flex-direction: row-reverse; }
.hud-glyph { font-size: 16px; line-height: 1; }
.hud-value {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.04em;
  color: var(--rich-black);
}
.smiley {
  background: var(--panel-2);
  border: 1px solid var(--plum);
  border-radius: var(--radius-sm);
  width: 44px;
  height: 44px;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  display: grid;
  place-items: center;
  transition: transform 80ms ease, border-color 120ms ease;
}
.smiley:hover { border-color: var(--accent); }
.smiley:active { transform: translateY(1px); }
.smiley:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---- Board ---- */
.board-wrap {
  display: flex;
  justify-content: center;
}
.board {
  background: var(--beige);
  border: 1px solid var(--plum);
  border-radius: var(--radius);
  padding: 4px;
  display: grid;
  gap: 0;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  box-shadow: var(--shadow);
  /* Cell grid is filled in by JS via inline style on .board */
}

.cell {
  width: var(--cell-size);
  height: var(--cell-size);
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-weight: 700;
  font-size: calc(var(--cell-size) * 0.55);
  background: var(--off-white);
  border: 1px solid var(--plum);
  margin: -1px 0 0 -1px; /* collapse borders so the grid reads as a single 1px plum mesh */
  color: var(--rich-black);
  cursor: pointer;
  transition: background-color 80ms ease;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}
.cell:hover { background: rgba(238, 117, 38, 0.10); }
.cell:focus {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  z-index: 2;
}

.cell.revealed {
  background: var(--panel-2);
  cursor: default;
}
.cell.revealed:hover { background: var(--panel-2); }
.cell.revealed.zero {
  background: var(--cream);
  border-color: transparent;
  color: transparent;
}
.cell.flag {
  background: var(--mustard);
}
.cell.flag::before {
  content: "\1F6A9";
  font-size: calc(var(--cell-size) * 0.55);
}
.cell.mine {
  background: var(--plum);
}
.cell.mine::before {
  content: "\25CF";
  color: var(--rich-black);
  background: var(--plum);
  font-size: calc(var(--cell-size) * 0.55);
}
.cell.mine.boom {
  outline: 2px solid var(--vermilion);
  outline-offset: -2px;
  z-index: 2;
}
.cell.wrong-flag::after {
  content: "\00D7";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--vermilion);
  font-size: calc(var(--cell-size) * 0.85);
  font-weight: 900;
  pointer-events: none;
}

/* Number colors per spec */
.cell.n1 { color: var(--plum); }
.cell.n2 { color: var(--tangelo); }
.cell.n3 { color: var(--vermilion); }
.cell.n4 { color: var(--rich-black); background: var(--mustard); }
.cell.n5,
.cell.n6,
.cell.n7,
.cell.n8 { color: var(--rich-black); }

/* ---- Modeline / foot ---- */
.modeline {
  color: var(--fg-faint);
  font-size: 11px;
  text-align: center;
  line-height: 1.6;
}
.modeline kbd {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--fg-strong);
}

.foot {
  margin: 2px 0 0;
  color: var(--fg-faint);
  font-size: 11px;
  text-align: center;
}
.foot .dot { margin: 0 6px; }

/* ---- Responsive ---- */
@media (max-width: 600px) {
  :root { --cell-size: 24px; }
  .title { font-size: 22px; }
}
@media (max-width: 420px) {
  :root { --cell-size: 20px; }
  #app { padding: 12px 8px 60px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .cell { transition: none; }
}
