/* Pixel Ages — piksel arayüz */
:root {
  --ink: #090a14; --deep: #151d28; --slate: #202e37; --slate2: #394a50; --mid: #577277; --muted: #a8b5b2; --text: #ebede9;
  --gold: #e8c170; --amber: #de9e41; --green: #a8ca58; --red: #cf573c; --sky: #73bed3; --cream: #e7d5b3;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #3c5e8b; color: var(--text); font: 500 15px/1.25 "Pixelify Sans", "Segoe UI", system-ui, sans-serif; -webkit-tap-highlight-color: transparent; user-select: none; }
img { image-rendering: pixelated; }
.hidden { display: none !important; }
#map { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; image-rendering: pixelated; cursor: grab; }
#map.drag { cursor: grabbing; } #map.place { cursor: crosshair; } #map.point { cursor: pointer; }

/* --- 9-dilim çerçeveler --- */
.panel { border: 8px solid transparent; border-image: var(--i-panel) 8 fill stretch; image-rendering: pixelated; }
.panel.gold { border-image-source: var(--i-gold); }
.inset { border: 8px solid transparent; border-image: var(--i-inset) 8 fill stretch; image-rendering: pixelated; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; padding: 0; }
.btn { border: 8px solid transparent; border-image: var(--i-btn) 8 fill stretch; image-rendering: pixelated; padding: 0 6px 3px; min-height: 34px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-weight: 600; white-space: nowrap; text-shadow: 0 2px 0 #090a1488; }
.btn:hover { filter: brightness(1.18); }
.btn:active, .btn.on { border-image-source: var(--i-btnD); padding: 2px 6px 1px; filter: none; }
.btn.on { color: var(--gold); }
.btn:disabled { opacity: .5; cursor: not-allowed; filter: grayscale(.7); }
.btn.pri { border-image-source: var(--i-btnG); color: #241527; text-shadow: 0 2px 0 #ffffff55; }
.btn.red { border-image-source: var(--i-btnR); }
.btn.sq { width: 38px; min-height: 38px; padding: 0 0 3px; font-size: 20px; }
.btn.sm { min-height: 28px; font-size: 13px; padding: 0 4px 3px; }
.btn:focus-visible, input:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.ic { width: 22px; height: 22px; object-fit: contain; flex: none; }
.ic.s { width: 16px; height: 16px; }
small, .mut { color: var(--muted); font-size: 12px; }
.good { color: var(--green); } .bad { color: #e98a6f; } .gld { color: var(--gold); }

/* --- üst çubuk --- */
#hud { position: fixed; inset: 0; pointer-events: none; }
#hud > * { pointer-events: auto; }
#top { position: absolute; top: 8px; left: 8px; right: 8px; display: flex; gap: 8px; align-items: stretch; pointer-events: none; }
#top > * { pointer-events: auto; }
.civ { display: flex; align-items: center; gap: 8px; padding: 0 6px 0 2px; min-width: 190px; text-align: left; }
.civ:hover { filter: brightness(1.12); }
.civ img { width: 36px; height: 36px; object-fit: contain; }
.civ span { display: flex; flex-direction: column; min-width: 0; }
.civ b { font-size: 17px; color: var(--gold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 170px; }
.civ small { letter-spacing: .5px; text-transform: uppercase; font-size: 11px; }
.resbar { flex: 1; display: flex; align-items: center; justify-content: space-evenly; gap: 2px; padding: 0 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.resbar::-webkit-scrollbar { display: none; }
.chip { display: flex; align-items: center; gap: 6px; padding: 2px 8px 2px 4px; position: relative; flex: none; }
.chip > span { display: flex; flex-direction: column; line-height: 1.05; }
.chip b { font-size: 17px; font-variant-numeric: tabular-nums; }
.chip small { font-size: 11px; color: var(--green); font-variant-numeric: tabular-nums; }
.chip small.neg { color: #e98a6f; }
.chip.full b { color: var(--amber); }
.chip i { position: absolute; left: 4px; right: 6px; bottom: -3px; height: 2px; background: #10141f; }
.chip i u { display: block; height: 100%; background: var(--mid); }
.chip.full i u { background: var(--amber); }
.sys { display: flex; align-items: center; gap: 6px; padding: 0 2px; }
.clock { display: flex; align-items: center; gap: 6px; padding: 0 6px; font-variant-numeric: tabular-nums; }
.clock img { width: 22px; height: 22px; }
#btnSpeed { font-size: 14px; width: 44px; }
#btnSettings img, #btnHome img, #btnWorld img { width: 22px; height: 22px; }

/* --- sol: görevler --- */
#left { position: absolute; top: 76px; left: 8px; width: 264px; display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
#left > * { pointer-events: auto; }
.eyebrow { font-size: 11px; letter-spacing: 1.5px; color: var(--gold); text-transform: uppercase; display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.quests { padding: 2px 4px 4px; }
.q { display: flex; gap: 8px; align-items: flex-start; padding: 5px 0; border-top: 2px solid #151d28; }
.q:first-of-type { border-top: 0; }
.q .box { width: 14px; height: 14px; flex: none; margin-top: 2px; background: #10141f; box-shadow: 0 0 0 2px #577277; }
.q b { display: block; font-size: 14px; }
.q small { display: block; margin-top: 2px; line-height: 1.25; }
.q .rw { display: flex; gap: 8px; margin-top: 3px; font-size: 12px; color: var(--gold); align-items: center; flex-wrap: wrap; }
.q .rw span { display: inline-flex; align-items: center; gap: 3px; }
.q.next { opacity: .62; }
.raid { padding: 2px 6px 4px; border-image-source: var(--i-btnR); }
.raid b { display: flex; align-items: center; gap: 6px; font-size: 15px; }
.raid small { color: #ffe1d2; }
.status { padding: 0 4px 2px; font-size: 13px; }
.status .row { display: flex; align-items: center; gap: 6px; padding: 2px 0; }
.status .row > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status .row em { font-style: normal; color: var(--muted); font-variant-numeric: tabular-nums; }
.prog { height: 8px; background: #10141f; box-shadow: 0 0 0 2px #090a14; margin: 5px 2px; }
.prog i { display: block; height: 100%; background: var(--green); box-shadow: inset 0 -2px 0 #75a743; }
.prog.blue i { background: var(--sky); box-shadow: inset 0 -2px 0 #4f8fba; }
.prog.gold i { background: var(--gold); box-shadow: inset 0 -2px 0 #de9e41; }

/* --- sağ: yakınlaştırma + küçük harita --- */
#right { position: absolute; top: 76px; right: 8px; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; pointer-events: none; }
#right > * { pointer-events: auto; }
.zoom { display: flex; flex-direction: column; gap: 4px; }
.minimap { padding: 0; line-height: 0; }
.minimap canvas { width: 168px; height: 112px; image-rendering: pixelated; cursor: pointer; display: block; }
.minimap small { display: block; text-align: center; line-height: 1.5; font-size: 11px; font-variant-numeric: tabular-nums; }

/* --- alt: eylemler, inşa çekmecesi --- */
#bottom { position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; max-width: calc(100% - 16px); pointer-events: none; }
#bottom > * { pointer-events: auto; }
#actions { display: flex; gap: 6px; padding: 0; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
#actions .btn { flex-direction: column; gap: 1px; min-width: 76px; min-height: 58px; font-size: 13px; padding: 2px 4px 4px; position: relative; }
#actions .btn img { width: 28px; height: 28px; object-fit: contain; }
#actions .btn .badge { position: absolute; top: -4px; right: -4px; background: var(--red); color: #fff; font-size: 11px; padding: 0 5px; box-shadow: 0 0 0 2px #090a14; text-shadow: none; }
#actions .btn .sub { font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 2px; text-shadow: none; }
#actions .btn.pri { min-width: 220px; font-size: 16px; flex-direction: row; gap: 8px; }
#hint { pointer-events: none !important; background: #090a14e0; box-shadow: 0 0 0 2px #e8c170, 0 4px 0 2px #090a1466; color: var(--cream); padding: 6px 12px; font-size: 14px; max-width: 100%; text-align: center; }
#hint b { color: var(--gold); }
#drawer { width: min(820px, calc(100vw - 16px)); padding: 0 2px 2px; }
.tabs { display: flex; gap: 4px; align-items: center; margin-bottom: 6px; }
.tabs .sp { flex: 1; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 6px; max-height: 250px; overflow-y: auto; padding: 2px; scrollbar-width: thin; scrollbar-color: #577277 #151d28; }
.card { border: 8px solid transparent; border-image: var(--i-inset) 8 fill stretch; image-rendering: pixelated; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 0 0 2px; text-align: center; position: relative; min-height: 116px; }
.card:hover:not(.lock) { filter: brightness(1.25); }
.card img.b { width: 54px; height: 72px; object-fit: contain; object-position: bottom; margin-top: -6px; }
.card.big img.b { width: 68px; height: 72px; }
.card b { font-size: 13px; line-height: 1.1; }
.card .costs { justify-content: center; }
.card.lock img.b { filter: grayscale(1) brightness(.55); }
.card.lock b { color: var(--muted); }
.card .why { font-size: 11px; color: #e98a6f; line-height: 1.15; display: flex; gap: 3px; align-items: center; justify-content: center; }
.card .cnt { position: absolute; top: -4px; right: -3px; font-size: 11px; color: var(--muted); }
.costs { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; font-size: 12px; font-variant-numeric: tabular-nums; }
.costs span { display: inline-flex; align-items: center; gap: 2px; }
.costs span.no { color: #e98a6f; }
.costs img { width: 14px; height: 14px; }

/* --- inceleme paneli --- */
#inspect { position: absolute; right: 8px; bottom: 8px; width: 292px; max-height: calc(100% - 392px); min-height: 80px; z-index: 5; overflow-y: auto; padding: 0 4px 4px; scrollbar-width: thin; scrollbar-color: #577277 #151d28; }
.ihead { display: flex; gap: 8px; align-items: center; }
.ihead img { width: 48px; height: 60px; object-fit: contain; object-position: bottom; flex: none; }
.ihead img.flat { height: 40px; }
.ihead > span { flex: 1; min-width: 0; }
.ihead b { display: block; font-size: 17px; color: var(--gold); }
.x { width: 26px; height: 26px; color: var(--muted); font-size: 16px; flex: none; }
.x:hover { color: #fff; }
#inspect p, #modal p { margin: 6px 0; font-size: 13px; color: #c7cfcc; line-height: 1.35; }
.lines { margin: 6px 0; font-size: 13px; display: flex; flex-direction: column; gap: 3px; }
.lines div { display: flex; align-items: center; gap: 6px; }
.lines .note { color: var(--sky); font-size: 12px; }
.brow { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.brow .btn { flex: 1; }
.upbox { margin-top: 8px; padding-top: 6px; border-top: 2px solid #151d28; }
.upbox .costs { margin: 4px 0; }
.req { display: flex; gap: 6px; align-items: center; font-size: 13px; }
.req.ok { color: var(--green); } .req.no { color: #e98a6f; }
.bars { display: flex; height: 12px; box-shadow: 0 0 0 2px #090a14; margin: 6px 2px; }
.bars i { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 4px; }
.legend u { width: 8px; height: 8px; display: inline-block; }
.stepper { display: flex; align-items: center; gap: 6px; margin: 6px 0; }
.stepper b { min-width: 64px; text-align: center; }

/* --- bildirimler --- */
#toasts { position: absolute; top: 78px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; width: min(520px, calc(100% - 24px)); z-index: 30; }
.toast { background: #090a14eb; padding: 7px 14px; font-size: 14px; box-shadow: 0 0 0 2px #577277, 0 4px 0 2px #090a1466; text-align: center; animation: pop .18s steps(3); }
.toast.good { box-shadow: 0 0 0 2px #a8ca58, 0 4px 0 2px #090a1466; }
.toast.bad { box-shadow: 0 0 0 2px #cf573c, 0 4px 0 2px #090a1466; }
.toast.quest { box-shadow: 0 0 0 2px #e8c170, 0 4px 0 2px #090a1466; color: var(--gold); }
.toast.out { opacity: 0; transition: opacity .4s; }
@keyframes pop { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* --- pencereler --- */
#modalBg { position: absolute; inset: 0; background: #090a14a8; display: flex; align-items: center; justify-content: center; padding: 8px; z-index: 40; }
#modal { width: min(660px, 100%); max-height: min(90%, 720px); display: flex; flex-direction: column; padding: 0 4px 4px; }
#modal.narrow { width: min(460px, 100%); }
.mhead { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.mhead img { width: 32px; height: 32px; object-fit: contain; }
.mhead h1 { flex: 1; margin: 0; font-size: 22px; color: var(--gold); font-weight: 700; }
.scroll { overflow-y: auto; flex: 1; min-height: 0; padding-right: 4px; scrollbar-width: thin; scrollbar-color: #577277 #151d28; }
h2 { font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--gold); margin: 12px 0 5px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
h2::after { content: ""; flex: 1; height: 2px; background: #394a50; }
.row { display: flex; align-items: center; gap: 8px; padding: 6px 4px; border-bottom: 2px solid #151d28; }
.row > .g { flex: 1; min-width: 0; }
.row b { font-size: 15px; }
.row small { display: block; line-height: 1.25; }
.row.done b { color: var(--green); }
.row.off { opacity: .55; }
.row .btn { flex: none; min-width: 96px; }
.row img.ic { width: 26px; height: 26px; }
.agebox { border: 8px solid transparent; border-image: var(--i-inset) 8 fill stretch; padding: 0 4px 2px; }
.agebox .t { display: flex; align-items: center; gap: 10px; }
.agebox .t b { font-size: 18px; color: var(--gold); flex: 1; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 6px; margin: 4px 0; }
.kv div { border: 8px solid transparent; border-image: var(--i-inset) 8 fill stretch; padding: 0 2px; display: flex; align-items: center; gap: 6px; }
.kv b { font-size: 18px; display: block; line-height: 1; }
.kv small { display: block; }
.trade { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 5px 6px; align-items: center; }
.trade .lab { display: flex; align-items: center; gap: 6px; }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
input[type=text] { width: 100%; font: inherit; color: var(--text); background: #10141f; border: 0; box-shadow: 0 0 0 2px #577277; padding: 8px 10px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches button { width: 38px; height: 38px; box-shadow: 0 0 0 2px #090a14, inset 0 -6px 0 #00000033, inset 0 4px 0 #ffffff33; }
.swatches button.on { box-shadow: 0 0 0 2px #090a14, 0 0 0 5px #e8c170, inset 0 -6px 0 #00000033, inset 0 4px 0 #ffffff33; }
.hero { text-align: center; padding: 6px 0 2px; }
.hero h1 { font-size: 30px; margin: 4px 0; color: var(--gold); letter-spacing: 1px; }
.hero img { width: 96px; height: 132px; object-fit: contain; }
.unlock { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 8px 0; }
.unlock span { display: flex; flex-direction: column; align-items: center; font-size: 12px; width: 78px; text-align: center; }
.unlock img { width: 48px; height: 60px; object-fit: contain; object-position: bottom; }
.log div { padding: 4px 2px; border-bottom: 2px solid #151d28; font-size: 13px; display: flex; gap: 8px; }
.log em { font-style: normal; color: var(--muted); font-size: 11px; flex: none; width: 44px; font-variant-numeric: tabular-nums; }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; font-size: 13px; color: #c7cfcc; }
.keys b { color: var(--gold); }

/* --- yükleniyor --- */
#loading { position: fixed; inset: 0; background: #151d28; display: flex; align-items: center; justify-content: center; z-index: 99; }
.loadbox { text-align: center; width: 260px; }
.loadbox b { display: block; font-size: 24px; color: var(--gold); letter-spacing: 2px; margin-bottom: 8px; }
.loadbox span { color: var(--muted); font-size: 13px; }

/* --- küçük ekranlar --- */
@media (max-width: 1260px), (max-height: 640px) { #inspect { bottom: 120px; max-height: calc(100% - 204px); } }
@media (max-width: 1100px) { .civ { min-width: 0; } .civ span { display: none; } .chip { padding: 2px 5px 2px 2px; gap: 4px; } .chip b { font-size: 15px; } }
@media (max-width: 760px) {
  html, body { font-size: 14px; }
  #top { top: 4px; left: 4px; right: 4px; gap: 4px; flex-wrap: wrap; }
  .civ { display: none; } .resbar { order: 2; flex-basis: 100%; justify-content: flex-start; } .sys { margin-left: auto; }
  #left { top: 104px; left: 4px; width: 200px; } .q small, .q.next { display: none; } .status { display: none; }
  #right { top: 104px; right: 4px; } .minimap { display: none; }
  #bottom { bottom: 4px; gap: 4px; max-width: calc(100% - 8px); } #actions { gap: 3px; } #actions .btn { min-width: 60px; min-height: 52px; font-size: 11px; }
  #drawer { width: calc(100vw - 8px); } #hint { font-size: 12px; }
  #inspect { right: 4px; left: 4px; width: auto; bottom: 100px; max-height: 44%; }
  .cards { max-height: 200px; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
}
@media (max-height: 560px) { #left .q.next, .status { display: none; } #inspect { max-height: calc(100% - 150px); } .cards { max-height: 150px; } }

/* --- görev panosu --- */
.quests { max-height: calc(100vh - 230px); overflow-y: auto; }
.bqh { margin-top: 6px; padding-top: 6px; border-top: 2px solid #151d28; }
.bq { padding: 4px 0; border-top: 2px solid #151d28; }
.bqh + .bq { border-top: 0; }
.bq b { display: block; font-size: 13px; overflow-wrap: anywhere; }
.bq.ok b { color: var(--gold); }
.bq .prog { margin: 3px 2px; }
.bq .bqr { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.bq .bqr > span { display: inline-flex; align-items: center; gap: 3px; }
.bq .bqr .btn { margin-left: auto; }
.bq .rw { display: flex; gap: 8px; margin-top: 2px; font-size: 12px; color: var(--gold); flex-wrap: wrap; }
.bq .rw span { display: inline-flex; align-items: center; gap: 3px; }
.bqd { display: block; margin-top: 2px; }
@media (max-width: 760px) { .bq .rw, .bqd { display: none; } .bq b { font-size: 12px; } }
@media (max-height: 560px) { .bq .rw, .bqd { display: none; } }
