/* ==========================================================================
   Cosmic Noodle — 70s Groove Design System
   --------------------------------------------------------------------------
   Palette: harvest gold, burnt orange, avocado green, chocolate brown, cream.
    Every game-scoped style is prefixed with the game's short code:
      .dc-  Dot Connect      .vs-  Visual Sudoku    .wc-  Word Connect
      .hx-  Hexablock        .bd-  Block Drop       .mm-  Memory Match
    Shared building blocks (buttons, chips, overlays, toasts) are unprefixed.
    Shell features that aren't games use their own prefixes: .fb- feedback.
    ========================================================================== */

:root {
  --cream:   #f6ead2;
  --paper:   #fdf6e3;
  --tan:     #ecd9ac;
  --sand:    #e2c98f;
  --brown:   #4a2f23;
  --ink:     #3c2a1e;
  --orange:  #d96c2c;
  --rust:    #c4522a;
  --gold:    #e2a13c;
  --avocado: #7a8a3c;
  --olive:   #5f7031;
  --teal:    #3f7d70;
  --plum:    #8a4a63;
  --pink:    #e08a9b;
  --red:     #b6402e;

  --border: 3px solid var(--brown);
  --radius: 18px;
  --radius-lg: 26px;
  --shadow: 6px 6px 0 rgba(74, 47, 35, .9);
  --shadow-sm: 4px 4px 0 rgba(74, 47, 35, .9);
  --font-display: 'Shrikhand', 'Cooper Black', 'Arial Black', serif;
  --font-body: 'Quicksand', 'Trebuchet MS', Verdana, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-weight: 500;
  color: var(--ink);
  background-color: var(--cream);
  background-image: radial-gradient(rgba(74, 47, 35, .055) 2px, transparent 2.6px);
  background-size: 26px 26px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

[x-cloak] { display: none !important; }

/* ---------- background blobs ---------- */
.bg-deco { position: fixed; inset: 0; pointer-events: none; z-index: -1; overflow: hidden; }
.blob { position: absolute; border-radius: 50%; opacity: .16; }
.blob-1 { width: 44vmax; height: 44vmax; background: var(--gold); top: -18vmax; right: -14vmax; }
.blob-2 { width: 36vmax; height: 36vmax; background: var(--avocado); bottom: -16vmax; left: -12vmax; }
.blob-3 { width: 22vmax; height: 22vmax; background: var(--pink); top: 42%; left: 66%; opacity: .12; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: .7rem clamp(1rem, 4vw, 2.5rem);
  background: var(--cream);
  border-bottom: var(--border);
}
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--ink); }
.brand-flower { width: 44px; height: 44px; display: inline-flex; transition: transform .5s ease; }
.brand:hover .brand-flower { transform: rotate(120deg); }
.brand-name {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3.4vw, 2rem);
  color: var(--rust);
  text-shadow: 2px 2px 0 var(--gold);
  letter-spacing: .5px;
}
.site-nav { display: flex; align-items: center; gap: .4rem; }
.nav-link {
  font-weight: 700; text-decoration: none; color: var(--ink);
  padding: .5rem 1rem; border-radius: 999px; border: 3px solid transparent;
}
.nav-link:hover { border-color: var(--brown); background: var(--paper); }
.nav-link.is-active { background: var(--avocado); color: var(--cream); border-color: var(--brown); box-shadow: var(--shadow-sm); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: var(--font-body); font-weight: 700; font-size: 1rem;
  color: var(--ink); background: var(--paper);
  border: var(--border); border-radius: 999px;
  padding: .68rem 1.5rem; cursor: pointer; text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
  user-select: none;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 rgba(74,47,35,.9); }
.btn:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 rgba(74,47,35,.9); }
.btn-primary { background: var(--orange); color: var(--cream); }
.btn-primary:hover { background: var(--rust); }
.btn-danger { background: var(--plum); color: var(--cream); }
.btn-small { padding: .45rem 1rem; font-size: .9rem; }
.btn-ic { display: inline-flex; width: 20px; height: 20px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }

.icon-btn {
  width: 46px; height: 46px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--paper); border: var(--border); border-radius: 50%;
  cursor: pointer; box-shadow: var(--shadow-sm);
  transition: transform .12s ease, box-shadow .12s ease;
  color: var(--ink);
}
.icon-btn:hover { transform: translate(-1px, -1px); }
.icon-btn:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 rgba(74,47,35,.9); }

/* ---------- main layout ---------- */
.site-main { flex: 1; width: 100%; max-width: 1080px; margin: 0 auto; padding: clamp(1rem, 3vw, 2rem) clamp(1rem, 4vw, 2.5rem) 3rem; }
.view { animation: viewIn .3s ease; }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.section-title {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(1.8rem, 4vw, 2.6rem); color: var(--brown);
  margin: 1.6rem 0 .2rem; text-align: center;
}
.section-sub { text-align: center; margin: 0 0 1.8rem; opacity: .8; font-weight: 600; }

/* ---------- hero ---------- */
.hero {
  position: relative; overflow: hidden;
  border: var(--border); border-radius: var(--radius-lg);
  background:
    repeating-conic-gradient(from -8deg at 50% 135%, rgba(226,161,60,.28) 0 11deg, transparent 11deg 22deg),
    var(--paper);
  box-shadow: var(--shadow);
  padding: clamp(2rem, 6vw, 4rem) clamp(1.2rem, 4vw, 3rem);
  text-align: center;
}
.hero-inner { position: relative; z-index: 1; }
.hero-title {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(2.2rem, 6.5vw, 4.2rem);
  line-height: 1.05; margin: 0 0 1rem; color: var(--brown);
}
.hero-accent { color: var(--rust); text-shadow: 3px 3px 0 var(--gold); }
.hero-sub { max-width: 46ch; margin: 0 auto 1.6rem; font-size: 1.08rem; font-weight: 600; opacity: .85; }
.hero-actions { display: flex; gap: .8rem; justify-content: center; flex-wrap: wrap; }
.hero-flower { position: absolute; width: 84px; height: 84px; opacity: .9; z-index: 0; }
.hf-1 { top: 14px; left: 18px; animation: sway 7s ease-in-out infinite; }
.hf-2 { bottom: 18px; right: 26px; width: 64px; height: 64px; animation: sway 9s ease-in-out infinite reverse; }
.hf-3 { top: 40%; right: 8%; width: 46px; height: 46px; opacity: .6; animation: sway 8s ease-in-out infinite; }
@keyframes sway { 0%,100% { transform: rotate(-12deg); } 50% { transform: rotate(16deg); } }

.streak-pill {
  display: inline-flex; align-items: center; gap: .5rem; margin-top: 1.4rem;
  background: var(--gold); border: var(--border); border-radius: 999px;
  padding: .5rem 1.2rem; font-weight: 700; box-shadow: var(--shadow-sm);
}

.wave-divider { display: block; margin: 1.4rem auto 0; max-width: 420px; color: var(--rust); }
.wave-divider svg { width: 100%; height: auto; display: block; }

/* ---------- game grid ---------- */
.game-grid {
  display: grid; gap: 1.4rem;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}
.game-card {
  --acc: var(--orange);
  display: flex; flex-direction: column; align-items: center; text-align: center;
  background: var(--paper); border: var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); padding: 1.6rem 1.2rem 1.2rem;
  text-decoration: none; color: var(--ink);
  transition: transform .15s ease, box-shadow .15s ease;
  position: relative; overflow: hidden;
}
.game-card::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 10px; background: var(--acc);
  border-bottom: var(--border);
}
.game-card:hover { transform: translate(-2px, -3px) rotate(-.6deg); box-shadow: 9px 9px 0 rgba(74,47,35,.9); }
.game-card:active { transform: translate(2px, 2px); box-shadow: 3px 3px 0 rgba(74,47,35,.9); }
.game-card-icon {
  width: 88px; height: 88px; margin-top: .4rem;
  display: flex; align-items: center; justify-content: center;
  background: var(--acc); border: var(--border); border-radius: 50%;
  box-shadow: var(--shadow-sm);
}
.game-card-icon svg { width: 52px; height: 52px; }
.game-card-body h3 { font-family: var(--font-display); font-weight: 400; font-size: 1.35rem; margin: .9rem 0 .3rem; color: var(--brown); }
.game-card-body p { margin: 0 0 1rem; font-weight: 600; opacity: .75; font-size: .95rem; }
.game-card-foot { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: center; margin-top: auto; }

