:root {
  --panel: rgba(15, 20, 30, 0.82);
  --border: rgba(255, 255, 255, 0.14);
  --text: #f1f5f9;
  --muted: #94a3b8;
  --accent: #f2c230;
  --war: #ef4444;
  --peace: #38bdf8;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0b1220; color: var(--text); font-family: system-ui, 'Segoe UI', sans-serif; }
#game canvas { display: block; }
.hidden { display: none !important; }
kbd { display: inline-block; min-width: 1.6em; padding: 1px 6px; margin: 0 2px; border-radius: 5px; background: #273244; border: 1px solid #3b4a62; border-bottom-width: 3px; font: 600 12px/1.4 ui-monospace, monospace; text-align: center; }


/* ---------- HUD */
#hud { position: fixed; inset: 0; pointer-events: none; user-select: none; }
#crosshair { position: absolute; left: 50%; top: 50%; width: 20px; height: 20px; transform: translate(-50%, -50%); }
#crosshair::before, #crosshair::after { content: ''; position: absolute; background: #fff; mix-blend-mode: difference; }
#crosshair::before { left: 9px; top: 0; width: 2px; height: 20px; }
#crosshair::after { top: 9px; left: 0; height: 2px; width: 20px; }
#hitmark { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); color: #ff4d4d; font-size: 28px; font-weight: 900; opacity: 0; transition: opacity .1s; }

#phase { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); padding: 8px 18px; border-radius: 999px; font-weight: 800; font-size: 16px; background: var(--panel); border: 2px solid var(--peace); white-space: nowrap; }
#phase.war { border-color: var(--war); background: rgba(127, 29, 29, .85); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 22px rgba(239, 68, 68, .8); } }

#stats { position: absolute; top: 12px; left: 12px; display: flex; gap: 8px; }
#stats span { padding: 7px 13px; border-radius: 10px; background: var(--panel); border: 1px solid var(--border); font-weight: 700; font-size: 16px; }

#flagstatus { position: absolute; top: 58px; left: 50%; transform: translateX(-50%); padding: 6px 14px; border-radius: 10px; background: rgba(0,0,0,.55); font-weight: 600; font-size: 14px; display: none; text-align: center; max-width: 90vw; }

#announce { position: absolute; top: 24%; left: 50%; transform: translate(-50%, -10px); max-width: 90vw; text-align: center; font-size: 26px; font-weight: 900; text-shadow: 0 3px 12px rgba(0,0,0,.8); opacity: 0; transition: opacity .3s, transform .3s; }
#announce.show { opacity: 1; transform: translate(-50%, 0); }
#announce.war { color: #fca5a5; }
#announce.peace { color: #bae6fd; }
#announce.capture { color: #fde047; }
#announce.flag { color: #fdba74; }

#toast { position: absolute; bottom: 168px; left: 50%; transform: translateX(-50%); padding: 6px 14px; border-radius: 8px; font-size: 14px; font-weight: 600; opacity: 0; transition: opacity .2s; white-space: nowrap; }
#toast.show { opacity: 1; }
#toast.err { background: rgba(127, 29, 29, .9); }
#toast.item { background: rgba(0, 0, 0, .55); }

#bottom { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; }
#zone { padding: 4px 12px; border-radius: 8px; background: rgba(0,0,0,.5); font-size: 14px; font-weight: 600; }
#zone.mine { color: #86efac; } #zone.enemy { color: #fca5a5; } #zone.free { color: #bef264; } #zone.road { color: #cbd5e1; }
#hpbar { position: relative; width: 300px; height: 16px; border-radius: 8px; background: rgba(0,0,0,.6); border: 1px solid var(--border); overflow: hidden; }
#hpfill { height: 100%; width: 100%; background: #4ade80; transition: width .2s; }
#hptext { position: absolute; inset: 0; text-align: center; font-size: 11px; font-weight: 800; line-height: 15px; text-shadow: 0 1px 2px #000; }
#hotbar { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--panel); border: 1px solid var(--border); }
.slot { position: relative; width: 52px; height: 52px; border-radius: 8px; border: 2px solid transparent; background: rgba(255,255,255,.06); display: grid; place-items: center; }
.slot.sel { border-color: var(--accent); background: rgba(242, 194, 48, .18); transform: translateY(-3px); }
.slot .key { position: absolute; top: 1px; left: 4px; font-size: 10px; color: var(--muted); font-weight: 700; }
.slot .cost { position: absolute; bottom: 1px; right: 4px; font-size: 10px; color: var(--accent); font-weight: 800; }
.slot .icon { font-size: 26px; }
.cube { width: 34px; height: 34px; background: center / contain no-repeat; image-rendering: pixelated; filter: drop-shadow(0 2px 2px rgba(0,0,0,.5)); }

#side { position: absolute; top: 12px; right: 12px; width: 180px; display: flex; flex-direction: column; gap: 8px; }
#minimap { width: 180px; height: 180px; border-radius: 10px; border: 2px solid var(--border); image-rendering: pixelated; background: #000; }
#board { padding: 8px; border-radius: 10px; background: var(--panel); border: 1px solid var(--border); font-size: 13px; }
#board .bh { font-weight: 800; margin-bottom: 4px; }
.brow { display: flex; align-items: center; gap: 6px; padding: 2px 0; }
.brow.me { color: var(--accent); font-weight: 700; }
.brow .rk { width: 14px; color: var(--muted); }
.brow .dot { width: 9px; height: 9px; border-radius: 50%; border: 2px solid; }
.brow .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brow .sc { font-weight: 800; }

#chat { position: absolute; left: 12px; bottom: 12px; width: min(380px, 40vw); }
#chatlog { max-height: 220px; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; font-size: 13px; }
#chatlog .line { padding: 3px 8px; margin-top: 2px; border-radius: 6px; background: rgba(0,0,0,.45); transition: opacity 1s; text-shadow: 0 1px 2px #000; }
#chatlog .line.old { opacity: .35; }
#chatinput { pointer-events: auto; width: 100%; margin-top: 6px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--accent); background: rgba(0,0,0,.75); color: var(--text); font-size: 14px; outline: none; }

#hurt { position: absolute; inset: 0; box-shadow: inset 0 0 120px 30px rgba(220, 0, 0, .65); opacity: 0; transition: opacity .25s; }
#death { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: rgba(80, 0, 0, .55); text-shadow: 0 3px 10px #000; }
#death h1 { font-size: 54px; margin: 0; }
#death p { font-size: 20px; margin: 6px; }

#clicktoplay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; background: rgba(0,0,0,.35); pointer-events: auto; cursor: pointer; font-size: 24px; font-weight: 800; text-shadow: 0 2px 8px #000; }
#clicktoplay small { font-size: 14px; color: #cbd5e1; font-weight: 500; }

.panel { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(820px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; padding: 22px 26px; border-radius: 16px; background: rgba(15, 20, 30, .95); border: 1px solid var(--border); pointer-events: auto; box-shadow: 0 30px 80px rgba(0,0,0,.6); }
.panel h2 { margin: 0 0 8px; }
.panel h3 { margin: 14px 0 6px; color: var(--accent); font-size: 15px; }
.panel p, .panel li, .panel td { font-size: 14px; line-height: 1.55; color: #cbd5e1; }
.panel td { padding: 2px 8px 2px 0; }
.panel .hint { color: var(--muted); margin-top: 0; }
.panel .close { position: absolute; top: 12px; right: 14px; width: 32px; height: 32px; border-radius: 8px; border: 0; background: #273244; color: var(--text); font-size: 16px; cursor: pointer; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 700px) { .cols { grid-template-columns: 1fr; } }
#invgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.invitem { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px; border-radius: 10px; border: 1px solid var(--border); background: rgba(255,255,255,.04); color: var(--text); cursor: pointer; }
.invitem:hover { border-color: var(--accent); background: rgba(242, 194, 48, .12); }
.invitem .cube { width: 48px; height: 48px; }
.invitem .iname { font-weight: 700; font-size: 13px; }
.invitem .istat { font-size: 11px; color: var(--muted); }

/* ---------- Mobil / dokunmatik */
#touch { display: none; }
.mob { display: none; }
body.touch .mob { display: block; }
body.touch .desk { display: none !important; }
body.touch, body.touch canvas { touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
body.touch #touch { display: block; position: absolute; inset: 0; pointer-events: none; }
body.touch #hud { -webkit-tap-highlight-color: transparent; }

#joy { position: absolute; left: calc(20px + env(safe-area-inset-left)); bottom: 22px; width: 132px; height: 132px; border-radius: 50%;
  background: rgba(255,255,255,.1); border: 2px solid rgba(255,255,255,.28); pointer-events: auto; touch-action: none; }
#joyknob { position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; margin: -29px 0 0 -29px; border-radius: 50%;
  background: rgba(255,255,255,.45); box-shadow: 0 2px 8px rgba(0,0,0,.4); }

#tactions { position: absolute; right: calc(18px + env(safe-area-inset-right)); bottom: 22px; width: 170px; height: 150px; }
#tactions .tb, #tmenubtn, #tclaim, #tmenu button { pointer-events: auto; touch-action: none; border: 2px solid rgba(255,255,255,.3); color: #fff;
  background: rgba(15,20,30,.55); border-radius: 50%; display: grid; place-items: center; padding: 0; }
#tactions .tb { position: absolute; width: 62px; height: 62px; font-size: 26px; }
#tactions .tb.big { right: 0; bottom: 0; width: 84px; height: 84px; font-size: 36px; border-color: rgba(242,194,48,.7); }
#tactions [data-act=secondary] { right: 92px; bottom: 6px; }
#tactions [data-act=jump] { right: 14px; bottom: 92px; }
#tactions .tb.off { opacity: .35; }
#tactions .tb.down, #tmenubtn.down, #tclaim.down, #tmenu button.down { background: rgba(242,194,48,.55); transform: scale(.94); }
/* Az kullanılan eylemler tek bir menü butonunda toplanır (sol üst) */
#tmenubtn { position: absolute; top: 8px; left: calc(8px + env(safe-area-inset-left)); width: 34px; height: 34px; border-radius: 10px; font-size: 18px; }
#tmenu { position: absolute; top: 48px; left: calc(8px + env(safe-area-inset-left)); display: flex; flex-direction: column; gap: 4px; padding: 6px;
  border-radius: 12px; background: rgba(15,20,30,.92); border: 1px solid var(--border); pointer-events: auto; z-index: 6; }
#tmenu.hidden { display: none; }
#tmenu button { display: block; text-align: left; padding: 8px 14px; border-radius: 9px; font: 600 14px system-ui, sans-serif; border-width: 1px; background: rgba(255,255,255,.06); }
/* Sadece sahiplenilebilir bölgedeyken görünen büyük buton */
#tclaim { position: absolute; left: 50%; bottom: 112px; transform: translateX(-50%); border-radius: 14px; padding: 10px 18px;
  font: 800 15px system-ui, sans-serif; background: rgba(34,120,60,.85); border-color: #86efac; animation: claimpulse 1.6s infinite; }
#tclaim.hidden { display: none; }
#tclaim.down { transform: translateX(-50%) scale(.94); }
@keyframes claimpulse { 50% { box-shadow: 0 0 0 6px rgba(134,239,172,.25); } }
body.touch #mute { display: none; }
#rotate { display: none; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); padding: 10px 16px; border-radius: 12px;
  background: rgba(0,0,0,.6); font-size: 14px; font-weight: 600; white-space: nowrap; }
@media (orientation: portrait) { body.touch #rotate { display: block; animation: fadeout 1s 5s forwards; } }
@keyframes fadeout { to { opacity: 0; visibility: hidden; } }

body.touch #side { width: 104px; top: 8px; right: calc(8px + env(safe-area-inset-right)); }
body.touch #minimap { width: 104px; height: 104px; }
body.touch #board { display: none; }
body.touch #stats { top: 8px; left: calc(50px + env(safe-area-inset-left)); }
body.touch #stats span { padding: 4px 9px; font-size: 13px; }
body.touch #phase { top: 8px; font-size: 13px; padding: 5px 12px; }
body.touch #flagstatus { top: 44px; font-size: 11px; max-width: min(340px, 40vw); }
body.touch #announce { font-size: 17px; top: 18%; }
body.touch #chat { top: 44px; bottom: auto; left: calc(8px + env(safe-area-inset-left)); width: min(260px, 36vw); }
body.touch #chatlog { max-height: 64px; font-size: 11px; }
body.touch #chatinput { position: fixed; left: 50%; top: 20%; transform: translateX(-50%); width: min(420px, 90vw); font-size: 16px; }
body.touch #bottom { bottom: 6px; gap: 4px; }
body.touch #zone { font-size: 11px; padding: 2px 8px; }
body.touch #hpbar { width: 180px; height: 12px; }
body.touch #hptext { font-size: 9px; line-height: 11px; }
body.touch #hotbar { pointer-events: auto; gap: 2px; padding: 3px; }
body.touch .slot { width: 36px; height: 36px; }
body.touch .slot.sel { transform: translateY(-2px); }
body.touch .slot .key { display: none; }
body.touch .slot .icon { font-size: 18px; }
body.touch .slot .cube { width: 26px; height: 26px; }
body.touch .slot .cost { font-size: 8px; right: 2px; }
body.touch #toast { bottom: 90px; font-size: 12px; }
body.touch .panel { padding: 16px; }
body.touch #death h1 { font-size: 36px; }
@media (max-width: 520px) {
  body.touch .slot { width: 30px; height: 30px; }
  body.touch #joy { width: 112px; height: 112px; bottom: 96px; }
  body.touch #tclaim { bottom: 140px; }
  body.touch #tactions { bottom: 96px; }
}

/* ---------- Çevrimiçi oyuncular */
#online { pointer-events: auto; cursor: pointer; padding: 7px 13px; border-radius: 10px; background: var(--panel); border: 1px solid var(--border);
  color: #86efac; font: 700 16px system-ui, sans-serif; }
#online:hover { border-color: #86efac; }
#onlinelist { position: absolute; top: 56px; left: 12px; min-width: 220px; max-width: 280px; max-height: 60vh; overflow: auto; padding: 10px;
  border-radius: 12px; background: rgba(15, 20, 30, .92); border: 1px solid var(--border); pointer-events: auto; z-index: 5; }
#onlinelist .oh { font-weight: 800; margin-bottom: 6px; color: #86efac; }
#onlinelist .orow { display: flex; align-items: center; gap: 8px; padding: 4px 2px; font-size: 14px; border-top: 1px solid rgba(255,255,255,.06); }
#onlinelist .orow.me { color: var(--accent); font-weight: 700; }
#onlinelist .odot { width: 10px; height: 10px; border-radius: 50%; flex: none; box-shadow: 0 0 6px currentColor; }
#onlinelist .oname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#onlinelist .otag { font-size: 12px; color: var(--muted); }
#onlinelist .obots { margin-top: 6px; font-size: 13px; color: #fca5a5; }
body.touch #online { padding: 4px 9px; font-size: 13px; }
body.touch #onlinelist { top: 40px; left: 8px; font-size: 12px; }

/* ---------- Yay ve ses */
#charge { display: none; position: absolute; left: 50%; top: calc(50% + 26px); transform: translateX(-50%); width: 70px; height: 6px; border-radius: 3px; background: rgba(0,0,0,.55); overflow: hidden; }
#chargefill { height: 100%; width: 0; }
#hitmark.kill { color: #ff2d2d; font-size: 40px; text-shadow: 0 0 12px #ff0000; }
#mute { pointer-events: auto; cursor: pointer; padding: 7px 10px; border-radius: 10px; background: var(--panel); border: 1px solid var(--border); font-size: 15px; }
body.touch #mute { padding: 4px 7px; font-size: 13px; }

/* ---------- Görevler */
#quest { position: absolute; top: 58px; left: 12px; width: 240px; padding: 9px 11px; border-radius: 12px; background: var(--panel); border: 1px solid rgba(242,194,48,.35); }
#quest .qh { font-size: 12px; font-weight: 800; color: var(--accent); text-transform: uppercase; letter-spacing: .04em; }
#qtext { font-size: 14px; font-weight: 600; margin: 3px 0 6px; line-height: 1.3; }
#quest .qbar { height: 6px; border-radius: 3px; background: rgba(255,255,255,.12); overflow: hidden; }
#qfill { height: 100%; width: 0; background: linear-gradient(90deg, #f2c230, #4ade80); transition: width .3s; }
#qreward { font-size: 12px; color: var(--muted); margin-top: 4px; }
#quest.flash { animation: qflash 1.2s; }
@keyframes qflash { 0%, 60% { background: rgba(74, 222, 128, .45); transform: scale(1.04); } 100% { background: var(--panel); transform: none; } }
body.touch #quest { top: 40px; left: 8px; width: min(220px, 34vw); padding: 6px 8px; }
body.touch #qtext { font-size: 11px; margin: 2px 0 4px; }
body.touch #quest .qh, body.touch #qreward { font-size: 10px; }
body.touch #chat { top: 118px; }

/* ---------- Savaş raporu */
#report { position: absolute; top: 90px; left: 50%; transform: translateX(-50%); min-width: 300px; padding: 14px 18px; border-radius: 14px;
  background: rgba(15, 20, 30, .92); border: 2px solid var(--accent); box-shadow: 0 20px 60px rgba(0,0,0,.5); animation: pop .35s; }
