/* Retro hockey card aesthetic — worn cream stock, faded ink, grain & creases */
:root {
  --paper: #e3d3a7;
  --paper-dark: #c8b481;
  --card: #efe1b4;
  --card-2: #e6d6a2;
  --ink: #1c1a17;
  --ink-soft: #4a3f30;
  --muted: #7a6748;
  --border: #2a241c;
  --soft-border: #ac9763;
  --red: #b41229;
  --red-dark: #821026;
  --blue: #173b6a;
  --gold: #b88820;
  --gold-soft: #d7af55;
  --green: #1d6e3a;
  --green-soft: #43a86e;
  --danger: #a91d30;
  --stain: rgba(96, 56, 18, 0.22);

  /* SVG fractal-noise overlay for paper grain */
  --noise: url("data:image/svg+xml;charset=utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.30  0 0 0 0 0.22  0 0 0 0 0.10  0 0 0 0.55 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");

  /* Coarser noise for the cards (stronger wear) */
  --noise-strong: url("data:image/svg+xml;charset=utf8,<svg xmlns='http://www.w3.org/2000/svg' width='320' height='320'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.55' numOctaves='3' stitchTiles='stitch' seed='3'/><feColorMatrix values='0 0 0 0 0.32  0 0 0 0 0.22  0 0 0 0 0.08  0 0 0 0.75 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  color: var(--ink);
  font-family: 'Oswald', -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  font-weight: 400;
  min-height: 100vh;
  /* Aged paper: SVG grain + faint halftone dots + corner vignette */
  background-color: var(--paper);
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(150, 100, 40, 0.18), transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(60, 35, 15, 0.20), transparent 55%),
    var(--noise),
    radial-gradient(circle at 1px 1px, rgba(0,0,0,0.05) 1px, transparent 0);
  background-size: auto, auto, 240px 240px, 9px 9px;
  background-repeat: no-repeat, no-repeat, repeat, repeat;
  background-attachment: fixed, fixed, fixed, fixed;
}

/* Hidden attribute support across the app */
[hidden] { display: none !important; }

/* ---------- Header ---------- */

header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 1.5rem 2rem 0.9rem;
  background: transparent;
  position: relative;
  flex-wrap: wrap;
  gap: 1rem;
}

/* Red/blue/gold stripe under the header */
header::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  bottom: -8px;
  height: 5px;
  background:
    linear-gradient(90deg,
      var(--red) 0 33%,
      var(--gold) 33% 66%,
      var(--blue) 66% 100%);
}

h1 {
  margin: 0;
  font-family: 'Bebas Neue', 'Oswald', sans-serif;
  font-weight: 400;
  font-size: 2.2rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  line-height: 1;
}

.title-block {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.daily-info {
  font-family: 'Oswald', sans-serif;
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--card);
  background: var(--blue);
  padding: 0.2rem 0.5rem 0.16rem;
  border-radius: 2px;
  align-self: center;
  position: relative;
  top: -2px;
}

.meta {
  display: flex;
  gap: 1.5rem;
  font-family: 'Oswald', sans-serif;
  font-weight: 500;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}

.meta strong {
  font-family: 'Bebas Neue', sans-serif;
  font-weight: 400;
  font-size: 1.4rem;
  letter-spacing: 0.04em;
  color: var(--red);
  display: inline-block;
  margin-left: 0.25rem;
  vertical-align: -2px;
  font-variant-numeric: tabular-nums;
}

.score strong {
  color: var(--blue);
}

/* ---------- Main layout ---------- */

main {
  max-width: 920px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
  display: grid;
  gap: 1.5rem;
}

.panel {
  position: relative;
  background-color: var(--card);
  background-image:
    radial-gradient(ellipse at 100% 0%, rgba(80, 50, 20, 0.16), transparent 50%),
    radial-gradient(ellipse at 0% 100%, rgba(80, 50, 20, 0.12), transparent 55%),
    var(--noise);
  background-size: auto, auto, 240px 240px;
  background-blend-mode: multiply, multiply, multiply;
  border: none;
  border-radius: 4px;
  padding: 1.5rem 1.25rem 1.25rem;
  box-shadow:
    inset 0 0 70px rgba(80, 50, 20, 0.18),
    0 2px 18px rgba(40, 25, 10, 0.22);
  overflow: hidden;
}

