:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ink: #f3f1e6;
  --muted: #bac7c6;
  --panel: rgba(12, 20, 24, 0.88);
  --panel-edge: rgba(238, 252, 249, 0.18);
  --accent: #a6f06f;
  --shadow: rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }
html, body, #game-shell { width: 100%; height: 100%; margin: 0; overflow: hidden; background: #89c8eb; }
body { user-select: none; }
button, input { font: inherit; }
#game { display: block; width: 100%; height: 100%; image-rendering: pixelated; outline: none; }
.hidden { display: none !important; }

.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at 72% 18%, rgba(190, 246, 171, 0.14), transparent 28%), linear-gradient(145deg, rgba(5, 15, 20, 0.28), rgba(5, 11, 14, 0.78));
  backdrop-filter: blur(8px) saturate(0.9);
}

.panel {
  width: min(700px, 100%);
  border: 1px solid var(--panel-edge);
  border-radius: 20px;
  padding: clamp(24px, 5vw, 48px);
  color: var(--ink);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), transparent 22%), var(--panel);
  box-shadow: 0 30px 90px var(--shadow), inset 0 1px rgba(255, 255, 255, 0.06);
}

.compact-panel { max-width: 500px; }
.brand-mark { display: grid; grid-template-columns: repeat(2, 13px); gap: 3px; width: max-content; margin-bottom: 18px; transform: rotate(45deg); }
.brand-mark span { width: 13px; height: 13px; background: var(--accent); box-shadow: inset -3px -3px rgba(0, 0, 0, 0.15); }
.eyebrow { margin: 0 0 10px; color: var(--accent); font-size: 0.72rem; font-weight: 800; letter-spacing: 0.16em; }

h1 { margin: 0; font-size: clamp(3.3rem, 10vw, 6.6rem); line-height: 0.75; letter-spacing: -0.075em; font-weight: 300; }
h1 strong { color: var(--accent); font-weight: 900; }
.compact-panel h1 { font-size: clamp(2rem, 7vw, 4rem); line-height: 0.95; }
.lede { max-width: 58ch; margin: 28px 0; color: var(--muted); font-size: 0.98rem; line-height: 1.6; }

.seed-field { display: grid; gap: 8px; margin-bottom: 14px; color: var(--muted); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.seed-field input { width: 100%; border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 10px; padding: 13px 14px; color: var(--ink); background: rgba(1, 7, 9, 0.6); outline: none; user-select: text; }
.seed-field input:focus { border-color: rgba(166, 240, 111, 0.72); box-shadow: 0 0 0 3px rgba(166, 240, 111, 0.1); }
.menu-actions { display: grid; grid-template-columns: 1.4fr 1fr 0.8fr; gap: 10px; }

button { min-height: 45px; border: 1px solid rgba(255, 255, 255, 0.15); border-radius: 9px; padding: 10px 14px; color: var(--ink); background: rgba(255, 255, 255, 0.055); cursor: pointer; transition: transform 120ms ease, background 120ms ease, border-color 120ms ease; }
button:hover { border-color: rgba(255, 255, 255, 0.28); background: rgba(255, 255, 255, 0.1); transform: translateY(-1px); }
button:active { transform: translateY(1px); }
.primary-button { border-color: rgba(166, 240, 111, 0.6); color: #10220a; font-weight: 900; background: linear-gradient(180deg, #baf780, #8bd84f); box-shadow: inset 0 1px rgba(255, 255, 255, 0.5), 0 10px 30px rgba(89, 151, 47, 0.2); }
.primary-button:hover { background: linear-gradient(180deg, #c7ff91, #96e75a); }

.controls-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 24px; }
.controls-grid div { display: grid; gap: 5px; min-width: 0; color: var(--muted); font-size: 0.72rem; }
kbd { overflow: hidden; color: var(--ink); font-family: inherit; font-size: 0.72rem; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }

#hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; color: white; text-shadow: 0 2px 4px rgba(0, 0, 0, 0.55); }
.status-panel { position: absolute; top: 16px; left: 16px; display: grid; gap: 4px; padding: 10px 12px; border: 1px solid rgba(255, 255, 255, 0.16); border-radius: 8px; font-size: 0.7rem; font-variant-numeric: tabular-nums; letter-spacing: 0.035em; background: rgba(5, 10, 13, 0.42); backdrop-filter: blur(5px); }

#crosshair { position: absolute; top: 50%; left: 50%; width: 20px; height: 20px; transform: translate(-50%, -50%); filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.8)); }
#crosshair span { position: absolute; top: 50%; left: 50%; background: rgba(255, 255, 255, 0.9); transform: translate(-50%, -50%); }
#crosshair span:first-child { width: 16px; height: 2px; }
#crosshair span:last-child { width: 2px; height: 16px; }
#target-label { position: absolute; top: calc(50% + 22px); left: 50%; min-width: 120px; transform: translateX(-50%); color: rgba(255, 255, 255, 0.85); font-size: 0.7rem; font-weight: 700; text-align: center; }

#hotbar { position: absolute; bottom: 22px; left: 50%; display: flex; gap: 5px; transform: translateX(-50%); padding: 6px; border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 9px; background: rgba(5, 9, 12, 0.55); backdrop-filter: blur(6px); }
.hotbar-slot { position: relative; display: grid; place-items: center; width: clamp(38px, 5vw, 52px); aspect-ratio: 1; border: 2px solid rgba(255, 255, 255, 0.18); border-radius: 5px; background: rgba(255, 255, 255, 0.06); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2); }
.hotbar-slot.selected { border-color: white; background: rgba(255, 255, 255, 0.16); transform: translateY(-4px); }
.hotbar-slot canvas { width: 72%; height: 72%; border: 1px solid rgba(255, 255, 255, 0.2); image-rendering: pixelated; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.28); }
.hotbar-slot .slot-number { position: absolute; top: 2px; left: 4px; color: rgba(255, 255, 255, 0.78); font-size: 0.58rem; font-weight: 800; }

#autosave-indicator { position: absolute; right: 16px; bottom: 16px; opacity: 0; font-size: 0.72rem; transition: opacity 200ms ease; }
#autosave-indicator.visible { opacity: 0.8; }
#toast { position: fixed; top: 22px; left: 50%; z-index: 40; max-width: min(420px, calc(100vw - 40px)); border: 1px solid rgba(255, 255, 255, 0.18); border-radius: 8px; padding: 10px 14px; color: white; font-size: 0.8rem; background: rgba(8, 15, 18, 0.84); box-shadow: 0 14px 35px rgba(0, 0, 0, 0.28); opacity: 0; pointer-events: none; transform: translate(-50%, -10px); transition: opacity 160ms ease, transform 160ms ease; }
#toast.visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 720px) {
  .menu-panel { padding: 24px; }
  .menu-actions { grid-template-columns: 1fr; }
  .controls-grid { grid-template-columns: repeat(2, 1fr); }
  .hotbar-slot { width: 34px; }
  #hotbar { gap: 3px; padding: 4px; }
}
