/* SAVAŞ DEFTERİ — defter estetiği: kağıt, kurşun kalem, mürekkep */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:root {
  --kagit: #f6f1e3;
  --kagit2: #efe8d3;
  --murekkep: #26262f;
  --gri: #6b6b78;
  --izgara: #c9d8e8;
  --altin: #c99a2e;
  --kirmizi: #c1121f;
  --silgi: #c25a7e;
  --yesil: #4f772d;
}
html, body { height: 100%; overflow: hidden; }
body {
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  background: #d8d2c0;
  color: var(--murekkep);
  user-select: none;
}
button { font-family: inherit; cursor: pointer; }
.hidden { display: none !important; }

#game { height: 100dvh; display: flex; flex-direction: column; }

/* ---------- HUD ---------- */
#hud {
  background: var(--kagit2);
  border-bottom: 2px solid var(--murekkep);
  box-shadow: 0 2px 8px rgba(38,38,47,.15);
  z-index: 5;
}
#hudTop {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  padding: 5px 10px 2px;
}
.kaleBar { flex: 1; display: flex; align-items: center; gap: 6px; font-size: 15px; }
.kaleBar .bar {
  flex: 1; height: 10px; border: 1.5px solid var(--murekkep); border-radius: 5px;
  background: rgba(38,38,47,.12); overflow: hidden;
}
.kaleBar .bar i { display: block; height: 100%; width: 100%; background: linear-gradient(180deg, #74a94c, var(--yesil)); transition: width .3s; }
.kaleBar.ters .bar i { background: linear-gradient(180deg, #e099b4, var(--silgi)); margin-left: auto; }
.kaleBar.ters .bar { direction: rtl; }
#midInfo { display: flex; gap: 12px; font-weight: 800; font-size: 14px; }
#goldVal { color: #8a6d1f; }
#gelirVal { color: #9a8a4f; font-size: 11px; font-weight: 700; align-self: center; }
#rozBox { display: flex; gap: 4px; align-items: center; }
#rozBox .roz {
  font-size: 10px; font-weight: 800; padding: 1px 6px; border-radius: 8px;
  border: 1.5px solid var(--murekkep); background: #ffe9b0; white-space: nowrap;
}
#istih {
  position: absolute; right: 8px; top: 24px; z-index: 6;
  font-size: 11.5px; font-weight: 800; letter-spacing: .5px;
  color: var(--silgi); white-space: nowrap;
  background: rgba(246,241,227,.95);
  border: 1.5px solid var(--silgi); border-radius: 8px;
  padding: 1px 8px;
  max-width: min(44vw, 430px); overflow: hidden; text-overflow: ellipsis;
}
#istih:empty { display: none; }
.cmdBtn .hRoz {
  position: absolute; top: -7px; right: -7px;
  min-width: 17px; height: 17px; border-radius: 9px; padding: 0 3px;
  background: var(--kirmizi); color: #fff;
  font-size: 10px; font-weight: 800; font-style: normal; line-height: 17px;
}
#popVal.dolu { color: var(--kirmizi); }
#timeVal { color: var(--gri); }

#band { display: flex; align-items: stretch; gap: 8px; padding: 4px 8px 7px; overflow-x: auto; }
#unitDock { display: flex; gap: 6px; }
.dockBtn {
  position: relative; width: 52px; height: 52px;
  border: 2px solid var(--murekkep); border-radius: 10px;
  background: var(--kagit); font-size: 22px;
  display: flex; align-items: center; justify-content: center;
  transition: transform .08s;
  box-shadow: 2px 2px 0 rgba(38,38,47,.35);
}
.dockBtn:active { transform: translate(2px, 2px); box-shadow: none; }
.dockBtn.yok { opacity: .45; }
.dockBtn .key {
  position: absolute; top: -6px; left: -6px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--murekkep); color: var(--kagit);
  font-size: 10px; font-weight: 800; line-height: 16px; text-align: center;
}
.dockBtn .cost {
  position: absolute; bottom: -7px; left: 50%; transform: translateX(-50%);
  font-size: 9px; font-weight: 800; color: #8a6d1f;
  background: var(--kagit); border: 1px solid var(--murekkep); border-radius: 6px;
  padding: 0 4px; white-space: nowrap;
}
.dockBtn .sira {
  position: absolute; top: -6px; right: -6px; z-index: 2;
  min-width: 17px; height: 17px; border-radius: 9px; padding: 0 3px;
  background: var(--altin); color: #fff;
  font-size: 10px; font-weight: 800; line-height: 17px; text-align: center;
}
.dockBtn .cd, #gucBtn .cd {
  position: absolute; inset: -2px; border-radius: 10px;
  background: conic-gradient(rgba(38,38,47,.72) var(--p, 0%), transparent 0);
  pointer-events: none;
}
#gucBtn .cd { border-radius: 12px; }