/* Reserve right-side space for the mystery silhouette in the stats panel */
#stats-panel {
  padding-right: 6.5rem;
}

/* Decorative top stripe on each panel (worn / desaturated) */
.panel::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 6px;
  background:
    linear-gradient(180deg,
      rgba(255,255,255,0.10) 0%,
      rgba(0,0,0,0.16) 100%),
    linear-gradient(90deg,
      var(--red) 0 60%,
      var(--gold) 60% 80%,
      var(--blue) 80% 100%);
  z-index: 1;
}

/* Subtle corner stain on panels (sits behind content) */
.panel::after {
  content: '';
  position: absolute;
  top: 18px;
  right: 26px;
  width: 64px;
  height: 48px;
  background: radial-gradient(ellipse at 55% 45%,
    var(--stain) 0%,
    rgba(96, 56, 18, 0.10) 35%,
    transparent 75%);
  border-radius: 50%;
  transform: rotate(-14deg);
  pointer-events: none;
}

.panel-label {
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--blue);
  margin: 0.15rem 0 0.95rem;
  padding-bottom: 0.35rem;
  position: relative;
}

/* Pre-NHL "drafted from" clue row */
.pre-nhl-row {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin: 0 0 1rem;
  padding: 0.2rem 0;
}

.pre-nhl-row:empty { display: none; }

.pre-nhl-label {
  font-family: 'Oswald', sans-serif;
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  flex-shrink: 0;
}

.pre-nhl-team {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.35rem;
  letter-spacing: 0.04em;
  color: var(--ink);
  line-height: 1;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.pre-nhl-league {
  display: inline-block;
  font-family: 'Oswald', sans-serif;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: var(--blue);
  color: var(--card);
  padding: 0.18rem 0.4rem 0.15rem;
  border-radius: 2px;
  vertical-align: 2px;
}

/* ---------- Mystery silhouette ---------- */

.mystery-silhouette {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 78px;
  height: 94px;
  z-index: 2;
  pointer-events: none;
  filter: drop-shadow(2px 3px 0 rgba(40, 25, 10, 0.4));
}

.mystery-silhouette svg {
  width: 100%;
  height: 100%;
  display: block;
}

.silhouette-fill {
  fill: var(--ink);
  opacity: 0.85;
}

.silhouette-q {
  fill: var(--gold);
  font-family: 'Bebas Neue', sans-serif;
  font-size: 38px;
  font-weight: 400;
  letter-spacing: 0;
}

/* ---------- Stats panel (back of card) ---------- */

.totals-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.totals-row .stat {
  background: transparent;
  padding: 0.35rem 0.5rem 0.4rem;
  text-align: center;
  font-family: 'Oswald', sans-serif;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  line-height: 1.1;
}

.totals-row .stat + .stat {
  border-left: 1px dotted var(--soft-border);
}

.totals-row .stat strong {
  display: block;
  color: var(--ink);
  font-family: 'Bebas Neue', sans-serif;
  font-weight: 400;
  font-size: 1.5rem;
  letter-spacing: 0.02em;
  margin-top: 0.15rem;
  font-variant-numeric: tabular-nums;
}

.table-wrap {
  max-height: 380px;
  overflow-y: auto;
  background: transparent;
}

#stats-table {
  width: 100%;
  border-collapse: collapse;
  font-family: 'Oswald', sans-serif;
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

#stats-table th,
#stats-table td {
  padding: 0.4rem 0.65rem;
  text-align: left;
}

#stats-table th.num,
#stats-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

#stats-table thead th {
  position: sticky;
  top: 0;
  background: var(--blue);
  color: var(--card);
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 0.45rem 0.65rem;
}

#stats-table tbody tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.04);
}

#stats-table td:first-child {
  font-weight: 600;
  color: var(--ink-soft);
}

/* ---------- Guess panel ---------- */

.guess-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.autocomplete {
  position: relative;
  flex: 1;
}

