/* ==========================================================================
   Shanghai Rummy — Daily Challenge page
   Loaded only on /daily-challenge. Extends css/style.css; defines no base rules.
   1. Hero   2. Grid   3. Board   4. Solution   5. Sidebar   6. How / Previous
   ========================================================================== */

/* 1. Hero ------------------------------------------------------------------ */
.dc-hero {
  padding: var(--space-7) 0 var(--space-5);
  background: radial-gradient(120% 70% at 50% 0%, #fbf9f4 0%, var(--cream) 60%, var(--cream-2) 100%);
}
.dc-hero h1 { text-align: center; font-size: clamp(28px, 5vw, 46px); font-weight: 800; color: var(--navy); }
.dc-hero .lede { margin-top: var(--space-3); }

.dc-meta {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap;
  gap: var(--space-4); margin-top: var(--space-5); font-size: 15px; color: #46536b;
}
.dc-meta svg { width: 17px; height: 17px; color: var(--navy); }
.dc-date { display: inline-flex; align-items: center; gap: var(--space-2); font-weight: 500; }
.dc-sep { width: 1px; height: 20px; background: var(--cream-2); }
.dc-countdown {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: 7px var(--space-4); border-radius: var(--r-pill);
  background: var(--paper); border: 1px solid var(--cream-2); box-shadow: var(--shadow-sm);
}
.dc-countdown strong { font-variant-numeric: tabular-nums; letter-spacing: .02em; color: var(--navy); }

/* 2. Grid ------------------------------------------------------------------ */
.dc-body { padding-bottom: var(--space-7); }
.dc-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: var(--space-5); align-items: start; }
.dc-board-col { display: flex; flex-direction: column; gap: var(--space-4); min-width: 0; }
.dc-side { display: flex; flex-direction: column; gap: var(--space-4); }

/* 3. Board ----------------------------------------------------------------- */
.dc-topbar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }

.dc-contract {
  display: inline-flex; align-items: center; gap: var(--space-3);
  padding: 8px var(--space-4); border-radius: var(--r-md);
  background: rgba(10,26,20,.5); border: 1px solid rgba(255,255,255,.22);
}
.dc-contract svg { width: 21px; height: 21px; color: var(--gold); }
.dc-contract span { display: flex; flex-direction: column; line-height: 1.2; }
.dc-contract small { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: rgba(255,255,255,.72); }
.dc-contract strong { font-size: 15px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }

.dc-stats {
  display: inline-flex; align-items: center; gap: var(--space-4);
  padding: 8px var(--space-5); border-radius: var(--r-md);
  background: rgba(10,26,20,.5); border: 1px solid rgba(255,255,255,.22);
}
.dc-stats > span { display: inline-flex; align-items: baseline; gap: 8px; }
.dc-stats small { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: rgba(255,255,255,.72); }
.dc-stats strong { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.dc-stat-sep { width: 1px; height: 20px; background: rgba(255,255,255,.22); }

/* Contract melds being built, with empty slots showing what's still needed */
.dc-melds { display: flex; justify-content: center; flex-wrap: wrap; gap: var(--space-6); margin: var(--space-5) 0 var(--space-4); }
.dc-meld { display: flex; flex-direction: column; align-items: center; gap: 7px; }
.dc-meld-label { font-size: 12px; color: rgba(255,255,255,.82); letter-spacing: .03em; }
.dc-meld-label b { font-weight: 600; }
.dc-meld-cards { display: flex; gap: 4px; }
.dc-slot {
  width: 52px; height: 74px; flex: none; border-radius: var(--r-sm);
  border: 2px dashed rgba(255,255,255,.42); background: rgba(255,255,255,.05);
  transition: border-color var(--t), background-color var(--t);
}
.dc-meld.is-target .dc-slot { border-color: var(--gold); background: rgba(201,169,97,.16); }
.dc-meld.is-complete .dc-meld-label { color: #9fe0bf; }
.dc-meld button.card { cursor: pointer; }

.dc-hand-label { margin-top: var(--space-4); font-size: 13px; color: rgba(255,255,255,.82); }

/* 4. Solution panel -------------------------------------------------------- */
.dc-solution {
  padding: var(--space-5) var(--space-6);
  background: var(--paper); border: 1px solid var(--cream-2);
  border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
}
.dc-solution-head { display: flex; align-items: center; gap: var(--space-4); }
.dc-lock {
  display: grid; place-items: center; width: 54px; height: 54px; flex: none;
  border-radius: 50%; background: var(--cream-2); color: var(--navy);
}
.dc-lock svg { width: 24px; height: 24px; }
.dc-solution.is-solved .dc-lock { background: #dff0e7; color: var(--green); }
.dc-solution h2 { font-size: clamp(19px, 2.4vw, 25px); font-weight: 700; color: var(--navy); }
.dc-solution-head p { margin-top: 5px; font-size: 15px; color: #4b5768; }

.dc-result-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-4);
  margin-top: var(--space-5); padding-top: var(--space-5); border-top: 1px solid var(--cream-2);
}
.dc-result { text-align: center; padding: 0 var(--space-3); }
.dc-result + .dc-result { border-left: 1px solid var(--cream-2); }
.dc-result-label { font-size: 13px; font-weight: 600; color: var(--navy); }
.dc-result-value {
  margin-top: 6px; font-family: var(--font-display); font-size: 26px; font-weight: 700;
  color: var(--navy); font-variant-numeric: tabular-nums; line-height: 1.2;
}
.dc-result-note { margin-top: 4px; font-size: 12.5px; color: var(--muted); }

.dc-share { display: flex; justify-content: center; gap: 7px; margin-top: 8px; }
.dc-suit {
  width: 40px; height: 40px; display: grid; place-items: center;
  border: 1px solid var(--cream-2); border-radius: var(--r-sm);
  background: var(--cream); color: var(--navy); font-size: 17px;
  transition: background-color var(--t), transform var(--t);
}
.dc-suit.is-red { color: #c0293b; }
.dc-suit:disabled { opacity: .45; cursor: not-allowed; }
.dc-suit:not(:disabled):hover { background: var(--cream-2); transform: translateY(-2px); }

/* 5. Sidebar --------------------------------------------------------------- */
.side-card {
  padding: var(--space-5); background: var(--paper);
  border: 1px solid var(--cream-2); border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
}
.side-card h2 {
  display: flex; align-items: center; gap: var(--space-3);
  font-size: 19px; font-weight: 700; color: var(--navy);
}
.side-card h2 svg { width: 19px; height: 19px; color: var(--gold); }

.dc-rules { margin-top: var(--space-4); display: grid; gap: var(--space-3); counter-reset: r; }
.dc-rules li {
  counter-increment: r; display: flex; align-items: center; gap: var(--space-3);
  font-size: 14.5px; color: #3f4b5e;
}
.dc-rules li::before {
  content: counter(r);
  display: grid; place-items: center; width: 26px; height: 26px; flex: none;
  border-radius: 50%; background: var(--cream-2); color: var(--navy);
  font-size: 12.5px; font-weight: 700;
}

.dc-progress-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-2); margin-top: var(--space-4); text-align: center; }
.dc-progress-stats strong {
  display: block; font-family: var(--font-display); font-size: 25px; font-weight: 700;
  color: var(--navy); font-variant-numeric: tabular-nums; line-height: 1.2;
}
.dc-progress-stats span { font-size: 12px; color: var(--muted); line-height: 1.35; }
.dc-bar { height: 7px; margin-top: var(--space-4); border-radius: var(--r-pill); background: var(--cream-2); overflow: hidden; }
.dc-bar span {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--green-light), var(--green));
  border-radius: var(--r-pill); transition: width 320ms cubic-bezier(.4,0,.2,1);
}
/* Progress widths as classes, so JS never writes a style attribute. */
.dc-bar .fill-0 { width: 0%; }
.dc-bar .fill-5 { width: 5%; }
.dc-bar .fill-10 { width: 10%; }
.dc-bar .fill-15 { width: 15%; }
.dc-bar .fill-20 { width: 20%; }
.dc-bar .fill-25 { width: 25%; }
.dc-bar .fill-30 { width: 30%; }
.dc-bar .fill-35 { width: 35%; }
.dc-bar .fill-40 { width: 40%; }
.dc-bar .fill-45 { width: 45%; }
.dc-bar .fill-50 { width: 50%; }
.dc-bar .fill-55 { width: 55%; }
.dc-bar .fill-60 { width: 60%; }
.dc-bar .fill-65 { width: 65%; }
.dc-bar .fill-70 { width: 70%; }
.dc-bar .fill-75 { width: 75%; }
.dc-bar .fill-80 { width: 80%; }
.dc-bar .fill-85 { width: 85%; }
.dc-bar .fill-90 { width: 90%; }
.dc-bar .fill-95 { width: 95%; }
.dc-bar .fill-100 { width: 100%; }

