:root {
  --bg: #07121f;
  --panel: rgba(8, 20, 34, 0.92);
  --panel2: #0d2438;
  --edge: #2b4a68;
  --txt: #e6eef6;
  --dim: #8aa3ba;
  --gold: #f2c14e;
  --hp: #d9534f;
  --kp: #4aa8e8;
  --tb: #7bcf6a;
  --warn: #ff9a6a;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--txt);
  font: 13px/1.35 "Segoe UI", Tahoma, Arial, sans-serif; user-select: none; }
.hidden { display: none !important; }
.dim { color: var(--dim); }
.spacer { flex: 1; }
kbd { background: #16344f; border: 1px solid #355a7d; border-radius: 3px; padding: 0 4px; font: 11px/16px "Segoe UI", sans-serif; color: #cfe3f5; }

/* ---------- Giriş ---------- */
#login { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, #123b5c 0%, #07121f 75%); z-index: 20; }
.login-card { background: var(--panel); border: 1px solid var(--edge); border-radius: 10px;
  padding: 28px 34px; width: 340px; text-align: center; box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.login-card h1 { margin: 0 0 4px; font-size: 34px; letter-spacing: 2px; color: var(--gold); }
.login-card form { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
input[type=text], input[type=number] { background: #0b1d30; border: 1px solid var(--edge); color: var(--txt);
  border-radius: 6px; padding: 8px 10px; font-size: 14px; outline: none; user-select: text; }
input[type=text]:focus, input[type=number]:focus { border-color: var(--kp); }
button { background: #1d5a8a; color: #fff; border: 1px solid #3b82b8; border-radius: 5px;
  padding: 6px 12px; font-size: 13px; cursor: pointer; font-family: inherit; }
button:hover:not(:disabled) { background: #2a73ab; }
button:disabled { opacity: .45; cursor: not-allowed; }
.msg { min-height: 20px; margin-top: 10px; color: #ff8d86; font-size: 13px; }

/* ---------- Sabit çerçeve ---------- */
#hud { position: fixed; inset: 0; display: grid; gap: 6px; padding: 6px; background: #050d17;
  grid-template-columns: 236px minmax(0, 1fr) 236px;
  grid-template-rows: 34px minmax(0, 1fr) 62px;
  grid-template-areas: "menu menu menu" "left map right" "tool tool tool"; }
#menubar { grid-area: menu; display: flex; align-items: center; gap: 6px; padding: 0 8px;
  background: linear-gradient(#17384f, #0d2438); border: 1px solid var(--edge); border-radius: 6px; }
.brand { color: var(--gold); font-weight: 700; letter-spacing: 1.5px; margin-right: 8px; }
.mbtn { padding: 3px 10px; background: #12324c; border-color: #2d5679; }
.mbtn.on { background: #2f7f3f; border-color: #58b36a; }
.chip { background: #0a1c2d; border: 1px solid #25405a; border-radius: 12px; padding: 2px 10px; }
.coin { display: inline-block; width: 11px; height: 11px; border-radius: 50%; background: var(--gold);
  box-shadow: inset -2px -2px 0 rgba(0,0,0,.25); vertical-align: -1px; }
#h-state.port { color: #8be28b; border-color: #3f8f4f; }
#h-state.count { color: var(--gold); border-color: var(--gold); }

.side { display: flex; flex-direction: column; gap: 6px; min-height: 0; overflow-y: auto; }
#left { grid-area: left; } #right { grid-area: right; }
.box { background: var(--panel); border: 1px solid var(--edge); border-radius: 6px; padding: 6px 8px; }
.box.grow { flex: 1; display: flex; flex-direction: column; min-height: 140px; }
.box-t { color: var(--gold); font-weight: 700; font-size: 12px; letter-spacing: .5px; margin-bottom: 4px;
  border-bottom: 1px solid rgba(43,74,104,.6); padding-bottom: 2px; display: flex; justify-content: space-between; }
.row { margin: 2px 0; }

.bar { position: relative; height: 16px; background: #0a1826; border: 1px solid #25405a; border-radius: 4px;
  margin-top: 4px; overflow: hidden; }
.bar .fill { height: 100%; width: 0; transition: width .15s linear; }
.bar.hp .fill { background: linear-gradient(#e8665f, #b53c37); }
.bar.kp .fill { background: linear-gradient(#63bdf5, #2d86c4); }
.bar.tb .fill { background: linear-gradient(#8bdc78, #52a342); }
.bar.cd .fill { background: linear-gradient(#f5d36a, #c79a2a); transition: none; }
.bar.cd.ready .fill { background: linear-gradient(#8bdc78, #52a342); }
.bar.rp .fill { background: linear-gradient(#c9a36a, #8e6a45); transition: none; }
.bar span { position: absolute; inset: 0; text-align: center; font-size: 11px; line-height: 15px;
  text-shadow: 0 0 3px #000, 0 0 3px #000; }

#ammo-list .am { display: flex; justify-content: space-between; padding: 2px 4px; border-radius: 4px; border: 1px solid transparent; }
#ammo-list .am.sel { background: rgba(242,193,78,.14); border-color: rgba(242,193,78,.5); }
#ammo-list .am.empty b { color: #ff8d86; }
#ammo-list .am.lock { color: #66798c; }

/* ---------- Deniz Haritası penceresi ---------- */
#mapwin { grid-area: map; display: flex; flex-direction: column; min-width: 0; min-height: 0;
  border: 2px solid #3b6286; border-radius: 6px; background: var(--panel2); box-shadow: 0 0 0 1px #050d17, inset 0 0 0 1px #1a3a56; }
#map-title { display: flex; gap: 10px; align-items: center; padding: 2px 10px; height: 24px; font-weight: 700;
  background: linear-gradient(#1d4d70, #12324c); border-bottom: 1px solid var(--edge); }
#mapbody { position: relative; flex: 1; min-height: 0; overflow: hidden; background: #0e4a73; }
#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; }
#game.drag { cursor: grabbing; }

#toasts { position: absolute; top: 40px; left: 50%; transform: translateX(-50%); display: flex;
  flex-direction: column; align-items: center; gap: 4px; pointer-events: none; z-index: 3; }
.toast { background: rgba(8,20,34,.88); border: 1px solid var(--edge); border-radius: 6px; padding: 4px 14px;
  animation: toastfade 3.2s forwards; }
.toast.lvl { color: var(--gold); border-color: var(--gold); font-weight: 700; font-size: 16px; }
.toast.warn { color: var(--warn); border-color: #a2543a; }
.toast.pick { color: #ffe27a; border-color: var(--gold); }
@keyframes toastfade { 0%{opacity:0; transform:translateY(-8px);} 8%{opacity:1; transform:none;} 80%{opacity:1;} 100%{opacity:0;} }

#port-banner { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); z-index: 2; pointer-events: none;
  background: rgba(40,28,6,.88); border: 1px solid var(--gold); color: var(--gold); border-radius: 8px; padding: 6px 18px;
  font-size: 15px; font-weight: 700; }
#death { position: absolute; top: 38%; left: 50%; transform: translate(-50%, -50%); background: rgba(70,10,10,.88);
  border: 1px solid #a33; border-radius: 10px; padding: 16px 30px; font-size: 20px; text-align: center; pointer-events: none; z-index: 4; }

#shop { position: absolute; right: 10px; bottom: 10px; width: 600px; max-width: calc(100% - 20px); z-index: 5;
  background: var(--panel); border: 1px solid var(--edge); border-radius: 8px; overflow: hidden; }
#shop-head { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-bottom: 1px solid var(--edge); }
.tab { background: #12324c; border-color: #2d5679; }
.tab.sel { background: #2a73ab; border-color: #5aa6d8; }
#shop-close { padding: 2px 10px; font-size: 16px; }
#shop-scroll { max-height: 320px; overflow-y: auto; }
#shop table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
#shop th { position: sticky; top: 0; background: var(--panel2); text-align: left; padding: 5px 6px; color: var(--dim); font-weight: 600; }
#shop td { padding: 4px 6px; border-top: 1px solid rgba(43,74,104,.5); }
#shop tr.cur td { background: rgba(242,193,78,.14); }
#shop tr.locked td { color: #66798c; }
#shop tr.poor td.price { color: #ff8d86; }
#shop td button { padding: 2px 8px; font-size: 12px; }
#shop td input[type=number] { width: 72px; padding: 2px 4px; font-size: 12px; }

#helpwin { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 6; width: 520px; max-width: 92%;
  background: var(--panel); border: 1px solid var(--gold); border-radius: 8px; padding: 10px 14px; }
#helpwin ul { margin: 6px 0 0; padding-left: 18px; line-height: 1.7; }
.x { padding: 0 8px; }

/* ---------- Sağ panel ---------- */
#mini { display: block; width: 100%; height: auto; border-radius: 4px; cursor: pointer; background: #0e4a73; }
#log { flex: 1; min-height: 80px; overflow-y: auto; font-size: 12.5px; user-select: text; word-break: break-word; margin-bottom: 4px; }
#log .m { margin: 1px 0; }
#log .m b { color: var(--kp); }
#log .sys { color: var(--gold); }
#log .gain { color: var(--tb); }
#log .warn { color: var(--warn); }
#log .dmg { color: #ff8d86; }
#log .out { color: #cfe3f5; }
#chat-in { width: 100%; }

/* ---------- Alt araç çubuğu ---------- */
#toolbar { grid-area: tool; display: flex; gap: 6px; align-items: stretch; padding: 5px 8px;
  background: linear-gradient(#0f2a40, #0a1c2d); border: 1px solid var(--edge); border-radius: 6px; overflow-x: auto; }
#tb-ammo { display: flex; gap: 6px; }
.tbtn { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 78px; padding: 2px 8px;
  background: #12324c; border: 1px solid #2d5679; line-height: 1.2; position: relative; }
.tbtn kbd { position: absolute; top: 2px; left: 3px; }
.tbtn span { font-size: 12px; }
.tbtn small { color: var(--dim); font-size: 11px; }
.tbtn.sel { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; background: #1d4a6c; }
.tbtn.empty small { color: #ff8d86; }
.tbtn.lock { opacity: .55; }
.tbtn.atk { margin-left: 14px; background: #7a2a22; border-color: #c85a4a; }
.tbtn.atk.on { background: #c0392b; box-shadow: 0 0 10px rgba(255,90,70,.7); }
.tbtn.cool { opacity: .6; }

@media (max-width: 900px) {
  #hud { grid-template-columns: 170px minmax(0, 1fr) 170px; }
  .brand { display: none; }
}

/* Dar ekran: yan paneller gizlenir, harita + menü + araç çubuğu kalır */
@media (max-width: 700px) {
  #hud { grid-template-columns: minmax(0, 1fr); grid-template-rows: 34px minmax(0, 1fr) 62px;
    grid-template-areas: "menu" "map" "tool"; }
  #left, #right { display: none; }
  #menubar { overflow-x: auto; }
}