#guess-input {
  width: 100%;
  padding: 0.7rem 0.6rem 0.6rem;
  background: transparent;
  border: none;
  border-bottom: 2px solid var(--soft-border);
  border-radius: 0;
  color: var(--ink);
  font-family: 'Oswald', sans-serif;
  font-weight: 500;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}

#guess-input::placeholder {
  color: var(--muted);
  font-style: italic;
}

#guess-input:focus {
  border-bottom-color: var(--gold);
  background: rgba(212, 160, 23, 0.06);
}

#suggestions {
  position: absolute;
  top: calc(100% + 2px);
  left: 0; right: 0;
  list-style: none;
  margin: 0;
  padding: 0.25rem 0;
  background: var(--card);
  border: none;
  border-radius: 3px;
  max-height: 240px;
  overflow-y: auto;
  z-index: 10;
  display: none;
  box-shadow: 0 8px 24px rgba(40, 25, 10, 0.35);
}

#suggestions.open { display: block; }

#suggestions li {
  padding: 0.5rem 0.9rem;
  cursor: pointer;
  font-family: 'Oswald', sans-serif;
  font-size: 0.95rem;
}

#suggestions li:hover,
#suggestions li.active {
  background: var(--gold);
  color: var(--ink);
}

button {
  font-family: 'Oswald', sans-serif;
  font-size: 0.92rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.7rem 1.2rem;
  border-radius: 3px;
  border: none;
  background: var(--card-2);
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.05s, box-shadow 0.1s, background 0.15s;
  box-shadow: 0 2px 0 rgba(40, 25, 10, 0.55);
}

button:hover { background: #f6e9be; }

button:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 rgba(40, 25, 10, 0.55);
}

#guess-btn,
button.primary {
  background: var(--red);
  color: var(--card);
  box-shadow: 0 2px 0 var(--red-dark);
}

#guess-btn:hover,
button.primary:hover {
  background: var(--red-dark);
  color: var(--card);
}

#guess-btn:active,
button.primary:active {
  box-shadow: 0 1px 0 var(--red-dark);
}

button.secondary {
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: var(--soft-border);
  padding: 0.7rem 0.4rem;
}

button.secondary:hover { color: var(--ink); text-decoration-color: var(--ink); }

#guess-history {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

#guess-history li {
  padding: 0.4rem 0.6rem;
  background: transparent;
  border-left: 3px solid var(--red);
  font-family: 'Oswald', sans-serif;
  font-size: 0.92rem;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

#guess-history li::before {
  content: "MISS";
  font-weight: 700;
  font-size: 0.7rem;
  color: var(--red);
  letter-spacing: 0.12em;
}

.actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.1rem;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Hint button — gold accent so it reads as a special "pay to peek" action */
button.hint-btn {
  background: var(--gold);
  color: var(--ink);
  box-shadow: 0 2px 0 rgba(120, 80, 10, 0.6);
}

button.hint-btn:hover {
  background: var(--gold-soft);
}

button.hint-btn:active {
  box-shadow: 0 1px 0 rgba(120, 80, 10, 0.6);
}

button.hint-btn .hint-cost {
  display: inline-block;
  margin-left: 0.4rem;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.1rem 0.35rem;
  background: rgba(0, 0, 0, 0.18);
  border-radius: 2px;
  letter-spacing: 0.08em;
  vertical-align: 1px;
}

button.hint-btn.used,
button.hint-btn:disabled {
  background: var(--soft-border);
  color: var(--muted);
  cursor: not-allowed;
  box-shadow: none;
}

button.hint-btn:disabled:hover { background: var(--soft-border); }

/* Hint reveal panel */
.hint-display {
  margin: 1rem 0 0;
  padding: 0.7rem 0.9rem;
  background:
    repeating-linear-gradient(45deg,
      transparent 0,
      transparent 12px,
      rgba(184, 136, 32, 0.08) 12px,
      rgba(184, 136, 32, 0.08) 14px),
    rgba(212, 160, 23, 0.10);
  border: none;
  border-left: 3px solid var(--gold);
  border-radius: 0;
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
  animation: hintPop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes hintPop {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.hint-label {
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--gold);
  background: var(--ink);
  padding: 0.18rem 0.5rem 0.15rem;
  border-radius: 2px;
  flex-shrink: 0;
}

.hint-text {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.2rem;
  letter-spacing: 0.03em;
  color: var(--ink);
  line-height: 1.1;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0,0,0,0); border: 0;
}

