:root {
  color-scheme: light;
  --ink: #323128;
  --muted: #777264;
  --paper: #f5f0e3;
  --panel: rgba(250, 247, 237, .94);
  --accent: #dc765d;
  --green: #527b59;
  font-family: "Trebuchet MS", "Avenir Next", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
body { background: var(--paper); color: var(--ink); user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
button { color: inherit; font: inherit; }
[hidden] { display: none !important; }

#game-shell { position: relative; width: 100%; height: 100%; min-height: 500px; overflow: hidden; isolation: isolate; }
#game { display: block; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }

.topbar {
  position: absolute; z-index: 5; top: max(12px, env(safe-area-inset-top)); left: max(14px, env(safe-area-inset-left)); right: max(14px, env(safe-area-inset-right));
  display: flex; align-items: center; justify-content: space-between; pointer-events: none;
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; pointer-events: auto; }
.brand > span:last-child { display: flex; flex-direction: column; line-height: .78; letter-spacing: -.05em; }
.brand b { font-size: 11px; letter-spacing: .22em; }
.brand strong { font-size: 23px; }
.brand-mark { position: relative; display: block; width: 38px; height: 27px; }
.brand-mark::before, .brand-mark::after { position: absolute; bottom: 0; width: 25px; height: 25px; border-radius: 50%; background: #d8c4c4; content: ""; }
.brand-mark::before { left: 0; }.brand-mark::after { right: 0; }
.brand-mark i { position: absolute; z-index: 1; top: 9px; width: 3px; height: 3px; border-radius: 50%; background: var(--ink); }
.brand-mark i:first-child { right: 13px; }.brand-mark i:last-child { right: 5px; }

.top-actions { display: flex; gap: 7px; pointer-events: auto; }
.pill-button, .round-button { height: 42px; border: 1px solid rgba(50,49,40,.2); background: rgba(250,247,237,.88); box-shadow: 0 4px 16px rgba(56,48,34,.1); cursor: pointer; }
.pill-button { padding: 0 14px; border-radius: 99px; font-size: 9px; font-weight: 900; letter-spacing: .09em; }
.pill-button span { display: inline-grid; place-items: center; width: 18px; height: 18px; margin-left: 4px; border-radius: 50%; background: #e6bd58; color: #55451f; }
.round-button { width: 42px; border-radius: 50%; font-weight: 900; letter-spacing: 1px; }
button:active { transform: translateY(1px) scale(.98); }
button:focus-visible { outline: 3px solid rgba(220,118,93,.42); outline-offset: 2px; }

.hint, .toast {
  position: absolute; z-index: 4; left: 50%; transform: translateX(-50%); margin: 0; padding: 8px 13px; border-radius: 99px;
  color: white; font-size: 10px; font-weight: 900; letter-spacing: .055em; white-space: nowrap; pointer-events: none; transition: opacity .25s, transform .25s;
}
.hint { top: max(70px, calc(env(safe-area-inset-top) + 58px)); background: rgba(50,49,40,.74); }
.hint.out { opacity: 0; transform: translate(-50%, -5px); }
.toast { top: max(70px, calc(env(safe-area-inset-top) + 58px)); background: var(--accent); opacity: 0; transform: translate(-50%, -6px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.toolbar {
  position: absolute; z-index: 5; left: 50%; bottom: max(10px, env(safe-area-inset-bottom)); width: min(620px, calc(100% - 18px));
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; padding: 6px; border: 1px solid rgba(50,49,40,.18); border-radius: 18px;
  background: var(--panel); box-shadow: 0 10px 30px rgba(56,48,34,.14); backdrop-filter: blur(8px); transform: translateX(-50%);
}
.tool { min-width: 0; height: 57px; padding: 5px 2px; border: 0; border-radius: 12px; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; cursor: pointer; }
.tool.selected { background: var(--ink); color: var(--paper); }
.tool b { font-size: 8px; letter-spacing: .07em; }
.tool img, .tool > span { display: block; width: 26px; height: 26px; object-fit: contain; }
.tool[data-tool="broccoli"] img { width: 30px; height: 27px; }
.dig-icon { position: relative; width: 26px !important; height: 26px !important; border-radius: 50%; border: 2px dashed currentColor; }
.dig-icon::after { position: absolute; width: 12px; height: 4px; left: 6px; top: 9px; border-radius: 99px; background: currentColor; transform: rotate(-35deg); content: ""; }
.cotton-icon { border-radius: 50%; background: #fffdf4; box-shadow: -7px 4px 0 -2px #fffdf4, 7px 5px 0 -3px #fffdf4, 0 7px 0 -3px #ded9cc; }
.selected .cotton-icon { background: #fffdf4; }
.wheel-icon { position: relative; border: 2px solid currentColor; border-radius: 50%; }
.wheel-icon::before, .wheel-icon::after, .wheel-icon i { position: absolute; left: 11px; top: 2px; width: 2px; height: 18px; background: currentColor; content: ""; }
.wheel-icon::after { transform: rotate(60deg); }.wheel-icon i { transform: rotate(-60deg); }

.overlay { position: fixed; z-index: 10; inset: 0; display: grid; place-items: center; padding: 18px; background: rgba(49,45,35,.38); backdrop-filter: blur(5px); }
.panel { position: relative; width: min(510px, 100%); padding: 25px; border: 1px solid rgba(50,49,40,.2); border-radius: 24px; background: #faf7ed; box-shadow: 10px 12px 0 rgba(50,49,40,.9); text-align: center; }
.eyebrow { margin: 0 0 7px; color: var(--accent); font-size: 9px; font-weight: 900; letter-spacing: .15em; }
.panel h1 { margin: 0 0 22px; font-size: clamp(25px, 7vw, 38px); line-height: .92; letter-spacing: -.055em; }
.panel-note, .menu-panel > p:not(.eyebrow) { margin: 16px 0 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.hamter-choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.hamter-choices button { min-width: 0; padding: 13px 6px 11px; border: 1px solid rgba(50,49,40,.15); border-radius: 16px; background: #eee8d8; cursor: pointer; }
.hamter-choices button:hover { border-color: var(--ink); transform: translateY(-2px); }
.hamter-choices b, .hamter-choices small { display: block; }.hamter-choices b { margin-top: 8px; font-size: 11px; letter-spacing: .08em; }.hamter-choices small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.mini-hamter { position: relative; display: block; width: 70px; height: 44px; margin: 0 auto; }
.mini-hamter::before, .mini-hamter::after { position: absolute; top: 5px; width: 39px; height: 35px; border-radius: 50%; content: ""; background: var(--coat); }
.mini-hamter::before { left: 3px; }.mini-hamter::after { right: 3px; box-shadow: inset -10px 0 rgba(255,255,255,var(--patch, 0)); }
.mini-hamter.peanut { --coat: #c89d6d; --patch: .36; }.mini-hamter.bean { --coat: #816353; --patch: .1; }.mini-hamter.hamter { --coat: #d8c4c4; --patch: .2; }
.menu-panel { width: min(340px, 100%); }.menu-panel h1 { margin-bottom: 10px; }
.close-button { position: absolute; top: 13px; right: 13px; width: 36px; height: 36px; border: 0; border-radius: 50%; background: #e9e3d5; font-size: 20px; cursor: pointer; }
.reset-button { width: 100%; height: 45px; margin-top: 20px; border: 1.5px solid #a24e43; border-radius: 99px; background: transparent; color: #a24e43; font-size: 10px; font-weight: 900; letter-spacing: .09em; cursor: pointer; }
.debug-panel { position: absolute; z-index: 8; top: 68px; right: 12px; margin: 0; padding: 7px 9px; background: rgba(35,33,29,.8); color: white; font: 10px/1.4 ui-monospace, monospace; pointer-events: none; }

@media (max-width: 590px) {
  .brand strong { font-size: 20px; }.brand-mark { transform: scale(.9); transform-origin: left center; }
  .pill-button { padding: 0 10px; }
  .toolbar { bottom: max(7px, env(safe-area-inset-bottom)); gap: 1px; padding: 5px; }
  .tool { height: 55px; }.tool b { font-size: 6.8px; }.tool img, .tool > span { transform: scale(.88); }
  .hamter-choices { gap: 4px; }.mini-hamter { transform: scale(.8); transform-origin: center; }
}

@media (max-height: 620px) { .toolbar { bottom: 5px; }.tool { height: 47px; }.hint, .toast { top: 55px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: .01ms !important; } }
