/* ==========================================================================
   Zip — "Neon Trail" aesthetic
   Game widget + /play-zip & /zip-answer-today page styles.
   ========================================================================== */

:root {
  --z-ink: #0e151e;          /* near-black base          */
  --z-ink-2: #15202c;        /* panel surface            */
  --z-ink-3: #243443;        /* raised / borders         */
  --z-teal: #2dd4bf;         /* the trail                */
  --z-teal-2: #5eead4;       /* trail highlight          */
  --z-coral: #fb7185;        /* walls                    */
  --z-cream: #e9f3f1;        /* text on dark             */
  --z-muted: #8ba0a8;        /* muted on dark            */
  --z-cell: #f3f8f8;         /* light cell               */
  --z-line: rgba(233,243,241,0.12);
  --z-radius: 16px;
  --z-display: 'Fraunces', Georgia, serif;
}

/* ---- Page hero / sections ----------------------------------------------- */

.zip-page { max-width: 980px; margin: 0 auto; padding: 20px 16px 56px; }
.zip-hero { text-align: center; margin: 8px 0 24px; }
.zip-hero .z-eyebrow { font: 600 0.78rem/1 var(--z-display); letter-spacing: 0.22em; text-transform: uppercase; color: #0f8c7e; margin-bottom: 12px; }
.zip-hero h1 { font: 600 clamp(2rem, 5vw, 3rem)/1.05 var(--z-display); color: var(--z-ink); margin: 0 0 10px; letter-spacing: -0.01em; }
.zip-hero h1 em { font-style: italic; color: #0f8c7e; }
.zip-hero p { color: #4b5a62; max-width: 60ch; margin: 0 auto; font-size: 1.05rem; }

/* ---- Game panel --------------------------------------------------------- */

.z-game {
  background: radial-gradient(130% 90% at 50% -10%, #1c2c3a 0%, var(--z-ink-2) 55%, var(--z-ink) 100%);
  border: 1px solid var(--z-ink-3); border-radius: var(--z-radius);
  padding: 18px 18px 22px; color: var(--z-cream); position: relative; overflow: hidden;
  box-shadow: 0 24px 60px -28px rgba(6,12,18,0.85), inset 0 1px 0 rgba(255,255,255,0.05);
}
.z-game::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0.4;
  background-image: radial-gradient(rgba(45,212,191,0.07) 1px, transparent 1px); background-size: 22px 22px; }

.z-toolbar { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; margin-bottom: 12px; position: relative; z-index: 1; }
.z-seg { display: inline-flex; gap: 4px; background: rgba(255,255,255,0.04); border: 1px solid var(--z-line); border-radius: 11px; padding: 4px; }
.z-seg-btn { font: 600 0.85rem/1 system-ui, sans-serif; color: var(--z-muted); background: none; border: 0; border-radius: 8px; padding: 8px 12px; cursor: pointer; transition: all 0.15s ease; }
.z-seg-btn:hover { color: var(--z-cream); }
.z-seg-btn.is-active { color: var(--z-ink); background: linear-gradient(180deg, var(--z-teal-2), var(--z-teal)); }

.z-statusbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; position: relative; z-index: 1; }
.z-chip { font: 600 0.85rem/1 system-ui, sans-serif; padding: 7px 12px; border-radius: 999px; background: rgba(255,255,255,0.05); border: 1px solid var(--z-line); }
.z-timer { font-variant-numeric: tabular-nums; min-width: 54px; text-align: center; }
.z-remain { color: var(--z-teal-2); }
.z-actions { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.z-btn { font: 600 0.9rem/1 system-ui, sans-serif; color: var(--z-cream); background: rgba(255,255,255,0.05); border: 1px solid var(--z-line); border-radius: 10px; padding: 10px 14px; cursor: pointer; transition: all 0.15s ease; }
.z-btn:hover { background: rgba(255,255,255,0.1); border-color: rgba(45,212,191,0.5); transform: translateY(-1px); }
.z-btn-primary { color: var(--z-ink); background: linear-gradient(180deg, var(--z-teal-2), var(--z-teal)); border-color: var(--z-teal-2); }
.z-btn-primary:hover { filter: brightness(1.05); }

/* ---- Board -------------------------------------------------------------- */

.z-board-wrap { position: relative; display: flex; justify-content: center; z-index: 1; }
.z-board {
  --n: 6; position: relative;
  display: grid; grid-template-columns: repeat(var(--n), 1fr); grid-template-rows: repeat(var(--n), 1fr);
  width: min(100%, 440px); aspect-ratio: 1/1;
  background: var(--z-cell); border-radius: 14px; overflow: hidden;
  box-shadow: 0 16px 40px -20px rgba(0,0,0,0.6); touch-action: none; -webkit-user-select: none; user-select: none;
}
.z-cell { position: relative; border: 1px solid #dde7e7; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.z-cell.is-on { background: rgba(45,212,191,0.14); }
.z-num {
  position: relative; z-index: 2; width: 62%; aspect-ratio: 1; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--z-ink); color: var(--z-cream); font: 700 clamp(0.8rem, 3.2vw, 1.15rem)/1 system-ui, sans-serif;
  box-shadow: 0 2px 6px -2px rgba(0,0,0,0.4);
}
.z-cell.is-hint::after { content: ""; position: absolute; inset: 10%; border-radius: 8px; box-shadow: 0 0 0 3px var(--z-teal), 0 0 14px var(--z-teal); animation: z-pulse 0.7s ease-in-out infinite alternate; z-index: 3; }

.z-overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }
.z-overlay .z-walls line { stroke: var(--z-coral); stroke-width: 0.16; stroke-linecap: round; }
.z-overlay .z-path { fill: none; stroke: var(--z-teal); stroke-width: 0.34; stroke-linejoin: round; stroke-linecap: round; filter: drop-shadow(0 0 0.12px var(--z-teal)); opacity: 0.9; }
.z-overlay .z-path.is-won { stroke: var(--z-teal-2); animation: z-glow 1s ease-in-out infinite alternate; }

@keyframes z-pulse { from { opacity: 0.5; } to { opacity: 1; } }
@keyframes z-glow { from { filter: drop-shadow(0 0 1px var(--z-teal)); } to { filter: drop-shadow(0 0 6px var(--z-teal-2)); } }

/* ---- Win overlay -------------------------------------------------------- */

.z-win { position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center; background: rgba(8,14,20,0.74); backdrop-filter: blur(4px); }
.z-win[hidden] { display: none; }
.z-win-card { background: linear-gradient(180deg, var(--z-ink-3), var(--z-ink-2)); border: 1px solid rgba(45,212,191,0.4); border-radius: 16px; padding: 26px 28px; text-align: center; max-width: 340px; box-shadow: 0 30px 70px -25px rgba(0,0,0,0.85); }
.z-win-card h3 { font: 600 1.9rem/1 var(--z-display); color: var(--z-teal-2); margin: 0 0 6px; }
.z-win-sub { color: var(--z-muted); font-size: 0.95rem; margin: 0 0 18px; }
.z-win-actions { display: flex; gap: 10px; justify-content: center; }
.z-win-copied { color: #7fe0a8; font-size: 0.85rem; margin: 12px 0 0; }

.z-msg { text-align: center; color: var(--z-muted); min-height: 1.2em; margin: 12px 0 4px; position: relative; z-index: 1; font-size: 0.92rem; }
.z-statsbar { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 22px; margin-top: 8px; padding-top: 14px; border-top: 1px solid var(--z-line); color: var(--z-muted); font-size: 0.85rem; position: relative; z-index: 1; }
.z-statsbar b { color: var(--z-teal-2); }

/* ---- Content sections --------------------------------------------------- */

.zip-section { margin: 40px 0 0; }
.zip-section h2 { font: 600 1.6rem/1.2 var(--z-display); color: var(--z-ink); margin: 0 0 14px; }
.zip-section h3 { font: 600 1.15rem/1.3 var(--z-display); color: var(--z-ink); margin: 22px 0 8px; }
.zip-section p, .zip-section li { color: #41505a; font-size: 1.02rem; line-height: 1.7; }
.zip-section ul, .zip-section ol { padding-left: 1.25em; margin: 10px 0; }
.zip-section li { margin: 6px 0; }

.z-rules { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin: 18px 0; }
.z-rule-card { background: #fff; border: 1px solid #e3ebeb; border-left: 4px solid var(--z-teal); border-radius: 12px; padding: 16px 18px; box-shadow: 0 4px 14px -10px rgba(14,21,30,0.4); }
.z-rule-card .z-rule-n { font: 700 0.78rem/1 system-ui; color: #0f8c7e; letter-spacing: 0.08em; }
.z-rule-card h4 { margin: 8px 0 4px; font-size: 1.02rem; color: var(--z-ink); }
.z-rule-card p { font-size: 0.92rem; color: #56646c; margin: 0; }

.z-faq details { background: #fff; border: 1px solid #e3ebeb; border-radius: 12px; padding: 4px 18px; margin: 10px 0; }
.z-faq details[open] { box-shadow: 0 8px 22px -14px rgba(14,21,30,0.5); }
.z-faq summary { cursor: pointer; list-style: none; padding: 14px 0; font: 600 1.02rem/1.4 system-ui, sans-serif; color: var(--z-ink); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.z-faq summary::-webkit-details-marker { display: none; }
.z-faq summary::after { content: "+"; font: 400 1.4rem/1 var(--z-display); color: var(--z-teal); }
.z-faq details[open] summary::after { content: "–"; }
.z-faq details p { margin: 0 0 14px; }

.zip-cross { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 16px; }
.zip-cross a { display: block; text-align: center; padding: 14px 10px; border-radius: 11px; background: #fff; border: 1px solid #e3ebeb; color: var(--z-ink); font-weight: 600; text-decoration: none; transition: all 0.15s ease; }
.zip-cross a:hover { border-color: var(--z-teal); transform: translateY(-2px); box-shadow: 0 8px 20px -12px rgba(14,21,30,0.5); }

/* ==========================================================================
   /zip-answer-today
   ========================================================================== */

.za-puzzle-num { display: inline-block; margin-top: 8px; font: 600 0.95rem/1 system-ui, sans-serif; color: #0f8c7e; background: #e6f7f4; border: 1px solid #bfe9e2; padding: 6px 13px; border-radius: 999px; }
.za-answerbox { background: linear-gradient(180deg, #fbfffe, #fff); border: 1px solid #e1ecea; border-radius: 16px; padding: 22px; box-shadow: 0 14px 36px -24px rgba(14,21,30,0.5); margin: 8px 0 26px; }
.za-meta { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.za-tag { font: 600 0.82rem/1 system-ui; padding: 7px 12px; border-radius: 999px; background: #eef4f3; color: #4c5a60; border: 1px solid #dcebe8; }
.za-tag b { color: var(--z-ink); }
.za-tag.is-diff { background: #e6f7f4; color: #0f7e72; border-color: #bfe9e2; }
.za-firstmove { color: #4b5a62; font-size: 0.98rem; margin: 0 0 18px; }
.za-firstmove strong { color: var(--z-ink); }

.za-reveal { text-align: center; }
.za-reveal-btn { font: 600 1rem/1 system-ui; cursor: pointer; color: var(--z-ink); background: linear-gradient(180deg, var(--z-teal-2), var(--z-teal)); border: 0; border-radius: 12px; padding: 13px 22px; box-shadow: 0 6px 18px -8px rgba(45,212,191,0.7); }
.za-reveal-btn:hover { filter: brightness(1.05); }
.za-reveal-btn small { display: block; font-weight: 500; font-size: 0.72rem; color: #0c5f56; margin-top: 3px; }
.za-hidden { display: none; }

.za-solution { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 22px; align-items: start; }
@media (max-width: 600px) { .za-solution { grid-template-columns: 1fr; } }
.za-grid { position: relative; width: 100%; max-width: 320px; aspect-ratio: 1/1; margin: 0 auto; display: grid; background: var(--z-cell); border-radius: 12px; overflow: hidden; box-shadow: 0 12px 30px -18px rgba(0,0,0,0.4); }
.za-grid .za-cell { position: relative; border: 1px solid #dde7e7; display: flex; align-items: center; justify-content: center; }
.za-grid .za-num { width: 60%; aspect-ratio: 1; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--z-ink); color: var(--z-cream); font: 700 0.85rem/1 system-ui; z-index: 2; }
.za-grid .za-overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.za-grid .za-path { fill: none; stroke: var(--z-teal); stroke-width: 0.34; stroke-linejoin: round; stroke-linecap: round; }

.za-copybox h3 { font: 600 1.05rem/1.3 var(--z-display); color: var(--z-ink); margin: 0 0 10px; }
.za-pathtext { font: 600 0.84rem/1.6 ui-monospace, Menlo, monospace; color: #41505a; word-break: break-word; background: #f4f8f8; border: 1px solid #e1ecea; border-radius: 10px; padding: 12px; margin: 0 0 12px; }
.za-pathtext b { color: #0f8c7e; }
.za-copy { font: 600 0.85rem/1 system-ui; cursor: pointer; color: var(--z-ink); background: #fff; border: 1px solid #dbeae6; border-radius: 9px; padding: 9px 14px; }
.za-copy:hover { border-color: var(--z-teal); }
.za-copied { color: #2e9e6b; font-size: 0.82rem; margin-left: 8px; }

.za-hints { display: grid; gap: 10px; margin-top: 6px; }
.za-hint { background: #fff; border: 1px solid #e3ebeb; border-radius: 12px; overflow: hidden; }
.za-hint-btn { width: 100%; text-align: left; cursor: pointer; background: none; border: 0; padding: 15px 18px; display: flex; justify-content: space-between; align-items: center; gap: 12px; font: 600 1rem/1.3 system-ui; color: var(--z-ink); }
.za-hint-btn:hover { background: #f5faf9; }
.za-hint-btn .za-hint-cue { font: 500 0.82rem/1 system-ui; color: var(--z-teal); }
.za-hint-body { padding: 0 18px 16px; color: #475560; line-height: 1.6; }

.za-yesterday { background: #f1f6f6; border: 1px dashed #d3e3e0; border-radius: 12px; padding: 16px 18px; margin-top: 22px; }
.za-yesterday h3 { font: 600 1.05rem/1 var(--z-display); color: var(--z-ink); margin: 0 0 6px; }
.za-yesterday p { margin: 0; color: #4b5a62; font-size: 0.95rem; }
.za-yesterday a { color: #0f8c7e; font-weight: 600; text-decoration: none; }

@media (max-width: 560px) {
  .z-game { padding: 14px 12px 18px; }
  .z-toolbar { gap: 8px; } .z-seg { width: 100%; justify-content: center; }
  .z-actions { width: 100%; margin-left: 0; } .z-actions .z-btn { flex: 1; padding: 10px 6px; }
}
@media (prefers-reduced-motion: reduce) { .z-overlay .z-path.is-won, .z-cell.is-hint::after { animation: none !important; } }