/* ---------- Strike flash (wrong guess feedback) ---------- */

.red-flash {
  position: fixed;
  inset: 0;
  background: var(--red);
  pointer-events: none;
  z-index: 199;
  opacity: 0;
  mix-blend-mode: multiply;
}

.red-flash.active {
  animation: redFlash 0.45s ease-out forwards;
}

@keyframes redFlash {
  0% { opacity: 0.55; }
  100% { opacity: 0; }
}

.strike-flash {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(4.5rem, 14vw, 9rem);
  letter-spacing: 0.08em;
  color: var(--red);
  text-shadow:
    4px 4px 0 var(--ink),
    -2px -2px 0 var(--card),
    0 0 40px rgba(180, 18, 41, 0.6);
  opacity: 0;
  transform: scale(0.6) rotate(-4deg);
  text-transform: uppercase;
  text-align: center;
  line-height: 0.9;
}

.strike-flash.active {
  animation: strikeFlash 0.9s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes strikeFlash {
  0%   { opacity: 0; transform: scale(0.5) rotate(-6deg); }
  18%  { opacity: 1; transform: scale(1.15) rotate(-4deg); }
  35%  { opacity: 1; transform: scale(1.02) rotate(-3deg); }
  70%  { opacity: 0.9; transform: scale(1) rotate(-3deg); }
  100% { opacity: 0; transform: scale(1.25) rotate(-3deg); }
}

/* ---------- Card modal (the hockey card reveal) ---------- */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(28, 26, 23, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1.5rem;
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.card {
  position: relative;
  width: min(380px, 100%);
  background-color: var(--card);
  background-image:
    /* coffee ring stain, top-right */
    radial-gradient(ellipse 70px 50px at 88% 22%,
      var(--stain) 0%,
      rgba(96, 56, 18, 0.10) 38%,
      transparent 72%),
    /* second smaller stain, lower-left */
    radial-gradient(circle 28px at 14% 78%,
      rgba(80, 45, 20, 0.18) 0%,
      transparent 70%),
    /* diagonal crease */
    linear-gradient(118deg,
      transparent 38%,
      rgba(0,0,0,0.05) 48.5%,
      rgba(255,255,255,0.2) 49.8%,
      rgba(255,255,255,0.18) 50.2%,
      rgba(0,0,0,0.04) 51.5%,
      transparent 62%),
    /* paper grain */
    var(--noise-strong);
  background-size: auto, auto, auto, 320px 320px;
  background-blend-mode: multiply, multiply, normal, multiply;
  border: none;
  border-radius: 6px;
  padding: 0 1.25rem 1.25rem;
  text-align: center;
  overflow: hidden;
  box-shadow:
    inset 0 0 60px rgba(80, 50, 20, 0.28),
    inset 0 0 8px rgba(60, 35, 15, 0.4),
    0 18px 40px rgba(20, 15, 5, 0.55);
  animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform: rotate(-1.2deg);
}

/* Folded / dog-eared corner (bottom-right) */
.card::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 26px;
  height: 26px;
  background:
    linear-gradient(135deg,
      transparent 0%,
      transparent 49%,
      var(--paper-dark) 50%,
      var(--paper) 100%);
  border-top: 1px solid rgba(60, 40, 15, 0.5);
  border-left: 1px solid rgba(60, 40, 15, 0.5);
  z-index: 3;
  pointer-events: none;
}

/* Scuff & scratch overlay (multiply blend so text stays readable) */
.card::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(73deg,
      transparent 0,
      transparent 60px,
      rgba(0,0,0,0.05) 60px,
      rgba(0,0,0,0.05) 61px,
      transparent 62px,
      transparent 140px),
    repeating-linear-gradient(-12deg,
      transparent 0,
      transparent 110px,
      rgba(0,0,0,0.04) 110px,
      rgba(0,0,0,0.04) 111px,
      transparent 112px,
      transparent 240px);
  mix-blend-mode: multiply;
  z-index: 2;
}

