:root { --gold: #ffd27a; --sea: #0e2440; --paper: #e8f0ff; }
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; background: #0b1226;
  font-family: "Trebuchet MS", "Segoe UI", Verdana, sans-serif; color: var(--paper); }
#stage, #stage canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
.hud-top { position: absolute; top: 10px; left: 12px; right: 12px; display: flex; gap: 10px; flex-wrap: wrap; }
.stat { background: rgba(10, 18, 38, 0.72); border: 1px solid rgba(255, 210, 122, 0.35);
  border-radius: 10px; padding: 6px 12px; display: flex; flex-direction: column; min-width: 74px; }
.stat .label { font-size: 10px; letter-spacing: 2px; text-transform: uppercase; color: var(--gold); opacity: 0.85; }
.stat span:last-child { font-size: 20px; font-weight: 700; text-shadow: 0 1px 0 #000; }
#timer.low { color: #ff7a5c; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: 0.45; } }
#prompt { position: absolute; bottom: 118px; left: 50%; transform: translateX(-50%);
  background: rgba(10, 18, 38, 0.78); border: 1px solid rgba(255, 210, 122, 0.4);
  padding: 7px 16px; border-radius: 9px; font-size: 14px; white-space: nowrap; }
#toast { position: absolute; top: 74px; left: 50%; transform: translateX(-50%);
  font-size: 19px; font-weight: 700; color: var(--gold); text-shadow: 0 2px 4px #000;
  opacity: 0; transition: opacity 0.4s; white-space: nowrap; }
#tension { display: none; position: absolute; bottom: 120px; left: 50%; transform: translateX(-50%);
  width: min(340px, 80vw); background: rgba(8, 14, 30, 0.82); border: 1px solid rgba(120, 180, 255, 0.4);
  border-radius: 12px; padding: 10px 14px; }
.barlabel { font-size: 10px; letter-spacing: 2px; color: #9fb8e8; margin-bottom: 3px; }
.bar { position: relative; height: 14px; border-radius: 7px; background: #16243f; margin-bottom: 8px; overflow: hidden; }
#tensionFill { height: 100%; width: 0%; border-radius: 7px;
  background: linear-gradient(90deg, #3fd6c0, #ffd27a); transition: width 0.08s linear; }
#tensionFill.danger { background: linear-gradient(90deg, #ff9a5c, #ff4a3a); }
.safe-zone { position: absolute; top: 0; bottom: 0; left: 0; width: 79%; border-right: 2px dashed rgba(255,255,255,0.35); }
.bar.prog #progFill { height: 100%; width: 0%; border-radius: 7px; background: linear-gradient(90deg, #7fb2ff, #d9e8ff); }
#shop { display: none; position: absolute; bottom: 170px; left: 50%; transform: translateX(-50%); gap: 10px; pointer-events: auto; }
.shopitem { pointer-events: auto; cursor: pointer; background: rgba(20, 32, 58, 0.9);
  border: 1px solid rgba(255, 210, 122, 0.5); border-radius: 10px; padding: 8px 14px;
  text-align: center; font-size: 12px; display: flex; flex-direction: column; gap: 2px; }
.shopitem b { color: var(--gold); font-size: 14px; }
.shopitem:hover { background: rgba(40, 58, 92, 0.95); }
#touch { position: fixed; inset: auto 0 0 0; z-index: 8; display: none; }
#touch.show { display: block; }
.tcol { position: fixed; bottom: 14px; display: flex; gap: 10px; }
.tcol.left { left: 14px; } .tcol.right { right: 14px; flex-wrap: wrap; max-width: 220px; justify-content: flex-end; }
#touch button { pointer-events: auto; touch-action: none; width: 62px; height: 52px;
  font-size: 17px; font-weight: 700; color: var(--paper); background: rgba(16, 28, 52, 0.75);
  border: 1px solid rgba(160, 200, 255, 0.45); border-radius: 12px; }
#touch button.on { background: rgba(90, 130, 190, 0.85); }
#startScreen, #endScreen { position: fixed; inset: 0; z-index: 20; display: flex;
  align-items: center; justify-content: center; background: rgba(5, 9, 22, 0.72); }
.panel { max-width: 560px; margin: 16px; padding: 26px 30px; text-align: center;
  background: linear-gradient(180deg, rgba(22, 34, 62, 0.96), rgba(10, 16, 34, 0.96));
  border: 1px solid rgba(255, 210, 122, 0.45); border-radius: 18px; box-shadow: 0 18px 60px rgba(0, 0, 0, 0.6); }
.panel h1 { font-size: 40px; letter-spacing: 6px; color: var(--gold); text-shadow: 0 0 24px rgba(255, 200, 110, 0.5); }
.panel h2 { font-size: 28px; letter-spacing: 4px; color: var(--gold); }
.panel .tag { color: #9fb8e8; font-style: italic; margin: 4px 0 12px; }
.panel p { font-size: 14px; line-height: 1.55; color: #cdd9f2; }
.howto { list-style: none; margin: 14px 0; text-align: left; font-size: 13.5px; line-height: 1.9; color: #cdd9f2; }
.howto b { color: var(--gold); }
.panel button { margin-top: 12px; font-size: 18px; font-weight: 800; letter-spacing: 3px;
  color: #101a30; background: linear-gradient(180deg, #ffd98a, #f2a94e); border: none;
  border-radius: 12px; padding: 13px 34px; cursor: pointer; }
.panel button:hover { filter: brightness(1.12); }
.fine { font-size: 11px; opacity: 0.7; margin-top: 10px; }
#endScreen .panel button { pointer-events: auto; }
