* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #8f4f3a; color: #fff;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  touch-action: none; overscroll-behavior: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; position: fixed; inset: 0; }
canvas#game { position: fixed; inset: 0; display: block; touch-action: none; }
.hidden { display: none !important; }

#hud { position: fixed; top: 0; left: 0; right: 0; height: calc(48px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 12px 0;
  display: flex; align-items: center; justify-content: space-between; gap: 8px; pointer-events: none;
  background: linear-gradient(rgba(40,24,16,0.65), rgba(40,24,16,0)); font-weight: 700; text-shadow: 0 1px 2px rgba(0,0,0,0.6); }
#timer, #score { font-size: 18px; min-width: 56px; font-variant-numeric: tabular-nums; }
#score { text-align: right; }
#contract { display: flex; align-items: center; gap: 6px; font-size: 14px; background: rgba(0,0,0,0.35); padding: 5px 10px; border-radius: 16px; }
#contract .swatch { width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.8); display: inline-block; }
#status { position: fixed; top: calc(52px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); font-size: 13px; font-weight: 700;
  background: rgba(200,50,35,0.85); padding: 4px 12px; border-radius: 14px; pointer-events: none; white-space: nowrap; }
#event { position: fixed; top: 30%; left: 0; right: 0; text-align: center; font-size: 22px; font-weight: 800; pointer-events: none;
  text-shadow: 0 2px 6px rgba(0,0,0,0.7); opacity: 0; transition: opacity 0.25s; padding: 0 20px; }
#event.show { opacity: 1; }

#controls { position: fixed; left: 0; right: 0; bottom: 0; height: calc(118px + env(safe-area-inset-bottom)); padding: 10px 12px calc(14px + env(safe-area-inset-bottom));
  display: flex; gap: 10px; background: linear-gradient(rgba(40,24,16,0), rgba(40,24,16,0.7)); }
.btn { flex: 1; border: 2px solid rgba(255,255,255,0.55); border-radius: 22px; background: rgba(30,22,18,0.72); color: #fff;
  font-size: 17px; font-weight: 800; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; touch-action: none; }
.btn .ico { font-size: 22px; line-height: 1; }
.btn.on { background: #ffd65a; color: #2a1a10; border-color: #fff; box-shadow: 0 0 0 3px rgba(255,214,90,0.4); }
.btn.attack { background: rgba(170,40,30,0.85); }
.btn.attack.on { background: #ff6a4a; color: #fff; }
.btn:disabled { opacity: 0.35; background: rgba(30,22,18,0.6); }

.screen { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  background: rgba(60,36,24,0.88); padding: 24px; text-align: center; z-index: 10; }
.screen.glass { background: rgba(30,20,14,0.6); }
h1 { font-size: 64px; margin: 0; letter-spacing: 2px; }
h2 { font-size: 28px; margin: 0; }
.sub { opacity: 0.85; margin: 0; font-size: 16px; max-width: 320px; }
.big { font-size: 26px; font-weight: 800; padding: 18px 64px; border-radius: 40px; border: none; background: #ffd65a; color: #2a1a10; }
#coatGrid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; width: 100%; max-width: 360px; }
.coat { border: 3px solid rgba(255,255,255,0.4); border-radius: 18px; background: #d8c49b; color: #2a1a10; font-weight: 800; font-size: 17px;
  padding: 10px 6px 12px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.coat canvas { width: 96px; height: 96px; }
#tutLines { display: flex; flex-direction: column; gap: 18px; font-size: 24px; font-weight: 800; }
.hint { opacity: 0.7; }
#finalScore { font-size: 64px; font-weight: 900; }
#finalStats { font-size: 16px; opacity: 0.9; line-height: 1.6; }