#cmds, #ozel { display: flex; gap: 6px; }
.cmdBtn, #gucBtn, #ctlBtn {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 62px; padding: 2px 8px;
  border: 2px solid var(--murekkep); border-radius: 12px;
  background: var(--kagit); font-size: 16px;
  box-shadow: 2px 2px 0 rgba(38,38,47,.35);
}
.cmdBtn b, #gucBtn b, #ctlBtn b { font-size: 10px; letter-spacing: .4px; }
.cmdBtn:active, #gucBtn:active, #ctlBtn:active { transform: translate(2px, 2px); box-shadow: none; }
.cmdBtn.picked { background: var(--murekkep); color: var(--kagit); }
#gucBtn { border-color: var(--altin); }
#ctlBtn.aktif { background: #d9a94a; }

.tools { display: flex; gap: 6px; margin-left: auto; }
.tools button {
  width: 40px; border: 2px solid var(--murekkep); border-radius: 10px;
  background: var(--kagit); font-size: 15px; font-weight: 800;
  box-shadow: 2px 2px 0 rgba(38,38,47,.35);
}
.tools button:active { transform: translate(2px, 2px); box-shadow: none; }
.tools #kameraBtn.serbest { background: #ffe9b0; border-color: var(--altin); }

/* ---------- Arena ---------- */
#arena { position: relative; flex: 1; min-height: 0; }
#cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }  /* kural 2 */

#toastBox {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column-reverse; gap: 6px; align-items: center;
  pointer-events: none; z-index: 8; width: min(92%, 560px);
}
#duyuru {
  position: absolute; top: 12%; left: 50%; transform: translateX(-50%);
  font-size: clamp(22px, 4vw, 40px); font-weight: 900; letter-spacing: 3px;
  color: var(--murekkep); text-shadow: 3px 3px 0 rgba(201,90,126,.3);
  pointer-events: none; z-index: 9; white-space: nowrap;
  animation: duyuruAn 2.4s ease forwards;
}
@keyframes duyuruAn {
  0% { opacity: 0; transform: translateX(-50%) scale(.7); }
  12% { opacity: 1; transform: translateX(-50%) scale(1.06); }
  20% { transform: translateX(-50%) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; }
}
#gorevSerit {
  position: absolute; left: 12px; top: 34px; z-index: 7;
  background: var(--kagit); border: 2px solid var(--murekkep); border-radius: 10px;
  box-shadow: 3px 3px 0 rgba(38,38,47,.25);
  padding: 8px 12px; font-size: 12.5px; font-weight: 700; line-height: 1.7;
  white-space: pre-line;
}
#gorevSerit .tamam { color: var(--yesil); text-decoration: line-through; }
#ctlPad {
  position: absolute; bottom: 14px; left: 14px; right: 14px;
  display: flex; justify-content: space-between;
  pointer-events: none; z-index: 7;
}
#ctlPad button {
  pointer-events: auto;
  width: 62px; height: 62px; border-radius: 50%;
  border: 2.5px solid var(--murekkep); background: rgba(246,241,227,.9);
  font-size: 24px; box-shadow: 3px 3px 0 rgba(38,38,47,.3);
  touch-action: none;
}
#ctlPad button:active { transform: translate(2px,2px); box-shadow: none; background: #ffe9b0; }
.toast {
  background: var(--kagit); border: 2px solid var(--murekkep); border-radius: 10px;
  box-shadow: 3px 3px 0 rgba(38,38,47,.3);
  padding: 7px 14px; font-size: 13px; font-weight: 700; text-align: center;
  opacity: 0; transform: translateY(-8px); transition: all .3s;
}
.toast.gorunur { opacity: 1; transform: translateY(0); }

