:root {
  --cream: #FBF4EA;
  --paper: #FFFDF8;
  --ink: #3B2F2A;
  --muted: #7A6A60;
  --line: #E9DCCB;
  --accent: #E07A4F;
  --accent-dark: #B95A33;
  --sage: #7FA37A;
  --radius: 18px;
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--cream); color: var(--ink); font-family: var(--font); font-size: 17px; line-height: 1.65; }
a { color: var(--accent-dark); }
img { max-width: 100%; height: auto; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 18px; }

/* Header */
.site-head { border-bottom: 1px solid var(--line); background: var(--paper); }
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 800; font-size: 20px; letter-spacing: .2px; }
.brand svg { width: 34px; height: 34px; }
.nav { display: flex; gap: 18px; font-size: 15px; }
.nav a { color: var(--ink); text-decoration: none; font-weight: 600; }
.nav a:hover { color: var(--accent-dark); }

/* Hero + player */
.hero { padding: 22px 0 8px; }
.hero h1 { margin: 0 0 4px; font-size: clamp(30px, 5vw, 44px); line-height: 1.1; letter-spacing: -.5px; }
.hero .lede { margin: 0 0 16px; color: var(--muted); font-size: 16px; }
.stage { position: relative; width: 100%; aspect-ratio: 16 / 10; background: #2E2420; border-radius: var(--radius); overflow: hidden; box-shadow: 0 10px 30px rgba(59,47,42,.18); }
.stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.cover { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; cursor: pointer; background: var(--paper); }
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: saturate(.95); }
.cover::after { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at center, rgba(251,244,234,.15) 0%, rgba(59,47,42,.28) 100%); }
.cover[hidden], [data-gf-state] .cover { display: none; }
.play-btn { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 10px; padding: 16px 30px; border: 0; border-radius: 999px; background: var(--accent); color: #fff; font: 800 20px/1 var(--font); box-shadow: 0 8px 22px rgba(185,90,51,.45); cursor: pointer; transition: transform .15s; }
.play-btn:hover { transform: translateY(-2px); background: var(--accent-dark); }
.play-btn svg { width: 22px; height: 22px; }
.loader { position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 18px; background: var(--paper); color: var(--ink); font-weight: 700; }
[data-gf-state="loading"] .loader { display: flex; }
.paws { display: flex; gap: 12px; }
.paws span { width: 18px; height: 18px; border-radius: 50%; background: var(--accent); animation: hop 1s ease-in-out infinite; }
.paws span:nth-child(2) { animation-delay: .15s; background: var(--sage); }
.paws span:nth-child(3) { animation-delay: .3s; background: #E9B949; }
@keyframes hop { 0%, 100% { transform: translateY(0); opacity: .5; } 50% { transform: translateY(-14px); opacity: 1; } }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0 6px; }
.act { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); color: var(--ink); font: 700 15px/1 var(--font); cursor: pointer; }
.act:hover { border-color: var(--accent); }
.act svg { width: 18px; height: 18px; }
.act[aria-pressed="true"] { background: #FCE3D6; border-color: var(--accent); color: var(--accent-dark); }
.act[aria-pressed="true"] svg path { fill: var(--accent); }
.share-msg { align-self: center; color: var(--sage); font-size: 14px; font-weight: 700; }

/* Article */
.article { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 28px 22px; margin: 22px auto; }
.article h2 { font-size: 26px; margin: 30px 0 8px; line-height: 1.25; }
.article h3 { font-size: 19px; margin: 22px 0 6px; }
.article, .comments, .page-body { max-width: 820px; }
.article p, .article li { max-width: none; }
.article img { display: block; width: 100%; max-width: 460px; margin: 12px auto; border-radius: 14px; border: 1px solid var(--line); }
.article table { border-collapse: collapse; width: 100%; margin: 12px 0; font-size: 15px; }
.article th, .article td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; }
.article th { background: var(--cream); }