.dc-progress-note { margin-top: var(--space-3); font-size: 13px; color: #4b5768; }

.dc-board { width: 100%; margin-top: var(--space-4); border-collapse: collapse; font-size: 13.5px; }
.dc-board th {
  padding: 0 6px 8px; text-align: left; font-size: 10.5px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
  border-bottom: 1px solid var(--cream-2);
}
.dc-board th:nth-child(3), .dc-board th:nth-child(4),
.dc-board td:nth-child(3), .dc-board td:nth-child(4) { text-align: right; }
.dc-board td { padding: 9px 6px; border-bottom: 1px solid var(--cream-2); font-variant-numeric: tabular-nums; }
.dc-board tbody tr:last-child td { border-bottom: 0; }
.dc-board .dc-player { display: flex; align-items: center; gap: 8px; }
.dc-avatar {
  display: grid; place-items: center; width: 26px; height: 26px; flex: none;
  border-radius: 50%; background: var(--navy); color: #fff; font-size: 10px; font-weight: 700;
}
.dc-board tr.is-you { background: var(--cream); }
.dc-board tr.is-you .dc-avatar { background: var(--gold); color: #241a06; }
.dc-board tr.is-you td { font-weight: 600; color: var(--navy); }
.dc-board tr.is-you td:last-child { white-space: nowrap; font-size: 12px; }
.dc-sample-note { margin-top: var(--space-3); font-size: 11.5px; color: var(--muted-light); font-style: italic; }

/* 6. How it works / Previous ----------------------------------------------- */
.dc-how { padding: var(--space-8) 0; background: var(--paper); border-top: 1px solid var(--cream-2); }
.dc-how h2, .dc-previous h2 { font-size: clamp(23px, 3.4vw, 32px); font-weight: 700; color: var(--navy); }
.dc-how-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-5); margin-top: var(--space-6); }
.dc-how-card { background: var(--cream); border: 1px solid var(--cream-2); border-radius: var(--r-lg); overflow: hidden; }
.dc-how-card .thumb { height: 150px; }
.dc-how-body { padding: var(--space-5); }
.dc-how-body h3 { font-size: 19px; font-weight: 700; color: var(--navy); }
.dc-how-body p { margin-top: var(--space-2); font-size: 14.5px; color: #4b5768; }

.thumb-pair { background: linear-gradient(150deg, #6b4a2c, #3f2a17); display: grid; place-items: center; }
.thumb-card {
  position: absolute; top: 50%; width: 56px; height: 78px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border-radius: 5px; background: var(--paper); border: 1px solid rgba(0,0,0,.16);
  box-shadow: 0 7px 14px rgba(0,0,0,.45);
}
.thumb-card:first-child { left: 50%; transform: translate(-92%,-52%) rotate(-9deg); }
.thumb-card:last-child  { left: 50%; transform: translate(-8%,-48%) rotate(7deg); }
.thumb-card b { font-size: 21px; font-weight: 700; line-height: 1; }
.thumb-card i { font-size: 24px; font-style: normal; line-height: 1; }
.thumb-card.is-black { color: var(--ink); }
.thumb-card.is-red { color: #c0293b; }
.thumb-deck { background: linear-gradient(150deg, #23543f, #143024); }
.thumb-deck::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 96px; height: 68px; transform: translate(-50%,-50%);
  border-radius: 6px;
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,.10) 0 4px, transparent 4px 8px),
    linear-gradient(160deg, #33507f, #22375c);
  border: 3px solid var(--paper);
  box-shadow: 0 7px 14px rgba(0,0,0,.45);
}
.thumb-streak { background: linear-gradient(150deg, #8a6a44, #573a1f); display: grid; place-items: center; }
.thumb-streak span {
  padding: 14px 18px; border-radius: 3px; background: #f6f1e4; color: #4a3a24;
  font-family: var(--font-display); font-size: 12px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; text-align: center; line-height: 1.8;
  box-shadow: 0 5px 12px rgba(0,0,0,.32);
}

.dc-previous { padding: var(--space-8) 0; }
.dc-prev-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: var(--space-3); margin-top: var(--space-6); }
.dc-prev {
  padding: var(--space-4) var(--space-3); text-align: center;
  background: var(--paper); border: 1px solid var(--cream-2);
  border-radius: var(--r-md); box-shadow: var(--shadow-sm);
}
.dc-prev-date { font-size: 13px; font-weight: 700; color: var(--navy); }
.dc-prev-contract { margin-top: 3px; font-size: 11.5px; color: var(--muted); line-height: 1.4; min-height: 32px; }
.dc-prev-mark {
  display: grid; place-items: center; width: 28px; height: 28px; margin: var(--space-3) auto 0;
  border-radius: 50%; background: var(--cream-2); color: var(--muted-light);
}
.dc-prev-mark svg { width: 15px; height: 15px; }
.dc-prev.is-done .dc-prev-mark { background: var(--green); color: #fff; }
.dc-prev-result { margin-top: 7px; font-size: 11.5px; color: var(--muted); line-height: 1.45; font-variant-numeric: tabular-nums; }

.footer-brand { display: flex; flex-direction: column; gap: var(--space-3); }
.footer-tag { color: rgba(255,255,255,.6); }

/* Responsive --------------------------------------------------------------- */
@media (max-width: 1024px) {
  .dc-grid { grid-template-columns: 1fr; }
  .dc-side { display: grid; grid-template-columns: repeat(2, 1fr); align-items: start; }
  .dc-prev-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 860px) {
  .dc-how-grid { grid-template-columns: 1fr; }
  .dc-how-card .thumb { height: 170px; }
}
@media (max-width: 720px) {
  .dc-side { grid-template-columns: 1fr; }
  .dc-topbar { gap: var(--space-2); }
  .dc-contract, .dc-stats { padding: 6px var(--space-3); }
  .dc-contract strong { font-size: 13px; }
  .dc-stats { gap: var(--space-3); }
  .dc-melds { gap: var(--space-4); margin: var(--space-4) 0 var(--space-3); }
  .dc-slot { width: 42px; height: 60px; }
  .dc-result-grid { grid-template-columns: 1fr; gap: var(--space-4); }
  .dc-result + .dc-result { border-left: 0; border-top: 1px solid var(--cream-2); padding-top: var(--space-4); }
  .dc-prev-grid { grid-template-columns: repeat(2, 1fr); }
  .dc-solution { padding: var(--space-4); }
  .dc-solution-head { flex-direction: column; text-align: center; }
}
@media (max-width: 420px) {
  .dc-slot { width: 36px; height: 52px; }
  .dc-meta { gap: var(--space-3); }
  .dc-sep { display: none; }
}
