* { margin:0; padding:0; box-sizing:border-box; }
html,body { width:100%; height:100%; overflow:hidden; background:#0c0f1a;
  font-family: ui-monospace, 'SF Mono', 'Cascadia Code', Menlo, monospace; }
canvas { display:block; }

/* ── Crosshair ── */
#crosshair { position:fixed; left:50%; top:50%; transform:translate(-50%,-50%);
  width:22px; height:22px; pointer-events:none; z-index:10; opacity:.85; }
#crosshair::before, #crosshair::after { content:''; position:absolute;
  background:#fff; box-shadow:0 0 2px #000; }
#crosshair::before { left:50%; top:0; width:2px; height:100%; transform:translateX(-50%); }
#crosshair::after  { top:50%; left:0; height:2px; width:100%; transform:translateY(-50%); }
#crosshair.shoot-flash::before, #crosshair.shoot-flash::after {
  background:#ffe066; box-shadow:0 0 8px #ff8800, 0 0 16px #ff4400; }
#crosshair.shoot-flash { opacity:1; transform:translate(-50%,-50%) scale(1.35); transition:transform .06s; }

/* ── Hotbar ── */
#hotbar { position:fixed; bottom:18px; left:50%; transform:translateX(-50%);
  display:flex; gap:6px; padding:6px; z-index:10;
  background:rgba(12,15,26,.55); border:1px solid rgba(255,255,255,.08);
  border-radius:10px; backdrop-filter:blur(6px); }
.slot { width:46px; height:46px; border-radius:7px; display:flex; flex-direction:column;
  align-items:center; justify-content:center; position:relative;
  background:rgba(255,255,255,.04); border:2px solid transparent; transition:.12s; }
.slot.active { border-color:#e8b34a; background:rgba(232,179,74,.12);
  box-shadow:0 0 14px rgba(232,179,74,.35); }
.slot .swatch { width:24px; height:24px; border-radius:4px; box-shadow:inset 0 -6px 0 rgba(0,0,0,.22), 0 1px 2px rgba(0,0,0,.4); }
.slot .key { position:absolute; top:1px; left:4px; font-size:9px; color:rgba(255,255,255,.45); }
.slot .lbl { font-size:7.5px; color:rgba(255,255,255,.6); margin-top:3px; letter-spacing:.3px; }

/* ── HUD top-left ── */
#hud { position:fixed; top:12px; left:12px; z-index:10; color:#cdd3e0; font-size:11px;
  line-height:1.55; text-shadow:0 1px 2px #000; pointer-events:none; }
#hud b { color:#e8b34a; }
#fps { color:#7fd99a; }
#hearts { color:#e85a6a; letter-spacing:1px; font-size:10px; margin-left:8px; }

/* ── Player HP bar ── */
#hp-bar-wrap { position:fixed; top:14px; left:50%; transform:translateX(-50%); z-index:12;
  display:flex; align-items:center; gap:8px; pointer-events:none; }
#hp-bar-label { font-size:10px; color:#aab2c8; letter-spacing:2px; }
#hp-bar { width:180px; height:14px; background:rgba(0,0,0,.45); border:1px solid rgba(255,255,255,.12);
  border-radius:7px; overflow:hidden; }
#hp-fill { height:100%; width:100%; background:linear-gradient(90deg,#c03040,#e85a6a);
  border-radius:6px; transition:width .15s; }

/* ── Boss HP bar ── */
#boss-bar-wrap { position:fixed; top:42px; left:50%; transform:translateX(-50%); z-index:12;
  display:flex; align-items:center; gap:8px; pointer-events:none; }
#boss-bar-label { font-size:10px; color:#e8b34a; letter-spacing:1px; min-width:72px; }
#boss-bar { width:220px; height:12px; background:rgba(0,0,0,.5); border:1px solid rgba(232,179,74,.35);
  border-radius:6px; overflow:hidden; }
#boss-hp-fill { height:100%; width:100%; background:linear-gradient(90deg,#8a2020,#e84040);
  border-radius:5px; transition:width .12s; }

/* ── Character HUD ── */
#char-hud { position:fixed; top:12px; right:14px; z-index:12; display:flex; align-items:center; gap:10px;
  padding:8px 14px; background:rgba(12,15,26,.7); border:1px solid rgba(255,255,255,.1);
  border-radius:8px; font-size:11px; color:#cdd3e0; pointer-events:none; }
