* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #020610; color: #e8f6ff; font-family: 'Pixelify Sans', monospace; user-select: none; }
canvas#game { position: fixed; inset: 0; image-rendering: pixelated; image-rendering: crisp-edges; cursor: none; }
.hidden { display: none !important; }
.dim { opacity: 0.65; }
.small { font-size: 13px; }
button { font-family: inherit; cursor: pointer; }

/* ───────── menü ───────── */
.overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 50;
  background: radial-gradient(ellipse at 50% 0%, #2a8ac8 0%, #0c3566 45%, #020610 100%); }
.menu-box { width: min(640px, 94vw); padding: 26px 28px; background: rgba(4, 18, 40, 0.82); border: 3px solid #f6c935;
  box-shadow: 0 0 0 3px #0b1a30, 0 0 60px rgba(95, 232, 255, 0.25); max-height: 96vh; overflow: auto; }
h1 { margin: 0; text-align: center; line-height: 0.9; letter-spacing: 2px; }
h1 span { display: block; font-size: 52px; color: #f6c935; text-shadow: 4px 4px 0 #b8302a, 0 0 30px rgba(246, 201, 53, 0.4); }
h1 .sub { font-size: 30px; color: #8fe3ff; text-shadow: 3px 3px 0 #155c9a; }
.tag { text-align: center; margin: 10px 0 18px; opacity: 0.85; }
.menu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: center; }
.col { display: flex; flex-direction: column; gap: 6px; }
.col.center { align-items: center; }
label { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 15px; }
input { font-family: inherit; font-size: 16px; background: #0b2340; color: #fff; border: 2px solid #2a8ac8; padding: 6px 8px; outline: none; }
input:focus { border-color: #f6c935; }
input[type=color] { width: 54px; height: 32px; padding: 0 2px; cursor: pointer; }
.swatches { display: flex; flex-wrap: wrap; gap: 4px; }
.swatches button { width: 20px; height: 20px; border: 2px solid #0b1a30; padding: 0; }
.swatches button:hover { border-color: #fff; }
#preview { image-rendering: pixelated; background: radial-gradient(circle, #2a8ac8 0%, #0c3566 80%); border: 2px solid #155c9a; width: 260px; height: 120px; max-width: 100%; }
.actions { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.actions button, .join input { font-size: 18px; padding: 10px; }
.actions button { background: #155c9a; color: #fff; border: 2px solid #8fe3ff; }
.actions button:hover:not(:disabled) { background: #2a8ac8; }
.actions button.primary { background: #f6c935; color: #1d1b26; border-color: #fff3b0; font-weight: 700; }
.actions button.primary:hover:not(:disabled) { background: #ffd84a; }
.actions button:disabled { opacity: 0.5; cursor: wait; }
.join { display: flex; gap: 8px; }
.join input { flex: 1; text-transform: uppercase; letter-spacing: 4px; text-align: center; }
#menu-msg { min-height: 20px; text-align: center; color: #8fe3ff; margin: 10px 0 0; }
#menu-msg.err { color: #ff8a8a; }
#progress { text-align: center; margin: 4px 0; }
button.link { background: none; border: none; color: #ff9a9a; display: block; margin: 0 auto; font-size: 13px; text-decoration: underline; }
.controls { margin-top: 12px; font-size: 14px; background: rgba(0, 0, 0, 0.2); padding: 6px 10px; }
.controls ul { margin: 6px 0; padding-left: 18px; line-height: 1.6; }
.loading-box { font-size: 26px; color: #8fe3ff; }
.dots { animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0.2; } }

/* ───────── HUD ───────── */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.6); }
#hud button, #shop, #room { pointer-events: auto; }
.hud-tl { position: absolute; left: 14px; top: 12px; display: flex; flex-direction: column; gap: 6px; width: 300px; }
.bar { display: flex; align-items: center; gap: 8px; }
.bar .lbl { width: 38px; font-weight: 700; color: #8fe3ff; }
.bar.hp .lbl { color: #ff8a8a; }
.bar.bag .lbl { font-size: 16px; }
.track { flex: 1; height: 14px; background: rgba(0, 10, 25, 0.7); border: 2px solid #0b1a30; box-shadow: 0 0 0 1px rgba(143, 227, 255, 0.4); }
.fill { height: 100%; background: linear-gradient(#bff4ff, #4fc4ee); transition: width 0.1s linear; }
.bar.hp .fill { background: linear-gradient(#ffb0a0, #e0483e); }
.bar.bag .fill { background: linear-gradient(#ffe48a, #c99a4a); }
.bar.bag.full .fill { background: linear-gradient(#ffb0a0, #e0483e); }
.bar .val { width: 90px; font-size: 14px; text-align: right; }
#o2-bar.low .fill { animation: lowo2 0.5s infinite alternate; }
#o2-bar.low .lbl { color: #ff5a5a; }
@keyframes lowo2 { from { background: #ff5a5a; } to { background: #ffd0d0; } }
.o2src { font-size: 12px; color: #5effd6; margin: -4px 0 0 46px; min-height: 12px; }

.hud-tr { position: absolute; right: 52px; top: 12px; text-align: right; }
.money { font-size: 30px; color: #ffd34a; font-weight: 700; }
.depth small { display: block; font-size: 12px; opacity: 0.7; }
.depth b { font-size: 24px; color: #8fe3ff; }
#team { list-style: none; margin: 8px 0 0; padding: 0; font-size: 14px; }
#team li { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
#team li.dead { opacity: 0.4; text-decoration: line-through; }
#team i { width: 10px; height: 10px; display: inline-block; border: 1px solid #000; }
#team b { color: #8fe3ff; min-width: 48px; }

#room { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); background: rgba(4, 18, 40, 0.75); border: 2px solid #f6c935;
  padding: 4px 10px; display: flex; align-items: center; gap: 8px; }
#room small { opacity: 0.7; font-size: 12px; }
#room b { font-size: 20px; letter-spacing: 3px; color: #f6c935; }
#room button { background: none; border: none; font-size: 16px; }

#gauge { position: absolute; right: 14px; top: 14px; bottom: 90px; width: 22px; }
#gauge-track { position: relative; height: 100%; border: 2px solid #0b1a30; box-shadow: 0 0 0 1px rgba(143, 227, 255, 0.3); }
.gl { position: absolute; left: 0; right: 0; opacity: 0.75; }
.gl span { display: none; }
#gauge-dots i { position: absolute; left: -5px; width: 28px; height: 4px; border: 1px solid #000; transform: translateY(-2px); }
#gauge-dots i.me { height: 6px; transform: translateY(-3px); box-shadow: 0 0 6px #fff; }
#gauge-dots i.rec { background: transparent; border: none; border-top: 2px dashed #fff; height: 0; opacity: 0.6; }

.hud-bl { position: absolute; left: 14px; bottom: 14px; }
.tool b { display: block; font-size: 18px; color: #f6c935; }
.tool small { opacity: 0.75; }
#kits { display: flex; gap: 12px; font-size: 13px; margin-top: 4px; opacity: 0.85; }
#build-bar { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; align-items: center;
  background: rgba(4, 18, 40, 0.8); padding: 6px 10px; border: 2px solid #155c9a; }
#build-bar span { padding: 4px 8px; border: 2px solid transparent; }
#build-bar span.on { border-color: #f6c935; color: #f6c935; }
#build-bar small { opacity: 0.6; margin-left: 6px; }
#build-info { position: absolute; bottom: 58px; left: 50%; transform: translateX(-50%); font-size: 15px; padding: 3px 10px; background: rgba(0, 0, 0, 0.5); }
#build-info.ok { color: #8affb0; }
#build-info.bad { color: #ff9a9a; }
#prompt { position: absolute; left: 50%; top: 62%; transform: translateX(-50%); background: rgba(4, 18, 40, 0.85); border: 2px solid #f6c935; padding: 6px 14px; font-size: 17px; }
.nametag { position: absolute; left: 0; top: 0; font-size: 13px; color: #fff; white-space: nowrap; }
#names { position: absolute; inset: 0; }
#feed { position: absolute; left: 14px; top: 140px; display: flex; flex-direction: column; gap: 3px; }
.feed-item { font-size: 14px; display: flex; align-items: center; gap: 6px; }
.feed-item i { width: 10px; height: 10px; border: 1px solid #000; display: inline-block; }
.feed-item.pop { animation: pop 0.25s; }
@keyframes pop { from { transform: scale(1.25); color: #fff59a; } }
#toasts { position: absolute; top: 56px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; width: min(620px, 90vw); }
.toast { background: rgba(4, 18, 40, 0.88); border-left: 4px solid #f6c935; padding: 6px 12px; font-size: 15px; transition: opacity 0.6s, transform 0.6s; text-align: center; }
.toast.out { opacity: 0; transform: translateY(-8px); }
#death { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: rgba(40, 0, 10, 0.45); }
#death h2 { font-size: 44px; color: #ff6a6a; margin: 0; text-shadow: 4px 4px 0 #000; }
#help { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background: rgba(4, 18, 40, 0.94); border: 3px solid #f6c935; padding: 16px 22px; width: min(520px, 92vw); }
#help h3 { margin: 0 0 8px; color: #f6c935; }
#help li { margin: 4px 0; }

/* ───────── dükkan ───────── */
#shop { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0, 5, 15, 0.45); }
.shop-box { width: min(760px, 94vw); max-height: 86vh; display: flex; flex-direction: column; background: #0a1f38; border: 3px solid #f6c935; box-shadow: 0 0 0 3px #04101f, 0 10px 40px #000; }
.shop-head { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: #123a66; }
.shop-head h2 { margin: 0; flex: 1; color: #f6c935; }
#shop-money { font-size: 24px; color: #ffd34a; }
#shop-close { background: #b8302a; color: #fff; border: 2px solid #ff8a8a; font-size: 18px; width: 34px; height: 34px; }
#shop-tabs { display: flex; }
#shop-tabs button { flex: 1; padding: 8px; font-size: 17px; background: #0b2340; color: #cfe9ff; border: none; border-bottom: 3px solid #04101f; }
#shop-tabs button.on { background: #0a1f38; color: #f6c935; border-bottom-color: #f6c935; }
#shop-body { padding: 14px; overflow: auto; }
.npc { font-style: italic; color: #cfe9ff; opacity: 0.85; margin: 0 0 12px; }
.empty { text-align: center; opacity: 0.6; padding: 20px; }
table.sell { width: 100%; border-collapse: collapse; font-size: 15px; }
table.sell th { text-align: left; opacity: 0.6; font-weight: 400; border-bottom: 2px solid #155c9a; }
table.sell td { padding: 3px 4px; border-bottom: 1px solid rgba(143, 227, 255, 0.1); }
.sw { display: inline-block; width: 10px; height: 10px; margin-right: 6px; border: 1px solid #000; }
button.big { margin-top: 12px; width: 100%; padding: 12px; font-size: 20px; background: #f6c935; color: #1d1b26; border: 2px solid #fff3b0; font-weight: 700; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.card { background: #0b2340; border: 2px solid #155c9a; padding: 10px; display: flex; flex-direction: column; gap: 4px; }
.card.own { border-color: #3f9a52; }
.card.next { border-color: #f6c935; }
.card.lock { opacity: 0.45; }
.ct { font-weight: 700; color: #fff; font-size: 16px; }
.ct small { opacity: 0.6; font-weight: 400; }
.cs { font-size: 13px; }
.card button { margin-top: 6px; padding: 7px; font-size: 16px; background: #f6c935; color: #1d1b26; border: 2px solid #fff3b0; font-weight: 700; }
.card button:disabled { background: #445; color: #99a; border-color: #556; cursor: not-allowed; }
.tag { margin-top: 6px; font-size: 13px; color: #8affb0; }
.card.lock .tag { color: #ff9a9a; }
.hint { font-size: 14px; opacity: 0.8; margin-top: 12px; }

.lang-switch { display: flex; justify-content: flex-end; gap: 4px; margin: -10px -12px 4px 0; }
.lang-switch button { background: #0b2340; color: #8fe3ff; border: 2px solid #155c9a; padding: 3px 10px; font-size: 14px; }
.lang-switch button.on { background: #f6c935; color: #1d1b26; border-color: #fff3b0; font-weight: 700; }
#mute-btn { position: absolute; right: 8px; bottom: 50px; width: 34px; height: 34px; font-size: 18px; background: rgba(4, 18, 40, 0.75); border: 2px solid #155c9a; pointer-events: auto; }
label > span { white-space: nowrap; }
.bar.stam .lbl { font-size: 16px; }
.bar.stam .fill { background: linear-gradient(#d8ffb0, #7ccf3a); }
.bar.stam.tired .fill { background: #777; }
.bar.stam.tired .val { color: #ff9a9a; }

#pause { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0, 5, 15, 0.6); pointer-events: auto; z-index: 30; }
.pause-box { width: min(560px, 94vw); max-height: 88vh; overflow: auto; background: #0a1f38; border: 3px solid #f6c935; box-shadow: 0 0 0 3px #04101f, 0 10px 40px #000; padding: 18px 22px; text-shadow: none; }
.pause-box h2 { margin: 0 0 14px; text-align: center; color: #f6c935; font-size: 30px; }
.pause-box h3 { margin: 0 0 12px; color: #8fe3ff; }
#pause-home { display: flex; flex-direction: column; gap: 10px; }
.pbtn { font-size: 20px; padding: 12px; background: #155c9a; color: #fff; border: 2px solid #8fe3ff; }
.pbtn:hover { background: #2a8ac8; }
.pbtn.primary { background: #f6c935; color: #1d1b26; border-color: #fff3b0; font-weight: 700; }
#pause-home p { text-align: center; margin: 4px 0 0; }
.ppanel .row { display: flex; align-items: center; gap: 12px; margin: 12px 0; font-size: 17px; }
.ppanel .row > span { flex: 0 0 150px; }
.ppanel input[type=range] { flex: 1; accent-color: #f6c935; padding: 0; border: none; background: none; }
.ppanel .row b { width: 42px; text-align: right; color: #f6c935; }
.seg { display: flex; gap: 4px; }
.seg button { background: #0b2340; color: #8fe3ff; border: 2px solid #155c9a; padding: 5px 14px; font-size: 15px; }
.seg button.on { background: #f6c935; color: #1d1b26; border-color: #fff3b0; font-weight: 700; }
button.back { margin: 14px 0 0; color: #8fe3ff; font-size: 16px; }
table.keys { width: 100%; border-collapse: collapse; font-size: 15px; }
table.keys td { padding: 5px 6px; border-bottom: 1px solid rgba(143, 227, 255, 0.12); vertical-align: top; }
table.keys td:first-child { white-space: nowrap; width: 1%; }
kbd { display: inline-block; min-width: 22px; text-align: center; padding: 1px 6px; margin: 1px 2px; background: #f4f1e8; color: #1d1b26; border-bottom: 3px solid #9a9488; font-family: inherit; font-size: 13px; }
.money-lbl { display: block; font-size: 12px; color: #ffd34a; opacity: 0.8; letter-spacing: 1px; }
#shop-money small { font-size: 12px; opacity: 0.8; }