/* accent palette (used by cards, chips, stat rows) */
.accent-orange  { --acc: var(--orange); }
.accent-gold    { --acc: var(--gold); }
.accent-avocado { --acc: var(--avocado); }
.accent-plum    { --acc: var(--plum); }
.accent-teal    { --acc: var(--teal); }
.accent-pink    { --acc: var(--pink); }

/* ---------- chips ---------- */
.chip {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .82rem; font-weight: 700;
  border: 2px solid var(--brown); border-radius: 999px;
  padding: .18rem .7rem; background: var(--tan); color: var(--ink);
}
.chip-best { background: var(--acc, var(--gold)); color: var(--cream); }
.chip-best-lg { font-size: .95rem; padding: .35rem 1rem; }

/* ---------- game header / stage ---------- */
.game-head { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; margin-bottom: .6rem; }
.game-head-title { flex: 1; min-width: 200px; }
.game-head-title h2 { font-family: var(--font-display); font-weight: 400; font-size: clamp(1.6rem, 3.6vw, 2.3rem); margin: 0; color: var(--brown); }
.game-head-title p { margin: .1rem 0 0; font-weight: 600; opacity: .75; }
.btn-back { flex-shrink: 0; }

.howto {
  background: var(--paper); border: var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); margin: .8rem 0 1.2rem; overflow: hidden;
}
.howto summary {
  cursor: pointer; font-weight: 700; padding: .7rem 1.1rem; list-style: none;
  display: flex; align-items: center; gap: .5rem;
}
.howto summary::before { content: "🌼"; }
.howto summary::-webkit-details-marker { display: none; }
.howto ul { margin: 0; padding: 0 1.4rem 1rem 2.2rem; font-weight: 600; }
.howto li { margin: .25rem 0; }

.stage {
  position: relative;
  background: var(--paper); border: var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); padding: clamp(1rem, 3vw, 1.8rem);
  min-height: 420px;
}

/* ---------- shared in-game UI (used by all game modules) ---------- */
.game-toolbar { display: flex; align-items: center; justify-content: center; gap: .6rem; flex-wrap: wrap; margin-bottom: 1rem; }
.game-toolbar .spacer { flex: 1; }
.toolbar-stat { font-weight: 700; font-size: .95rem; background: var(--tan); border: 2px solid var(--brown); border-radius: 999px; padding: .3rem .9rem; }
.toolbar-stat b { font-size: 1.05rem; }

.ovl {
  position: absolute; inset: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center;
  background: rgba(246, 234, 210, .88); border-radius: var(--radius-lg);
  animation: viewIn .25s ease;
}
.ovl-panel {
  background: var(--paper); border: var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); padding: 2rem 2.4rem; text-align: center; max-width: 92%;
}
.ovl-panel h3 { font-family: var(--font-display); font-weight: 400; font-size: 2rem; margin: 0 0 .4rem; color: var(--rust); }
.ovl-panel p { font-weight: 600; margin: .3rem 0 1.2rem; }
.ovl-panel .ovl-actions { display: flex; gap: .7rem; justify-content: center; flex-wrap: wrap; }

.toast {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%);
  z-index: 30; background: var(--brown); color: var(--cream);
  font-weight: 700; padding: .55rem 1.2rem; border-radius: 999px;
  border: 2px solid var(--paper); box-shadow: var(--shadow-sm);
  animation: toastIn 1.6s ease forwards; pointer-events: none; white-space: nowrap;
}

