:root {
  color-scheme: dark;
  font-family: system-ui, sans-serif;
  color: #f0eee3;
  background: #0b1424;
  --yellow: #e5c27c;
  --muted: #afb9c4;
}
* { box-sizing: border-box; }
body { margin: 0; background: radial-gradient(ellipse at 40% 0, #263d64, transparent 70%); min-height: 100vh; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; font: inherit; font-weight: 650; color: #f0eee3; background: linear-gradient(#3b4c60, #253448); border: 1px solid #8a8d7a; border-radius: 5px; padding: 10px 14px; box-shadow: 0 2px 4px #0005, inset 0 1px #ffffff15; }
button:hover:not(:disabled) { background: linear-gradient(#4c6074, #35475b); border-color: #dbc388; }
button:active:not(:disabled) { transform: translateY(2px); box-shadow: none; }
button:disabled { opacity: .42; cursor: not-allowed; }
button:focus-visible, a:focus-visible, canvas:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }
[hidden] { display: none !important; }
.topbar { max-width: 1440px; margin: auto; padding: 18px 26px; display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.back { color: var(--muted); font-size: 13px; text-decoration: none; }
.back:hover { color: var(--yellow); }
h1 { display: flex; align-items: center; gap: 10px; margin: 0; font-family: Georgia, serif; font-size: clamp(18px, 2.3vw, 30px); letter-spacing: 1.5px; color: var(--yellow); text-shadow: 0 2px 6px #0009; }
.tools { display: flex; gap: 8px; }
.tools button { padding: 8px 13px; }
main { max-width: 1440px; margin: auto; padding: 0 26px; }
.dashboard { display: grid; grid-template-columns: repeat(4, 1fr); background: linear-gradient(120deg, #28374c, #172438); border: 1px solid #7e816f; border-radius: 7px; margin-bottom: 14px; overflow: hidden; box-shadow: inset 0 1px #f4dc9e18, 0 5px 18px #0002; }
.stat { padding: 12px 20px; border-right: 1px solid #486069; }
.stat:last-child { border: 0; }
.stat span { display: block; color: var(--muted); font-size: 10px; letter-spacing: 1.3px; font-weight: 800; margin-bottom: 3px; }
.stat strong { font-size: clamp(17px, 2vw, 24px); }
#money { color: var(--yellow); }
.game-layout { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 16px; align-items: start; }
.playfield { position: relative; min-width: 0; overflow: hidden; border: 2px solid #949078; border-radius: 7px; background: #8d8260; box-shadow: 0 16px 45px #0006; }
canvas { display: block; width: 100%; height: clamp(440px, 67vh, 760px); cursor: crosshair; }
.mode { pointer-events: none; position: absolute; top: 13px; left: 13px; background: #142c35ee; border: 1px solid #789095; color: #ffe095; border-radius: 8px; padding: 8px 12px; font-size: 11px; font-weight: 900; letter-spacing: 1px; }
.hint { position: absolute; pointer-events: none; bottom: 12px; left: 12px; right: 12px; text-align: center; padding: 10px 14px; border-radius: 10px; color: #fff4ca; background: #142c35eb; font-size: 13px; box-shadow: 0 2px 7px #0003; }
.toast { position: absolute; pointer-events: none; top: 57px; left: 50%; transform: translateX(-50%); width: max-content; max-width: 90%; background: #fff0c7; color: #263c42; border: 2px solid #7b6534; border-radius: 10px; padding: 9px 14px; font-size: 13px; text-align: center; box-shadow: 0 3px #0003; }
.toast.error { background: #ffe2cc; border-color: #b55840; }
.overlay { position: absolute; inset: 0; z-index: 2; background: #0c172aca; backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; overflow-y: auto; padding: 22px; }
.panel { max-width: 580px; margin: auto; padding: 26px; border: 1px solid #b19b70; border-radius: 8px; background: linear-gradient(135deg, #2c3c51, #172539); box-shadow: 0 14px 45px #0007, inset 0 0 0 5px #ffffff03; }
.eyebrow { color: var(--yellow); font-size: 10px; letter-spacing: 1.5px; font-weight: 900; }
.panel h2 { color: #eddbad; font-family: Georgia, serif; font-size: clamp(25px, 3vw, 36px); font-weight: 500; margin: 10px 0; line-height: 1.1; }
.panel p { color: #cfddda; font-size: 14px; line-height: 1.5; }
.panel ol { padding-left: 21px; font-size: 13px; line-height: 1.55; }
.panel li { margin: 9px 0; padding-left: 2px; }
.panel .note { color: #aebfba; font-size: 12px; }
.primary { background: var(--yellow); border-color: #ffeaae; color: #273838; padding: 12px 24px; }
.primary:hover:not(:disabled) { background: #ffe497; }
.secondary { margin-left: 8px; }
.sidebar { display: grid; gap: 12px; }
.sidebar section { background: linear-gradient(120deg, #25364a, #1b2a3d); border: 1px solid #687572; border-radius: 6px; box-shadow: inset 0 1px #ffffff0a; }
.wall-card { padding: 15px; }
.card-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.sidebar h2 { margin: 0; font-size: 15px; }
.card-title span { font-size: 11px; color: var(--muted); }
.meter { background: #11292f; height: 15px; border-radius: 5px; overflow: hidden; border: 1px solid #658078; }
#wall-fill { width: 100%; height: 100%; background: #94d48b; transition: width .15s; }
#wall-hp { font-size: 12px; text-align: right; margin: 5px 0 12px; color: #c8dbcd; }
.wall-card button { width: 100%; font-size: 12px; padding: 10px 5px; }
.wall-card small { display: block; color: var(--muted); font-size: 10px; margin: 7px 0 14px; text-align: center; }
.wall-card small:last-child { margin-bottom: 0; }
.inventory { overflow: hidden; }
.supply { padding: 12px 15px; border-bottom: 1px solid #486069; }
.supply:last-child { border: none; }
.supply > span:first-child { display: block; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .8px; }
.supply strong { display: block; font-size: 22px; margin: 4px 0 7px; color: var(--yellow); }
.supply strong small { font-size: 12px; font-weight: 400; color: var(--muted); }
.cannon strong { color: #9dd6e8; }
.storage strong { color: #b2d3a0; }
.capacity { display: block; height: 4px; background: #102930; border-radius: 4px; overflow: hidden; }
.capacity i { display: block; width: 0; height: 100%; background: var(--yellow); }
.cannon i { background: #9dd6e8; }
.storage i { background: #b2d3a0; }
.controls { padding: 15px; }
.controls h2 { margin-bottom: 12px; }
.controls p { font-size: 11px; color: #c3d5d5; margin: 8px 0; }
kbd { display: inline-block; background: #102930; color: #ffe7a4; border: 1px solid #597179; border-bottom: 3px solid #597179; padding: 0 5px; border-radius: 4px; font-size: 11px; font-family: inherit; font-weight: 800; }
footer { color: #90aaac; font-size: 11px; padding: 16px 0 22px; text-align: center; }
@media (max-width: 900px) {
  .topbar, main { padding-left: 12px; padding-right: 12px; }
  .back { display: none; }
  .game-layout { grid-template-columns: minmax(0, 1fr) 190px; gap: 10px; }
  .stat { padding: 10px; }
  .wall-card { padding: 10px; }
}
@media (max-width: 620px) {
  .game-layout { grid-template-columns: 1fr; }
  canvas { height: 560px; }
  .sidebar { grid-template-columns: 1fr 1fr; }
  .controls { grid-column: 1 / -1; }
  .dashboard { grid-template-columns: 1fr 1fr; }
  .stat:nth-child(2) { border: none; }
  .panel { padding: 18px; }
  .overlay { padding: 12px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