/* Comments */
.comments { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 28px; margin: 22px auto 36px; }
.comments h2 { margin: 0 0 12px; font-size: 24px; }
.c-form { display: grid; gap: 10px; margin-bottom: 16px; }
.c-form input, .c-form textarea { width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 12px; background: var(--cream); font: 16px var(--font); color: var(--ink); }
.c-form textarea { min-height: 88px; resize: vertical; }
.c-form button { justify-self: start; padding: 11px 20px; border: 0; border-radius: 999px; background: var(--ink); color: var(--paper); font: 700 15px var(--font); cursor: pointer; }
.c-msg { color: var(--sage); font-size: 14px; }
.c-replying { font-size: 14px; color: var(--muted); }
.c-list { list-style: none; margin: 0; padding: 0; }
.c-list[data-gf-empty]::before { content: "No comments yet. What is your fastest daily time? Share it, or leave a tip for the next solver."; color: var(--muted); }
.c-list[data-gf-off] { display: none; }
.c-item { padding: 12px 0; border-top: 1px solid var(--line); }
.c-item[data-gf-owner] { background: #FDF0E6; border-radius: 12px; padding: 12px; }
.c-head { display: flex; gap: 8px; align-items: baseline; font-size: 14px; color: var(--muted); }
.c-name { font-weight: 800; color: var(--ink); }
.c-owner { display: none; font-size: 12px; background: var(--accent); color: #fff; border-radius: 6px; padding: 1px 6px; }
[data-gf-owner] > .c-head .c-owner { display: inline; }
.c-text { margin: 4px 0; white-space: pre-wrap; }
.c-reply { border: 0; background: none; color: var(--accent-dark); font: 700 13px var(--font); padding: 0; cursor: pointer; }
.c-replies { margin-left: 18px; }
.c-to { color: var(--accent-dark); font-size: 13px; }

/* Footer */
.site-foot { border-top: 1px solid var(--line); background: var(--paper); padding: 24px 0 30px; font-size: 14px; color: var(--muted); }
.site-foot nav { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 8px; }
.site-foot a { color: var(--ink); text-decoration: none; font-weight: 600; }

/* Plain pages */
.page-body { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 28px 28px; margin: 24px auto 40px; }
.page-body h1 { font-size: 34px; line-height: 1.2; margin: 14px 0 10px; }

@media (max-width: 700px) {
  body { font-size: 16px; }
  .wrap { padding: 0 12px; }
  .nav { gap: 12px; font-size: 14px; }
  .stage { aspect-ratio: 3 / 4.3; border-radius: 14px; }
  .article, .comments, .page-body { padding: 6px 16px 18px; margin-left: 12px; margin-right: 12px; }
}

/* ---------- Game (embed page) ---------- */
body.mz-embed { background: radial-gradient(circle at 30% 20%, #FFF9F0 0%, var(--cream) 60%, #F5EADB 100%); margin: 0; height: 100vh; overflow: hidden; font-size: 15px; }
.mz-app { height: 100%; display: flex; flex-direction: column; padding: 12px 16px; gap: 10px; }
.mz-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.mz-tabs { display: flex; gap: 4px; background: var(--paper); border: 1px solid var(--line); border-radius: 999px; padding: 4px; box-shadow: 0 2px 6px rgba(59,47,42,.06); }
.mz-tab { border: 0; background: none; padding: 7px 15px; border-radius: 999px; font: 700 14px var(--font); color: var(--muted); cursor: pointer; transition: background .15s, color .15s; }
.mz-tab:hover { color: var(--ink); }
.mz-tab[aria-selected="true"] { background: var(--accent); color: #fff; box-shadow: 0 3px 8px rgba(224,122,79,.35); }
.mz-level { padding: 7px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); font: 600 14px var(--font); color: var(--ink); max-width: 100%; }
.mz-main { flex: 1; min-height: 0; display: flex; gap: 22px; align-items: center; justify-content: center; }
.mz-board-wrap { position: relative; height: 100%; max-height: 100%; aspect-ratio: 1; max-width: calc(100% - 252px); display: flex; align-items: center; justify-content: center; }

/* Board: a soft "tray" with thick region borders and thin cell lines */
.mz-board { --n: 8; position: relative; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); grid-template-rows: repeat(var(--n), minmax(0, 1fr)); width: 100%; aspect-ratio: 1; padding: 0; border: 3px solid var(--ink); border-radius: 16px; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; background: rgba(59,47,42,.22); gap: 1px; box-shadow: 0 14px 30px rgba(59,47,42,.18), 0 2px 0 rgba(255,255,255,.6) inset; }
.mz-cell { position: relative; min-width: 0; min-height: 0; overflow: hidden; border: 0; padding: 0; margin: 0; display: flex; align-items: center; justify-content: center; cursor: pointer; -webkit-tap-highlight-color: transparent; background-image: linear-gradient(160deg, rgba(255,255,255,.38), rgba(255,255,255,0) 55%); transition: filter .12s; }
.mz-cell.bR { box-shadow: inset -2.5px 0 0 var(--ink); }
.mz-cell.bB { box-shadow: inset 0 -2.5px 0 var(--ink); }
.mz-cell.bR.bB { box-shadow: inset -2.5px -2.5px 0 var(--ink); }
.mz-cell:hover { filter: brightness(1.05) saturate(1.05); }
.mz-cell .paw { width: 34%; height: 34%; fill: rgba(59,47,42,.32); animation: pawIn .16s ease-out; }
.mz-cell .cat { width: 84%; height: 84%; overflow: visible; filter: drop-shadow(0 2px 1.5px rgba(59,47,42,.28)); transform-origin: 50% 95%; }
.mz-cell .cat .eyes { transform-box: fill-box; transform-origin: center; animation: blink 5.5s infinite; animation-delay: var(--blink, 0s); }
.mz-cell .cat .tail { transform-box: fill-box; transform-origin: 0% 100%; animation: tail 3.2s ease-in-out infinite; animation-delay: var(--blink, 0s); }
.mz-cell.drop .cat { animation: drop .32s cubic-bezier(.3,1.6,.5,1); }
.mz-cell.bad { background-color: #FFD6D6 !important; }
.mz-cell.bad .cat { animation: shake .4s ease-in-out 2; filter: drop-shadow(0 0 3px rgba(215,38,61,.8)); }
.mz-cell.bad::after { content: ""; position: absolute; inset: 12%; border: 2.5px solid #D7263D; border-radius: 50%; opacity: .75; }
.mz-cell.flash::before { content: ""; position: absolute; inset: 0; background: rgba(255,255,255,.55); animation: flash .52s ease-out forwards; pointer-events: none; }
.mz-cell.won .cat { animation: hop .7s ease-in-out 2; animation-delay: calc(var(--blink, 0s) / 10); }
@keyframes pawIn { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes drop { 0% { transform: translateY(-30%) scale(.7); } 70% { transform: translateY(4%) scale(1.06, .94); } 100% { transform: none; } }
@keyframes blink { 0%, 95%, 100% { transform: scaleY(1); } 97% { transform: scaleY(.1); } }
@keyframes tail { 0%, 100% { transform: rotate(0deg); } 50% { transform: rotate(-9deg); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-8%) rotate(-6deg); } 75% { transform: translateX(8%) rotate(6deg); } }
@keyframes flash { from { opacity: 1; } to { opacity: 0; } }
@keyframes hop { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-16%) scale(1.04, .96); } 60% { transform: translateY(0) scale(1.05, .95); } }

/* Side panel */
.mz-side { width: 230px; flex: none; align-self: flex-start; display: flex; flex-direction: column; gap: 12px; background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: 16px; box-shadow: 0 6px 18px rgba(59,47,42,.08); }
.mz-title { margin: 0; font-weight: 800; font-size: 17px; line-height: 1.25; }
.mz-meta { margin: 0; display: flex; gap: 12px; align-items: baseline; justify-content: space-between; }
.mz-timer { font-variant-numeric: tabular-nums; font-size: 30px; font-weight: 800; letter-spacing: -.5px; }
.mz-count { color: var(--muted); font-weight: 700; font-size: 14px; }
.mz-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mz-btn { padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--cream); font: 700 14px var(--font); color: var(--ink); cursor: pointer; transition: transform .1s, border-color .15s; }
.mz-btn:hover { border-color: var(--accent); }
.mz-btn:active { transform: scale(.97); }
.mz-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 4px 10px rgba(224,122,79,.35); }
.mz-btn.ghost { background: none; }
.mz-status:empty { display: none; }
.mz-status { margin: 0; min-height: 20px; color: var(--accent-dark); font-weight: 700; font-size: 14px; }
.mz-rules { background: var(--cream); border-radius: 12px; padding: 4px 12px; font-size: 14px; }
.mz-rules p { margin: 8px 0; }

/* Win card */
.mz-win { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(251,244,234,.6); backdrop-filter: blur(2px); animation: fadeIn .25s ease-out; }
.mz-win[hidden] { display: none; }
.mz-win-card { background: var(--paper); border: 1px solid var(--line); border-radius: 20px; padding: 20px 22px 16px; text-align: center; box-shadow: 0 18px 40px rgba(59,47,42,.22); max-width: 340px; width: 90%; animation: rise .35s cubic-bezier(.3,1.4,.5,1); }
.mz-win-kicker { margin: 0; color: var(--sage); font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; font-size: 12px; }
.mz-win-time { margin: 2px 0 0; font-size: 44px; line-height: 1.1; font-weight: 800; font-variant-numeric: tabular-nums; }
.mz-win-best { margin: 2px 0 8px; color: var(--muted); }
.mz-win-badges { display: flex; gap: 6px; justify-content: center; margin: 0 0 12px; min-height: 0; }
.mz-win-badges span { background: #FCE3D6; color: var(--accent-dark); font-weight: 800; font-size: 12px; padding: 4px 10px; border-radius: 999px; }
.mz-lb { text-align: left; font-size: 14px; }
.mz-lb-title { margin: 6px 0; font-weight: 800; }
.mz-lb ol { list-style: none; margin: 0 0 12px; padding: 0; max-height: 140px; overflow: auto; }
.mz-lb li { display: flex; gap: 8px; padding: 4px 0; border-bottom: 1px dashed var(--line); }
.mz-lb li span { margin-left: auto; font-variant-numeric: tabular-nums; }
.mz-lb li.me { color: var(--accent-dark); font-weight: 800; }
.mz-lb li.note { color: var(--muted); font-size: 12px; border: 0; }
.mz-win-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.mz-share-msg:empty { display: none; }
.mz-share-msg { margin: 8px 0 0; min-height: 16px; font-size: 12px; color: var(--sage); font-weight: 700; word-break: break-word; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { transform: translateY(16px) scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }

/* Phones and portrait frames: one compact bar on top, board as large as the frame allows */
@media (max-width: 640px), (max-aspect-ratio: 1/1) {
  .mz-app { padding: 8px; gap: 6px; }
  .mz-top { flex-wrap: nowrap; gap: 6px; }
  .mz-tabs { padding: 3px; gap: 2px; flex: none; }
  .mz-tab { padding: 6px 9px; font-size: 12.5px; }
  .mz-level { flex: 1; min-width: 0; padding: 6px 4px; font-size: 12px; }
  .mz-main { flex-direction: column; gap: 6px; justify-content: flex-start; align-items: stretch; }
  .mz-side { width: auto; align-self: stretch; order: -1; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 6px 10px; padding: 8px 10px; border-radius: 14px; }
  .mz-title { font-size: 13px; }
  .mz-meta { gap: 8px; }
  .mz-timer { font-size: 20px; }
  .mz-count { font-size: 12px; }
  .mz-tools { grid-column: 1 / -1; grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .mz-status { grid-column: 1 / -1; min-height: 0; font-size: 12px; }
  .mz-btn { padding: 7px 4px; font-size: 13px; border-radius: 10px; }
  .mz-board-wrap { height: auto; width: min(100%, calc(100vh - 150px)); max-width: 100%; margin: 0 auto; }
  .mz-board { border-radius: 12px; }
  .mz-rules { position: absolute; z-index: 5; left: 8px; right: 8px; top: 110px; box-shadow: 0 10px 30px rgba(59,47,42,.18); background: var(--paper); border: 1px solid var(--line); }
  .mz-win-card { padding: 16px; }
  .mz-win-time { font-size: 36px; }
}
@media (prefers-reduced-motion: reduce) { .mz-cell .cat, .mz-cell .cat .eyes, .mz-cell .cat .tail { animation: none !important; } }