/* ---------- feedback modal (.fb-) ---------- */
.fb-ovl {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  background: rgba(74, 47, 35, .5); padding: 1rem;
  animation: viewIn .25s ease;
}
.fb-panel { width: min(480px, 100%); text-align: left; max-height: 92vh; overflow-y: auto; }
.fb-panel h3 { text-align: center; }
.fb-sub { text-align: center; margin: 0 0 1rem; }
.fb-textarea {
  width: 100%; resize: vertical; min-height: 110px;
  font: inherit; font-weight: 600; color: var(--ink);
  background: var(--cream); border: var(--border); border-radius: var(--radius);
  padding: .7rem .9rem;
}
.fb-textarea:focus { outline: 3px solid var(--gold); outline-offset: 1px; }
.fb-hp { position: absolute; left: -9999px; top: -9999px; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.fb-turnstile { display: flex; justify-content: center; margin: .9rem 0 .2rem; min-height: 65px; }
.fb-error { color: var(--rust); font-weight: 700; text-align: center; margin: .5rem 0 0; }
.fb-panel .ovl-actions { margin-top: 1.1rem; }
.fb-open-btn { flex-shrink: 0; }
@keyframes toastIn {
  0% { opacity: 0; transform: translate(-50%, 10px); }
  12% { opacity: 1; transform: translate(-50%, 0); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -8px); }
}

/* level dots (dot connect, word connect) */
.level-dots { display: flex; gap: .45rem; flex-wrap: wrap; justify-content: center; }
.level-dot {
  width: 38px; height: 38px; border-radius: 50%; border: 2px solid var(--brown);
  background: var(--paper); font-family: var(--font-body); font-weight: 700; font-size: .9rem;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink); padding: 0; transition: transform .1s ease;
}
.level-dot:hover { transform: scale(1.08); }
.level-dot.is-current { background: var(--orange); color: var(--cream); }
.level-dot.is-solved { background: var(--avocado); color: var(--cream); }
.level-dot.is-locked { opacity: .45; cursor: not-allowed; }

/* ---------- stats page ---------- */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; margin-bottom: 1.8rem; }
.stat-card {
  background: var(--paper); border: var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 1.1rem 1rem; text-align: center;
  display: flex; flex-direction: column; gap: .2rem; align-items: center;
}
.stat-card b { font-family: var(--font-display); font-weight: 400; font-size: 1.9rem; color: var(--brown); }
.stat-card span:last-child { font-weight: 600; opacity: .7; font-size: .9rem; }
.stat-ic { width: 34px; height: 34px; display: inline-flex; }
.stat-ic-orange { color: var(--orange); } .stat-ic-green { color: var(--avocado); }
.stat-ic-gold { color: var(--gold); } .stat-ic-plum { color: var(--plum); }

.stat-table { display: flex; flex-direction: column; gap: .7rem; margin-bottom: 2rem; }
.stat-row {
  --acc: var(--orange);
  display: flex; align-items: center; gap: 1rem;
  background: var(--paper); border: var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: .7rem 1.1rem;
  text-decoration: none; color: var(--ink); font-weight: 700;
  transition: transform .12s ease;
}
.stat-row:hover { transform: translateX(4px); }
.stat-row-icon { width: 46px; height: 46px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--acc); border: 2px solid var(--brown); border-radius: 50%; }
.stat-row-icon svg { width: 28px; height: 28px; }
.stat-row-name { flex: 1; font-size: 1.05rem; }
.stat-row-best { background: var(--acc); color: var(--cream); border: 2px solid var(--brown); border-radius: 999px; padding: .15rem .7rem; font-size: .85rem; }
.stat-row-plays { opacity: .65; font-size: .88rem; min-width: 64px; text-align: right; }
.danger-zone { text-align: center; }

/* ---------- footer ---------- */
.site-footer {
  border-top: var(--border); background: var(--tan);
  text-align: center; padding: 1.6rem 1rem 2rem; font-weight: 600;
}
.foot-flower { width: 38px; height: 38px; display: inline-flex; margin-bottom: .3rem; }
.site-footer p { margin: .2rem 0; }
.site-footer .muted { opacity: .65; font-size: .9rem; }
.site-footer code { background: var(--paper); border: 2px solid var(--brown); border-radius: 6px; padding: 0 .35rem; }

/* ==========================================================================
   DOT CONNECT (.dc-)
   ========================================================================== */