@keyframes popIn {
  from { transform: rotate(-1deg) scale(0.7); opacity: 0; }
  to { transform: rotate(-1deg) scale(1); opacity: 1; }
}

.card.correct {
  box-shadow:
    inset 0 0 0 3px var(--gold-soft),
    inset 0 0 60px rgba(80, 50, 20, 0.28),
    0 18px 40px rgba(180, 140, 30, 0.45),
    0 0 60px rgba(212, 160, 23, 0.35);
}

.card.give-up {
  box-shadow:
    inset 0 0 0 2px rgba(180, 30, 50, 0.4),
    inset 0 0 60px rgba(80, 50, 20, 0.3),
    0 18px 40px rgba(20, 15, 5, 0.6);
}

/* Card top banner — the "team" stripe */
.card-banner {
  position: relative;
  margin: 0 -1.25rem;
  padding: 0.6rem 1rem 0.5rem;
  background: var(--red);
  color: var(--card);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.3rem;
  letter-spacing: 0.18em;
}

.card.correct .card-banner { background: var(--blue); }
.card.give-up .card-banner { background: var(--red-dark); }

.card-banner::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  bottom: -8px;
  height: 5px;
  background:
    linear-gradient(90deg,
      var(--gold) 0 50%,
      var(--card) 50% 100%);
}

.card-banner-star {
  font-size: 1.4rem;
  color: var(--gold);
  filter: drop-shadow(0 0 0 var(--ink));
}

/* Foil shimmer overlay — only animates on .correct */
.card-foil {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    115deg,
    transparent 30%,
    rgba(255, 255, 255, 0.6) 48%,
    rgba(255, 255, 255, 0.85) 50%,
    rgba(255, 255, 255, 0.6) 52%,
    transparent 70%
  );
  background-size: 250% 100%;
  background-position: 200% 0;
  opacity: 0;
  z-index: 5;
}

.card.correct .card-foil {
  opacity: 1;
  animation: foilSweep 2.4s ease-in-out 0.2s 2;
}

@keyframes foilSweep {
  0% { background-position: 200% 0; }
  100% { background-position: -100% 0; }
}

/* Headshot frame */
.card-headshot-frame {
  position: relative;
  width: 132px;
  height: 132px;
  margin: 1rem auto 0.5rem;
  padding: 5px;
  background:
    linear-gradient(135deg, var(--gold) 0%, var(--gold-soft) 50%, var(--gold) 100%);
  border-radius: 4px;
  box-shadow: 0 4px 14px rgba(40, 25, 10, 0.4);
}

.card.give-up .card-headshot-frame {
  background: var(--paper-dark);
  box-shadow: 0 4px 14px rgba(40, 25, 10, 0.4);
}

.card-headshot {
  width: 100%;
  height: 100%;
  border-radius: 2px;
  background: var(--card-2);
  object-fit: cover;
  display: block;
  /* Faded / yellowed look */
  filter: sepia(0.22) saturate(0.85) contrast(0.95);
}

.report-list .round-headshot {
  filter: sepia(0.22) saturate(0.85) contrast(0.95);
}

.card-close {
  position: absolute;
  top: 0.25rem;
  right: 0.5rem;
  background: transparent;
  border: none;
  color: var(--card);
  font-size: 1.6rem;
  padding: 0.05rem 0.4rem;
  z-index: 3;
  box-shadow: none;
  text-shadow: 1px 1px 0 rgba(0,0,0,0.25);
}

.card-close:hover { background: rgba(0,0,0,0.18); }

#card-name {
  margin: 0.6rem 0 0.2rem;
  font-family: 'Bebas Neue', sans-serif;
  font-weight: 400;
  font-size: 2.1rem;
  letter-spacing: 0.04em;
  line-height: 1;
  color: var(--ink);
}