/* ---------- Kaplamalar ---------- */
.overlay {
  position: absolute; inset: 0; z-index: 10;
  display: flex; align-items: center; justify-content: center;
  background: rgba(58, 54, 42, .45);
  padding: 14px;
}
#titleView, #haritaView, #serbestView {
  background:
    linear-gradient(rgba(201,216,232,.28) 1px, transparent 1px) 0 0/100% 26px,
    linear-gradient(90deg, rgba(201,216,232,.28) 1px, transparent 1px) 0 0/26px 100%,
    var(--kagit);
}
.panel {
  background: var(--kagit);
  border: 2.5px solid var(--murekkep); border-radius: 14px;
  box-shadow: 6px 6px 0 rgba(38,38,47,.28);
  padding: 20px 24px;
  max-width: 560px; width: 100%;
  max-height: 92%; overflow-y: auto;
  text-align: center;
}
.panel.genis { max-width: 720px; }
.panel h2 { font-size: 24px; margin-bottom: 4px; }
.panel h3 { font-size: 18px; margin-bottom: 8px; }
.sub { color: var(--gri); font-size: 13px; line-height: 1.45; margin-bottom: 12px; }

.btnRow { display: flex; gap: 10px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
button.primary, button.ghost, .menuCol button {
  border: 2px solid var(--murekkep); border-radius: 12px;
  padding: 10px 20px; font-size: 15px; font-weight: 800;
  background: var(--kagit);
  box-shadow: 3px 3px 0 rgba(38,38,47,.3);
}
button.primary { background: var(--murekkep); color: var(--kagit); }
button.ghost { opacity: .8; }
button.primary:active, button.ghost:active, .menuCol button:active { transform: translate(2px, 2px); box-shadow: none; }

/* ---------- Başlık ---------- */
.titlePanel { padding: 30px 24px; }
.logo { display: flex; flex-direction: column; line-height: 1; margin-bottom: 12px; }
.logoUst {
  font-size: clamp(30px, 7vw, 46px); font-weight: 900; letter-spacing: 3px;
}
.logoAlt {
  font-size: clamp(40px, 10vw, 66px); font-weight: 900; letter-spacing: 6px;
  color: transparent;
  -webkit-text-stroke: 2.2px var(--murekkep);
  text-shadow: 4px 4px 0 rgba(201,90,126,.35);
}
.menuCol { display: flex; flex-direction: column; gap: 10px; align-items: stretch; max-width: 340px; margin: 0 auto; }
.menuCol .buyuk { font-size: 17px; padding: 13px; }

/* ---------- Bölüm haritası ---------- */
#bolumList {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px; margin: 8px 0;
}
.bolumKart {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  border: 2px solid var(--murekkep); border-radius: 12px;
  background: var(--kagit); padding: 10px 6px;
  box-shadow: 3px 3px 0 rgba(38,38,47,.25);
}
.bolumKart:not(.kilitli):active { transform: translate(2px, 2px); box-shadow: none; }
.bolumKart.kilitli { opacity: .45; cursor: default; }
.bolumKart.bitti { border-color: var(--yesil); background: #eef3e4; }
.bolumKart .bNo { font-size: 10px; font-weight: 800; color: var(--gri); letter-spacing: 1px; }
.bolumKart .bIk { font-size: 26px; }
.bolumKart .bAd { font-size: 13px; font-weight: 800; }
.bolumKart .bAlt { font-size: 11px; color: var(--gri); }

/* ---------- Seviye seçimi ---------- */
#lvRow { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.lvBtn {
  flex: 1; min-width: 140px; max-width: 170px;
  border: 2px solid var(--murekkep); border-radius: 12px;
  background: var(--kagit); padding: 10px 8px;
  display: flex; flex-direction: column; gap: 4px;
  box-shadow: 3px 3px 0 rgba(38,38,47,.25);
}
.lvBtn b { font-size: 15px; }
.lvBtn span { font-size: 11px; color: var(--gri); line-height: 1.35; }
.lvBtn.picked { background: var(--murekkep); color: var(--kagit); }
.lvBtn.picked span { color: #cfcfda; }

/* ---------- Bitiş ---------- */
#endTitle.zafer { color: var(--yesil); }
#endTitle.yenilgi { color: var(--kirmizi); }
.endStats {
  display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-top: 10px;
}
.endStats div { display: flex; flex-direction: column; min-width: 76px; }
.endStats b { font-size: 20px; }
.endStats span { font-size: 11px; color: var(--gri); }
.endStats .icgoru {
  width: 100%; margin-top: 10px; font-size: 13px; line-height: 1.45;
  background: #f2ecd8; border: 1.5px dashed var(--murekkep); border-radius: 10px;
  padding: 8px 12px; text-align: center;
}
.dockBtn.bilgi { width: 34px; height: 52px; font-size: 15px; opacity: .75; }

/* ---------- Diyalog ---------- */
#oykuView { align-items: flex-end; padding-bottom: 36px; background: rgba(38,38,47,.35); }
.oykuKart {
  display: grid; grid-template-columns: 88px 1fr; grid-template-rows: auto auto;
  gap: 10px 14px; align-items: start;
  background: var(--kagit); border: 2.5px solid var(--murekkep); border-radius: 14px;
  box-shadow: 6px 6px 0 rgba(38,38,47,.35);
  padding: 16px; width: min(640px, 96%);
}
#portre { border: 2px solid var(--murekkep); border-radius: 10px; background: var(--kagit); }
.oykuIc { text-align: left; }
#oykuAd { font-size: 14px; letter-spacing: .5px; }
#oykuMetin { font-size: 15px; line-height: 1.5; min-height: 66px; margin-top: 4px; }
#oykuMetin.anlatici { font-style: italic; color: var(--gri); }
.oykuKart .btnRow { grid-column: 1 / -1; margin-top: 2px; }

/* ---------- Duraklama ---------- */
.pauseCard {
  background: var(--kagit); border: 2.5px solid var(--murekkep); border-radius: 14px;
  padding: 18px 40px; font-size: 26px; font-weight: 900; letter-spacing: 4px;
  box-shadow: 6px 6px 0 rgba(38,38,47,.3);
}

/* ---------- Ayarlar ---------- */
.ayarlar { display: flex; flex-direction: column; gap: 14px; padding: 6px 0 2px; }
.ayarlar label {
  display: grid; grid-template-columns: 1fr 150px 44px; align-items: center;
  gap: 10px; font-size: 14px; font-weight: 700; text-align: left;
}
.ayarlar input[type=range] { accent-color: var(--murekkep); }

/* ---------- Nasıl oynanır ---------- */
.nasil { text-align: left; font-size: 13px; line-height: 1.5; }
.nasil p { margin-bottom: 8px; }

/* ---------- Dar ekran ---------- */
@media (max-width: 720px) {
  .dockBtn { width: 46px; height: 46px; font-size: 19px; }
  .cmdBtn, #gucBtn, #ctlBtn { min-width: 52px; font-size: 14px; }
  #midInfo { font-size: 12px; gap: 8px; }
  .oykuKart { grid-template-columns: 64px 1fr; }
  #portre { width: 64px; height: 64px; }
}