.dc-wrap { display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.dc-board { width: 100%; max-width: 520px; touch-action: none; user-select: none; -webkit-user-select: none; }
.dc-board svg { display: block; width: 100%; height: auto; }
.dc-cell { fill: rgba(74, 47, 35, .05); stroke: rgba(74, 47, 35, .18); stroke-width: 2; }
.dc-pipe { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.dc-pipe-glow { fill: none; stroke-linecap: round; stroke-linejoin: round; opacity: .25; }
.dc-dot { stroke: var(--brown); stroke-width: 3.5; cursor: pointer; }
.dc-dot-ring { fill: none; stroke: var(--paper); stroke-width: 5; opacity: 0; transition: opacity .15s; }
.dc-dot-ring.is-on { opacity: .95; }
.dc-picker {
  background: var(--paper); border: var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); padding: 2rem 2.4rem; text-align: center;
  width: 100%; max-width: 520px; display: flex; flex-direction: column; gap: .9rem;
}
.dc-picker h3 { font-family: var(--font-display); font-weight: 400; font-size: 2rem; margin: 0; color: var(--rust); }
.dc-picker-row { display: flex; gap: .6rem; justify-content: center; flex-wrap: wrap; }
.dc-picker-label { font-weight: 700; margin: .4rem 0 0; }

/* ==========================================================================
   VISUAL SUDOKU (.vs-)
   ========================================================================== */
.vs-wrap { display: flex; flex-direction: column; align-items: center; gap: 1.1rem; }
.vs-board {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px;
  background: var(--brown); border: var(--border); border-radius: var(--radius);
  padding: 5px; width: 100%; max-width: 460px;
}
.vs-cell {
  aspect-ratio: 1; border: none; border-radius: 8px; background: var(--paper);
  font-size: clamp(1.3rem, 5.5vw, 1.9rem); cursor: pointer; padding: 0;
  display: flex; align-items: center; justify-content: center;
  transition: transform .08s ease, background .12s ease;
  font-family: var(--font-body);
}
.vs-cell:hover { background: var(--tan); }
.vs-cell.is-given { background: var(--sand); cursor: default; }
.vs-cell.is-selected { background: var(--gold); transform: scale(1.06); }
.vs-cell.is-same { background: #f3ddb0; }
.vs-cell.is-conflict { background: #ef9a8a; animation: vsShake .25s ease; }
.vs-cell.is-box-edge-r { margin-right: 6px; }
.vs-cell.is-box-edge-b { margin-bottom: 6px; }
@keyframes vsShake { 0%,100% { transform: translateX(0); } 30% { transform: translateX(-4px); } 70% { transform: translateX(4px); } }
.vs-palette { display: flex; gap: .55rem; flex-wrap: wrap; justify-content: center; }
.vs-sym {
  width: 54px; height: 54px; border-radius: 50%; border: var(--border);
  background: var(--paper); font-size: 1.5rem; cursor: pointer;
  box-shadow: var(--shadow-sm); transition: transform .1s ease;
  display: inline-flex; align-items: center; justify-content: center; padding: 0;
}
.vs-sym:hover { transform: translateY(-2px); background: var(--tan); }
.vs-sym:active { transform: translateY(1px); box-shadow: 2px 2px 0 rgba(74,47,35,.9); }
.vs-sym.vs-erase { font-size: 1.1rem; background: var(--tan); }

/* ==========================================================================
   WORD CONNECT (.wc-)
   ========================================================================== */
.wc-wrap { display: flex; flex-direction: column; align-items: center; gap: 1.1rem; }
.wc-found { display: flex; flex-wrap: wrap; gap: .45rem; justify-content: center; max-width: 640px; }
.wc-word {
  font-weight: 700; letter-spacing: .18em; font-size: .92rem;
  border: 2px solid var(--brown); border-radius: 10px; padding: .3rem .6rem;
  background: var(--tan); color: rgba(60, 42, 30, .38); min-width: 3.2em; text-align: center;
}
.wc-word.is-found { background: var(--avocado); color: var(--cream); animation: wcPop .3s ease; }
@keyframes wcPop { 0% { transform: scale(.6); } 70% { transform: scale(1.12); } 100% { transform: scale(1); } }
.wc-current {
  min-height: 54px; min-width: 200px; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 1.7rem; letter-spacing: .12em;
  color: var(--brown); background: var(--tan); border: var(--border); border-radius: 999px;
  padding: .25rem 1.6rem; box-shadow: var(--shadow-sm);
}
.wc-current:empty::before { content: "drag the letters…"; font-family: var(--font-body); font-size: .95rem; font-weight: 600; opacity: .5; letter-spacing: 0; }
.wc-wheel { position: relative; width: min(78vw, 340px); aspect-ratio: 1; touch-action: none; user-select: none; -webkit-user-select: none; }
.wc-wheel svg.wc-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }
.wc-letter {
  position: absolute; width: 62px; height: 62px; margin: -31px 0 0 -31px;
  border-radius: 50%; border: var(--border); background: var(--paper);
  font-family: var(--font-display); font-size: 1.5rem; color: var(--brown);
  display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 2;
  box-shadow: var(--shadow-sm); transition: transform .1s ease, background .1s ease;
}
.wc-letter.is-active { background: var(--orange); color: var(--cream); transform: scale(1.12); }
.wc-shuffle { margin-top: .2rem; }
.wc-hint {
  min-height: 1.6rem; font-weight: 700; letter-spacing: .3em; font-size: 1.05rem;
  color: var(--plum);
}

/* ==========================================================================
   HEXABLOCK (.hx-)
   ========================================================================== */
.hx-wrap { display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.hx-board { width: 100%; max-width: 500px; }
.hx-board svg { display: block; width: 100%; height: auto; }
.hx-cell { fill: rgba(74, 47, 35, .07); stroke: rgba(74, 47, 35, .25); stroke-width: 1.4; stroke-dasharray: 4 3; }
.hx-piece-cell { stroke: var(--brown); stroke-width: 2; cursor: grab; touch-action: none; }
.hx-ghost { opacity: .45; stroke: var(--brown); stroke-width: 2; }
.hx-ghost-bad { fill: rgba(74, 47, 35, .12); stroke: var(--rust); stroke-width: 2; stroke-dasharray: 5 4; opacity: .7; }
.hx-tray {
  display: flex; gap: .6rem; justify-content: center; align-items: center;
  min-height: 96px; max-width: 640px; flex-wrap: wrap;
}
.hx-slot {
  min-width: 74px; min-height: 68px; padding: 4px; display: flex; align-items: center; justify-content: center;
  background: var(--tan); border: 2px dashed rgba(74, 47, 35, .45); border-radius: var(--radius);
  cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none;
}
.hx-slot:active { cursor: grabbing; }
.hx-slot:empty { cursor: default; border-color: transparent; background: transparent; min-width: 0; min-height: 0; padding: 0; }
.hx-slot svg { overflow: visible; pointer-events: none; }
.hx-drag-clone { position: fixed; z-index: 60; pointer-events: none; filter: drop-shadow(3px 4px 0 rgba(74,47,35,.4)); }
.hx-picker { display: flex; flex-direction: column; align-items: center; gap: 1rem; padding: 1.4rem 0; text-align: center; }
.hx-picker h3 { font-family: var(--font-display); font-weight: 400; font-size: 2rem; margin: 0; color: var(--rust); }
.hx-picker-row { display: flex; gap: .6rem; justify-content: center; flex-wrap: wrap; }
.hx-picker-label { font-weight: 700; margin: .4rem 0 0; }

/* ==========================================================================
   BLOCK DROP (.bd-)
   ========================================================================== */
.bd-wrap { display: flex; gap: 1.2rem; justify-content: center; align-items: flex-start; flex-wrap: wrap; }
.bd-canvas-col { position: relative; display: flex; flex-direction: column; gap: .7rem; align-items: center; }
.bd-canvas {
  display: block; width: min(66vw, 300px); height: auto;
  background: #2e2018; border: var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.bd-side { display: flex; flex-direction: column; gap: .8rem; width: 170px; }
.bd-panel { background: var(--tan); border: var(--border); border-radius: var(--radius); padding: .8rem .95rem; box-shadow: var(--shadow-sm); }
.bd-panel h4 { margin: 0 0 .4rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .12em; opacity: .65; }
.bd-panel .bd-num { font-family: var(--font-display); font-size: 1.45rem; color: var(--brown); }
.bd-next { display: grid; grid-template-columns: repeat(4, 22px); grid-auto-rows: 22px; gap: 2px; justify-content: center; padding: .3rem 0; }
.bd-next span { border-radius: 5px; }
.bd-controls { display: flex; gap: .5rem; flex-wrap: wrap; }
.bd-touch { display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; }
.bd-touch .btn { padding: .6rem 1.05rem; font-size: 1.1rem; }

/* ==========================================================================
   MEMORY MATCH (.mm-)
   ========================================================================== */
.mm-wrap { display: flex; flex-direction: column; align-items: center; gap: 1.1rem; }
.mm-grid { display: grid; gap: .6rem; width: 100%; max-width: 560px; }
.mm-grid.mm-easy { grid-template-columns: repeat(4, 1fr); max-width: 440px; }
.mm-grid.mm-medium { grid-template-columns: repeat(4, 1fr); }
.mm-grid.mm-hard { grid-template-columns: repeat(6, 1fr); max-width: 620px; }
.mm-card { perspective: 700px; aspect-ratio: 3 / 3.4; border: none; background: none; padding: 0; cursor: pointer; }
.mm-card-inner {
  position: relative; width: 100%; height: 100%;
  transform-style: preserve-3d; transition: transform .38s cubic-bezier(.2,.7,.3,1.15);
}
.mm-card.is-flipped .mm-card-inner, .mm-card.is-matched .mm-card-inner { transform: rotateY(180deg); }
.mm-face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  display: flex; align-items: center; justify-content: center;
  border: var(--border); border-radius: 14px; font-size: clamp(1.5rem, 6vw, 2.3rem);
}
.mm-back {
  background: var(--rust);
  background-image: radial-gradient(rgba(253,246,227,.35) 3px, transparent 3.6px);
  background-size: 16px 16px;
  box-shadow: var(--shadow-sm);
}
.mm-back::after { content: "🌼"; font-size: clamp(1.2rem, 4.5vw, 1.8rem); opacity: .9; }
.mm-front { background: var(--paper); transform: rotateY(180deg); box-shadow: var(--shadow-sm); }
.mm-card.is-matched .mm-front { background: #e6ebc9; border-color: var(--olive); animation: wcPop .35s ease; }
.mm-card:not(.is-flipped):not(.is-matched):hover .mm-card-inner { transform: rotateY(12deg); }

/* ---------- responsive ---------- */
@media (max-width: 640px) {
  .site-header { gap: .5rem; padding: .6rem .8rem; }
  .brand-flower { width: 36px; height: 36px; }
  .brand-name { font-size: 1.35rem; }
  .site-nav { gap: .25rem; }
  .site-nav .nav-link { padding: .4rem .55rem; font-size: .9rem; }
  .bd-side { flex-direction: row; flex-wrap: wrap; width: 100%; }
  .bd-panel { flex: 1 1 30%; min-width: 0; }
  .bd-panel h4 { letter-spacing: .06em; }
  .game-head { gap: .6rem; }
  .chip-best-lg { order: 3; }
  .mm-grid.mm-hard { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 480px) {
  .brand-name { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- fullscreen game mode + mobile focus ---------- */
html { scroll-behavior: smooth; }

.game-head-wrap { scroll-margin-top: 84px; }

.fs-btn { width: 42px; height: 42px; flex-shrink: 0; }

html:fullscreen { background-color: var(--cream); }
html:fullscreen .view-game .stage { min-height: 60vh; }
html::backdrop { background: var(--brown); }

/* keep the block-drop side panels compact on small screens */
@media (max-width: 640px) {
  .bd-panel { padding: .6rem .7rem; }
  .bd-panel .bd-num { font-size: 1.2rem; }
  .bd-next { grid-template-columns: repeat(4, 16px); grid-auto-rows: 16px; }
}