.card-sub {
  color: var(--ink-soft);
  font-family: 'Oswald', sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.55rem 0.25rem 0.5rem;
  margin: 0.55rem 1rem;
  position: relative;
}

.card-sub::before,
.card-sub::after {
  content: '';
  position: absolute;
  left: 20%; right: 20%;
  height: 1px;
  background: var(--soft-border);
  opacity: 0.6;
}

.card-sub::before { top: 0; }
.card-sub::after { bottom: 0; }

.card-result {
  margin: 0.5rem 0 1rem;
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  font-size: 0.92rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.card-result.win { color: var(--green); }
.card-result.lose { color: var(--danger); }

#card-next {
  width: 100%;
}

/* ---------- End-of-game report card ---------- */

.report {
  position: relative;
  width: min(540px, 100%);
  max-height: calc(100vh - 3rem);
  display: flex;
  flex-direction: column;
  background-color: var(--card);
  background-image:
    radial-gradient(ellipse 90px 60px at 12% 8%,
      var(--stain) 0%,
      rgba(96, 56, 18, 0.08) 35%,
      transparent 75%),
    radial-gradient(circle 40px at 92% 95%,
      rgba(80, 45, 20, 0.18) 0%,
      transparent 75%),
    linear-gradient(122deg,
      transparent 38%,
      rgba(0,0,0,0.04) 49%,
      rgba(255,255,255,0.18) 50%,
      rgba(0,0,0,0.03) 51%,
      transparent 62%),
    var(--noise-strong);
  background-size: auto, auto, auto, 320px 320px;
  background-blend-mode: multiply, multiply, normal, multiply;
  border: none;
  border-radius: 6px;
  padding: 0;
  overflow: hidden;
  box-shadow:
    inset 0 0 70px rgba(80, 50, 20, 0.22),
    inset 0 0 6px rgba(60, 35, 15, 0.32),
    0 18px 40px rgba(20, 15, 5, 0.55);
  animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform: rotate(-0.5deg);
}

/* Folded corner on the report card too */
.report::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 22px;
  height: 22px;
  background:
    linear-gradient(315deg,
      transparent 0%,
      transparent 49%,
      var(--paper-dark) 50%,
      var(--paper) 100%);
  border-bottom: 1px solid rgba(60, 40, 15, 0.4);
  border-right: 1px solid rgba(60, 40, 15, 0.4);
  z-index: 3;
  pointer-events: none;
}

@keyframes popInReport {
  from { transform: rotate(-0.5deg) scale(0.7); opacity: 0; }
  to { transform: rotate(-0.5deg) scale(1); opacity: 1; }
}

.report-header {
  text-align: center;
  padding: 1.4rem 1.5rem 1.1rem;
  background: transparent;
  position: relative;
}

.report-header::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 6px;
  background:
    linear-gradient(90deg,
      var(--red) 0 33%,
      var(--gold) 33% 66%,
      var(--blue) 66% 100%);
}

.report-subtitle {
  margin: 0.5rem 0 0.25rem;
  font-family: 'Oswald', sans-serif;
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
}

.report-header h2 {
  margin: 0;
  font-family: 'Bebas Neue', sans-serif;
  font-weight: 400;
  font-size: 1rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.score-big {
  font-family: 'Bebas Neue', sans-serif;
  font-weight: 400;
  font-size: 4.6rem;
  font-variant-numeric: tabular-nums;
  color: var(--red);
  line-height: 1;
  margin: 0.25rem 0 0.1rem;
  letter-spacing: 0.02em;
}

.score-max {
  color: var(--muted);
  font-size: 1.8rem;
  font-weight: 400;
  margin-left: 0.15rem;
}

.report-rating {
  margin: 0.25rem 0 0.35rem;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--blue);
  line-height: 1;
}