#char-icon { font-size:18px; }
#char-name { color:#e8b34a; font-weight:700; max-width:140px; text-align:right; line-height:1.2; }

/* ── Character select ── */
.char-select-title { font-size:13px; letter-spacing:4px; color:#e8b34a; margin:18px 0 10px;
  text-transform:uppercase; font-weight:700; }
.char-preview-stage { width:200px; height:200px; margin:0 auto 14px; border-radius:16px;
  background:radial-gradient(ellipse at center, rgba(40,50,80,.6) 0%, rgba(0,0,0,.5) 70%);
  border:2px solid rgba(232,179,74,.25); overflow:hidden; display:flex; align-items:center; justify-content:center; }
.char-preview-canvas { display:block; width:200px; height:200px; }
.char-grid { display:grid; grid-template-columns:repeat(2, minmax(130px, 1fr)); gap:10px;
  max-width:420px; margin:0 auto 20px; }
.char-card { position:relative; display:flex; flex-direction:column; align-items:center; gap:6px;
  padding:12px 8px 12px; border-radius:14px; cursor:pointer; user-select:none;
  background:rgba(18,22,38,.75); border:2px solid rgba(255,255,255,.1);
  color:#e6e9f2; transition:.15s; font-family:inherit; text-align:center; }
.char-card:hover { border-color:rgba(232,179,74,.45); transform:translateY(-2px); }
.char-card.selected { border-color:#e8b34a; box-shadow:0 0 24px rgba(232,179,74,.35);
  background:rgba(32,28,18,.85); }
.char-thumb { font-size:36px; line-height:1; margin-bottom:2px; filter:drop-shadow(0 2px 6px rgba(0,0,0,.5)); }
.char-title { font-size:11px; font-weight:700; color:#ffe2a0; line-height:1.2; }
.char-tag { font-size:9px; color:#8a93ad; letter-spacing:.3px; }
.panel .play.disabled { opacity:.45; pointer-events:none; filter:grayscale(.4); }

/* ── Toast ── */
#toast { position:fixed; top:72px; left:50%; transform:translateX(-50%); z-index:20;
  padding:8px 18px; background:rgba(12,15,26,.85); border:1px solid rgba(127,217,154,.4);
  border-radius:8px; color:#7fd99a; font-size:12px; opacity:0; transition:opacity .3s; pointer-events:none; }
#toast.show { opacity:1; }

/* ── Crafting panel ── */
#craft-panel { position:fixed; inset:0; z-index:58; display:none; align-items:center; justify-content:center;
  background:rgba(6,8,14,.88); backdrop-filter:blur(8px); }
.craft-box { text-align:center; color:#e6e9f2; padding:24px 32px; min-width:340px;
  background:linear-gradient(180deg,#1a2440,#0f1424); border:1px solid rgba(200,155,90,.25);
  border-radius:16px; box-shadow:0 20px 60px rgba(0,0,0,.5); }
.craft-box h2 { font-size:22px; color:#c89b5a; letter-spacing:3px; margin-bottom:6px; }
.craft-sub { font-size:11px; color:#8a93ad; margin-bottom:16px; }
#craft-list { display:flex; flex-direction:column; gap:8px; margin-bottom:14px; text-align:left; }
.craft-row { display:flex; align-items:center; gap:12px; padding:10px 12px; border-radius:10px;
  background:rgba(255,255,255,.04); border:1px solid rgba(255,255,255,.06); }
.craft-row.can-craft { border-color:rgba(127,217,154,.35); }
.craft-row.crafted { opacity:.55; }
.craft-icon { font-size:22px; width:32px; text-align:center; }
.craft-info { flex:1; font-size:12px; line-height:1.4; }
.craft-info b { color:#e8b34a; }
.craft-cost { color:#c89b5a; font-size:11px; }
.craft-btn { padding:6px 14px; border:none; border-radius:16px; cursor:pointer; font-family:inherit;
  font-size:11px; font-weight:700; color:#1a1206; background:linear-gradient(180deg,#ffd87a,#e8b34a); }
.craft-btn:disabled { opacity:.4; cursor:default; }
.craft-btn:not(:disabled):hover { filter:brightness(1.08); }

/* ── Compass ── */
#compass { position:fixed; bottom:82px; right:16px; z-index:12; display:flex; flex-direction:column;
  align-items:center; gap:4px; pointer-events:none; }
.compass-ring { position:relative; width:72px; height:72px; border-radius:50%;
  background:rgba(12,15,26,.75); border:2px solid rgba(232,179,74,.45);
  box-shadow:0 4px 16px rgba(0,0,0,.4), inset 0 0 12px rgba(0,0,0,.35); }
.cdir { position:absolute; font-size:9px; font-weight:800; color:#8a93ad; letter-spacing:1px; }
.cn { top:4px; left:50%; transform:translateX(-50%); color:#e8b34a; }
.ce { right:5px; top:50%; transform:translateY(-50%); }
.cs { bottom:4px; left:50%; transform:translateX(-50%); }
.cw { left:5px; top:50%; transform:translateY(-50%); }
#compass-needle { position:absolute; left:50%; top:50%; width:3px; height:28px; margin-left:-1.5px;
  margin-top:-24px; background:linear-gradient(180deg,#e85a6a 55%,#aab2c8 55%);
  border-radius:2px; transform-origin:50% 85%; box-shadow:0 0 4px rgba(232,90,106,.5); }
.compass-center { position:absolute; left:50%; top:50%; width:8px; height:8px; margin:-4px 0 0 -4px;
  border-radius:50%; background:#e8b34a; border:1px solid #1a1206; z-index:2; }
#compass-bearing { font-size:10px; font-weight:700; color:#e8b34a; letter-spacing:2px;
  text-shadow:0 1px 3px #000; }

/* ── Start screen chaos field ── */
#overlay { position:fixed; inset:0; z-index:50; display:flex; align-items:center; justify-content:center;
  background:
    radial-gradient(ellipse 80% 60% at 20% 20%, rgba(255,68,102,.35) 0%, transparent 55%),
    radial-gradient(ellipse 70% 55% at 85% 15%, rgba(68,255,170,.28) 0%, transparent 50%),
    radial-gradient(ellipse 90% 70% at 50% 100%, rgba(255,204,34,.22) 0%, transparent 55%),
    radial-gradient(ellipse 60% 50% at 75% 75%, rgba(102,136,255,.3) 0%, transparent 50%),
    linear-gradient(135deg, #1a0838 0%, #0d1a3a 40%, #1a0a28 100%);
  transition:opacity .4s;
  overflow:hidden;
  animation:overlay-pulse 8s ease-in-out infinite; }
@keyframes overlay-pulse {
  0%,100% { filter:hue-rotate(0deg) saturate(1); }
  50% { filter:hue-rotate(25deg) saturate(1.25); }
}
#chaos-field { position:absolute; inset:0; pointer-events:none; overflow:hidden; z-index:0; }
#chaos-field::before { content:''; position:absolute; inset:0; z-index:1;
  background:repeating-conic-gradient(from 0deg at 50% 50%,
    rgba(255,255,255,.03) 0deg 8deg, transparent 8deg 18deg);
  animation:chaos-spin 24s linear infinite; mix-blend-mode:screen; opacity:.6; }
@keyframes chaos-spin { to { transform:rotate(360deg); } }
#chaos-canvas { position:absolute; inset:0; width:100%; height:100%; display:block; opacity:1; z-index:0; }
.panel { position:relative; z-index:2; text-align:center; color:#e6e9f2; padding:36px 44px;
  background:rgba(10,13,24,.55); border:1px solid rgba(232,179,74,.35); border-radius:20px;
  backdrop-filter:blur(12px); box-shadow:0 24px 80px rgba(0,0,0,.45), 0 0 60px rgba(255,100,150,.15);
  max-width:min(480px, 94vw); }

.panel h1 { font-size:46px; letter-spacing:6px; font-weight:800;
  background:linear-gradient(180deg,#ffe2a0,#e8b34a 60%,#b5792a);
  -webkit-background-clip:text; background-clip:text; color:transparent;
  text-shadow:0 4px 30px rgba(232,179,74,.25);
  filter:drop-shadow(0 2px 12px rgba(0,0,0,.8)); }
.panel .tag { color:#8a93ad; font-size:12px; letter-spacing:3px; margin-top:4px; text-transform:uppercase; }
.panel .play { margin-top:30px; display:inline-block; cursor:pointer; user-select:none;
  padding:13px 40px; border-radius:30px; font-size:15px; letter-spacing:2px; font-weight:700;
  color:#1a1206; background:linear-gradient(180deg,#ffd87a,#e8b34a);
  box-shadow:0 8px 24px rgba(232,179,74,.35); transition:.15s; }
.panel .play:hover { transform:translateY(-2px); box-shadow:0 12px 30px rgba(232,179,74,.45); }
.controls { margin-top:34px; display:grid; grid-template-columns:auto auto; gap:6px 26px;
  font-size:12px; color:#aab2c8; text-align:left; }
.controls kbd { display:inline-block; min-width:20px; text-align:center; padding:2px 7px; margin-right:8px;
  background:#222a40; border:1px solid #38415e; border-bottom-width:2px; border-radius:5px;
  color:#e6e9f2; font-size:11px; }
#loading { color:#8a93ad; font-size:12px; margin-top:24px; letter-spacing:1px; }

/* ── Prompt de interacción ── */
#interact-prompt { position:fixed; bottom:90px; left:50%; transform:translateX(-50%);
  z-index:15; padding:8px 18px; border-radius:8px; font-size:12px; color:#e6e9f2;
  background:rgba(12,15,26,.75); border:1px solid rgba(232,179,74,.4);
  backdrop-filter:blur(6px); display:none; pointer-events:none; }
#interact-prompt kbd { padding:2px 7px; background:#222a40; border:1px solid #38415e;
  border-radius:5px; color:#e8b34a; font-size:11px; }

/* ── Minigames (carousel + fishing) ── */
#minigame, #fishing-minigame { position:fixed; inset:0; z-index:60; display:none; align-items:center; justify-content:center;
  background:rgba(6,8,14,.88); backdrop-filter:blur(8px); }
.mg-panel { text-align:center; color:#e6e9f2; padding:28px 36px;
  background:linear-gradient(180deg,#1a2440,#0f1424); border:1px solid rgba(232,179,74,.2);
  border-radius:16px; box-shadow:0 20px 60px rgba(0,0,0,.5); }
.mg-panel h2 { font-size:28px; letter-spacing:4px; color:#e8b34a; margin-bottom:6px; }
.mg-sub { font-size:12px; color:#8a93ad; margin-bottom:14px; }
#mg-canvas, #fish-canvas { border-radius:12px; background:#0c1020; cursor:pointer; display:block; margin:0 auto; }
.mg-stats { margin-top:12px; font-size:13px; color:#aab2c8; }
.mg-stats b { color:#7fd99a; }
.mg-msg { margin-top:10px; font-size:13px; color:#e8b34a; min-height:20px; }
.mg-btn { margin-top:16px; padding:10px 28px; border:none; border-radius:24px; cursor:pointer;
  font-family:inherit; font-size:13px; font-weight:700; letter-spacing:1px;
  color:#1a1206; background:linear-gradient(180deg,#ffd87a,#e8b34a); }
.mg-btn:hover { filter:brightness(1.08); }

/* ── King dialogue ── */
#dialogue { position:fixed; inset:0; z-index:55; display:none; align-items:flex-end; justify-content:center;
  padding-bottom:48px; pointer-events:none; }
.dlg-panel { pointer-events:auto; max-width:520px; width:90%; padding:22px 28px;
  background:linear-gradient(180deg,#1a2440ee,#0f1424ee); border:2px solid rgba(232,179,74,.45);
  border-radius:14px; box-shadow:0 12px 40px rgba(0,0,0,.55); backdrop-filter:blur(8px); }
.dlg-name { font-size:15px; font-weight:700; color:#e8b34a; letter-spacing:2px; margin-bottom:10px; }
#dlg-text { font-size:14px; line-height:1.65; color:#e6e9f2; min-height:48px; }
.dlg-btn { margin-top:14px; padding:8px 22px; border:none; border-radius:20px; cursor:pointer;
  font-family:inherit; font-size:12px; font-weight:600; color:#1a1206;
  background:linear-gradient(180deg,#ffd87a,#e8b34a); }
.dlg-btn:hover { filter:brightness(1.08); }
