:root {
  color-scheme: light;
  --bg: var(--pg-bg, #f4efe5);
  --panel: rgba(255, 253, 247, 0.94);
  --panel-strong: #fffdf7;
  --felt: #0b6248;
  --felt-dark: #064332;
  --text: var(--pg-text, #1f1d19);
  --muted: var(--pg-muted, #70695f);
  --line: var(--pg-border, #2a2823);
  --gold: #8c6b35;
  --green: #0b7f52;
  --red: #b93b35;
  --blue: #2c5c7c;
  --shadow: var(--pg-shadow-hard, 4px 4px 0 #2a2823);
  font-family: var(--pg-font-ui, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
}

* { box-sizing: border-box; }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(rgba(42, 40, 35, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(42, 40, 35, .035) 1px, transparent 1px),
    var(--bg);
  background-size: 28px 28px;
}

button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, a:focus-visible {
  outline: 3px solid #8c6b35;
  outline-offset: 3px;
}

.shell {
  width: min(1160px, calc(100% - 28px));
  margin: 0 auto;
  padding: 18px 0 56px;
}

.topbar, .hero, .card-heading, .score-card {
  display: flex;
  align-items: center;
  gap: 16px;
}
.topbar { display: none; }
.gallery-link, .pill, button, .score-card, .card {
  border: 2px solid var(--line);
}
.gallery-link, .pill {
  border-radius: 2px;
  padding: 0.72rem 0.95rem;
  color: var(--muted);
  background: var(--panel-strong);
  text-decoration: none;
}
.gallery-link:hover { color: var(--text); background: #fffaf0; }

.hero {
  justify-content: space-between;
  align-items: stretch;
  margin-bottom: 22px;
}
.eyebrow {
  margin: 0 0 10px;
  color: var(--gold);
  font-family: var(--pg-font-mono, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: none;
}
.eyebrow.small { font-size: 0.7rem; }
h1, h2 { margin: 0; letter-spacing: -0.025em; }
h1 {
  max-width: 900px;
  font-size: clamp(2.75rem, 8vw, 6.6rem);
  line-height: 0.92;
}
h2 { font-size: clamp(1.55rem, 3vw, 2.35rem); }
.lede, .subtle, .feedback, details { color: var(--muted); line-height: 1.65; }
.lede { max-width: 780px; font-size: 1.08rem; }

.score-card {
  flex-wrap: wrap;
  justify-content: center;
  min-width: min(100%, 330px);
  padding: 18px;
  border-radius: 2px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.score-card div { min-width: 74px; text-align: center; }
.score-card span { display: block; font-size: 1.85rem; font-weight: 900; color: var(--green); }
.score-card small { color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }

.layout { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.75fr); gap: 22px; }
.card {
  border-radius: 2px;
  padding: clamp(20px, 4vw, 34px);
  background: var(--panel);
  box-shadow: var(--shadow);
}
.card-heading { justify-content: space-between; align-items: flex-start; margin-bottom: 22px; }

button {
  border-radius: 2px;
  padding: 0.86rem 1rem;
  color: var(--text);
  background: #fffaf0;
  font-weight: 850;
  box-shadow: none;
}
button:hover { transform: translate(-1px, -1px); box-shadow: 2px 2px 0 var(--line); }
button.secondary, button.ghost {
  color: var(--text);
  background: #fffdf7;
  box-shadow: none;
}
button.ghost { padding: 0.65rem 0.85rem; color: var(--muted); }
.actions { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin: 22px 0; }
.actions button[disabled] { opacity: 0.58; cursor: not-allowed; transform: none; }

.table-felt {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 0.72fr 1fr;
  gap: 22px;
  min-height: 330px;
  padding: clamp(18px, 4vw, 34px);
  border: 2px solid var(--line);
  border-radius: 2px;
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.11), transparent 42%),
    linear-gradient(135deg, var(--felt), var(--felt-dark));
}
.table-felt::before {
  content: "BLACKJACK";
  position: absolute;
  inset: auto 0 18px;
  text-align: center;
  color: rgba(255, 255, 255, 0.08);
  font-size: clamp(3rem, 10vw, 7rem);
  font-weight: 1000;
  letter-spacing: 0.08em;
  pointer-events: none;
}
.dealer-zone, .player-zone { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 14px; justify-content: center; }
.label { color: rgba(255,255,255,0.76); font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.75rem; }
.hand { display: flex; flex-wrap: wrap; gap: 12px; }
.playing-card {
  display: grid;
  place-items: center;
  width: 86px;
  height: 122px;
  border-radius: 6px;
  color: #111827;
  background: linear-gradient(160deg, #fff, #dbe4ef);
  border: 1px solid rgba(255, 255, 255, 0.65);
  box-shadow: 2px 2px 0 rgba(0,0,0,.34);
  font-size: 2rem;
  font-weight: 1000;
}
.playing-card.red { color: #c62828; }

.feedback {
  min-height: 112px;
  border-radius: 2px;
  padding: 18px;
  background: #fffaf0;
  border: 2px solid var(--line);
}
.feedback.correct { color: #17472f; border-color: var(--line); background: #edf8ee; }
.feedback.incorrect { color: #6e211f; border-color: var(--line); background: #fff0ec; }
.feedback strong { color: var(--text); }

.control { display: grid; gap: 8px; margin: 18px 0; color: var(--muted); font-weight: 800; }
input {
  width: 100%;
  border: 2px solid var(--line);
  border-radius: 2px;
  padding: 0.85rem 0.95rem;
  color: var(--text);
  background: #fffdf7;
}
.true-count-box, .guidance {
  margin: 18px 0;
  border: 2px solid var(--line);
  border-radius: 2px;
  padding: 18px;
  background: #fffaf0;
}
.true-count-box { display: flex; align-items: center; justify-content: space-between; color: var(--muted); }
.true-count-box strong { color: var(--blue); font-size: 2rem; }
.guidance { color: var(--text); line-height: 1.6; }
summary { color: var(--gold); cursor: pointer; font-weight: 900; }
li { margin: 0.4rem 0; }

@media (max-width: 900px) {
  .hero, .layout, .table-felt { grid-template-columns: 1fr; }
  .hero { display: grid; }
  .actions { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .card-heading { align-items: stretch; flex-direction: column; }
  .actions { grid-template-columns: 1fr; }
  .playing-card { width: 72px; height: 104px; }
}