.report-summary {
  margin: 0;
  color: var(--ink-soft);
  font-family: 'Oswald', sans-serif;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.report-list {
  list-style: none;
  margin: 0;
  padding: 0.5rem 1rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.report-list li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.25rem;
  font-family: 'Oswald', sans-serif;
  font-size: 0.95rem;
}

.report-list li + li {
  margin-top: 0.05rem;
}

.report-list .round-num {
  width: 1.6rem;
  text-align: right;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.3rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.report-list .round-headshot {
  width: 40px;
  height: 40px;
  border-radius: 3px;
  background: var(--card-2);
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(40, 25, 10, 0.3);
}

.report-list .round-player {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-weight: 500;
}

.report-list .round-detail {
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.report-list .round-points {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.5rem;
  font-variant-numeric: tabular-nums;
  min-width: 2.6rem;
  text-align: right;
  line-height: 1;
}

.report-list li.win .round-points { color: var(--green); }
.report-list li.lose .round-points { color: var(--danger); }

/* ---------- Report share section ---------- */

.report-share {
  padding: 1rem 1.25rem 0.5rem;
  text-align: center;
}

.share-label {
  font-family: 'Oswald', sans-serif;
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
  margin-bottom: 0.6rem;
}

.share-buttons {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.share-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem 0.65rem 0.55rem;
  border-radius: 4px;
  font-family: 'Oswald', sans-serif;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: none;
  cursor: pointer;
  transition: transform 0.06s, box-shadow 0.1s, filter 0.15s;
  min-width: 64px;
  color: var(--card);
}

.share-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  background: rgba(255, 255, 255, 0.18);
  color: inherit;
}

.share-name {
  font-size: 0.7rem;
}

.share-btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
.share-btn:active { transform: translateY(1px); filter: brightness(0.95); }

.share-sms {
  background: #34c759;
  box-shadow: 0 2px 0 #1ea344;
}

.share-whatsapp {
  background: #25d366;
  box-shadow: 0 2px 0 #128c4d;
}

.share-facebook {
  background: #1877f2;
  box-shadow: 0 2px 0 #0e54b0;
}

.share-instagram {
  background:
    radial-gradient(circle at 30% 110%, #fdf497 0%, #fdf497 5%, #fd5949 45%, #d6249f 60%, #285aeb 90%);
  box-shadow: 0 2px 0 #952b86;
}

.share-toast {
  margin-top: 0.7rem;
  display: inline-block;
  padding: 0.4rem 0.8rem;
  background: var(--ink);
  color: var(--gold);
  font-family: 'Oswald', sans-serif;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border-radius: 3px;
  animation: toastIn 0.25s ease;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Next-puzzle countdown (daily mode) */
.next-puzzle {
  margin: 0.5rem 1.5rem 1.25rem;
  padding: 0.9rem 1rem 1rem;
  text-align: center;
  background:
    repeating-linear-gradient(45deg,
      transparent 0,
      transparent 14px,
      rgba(23, 59, 106, 0.06) 14px,
      rgba(23, 59, 106, 0.06) 16px),
    rgba(23, 59, 106, 0.08);
  border-left: 3px solid var(--blue);
  border-radius: 0;
  align-self: stretch;
}

.next-label {
  font-family: 'Oswald', sans-serif;
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
  margin-bottom: 0.2rem;
}

.next-countdown {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 2.4rem;
  letter-spacing: 0.06em;
  color: var(--blue);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.next-hint {
  margin-top: 0.4rem;
  font-family: 'Oswald', sans-serif;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

#report-again {
  margin: 0.5rem 1.5rem 1.25rem;
  align-self: center;
  padding: 0.85rem 2.2rem;
  background: var(--blue);
  color: var(--card);
  font-size: 1rem;
}

#report-again:hover { background: #0a2c54; color: var(--card); }

/* ---------- Responsive ---------- */

@media (max-width: 600px) {
  header { padding: 1rem 1rem 0.7rem; }
  h1 { font-size: 1.7rem; }
  main { padding: 1.5rem 1rem 2rem; }
  .panel { padding: 1.25rem 0.9rem 1rem; }
  .totals-row { grid-template-columns: repeat(5, 1fr); gap: 0.25rem; }
  .totals-row .stat { font-size: 0.55rem; padding: 0.3rem 0.2rem; }
  .totals-row .stat strong { font-size: 1.2rem; }
  .meta { gap: 0.9rem; font-size: 0.75rem; }
  .card { width: 100%; }
}
