:root {
  --teal: #2f8f8a; --teal2: #46c3b8; --orange: #f0892e; --ink: #12181c; --panel: rgba(16, 24, 28, 0.72);
  --line: rgba(255, 255, 255, 0.14); --text: #eef3f2; --muted: #9fb0b3; --clean: #46c3f0; --dirty: #8a9a2a;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0d1418; font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; color: var(--text); user-select: none; }
#game canvas { display: block; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
kbd { display: inline-block; background: #fff; color: #111; border-radius: 4px; padding: 0 6px; font: 700 11px/18px monospace; box-shadow: 0 2px 0 #9aa; margin: 0 2px; }

#underTint { position: fixed; inset: 0; pointer-events: none; opacity: 0; transition: opacity .25s;
  background: radial-gradient(ellipse at center, rgba(40,90,70,0) 40%, rgba(5,20,15,0.65) 100%); }
#drown { position: fixed; inset: 0; pointer-events: none; opacity: 0; background: radial-gradient(ellipse at center, rgba(60,0,0,0.3), rgba(0,0,0,0.95)); }

/* ---- Ana menü ---- */
#mainMenu { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: linear-gradient(180deg, rgba(10,20,25,0.2), rgba(10,20,25,0.65)); z-index: 20; }
.menuCard { width: 400px; padding: 30px 32px; background: rgba(18, 26, 30, 0.88); border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 30px 80px rgba(0,0,0,.5); backdrop-filter: blur(8px); }
.logo { font: 900 46px/1 'Segoe UI', system-ui; letter-spacing: 2px; color: #a7b83a; text-shadow: 0 4px 0 #4b5512; }
.logo span { color: var(--clean); text-shadow: 0 4px 0 #11587a; }
.sub { color: var(--muted); margin: 8px 0 22px; }
.menuCard label { font-size: 12px; color: var(--muted); letter-spacing: 1px; }
.menuCard input { width: 100%; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--line); background: #0c1316; color: #fff; font-size: 16px; margin: 6px 0 14px; outline: none; }
.menuCard input:focus { border-color: var(--teal2); }
.btns { display: flex; flex-direction: column; gap: 10px; }
button { cursor: pointer; border: 0; border-radius: 12px; padding: 11px 16px; font-weight: 700; font-size: 15px; background: #34434a; color: #fff; transition: transform .08s, filter .15s; }
button:hover:not(:disabled) { filter: brightness(1.15); }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: .4; cursor: default; }
button.primary { background: linear-gradient(180deg, #f39a45, #e0731d); box-shadow: 0 4px 0 #9e4c0e; }
.join { display: flex; gap: 8px; margin-top: 16px; }
.join input { margin: 0; text-transform: uppercase; letter-spacing: 3px; font-weight: 700; }
.join button { background: var(--teal); box-shadow: 0 4px 0 #1b5754; }
#menuStatus { min-height: 20px; margin-top: 12px; color: #ffcf7a; font-size: 14px; }
.tiny { font-size: 11px; color: var(--muted); margin-top: 8px; }

/* ---- HUD ---- */
#hud { position: fixed; inset: 0; pointer-events: none; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; backdrop-filter: blur(4px); }
.ptitle { font-weight: 800; font-size: 13px; letter-spacing: 1.2px; display: flex; justify-content: space-between; gap: 10px; }
.ptitle.small { font-size: 11px; margin-top: 10px; }
#lakePanel { position: absolute; left: 16px; top: 16px; width: 290px; }
#lakePct { color: var(--clean); }
.lakebar { height: 14px; border-radius: 7px; background: linear-gradient(90deg, #4a5214, #5b6a1f); margin: 8px 0 6px; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(0,0,0,.4); }
#lakeBar { height: 100%; background: linear-gradient(90deg, #3fa58f, #46c3f0); border-radius: 7px; transition: width .3s; }
.lakerow { display: flex; justify-content: space-between; font-size: 12px; }
.fbar, .wbar, .cbar, .obar { height: 6px; border-radius: 3px; background: rgba(255,255,255,0.1); margin-top: 5px; overflow: hidden; }
.fbar > div { height: 100%; background: var(--dirty); }
.fbar.clean > div { background: var(--clean); }
#fText { margin-top: 4px; }

#topRight { position: absolute; right: 16px; top: 16px; display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; justify-content: flex-end; max-width: 60vw; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; font-size: 13px; display: flex; gap: 8px; align-items: center; }
.stat b { font-size: 17px; }
#room { pointer-events: auto; cursor: pointer; background: var(--teal); border-radius: 12px; padding: 9px 12px; font-size: 13px; }
#room b { letter-spacing: 2px; }

#crosshair { position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 2px rgba(0,0,0,.35); }
#prompt { position: absolute; left: 50%; top: calc(50% + 26px); transform: translateX(-50%); font-size: 15px; text-align: center; text-shadow: 0 2px 4px rgba(0,0,0,.8); white-space: nowrap; }
#prompt:not(:empty) { background: rgba(10,16,20,.55); padding: 6px 12px; border-radius: 10px; }
#prompt .bad { color: #ff8a7a; }
#prompt small { color: var(--muted); }

#gains { position: absolute; left: 50%; top: 42%; }
.gain { position: absolute; left: 0; transform: translateX(-50%); font-weight: 900; font-size: 22px; color: #ffe066; text-shadow: 0 2px 0 #7a5a00, 0 0 12px rgba(0,0,0,.6); animation: rise 1.4s ease-out forwards; white-space: nowrap; }
@keyframes rise { from { opacity: 1; transform: translate(-50%, 0) scale(1.2); } to { opacity: 0; transform: translate(-50%, -70px) scale(1); } }

#toasts { position: absolute; top: 74px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.toast { background: rgba(16,24,28,.85); border: 1px solid var(--line); padding: 8px 16px; border-radius: 12px; font-size: 14px; animation: tin .25s ease-out; transition: opacity .5s, transform .5s; max-width: 70vw; text-align: center; }
.toast.big { background: linear-gradient(180deg, rgba(47,143,138,.95), rgba(28,95,92,.95)); font-size: 16px; font-weight: 700; padding: 11px 20px; }
.toast.warn { border-color: #f0892e; }
.toast.out { opacity: 0; transform: translateY(-8px); }
@keyframes tin { from { opacity: 0; transform: translateY(-10px); } }

#oxy { position: absolute; left: 50%; bottom: 120px; transform: translateX(-50%); width: 260px; text-align: center; font-weight: 700; font-size: 13px; text-shadow: 0 1px 3px #000; }
.obar { height: 10px; border-radius: 5px; }
#oxyFill { height: 100%; background: linear-gradient(90deg, #8fe3ff, #d8f6ff); transition: width .1s; }
#oxyFill.low { background: linear-gradient(90deg, #ff5a4a, #ffa07a); animation: blink .5s infinite alternate; }
@keyframes blink { to { opacity: .4; } }

#toolCard { position: absolute; left: 16px; bottom: 16px; width: 250px; }
.wbar { height: 12px; border-radius: 6px; margin: 7px 0 4px; }
.wbar .fill { height: 100%; transition: width .2s; }
.fill.dirty { background: linear-gradient(90deg, #6b7a1a, #9aa83a); }
.fill.clean { background: linear-gradient(90deg, #2c9fd0, #7fdcff); }
.cbar > div { height: 100%; background: var(--orange); }
#carryList { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; font-size: 13px; min-height: 24px; }
.chip { background: rgba(255,255,255,.08); border-radius: 8px; padding: 2px 7px; font-size: 16px; }
.chip b { font-size: 12px; margin-left: 3px; }

#skillBar { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); display: flex; gap: 10px; }
.skill { position: relative; width: 64px; height: 72px; background: var(--panel); border: 2px solid var(--line); border-radius: 14px; overflow: hidden; text-align: center; }
.skill kbd { position: absolute; left: 4px; top: 4px; font-size: 10px; line-height: 15px; padding: 0 4px; }
.skill .ico { font-size: 28px; margin-top: 12px; }
.skill .nm { font-size: 10px; color: var(--muted); }
.skill .cd { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.6); }
.skill .cdt { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 20px; }
.skill.locked { opacity: .35; filter: grayscale(1); }
.skill.active { border-color: #ffe066; box-shadow: 0 0 16px rgba(255,224,102,.6); }
#hint { position: absolute; right: 16px; bottom: 16px; font-size: 12px; color: var(--muted); text-shadow: 0 1px 2px #000; }

#clickToPlay, #disconnected { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; background: rgba(8,14,16,.45); font-size: 26px; font-weight: 800; cursor: pointer; z-index: 10; }
#clickToPlay small { font-size: 14px; color: var(--muted); font-weight: 500; }
#disconnected { z-index: 30; cursor: default; }

/* ---- Tab menü ---- */
#menu { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(5,10,12,.55); z-index: 15; }
.menuWin { width: min(820px, 94vw); height: min(640px, 90vh); display: flex; flex-direction: column; background: rgba(18, 26, 30, 0.95); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; box-shadow: 0 30px 90px rgba(0,0,0,.6); }
.menuHead { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); gap: 10px; }
#menuTabs { display: flex; gap: 6px; flex-wrap: wrap; }
#menuTabs button { background: transparent; color: var(--muted); padding: 8px 12px; font-size: 14px; }
#menuTabs button.on { background: var(--teal); color: #fff; }
.wallet { font-size: 15px; white-space: nowrap; }
#menuBody { flex: 1; overflow-y: auto; padding: 6px 18px 18px; user-select: text; }
#menuBody h3 { font-size: 13px; letter-spacing: 1.5px; color: var(--teal2); text-transform: uppercase; margin: 18px 0 8px; }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.06); border-radius: 12px; margin-bottom: 7px; }
.row .ic { font-size: 26px; width: 34px; text-align: center; }
.row .info { flex: 1; font-size: 14px; }
.row .desc { color: var(--muted); font-size: 12px; margin-top: 2px; }
.row .warn { color: #ffb36b; font-size: 12px; margin-top: 3px; }
.row .lvl { color: var(--orange); font-size: 12px; font-weight: 700; }
.row button { min-width: 112px; background: linear-gradient(180deg, #f39a45, #e0731d); }
.row button:disabled { background: #3a454b; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.bincard { background: rgba(255,255,255,.05); border-radius: 12px; padding: 10px; font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.bincard .e { font-size: 28px; }
.bincard small { color: var(--muted); font-size: 11px; }
.bincard .bar { height: 6px; background: rgba(255,255,255,.1); border-radius: 3px; overflow: hidden; }
.bincard .bar div { height: 100%; background: var(--orange); }
.bincard.done { background: rgba(47,143,138,.25); }
.bincard.done .bar div { background: #6fe39a; }
.help li { margin-bottom: 7px; font-size: 14px; }
.keys { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; font-size: 14px; }
.menuFoot { padding: 8px; text-align: center; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); }

.plan { width: 100%; max-height: 560px; display: block; margin: 6px auto 14px; background: rgba(0,0,0,.2); border-radius: 12px; }
.bincard .num { display: inline-block; min-width: 22px; padding: 0 5px; margin-right: 6px; border-radius: 6px; background: #20262a; color: #fff; font: 800 13px/22px system-ui; text-align: center; vertical-align: middle; }
.qbtns { display: flex; gap: 8px; }
.qbtns button { background: #34434a; }
.qbtns button.on { background: var(--teal); }
img.ti { width: 28px; height: 28px; vertical-align: middle; object-fit: contain; margin: -6px 1px -4px; image-rendering: auto; }
img.ti.big { width: 44px; height: 44px; margin: 0; }
.chip { display: inline-flex; align-items: center; gap: 2px; }
.chip img.ti { width: 30px; height: 30px; margin: -3px 0; }
.toast img.ti { width: 26px; height: 26px; }
#prompt img.ti { width: 30px; height: 30px; }
.bincard .e { display: flex; align-items: center; gap: 4px; }
