:root {
  --bg: #1b1e24; --panel: #252a33; --panel2: #2e3440; --line: #3b4252; --text: #e5e9f0; --dim: #9aa3b2;
  --accent: #e0b04a; --good: #7fcf7f; --bad: #ef6b6b; --warn: #f0c060; --info: #8fbcef;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.4 system-ui, "Segoe UI", sans-serif; overflow: hidden; }
.hidden { display: none !important; }
button { background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 5px 9px; cursor: pointer; font: inherit; }
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: #6b5320; border-color: var(--accent); }
button.danger { background: #5a2626; border-color: #a44; }
button.small { padding: 2px 6px; font-size: 12px; }
input, select, textarea { background: #161a20; color: var(--text); border: 1px solid var(--line); border-radius: 5px; padding: 4px 6px; font: inherit; }
textarea { width: 100%; resize: vertical; }
h3 { margin: 12px 0 6px; font-size: 14px; color: var(--accent); }

/* ---------- Ana sayfa ---------- */
#login { position: fixed; inset: 0; overflow-y: auto; background: radial-gradient(ellipse at 50% 0%, #34432c 0%, #1a2019 45%, #12151a 100%); z-index: 10; scroll-behavior: smooth; }
#login .hero { max-width: 1100px; margin: 0 auto; padding: 56px 20px 36px; display: flex; gap: 36px; align-items: center; flex-wrap: wrap; }
#login .hero-text { flex: 1 1 420px; }
#login h1 { margin: 0 0 10px; font-size: clamp(34px, 6vw, 56px); color: var(--accent); letter-spacing: .5px; text-shadow: 0 3px 12px #000a; }
#login .tagline { font-size: 18px; line-height: 1.55; color: #dfe5d8; max-width: 620px; margin: 0 0 18px; }
#login .stats { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
#login .stats span { background: #0007; border: 1px solid #ffffff1f; border-radius: 20px; padding: 5px 12px; font-size: 14px; }
#login .stats span b { color: var(--accent); }
.guide-link { color: var(--accent); text-decoration: none; font-weight: 600; font-size: 16px; border-bottom: 1px dashed var(--accent); }
#login .card.join { flex: 0 1 360px; background: #252a33ee; border: 1px solid var(--line); border-radius: 14px; padding: 22px; box-shadow: 0 10px 40px #0008; }
#login .card.join h2 { margin: 0 0 6px; font-size: 20px; }
#login .fl input { width: 100%; font-size: 17px; padding: 10px; margin: 4px 0 8px; box-sizing: border-box; }
.fl { display: block; color: var(--dim); font-size: 13px; }
.fl.hidden { display: none; }
#login .tabs { display: flex; gap: 6px; margin: 0 0 10px; }
#login .tab { flex: 1; padding: 9px; font-size: 15px; background: transparent; }
#login .tab.on { background: #6b5320; border-color: var(--accent); color: #fff; }
#login #joinBtn { width: 100%; font-size: 17px; padding: 10px; }
#savedNote { margin: 0 0 8px; }
#savedNote a { color: var(--accent); cursor: pointer; }
#acctModal { position: fixed; inset: 0; background: rgba(5, 8, 12, .82); display: flex; align-items: flex-start; justify-content: center; z-index: 27; padding: 30px 16px; overflow-y: auto; }
#acctModal .hm-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; max-width: 440px; width: 100%; padding: 8px 16px 16px; }
#acctModal .hm-head { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
#acctModal .hm-head b { flex: 1; font-size: 18px; color: var(--accent); }
#acctModal .fl input { width: 100%; padding: 8px; margin: 3px 0 8px; box-sizing: border-box; }
#acctModal hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
#acctModal.hidden, #acctModal .hidden { display: none; }
button.danger { border-color: var(--bad); color: #ffd0c8; }
#meName { display: inline-flex; align-items: center; gap: 6px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin: 8px 0 14px; }
.stat-grid div { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.stat-grid b { display: block; font-size: 20px; color: var(--text); }
.stat-grid span { color: var(--dim); font-size: 12px; }
.rank-card h3 { margin: 14px 0 4px; }
#login #joinBtn { width: 100%; font-size: 17px; padding: 11px; }
#loginErr { color: var(--bad); min-height: 20px; margin-top: 6px; }
#guide { max-width: 1000px; margin: 0 auto; padding: 0 20px 60px; }
.g-sec { background: #20252dcc; border: 1px solid var(--line); border-radius: 14px; padding: 18px 22px; margin: 18px 0; }
.g-sec h2 { margin: 0 0 10px; color: var(--accent); font-size: 21px; }
.g-sec p, .g-sec li { line-height: 1.6; }
.g-sec ul, .g-sec ol { padding-left: 22px; margin: 8px 0; }
.g-sec .center { text-align: center; margin-top: 14px; }
.features { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; margin-top: 12px; }
.feat { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.feat .fi { font-size: 28px; margin-bottom: 4px; }
.feat p { margin: 6px 0 0; font-size: 13.5px; color: var(--dim); line-height: 1.45; }
.steps li { margin: 8px 0; }
table.gt { width: 100%; border-collapse: collapse; font-size: 14px; }
table.gt td, table.gt th { border-bottom: 1px solid var(--line); padding: 7px 8px; text-align: left; vertical-align: top; }
table.gt th { color: var(--accent); font-weight: 600; }
table.gt td:first-child, #bldTable td:nth-child(3) { white-space: nowrap; }
.tablewrap { overflow-x: auto; }
kbd { background: #11151b; border: 1px solid #4a5263; border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }
/* oyun içi yardım penceresi */
#rankModal { position: fixed; inset: 0; background: rgba(5, 8, 12, .82); display: flex; align-items: flex-start; justify-content: center; z-index: 26; padding: 30px 16px; overflow-y: auto; }
#rankModal .hm-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; max-width: 640px; width: 100%; padding: 8px 16px 16px; }
#rankModal .hm-head { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
#rankModal .hm-head b { flex: 1; font-size: 18px; color: var(--accent); }
.rank-big { font-size: 22px; text-align: center; margin: 6px 0 12px; }
.rank-big b { color: var(--accent); }
.rank-tbl { width: 100%; border-collapse: collapse; }
.rank-tbl td, .rank-tbl th { padding: 5px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.rank-tbl th { color: var(--dim); font-weight: 600; }
.rank-tbl tr.me td { background: #e0b04a22; font-weight: 600; }
.rank-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.podium { display: flex; gap: 10px; justify-content: center; margin: 10px 0 14px; flex-wrap: wrap; }
.podium div { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; text-align: center; min-width: 150px; }
.podium div:first-child { border-color: var(--accent); }
.podium .m { font-size: 28px; }
#roundBtn.urgent { border-color: var(--bad); color: #ffd0c8; }
#helpModal { position: fixed; inset: 0; background: rgba(5, 8, 12, .82); display: flex; align-items: flex-start; justify-content: center; z-index: 25; padding: 30px 16px; overflow-y: auto; }
#helpModal .hm-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; max-width: 980px; width: 100%; padding: 8px 16px 16px; }
#helpModal .hm-head { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; background: var(--panel); padding: 8px 0; z-index: 1; }
#helpModal .hm-head b { flex: 1; font-size: 18px; color: var(--accent); }
#helpModal #guide { padding: 0; }

#app { display: flex; flex-direction: column; height: 100%; }
#topbar { display: flex; align-items: center; gap: 14px; padding: 6px 12px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
#topbar .res b { font-size: 15px; }
#topbar small { color: var(--dim); margin-left: 3px; }
#topbar small.neg { color: var(--bad); }
#topbar .sep { width: 1px; height: 20px; background: var(--line); }
#topbar .grow { flex: 1; }
#prot { color: var(--info); }
#aiBadge { color: var(--good); }
#main { flex: 1; display: flex; min-height: 0; }
#view { position: relative; flex: 1; min-width: 0; }
#cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: default; }
#mini { position: absolute; right: 8px; bottom: 8px; border: 1px solid var(--line); background: #000; cursor: pointer; border-radius: 4px; }
#log { position: absolute; left: 8px; bottom: 8px; width: min(460px, 60%); pointer-events: none; display: flex; flex-direction: column; gap: 3px; }
#log div { background: rgba(20, 22, 28, .82); padding: 4px 8px; border-radius: 5px; border-left: 3px solid var(--info); font-size: 13px; pointer-events: auto; cursor: pointer; transition: opacity 1s; }
#log div.good { border-color: var(--good); } #log div.bad { border-color: var(--bad); } #log div.warn { border-color: var(--warn); }
#hint { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); background: rgba(20, 22, 28, .9); padding: 5px 12px; border-radius: 6px; display: none; }
#toast { position: absolute; top: 44px; left: 50%; transform: translateX(-50%); background: #5a2626; padding: 6px 14px; border-radius: 6px; display: none; }
#toast.ok { background: #2c5a2c; }

#side { width: 360px; background: var(--panel); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
#selinfo { padding: 8px 10px; border-bottom: 1px solid var(--line); min-height: 70px; max-height: 260px; overflow: auto; }
#tabs { display: flex; flex-wrap: wrap; gap: 3px; padding: 6px; border-bottom: 1px solid var(--line); }
#tabs button { padding: 4px 7px; font-size: 13px; position: relative; }
#tabs button.on { background: #6b5320; border-color: var(--accent); }
#tabs button i { position: absolute; top: -4px; right: -4px; width: 9px; height: 9px; border-radius: 50%; background: var(--bad); display: none; }
#tabs button.notify i { display: block; }
#tabbody { flex: 1; overflow: auto; padding: 6px 10px 20px; }
.row { display: flex; gap: 6px; align-items: center; margin: 6px 0; flex-wrap: wrap; }
.row input:not([type=checkbox]), .row select { flex: 1; min-width: 60px; }
.note { color: var(--dim); font-size: 12px; margin: 4px 0; }
.warnnote { color: #d8b56a; }
.scopes label { font-size: 13px; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.bcard { background: var(--panel2); border: 1px solid var(--line); border-radius: 7px; padding: 6px; cursor: pointer; text-align: left; }
.bcard.sel { border-color: var(--accent); background: #3d3522; }
.bcard.cant { opacity: .55; }
.bcard .t { font-weight: 600; }
.bcard .c { font-size: 12px; color: var(--dim); }
.bcard .d { font-size: 11px; color: var(--dim); margin-top: 3px; }
.kv { display: flex; justify-content: space-between; font-size: 13px; padding: 1px 0; }
.bar { height: 6px; background: #111; border-radius: 3px; overflow: hidden; margin: 3px 0; }
.bar > div { height: 100%; background: var(--good); }
.bar.xp > div { background: var(--accent); }
.plist .p { display: flex; flex-direction: column; gap: 4px; padding: 6px; border: 1px solid var(--line); border-radius: 7px; margin-bottom: 6px; background: var(--panel2); }
.plist .top { display: flex; align-items: center; gap: 6px; }
.dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; border: 1px solid #0006; }
.rel { font-size: 11px; padding: 1px 6px; border-radius: 9px; }
.rel.war { background: #7a2b2b; } .rel.peace { background: #3a4a5a; } .rel.alliance { background: #2b6a3a; } .rel.self { background: #6b5320; }
.off { opacity: .55; }
.item { background: var(--panel2); border: 1px solid var(--line); border-radius: 7px; padding: 6px; margin: 5px 0; font-size: 13px; }
.mk { display: grid; grid-template-columns: 1.2fr 1fr 1fr 0.9fr 0.9fr; gap: 4px; align-items: center; font-size: 13px; margin: 3px 0; }
table.resform { width: 100%; border-collapse: collapse; font-size: 13px; }
table.resform input { width: 100%; padding: 3px; }
table.resform td, table.resform th { padding: 2px; }
#chatlog { height: calc(100vh - 330px); min-height: 160px; overflow: auto; background: #161a20; border: 1px solid var(--line); border-radius: 6px; padding: 6px; font-size: 13px; }
#chatlog .m { margin: 2px 0; word-wrap: break-word; }
#chatlog .m .ch { color: var(--dim); font-size: 11px; }
#aiStatus .log { font-family: ui-monospace, Consolas, monospace; font-size: 11.5px; background: #161a20; border: 1px solid var(--line); border-radius: 6px; padding: 6px; max-height: 260px; overflow: auto; white-space: pre-wrap; }
.queue { font-size: 12px; color: var(--dim); }

#regionName { color: var(--accent); font-weight: 600; }
#banner { position: absolute; top: 18%; left: 50%; transform: translateX(-50%); text-align: center; pointer-events: none; opacity: 0; transition: opacity .6s; text-shadow: 0 2px 6px #000, 0 0 2px #000; }
#banner.show { opacity: 1; }
#banner .t { font-size: 30px; font-weight: 700; color: #fff3c4; letter-spacing: 1px; }
#banner .s { font-size: 15px; color: #e5e9f0; }
#worldmap { position: fixed; inset: 0; background: rgba(5, 8, 12, .82); display: flex; align-items: center; justify-content: center; z-index: 20; padding: 16px; }
#worldmap .wm-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; max-width: 100%; }
#worldmap .wm-head { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
#worldmap .wm-head #wmInfo { flex: 1; color: var(--dim); font-size: 13px; min-width: 200px; }
#wmc { display: block; border-radius: 6px; cursor: crosshair; max-width: 100%; }

@media (max-width: 800px) {
  #main { flex-direction: column; }
  #side { width: 100%; height: 45%; border-left: 0; border-top: 1px solid var(--line); }
  #mini { width: 160px; height: 96px; }
}
#aiBadge.warn { color: var(--warn); }

/* olay geçmişi */
#evlist { display: flex; flex-direction: column; gap: 4px; }
#evlist .ev { background: var(--panel2, #2e3440); border-left: 3px solid var(--info); border-radius: 5px; padding: 5px 8px; font-size: 13px; line-height: 1.35; }
#evlist .ev.good { border-color: var(--good); } #evlist .ev.bad { border-color: var(--bad); } #evlist .ev.warn { border-color: var(--warn); }
#evlist .ev small { color: #9aa3b2; margin-right: 6px; }
#evlist .ev.go { cursor: pointer; } #evlist .ev.go:hover { filter: brightness(1.2); }
.logfilter button.on { border-color: var(--accent); color: var(--accent); }
.alertopts { gap: 10px; align-items: center; }
/* dokunmatik çubuk */
#touchbar { position: absolute; right: 8px; bottom: 166px; display: flex; gap: 6px; z-index: 6; }   /* mini haritanın (150px) üstünde */
#touchbar button { width: 46px; height: 46px; border-radius: 50%; font-size: 18px; padding: 0; background: rgba(20, 22, 28, .85); border: 1px solid #ffffff33; color: #fff; }
#touchbar button[data-tb="box"] { width: auto; border-radius: 23px; padding: 0 12px; font-size: 14px; }
#touchbar button.on { border-color: var(--accent); color: var(--accent); }
body.touch #log { bottom: 8px; }
body.touch #tabs button { padding: 8px 9px; }
/* telefon: üst çubuk tek satır, yana kaydırılır; dokunmatik düğmeler mini haritanın üstünde dikey */
@media (max-width: 800px) {
  #topbar { flex-wrap: nowrap; overflow-x: auto; gap: 10px; padding: 5px 8px; font-size: 13px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  #topbar::-webkit-scrollbar { display: none; }
  #topbar > * { flex: 0 0 auto; }
  #topbar .grow, #topbar .sep, #regionName { display: none; }
  #topbar small { display: none; }
  #touchbar { flex-direction: column; bottom: 112px; max-height: calc(100% - 120px); overflow-y: auto; }
  #touchbar button { width: 42px; height: 42px; flex: 0 0 auto; }
  #touchbar button[data-tb="box"] { width: 42px; padding: 0; border-radius: 50%; font-size: 12px; }
  body.touch #log { bottom: 8px; width: calc(100% - 190px); max-height: 40%; overflow: hidden; justify-content: flex-end; }
  #log div { font-size: 12px; }
}

/* gelişim: seviye rozeti, yükseltme ve teknoloji kartları */
.lvl { display: inline-block; font-size: 11px; font-weight: bold; color: #ffd56a; border: 1px solid #ffd56a88; border-radius: 9px; padding: 0 6px; margin-left: 4px; }
.upg { margin: 6px 0; padding-top: 4px; border-top: 1px dashed var(--line); }
.upg button { margin-top: 3px; }
.bar.upgbar div { background: #6ab0ff; }
.tcard { cursor: default; display: flex; flex-direction: column; gap: 3px; }
.tcard.done { border-color: #4f9a5c; background: #24322a; }
.tcard button { align-self: flex-start; }