@keyframes pop { from { transform: translateX(-50%) scale(.85); opacity: 0; } }
#report h2 { margin: 0 0 6px; font-size: 18px; text-align: center; }
#report .mvp { text-align: center; color: var(--accent); font-weight: 800; margin-bottom: 8px; }
#report table { width: 100%; border-collapse: collapse; font-size: 14px; }
#report th { color: var(--muted); font-weight: 600; padding: 2px 6px; }
#report td { padding: 3px 6px; text-align: center; }
#report td.n { text-align: left; font-weight: 700; }
#report tr.me { background: rgba(242,194,48,.15); }
body.touch #report { top: 60px; min-width: 260px; padding: 10px; }
body.touch #report table { font-size: 12px; }

/* ---------- Lobi */
#login { position: fixed; inset: 0; z-index: 50; overflow-y: auto; padding: 24px 16px;
  background: linear-gradient(180deg, rgba(8,14,28,.25) 0%, rgba(8,14,28,.55) 55%, rgba(8,14,28,.85) 100%); }
.lobby { width: min(460px, 100%); margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.brand { text-align: center; text-shadow: 0 4px 24px rgba(0,0,0,.6); padding-top: 2vh; }
.brand .logo { font-size: 56px; line-height: 1; animation: bob 3s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-6px); } }
.brand h1 { margin: 6px 0 0; font-size: clamp(32px, 7vw, 44px); letter-spacing: .02em; }
.brand .sub { margin: 4px 0 0; color: var(--accent); font-weight: 700; letter-spacing: .1em; }
#login .card { padding: 20px; border-radius: 18px; background: rgba(15, 20, 30, .82); border: 1px solid var(--border);
  box-shadow: 0 24px 60px rgba(0,0,0,.45); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.join label { display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.namerow { display: flex; gap: 8px; }
.namerow input { flex: 1; min-width: 0; padding: 13px 14px; border-radius: 12px; border: 2px solid #3b4a62; background: #0b1220; color: var(--text); font-size: 17px; font-weight: 600; outline: none; transition: border-color .15s; }
.namerow input:focus { border-color: var(--accent); }
#dice { width: 52px; border-radius: 12px; border: 2px solid #3b4a62; background: #1a2436; font-size: 22px; cursor: pointer; transition: transform .15s; }
#dice:hover { transform: rotate(20deg) scale(1.08); border-color: var(--accent); }
#namehint { min-height: 20px; margin: 8px 2px 0; font-size: 13px; line-height: 1.4; }
#namehint .recover { display: flex; gap: 6px; margin-top: 6px; }
#namehint .recover input { flex: 1; min-width: 0; padding: 7px 10px; border-radius: 8px; border: 1px solid rgba(255,255,255,.25); background: rgba(0,0,0,.35); color: #fff; font: 600 14px ui-monospace, monospace; letter-spacing: 1px; text-transform: uppercase; }
#namehint .recover button { padding: 7px 12px; border-radius: 8px; border: 0; background: #f2c230; color: #2a1d00; font-weight: 700; cursor: pointer; white-space: nowrap; }
#namehint .recover button:disabled { opacity: .6; }
#namehint.ok { color: #86efac; } #namehint.bad { color: #fca5a5; } #namehint.warn { color: #fcd34d; } #namehint.muted { color: var(--muted); }
#accounts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
#accounts .acclabel { font-size: 12px; color: var(--muted); }
#accounts .chip { padding: 5px 11px; border-radius: 999px; border: 1px solid #3b4a62; background: #1a2436; color: var(--text); font-size: 13px; cursor: pointer; }
#accounts .chip:hover { border-color: var(--accent); }
#colorrow { margin-top: 14px; }
#colors { display: flex; flex-wrap: wrap; gap: 7px; }
.swatch { width: 26px; height: 26px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; box-shadow: 0 0 0 1px rgba(0,0,0,.4) inset; transition: transform .1s; }
.swatch:hover { transform: scale(1.15); }
.swatch.on { border-color: #fff; transform: scale(1.18); box-shadow: 0 0 12px rgba(255,255,255,.5); }
#play { width: 100%; margin-top: 16px; padding: 15px; border: 0; border-radius: 12px; background: linear-gradient(180deg, #f8d24a, #e0a91b);
  color: #1a1300; font-size: 18px; font-weight: 900; cursor: pointer; box-shadow: 0 6px 0 #a87a0c, 0 10px 24px rgba(242,194,48,.25);
  transition: transform .08s, box-shadow .08s, filter .15s; display: flex; align-items: center; justify-content: center; gap: 10px; }
#play:hover:not(:disabled) { filter: brightness(1.08); }
#play:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 2px 0 #a87a0c; }
#play:disabled { filter: grayscale(.7) brightness(.7); cursor: not-allowed; box-shadow: 0 6px 0 #5a4a20; }
.spin { width: 18px; height: 18px; border-radius: 50%; border: 3px solid rgba(26,19,0,.25); border-top-color: #1a1300; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#loginerr { display: none; margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: rgba(127, 29, 29, .55); border: 1px solid rgba(248, 113, 113, .5);
  color: #fecaca; font-size: 14px; line-height: 1.4; align-items: center; gap: 10px; justify-content: space-between; }
#loginerr.show { display: flex; animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
#loginerr .retry { flex: none; padding: 6px 10px; border-radius: 8px; border: 0; background: #fecaca; color: #7f1d1d; font-weight: 800; cursor: pointer; }

#live { font-size: 14px; padding: 14px 18px !important; }
#live .livehead { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
#live .dot { width: 10px; height: 10px; border-radius: 50%; background: #64748b; }
#live .dot.on { background: #4ade80; box-shadow: 0 0 10px #4ade80; animation: pulse2 1.6s infinite; }
@keyframes pulse2 { 50% { opacity: .5; } }
#live .phase { margin-left: auto; padding: 3px 10px; border-radius: 999px; background: rgba(56,189,248,.18); color: #bae6fd; font-weight: 700; font-size: 13px; }
#live .phase.war { background: rgba(239,68,68,.25); color: #fecaca; }
#live .liveplayers, #live .livetop { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 10px; }
#live .lp { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; }
#live .lp i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
#live .lt { font-weight: 700; color: var(--accent); }
#live .muted, .muted { color: var(--muted); }
#live .offline { color: #fca5a5; }

.features { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.features div { padding: 10px 12px; border-radius: 12px; background: rgba(15,20,30,.6); border: 1px solid var(--border); backdrop-filter: blur(6px); }
.features b { display: block; font-size: 14px; }
.features span { font-size: 12px; color: #cbd5e1; }

#disconnected { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(5,8,16,.7); backdrop-filter: blur(4px); padding: 16px; }
#disconnected .card { width: min(380px, 100%); padding: 26px; border-radius: 18px; text-align: center; background: rgba(15,20,30,.95); border: 1px solid var(--border); }
#disconnected .big { font-size: 48px; }
#disconnected h2 { margin: 8px 0 4px; }
#disconnected p { color: #cbd5e1; margin: 0 0 18px; }
#reconnect { width: 100%; padding: 13px; border: 0; border-radius: 12px; background: var(--accent); color: #1a1300; font-size: 17px; font-weight: 900; cursor: pointer; }

#gold.pulse { animation: goldpulse .6s; }
@keyframes goldpulse { 30% { color: #fde047; box-shadow: 0 0 14px rgba(253,224,71,.6); } }

.online-tag { display: inline-block; margin-top: 8px; padding: 2px 10px; border-radius: 6px; background: var(--war); color: #fff; font-weight: 900; font-size: 12px; letter-spacing: .25em; box-shadow: 0 4px 14px rgba(239,68,68,.45); }
.brand h1 { margin-top: 2px !important; }

/* ---------- Sohbet komutları */
#cmdhint { pointer-events: auto; margin-top: 6px; border-radius: 10px; overflow: hidden; background: rgba(15,20,30,.95); border: 1px solid var(--accent); }
#cmdhint .cmd { display: flex; gap: 10px; align-items: baseline; padding: 7px 10px; cursor: pointer; font-size: 13px; }
#cmdhint .cmd:first-child { background: rgba(242,194,48,.12); }
#cmdhint .cmd:hover { background: rgba(242,194,48,.22); }
#cmdhint .cmd b { color: var(--accent); white-space: nowrap; }
#cmdhint .cmd span { color: #cbd5e1; }
body.touch #cmdhint { position: fixed; left: 50%; top: calc(20% + 48px); transform: translateX(-50%); width: min(420px, 90vw); margin: 0; }

/* ---------- Barbar akını göstergesi */
#raid { position: absolute; top: 56px; left: 50%; transform: translateX(-50%); padding: 6px 14px; border-radius: 10px; background: rgba(60, 20, 10, .85);
  border: 1px solid rgba(251, 146, 60, .6); color: #fed7aa; font-weight: 800; font-size: 14px; white-space: nowrap; }
#raid.mine { border-color: #ef4444; background: rgba(127, 29, 29, .9); color: #fecaca; }
#raid.tick { animation: raidtick .5s; }
@keyframes raidtick { 40% { transform: translateX(-50%) scale(1.08); } }
body.raiding #flagstatus { top: 94px; }
body.touch #raid { top: 40px; font-size: 11px; padding: 4px 10px; }
body.touch.raiding #flagstatus { top: 70px; }

/* ---------- Taht ve ittifak */
#throne { position: absolute; top: 56px; left: 50%; transform: translateX(-50%); padding: 5px 14px; border-radius: 10px; white-space: nowrap; max-width: 92vw; overflow: hidden; text-overflow: ellipsis;
  background: rgba(60, 45, 5, .85); border: 1px solid rgba(242,194,48,.6); color: #fde68a; font-weight: 800; font-size: 13px; }
#throne.contested { background: rgba(127, 29, 29, .9); border-color: #ef4444; color: #fecaca; animation: pulse 1s infinite; }
body:has(#throne:not(.hidden)) #raid { top: 90px; }
body:has(#throne:not(.hidden)) #flagstatus { top: 92px; }
body.raiding:has(#throne:not(.hidden)) #flagstatus { top: 126px; }
#invite { position: absolute; top: 130px; left: 50%; transform: translateX(-50%); z-index: 6; pointer-events: auto; padding: 14px 18px; border-radius: 14px;
  background: rgba(15, 30, 20, .95); border: 2px solid #4ade80; box-shadow: 0 16px 40px rgba(0,0,0,.5); text-align: center; animation: pop .3s; }
#invite .itext { font-weight: 800; margin-bottom: 10px; }
#invite .ibtns { display: flex; gap: 8px; justify-content: center; }
#invite button { padding: 8px 16px; border-radius: 10px; border: 0; font-weight: 800; cursor: pointer; }
#invite .yes { background: #4ade80; color: #052e16; }
#invite .no { background: #334155; color: #e2e8f0; }
body.touch #throne { top: 40px; font-size: 11px; padding: 3px 10px; }
body.touch:has(#throne:not(.hidden)) #raid { top: 64px; }

/* ---------- Seviye ve demirci */
#level { position: relative; overflow: hidden; }
#level i { position: absolute; left: 0; bottom: 0; height: 3px; background: #a78bfa; }
#smith { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.smithrow { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: rgba(255,255,255,.05); border: 1px solid var(--border); }
.smithrow .si { font-size: 24px; }
.smithrow .sinfo { flex: 1; display: flex; flex-direction: column; }
.smithrow b { font-size: 14px; }
.smithrow small { color: var(--muted); font-size: 12px; }
.smithrow button { min-width: 72px; padding: 8px 10px; border-radius: 8px; border: 0; background: var(--accent); color: #1a1300; font-weight: 800; cursor: pointer; }
.smithrow button:disabled { background: #334155; color: #94a3b8; cursor: not-allowed; }

#hpbar.healing { box-shadow: 0 0 12px rgba(74, 222, 128, .8); border-color: #4ade80; animation: healpulse 1s infinite; }
@keyframes healpulse { 50% { box-shadow: 0 0 4px rgba(74, 222, 128, .4); } }

/* ---------- Sade ekran: eski sohbet satırları tamamen kaybolur (sohbet açılınca hepsi görünür) */
#chatlog .line.old { opacity: 0; }
#chat:has(#chatinput:not(.hidden)) #chatlog .line { opacity: 1; display: block; }
body.touch #chatlog .line:not(:nth-last-child(-n+3)) { display: none; }
body.touch #quest .qh, body.touch #qreward { display: none; }
body.touch #quest { width: min(190px, 30vw); padding: 5px 8px; }
body.touch #chat { top: 92px; }
body.touch #announce { top: 28%; }
body.touch #chatlog { max-height: 96px; }

/* ---------- Eylemler paneli: komutlar yazmadan seçilir */
#actions { width: min(620px, calc(100vw - 24px)); }
#actions h3:empty { display: none; }
.actrow { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.actbtn { padding: 8px 12px; border-radius: 10px; border: 1px solid var(--border); background: #1f2937; color: var(--text);
  font: 600 14px system-ui, sans-serif; cursor: pointer; touch-action: manipulation; }
.actbtn:hover { border-color: var(--accent); }
.actbtn:active { transform: scale(.96); }
.actbtn.danger { background: #7f1d1d; border-color: #fca5a5; }
.actbtn.toggle { background: #14532d; border-color: #86efac; }
.actnote { font-size: 13px; color: var(--muted); align-self: center; }
body.touch #actions { top: 8px; transform: translateX(-50%); max-height: calc(100vh - 16px); }
body.touch .actbtn { padding: 7px 10px; font-size: 13px; }

/* ---------- Mobilde sohbet yazarken: kutu en üstte, mesajlar altında (klavye alt yarıyı kaplıyor) */
body.touch #chat:has(#chatinput:not(.hidden)) { top: 52px; left: max(3vw, calc(50% - 260px)); width: min(520px, 94vw); z-index: 7; }
body.touch #chat:has(#chatinput:not(.hidden)) #chatlog { max-height: 34vh; font-size: 12px; }
body.touch #chat:has(#chatinput:not(.hidden)) #chatlog .line { display: block; }
body.touch #chatinput { top: 8px; }
body.touch #cmdhint { position: fixed; top: 52px; left: 50%; transform: translateX(-50%); width: min(520px, 94vw); z-index: 8; }
