:root {
  --bg: #bfe6ff;
  --panel: #fffaf0;
  --ink: #3b2a1a;
  --accent: #f4a52c;
  --accent-dark: #c97a12;
  --green: #5aa83c;
  --green-dark: #3c7a26;
  --card-edge: #e6d3b3;
  --shadow: 0 4px 0 rgba(0, 0, 0, .18);
  font-family: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--bg); color: var(--ink);
  overscroll-behavior: none; user-select: none; -webkit-user-select: none;
}
#app { position: fixed; inset: 0; }
#game { width: 100%; height: 100%; display: block; touch-action: none; }
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; border: 0; background: none; }

/* ---- Üst bilgi ---- */
#hud {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 8px;
  padding: calc(env(safe-area-inset-top) + 10px) calc(env(safe-area-inset-right) + 10px) 0 calc(env(safe-area-inset-left) + 10px);
  pointer-events: none;
}
#hud > * { pointer-events: auto; }
.hud-left, .hud-right { display: flex; align-items: center; gap: 8px; min-width: 0; }
.level-badge {
  flex: none; width: 48px; height: 48px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe08a, var(--accent));
  border: 3px solid #fff; display: grid; place-items: center;
  font-weight: 900; font-size: 20px; box-shadow: var(--shadow);
}
.hud-stats { display: flex; flex-direction: column; gap: 6px; }
.xpbar {
  position: relative; width: 150px; height: 18px; border-radius: 10px; overflow: hidden;
  background: rgba(255, 255, 255, .75); border: 2px solid #fff; box-shadow: var(--shadow);
}
#xpfill { height: 100%; width: 0; background: linear-gradient(#8fdc5f, var(--green)); transition: width .4s; }
#xptext { position: absolute; inset: 0; display: grid; place-items: center; font-size: 11px; font-weight: 800; }
.coins {
  width: max-content; padding: 2px 10px; border-radius: 12px; font-weight: 900;
  background: rgba(255, 255, 255, .92); border: 2px solid #fff; box-shadow: var(--shadow);
}
.chip {
  padding: 9px 12px; border-radius: 12px; font-weight: 800; font-size: 14px;
  background: rgba(255, 255, 255, .92); box-shadow: var(--shadow);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw;
}
.icon-btn {
  flex: none; width: 42px; height: 42px; border-radius: 12px; font-size: 20px;
  background: rgba(255, 255, 255, .92); box-shadow: var(--shadow);
}
.icon-btn:active, .chip:active { transform: translateY(2px); box-shadow: none; }

/* ---- Araç çubuğu ---- */
#toolbar {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom) + 10px);
  display: flex; gap: 6px; padding: 6px; border-radius: 20px;
  background: rgba(255, 250, 240, .94);
  box-shadow: 0 6px 0 rgba(0, 0, 0, .15), 0 10px 30px rgba(0, 0, 0, .15);
  max-width: calc(100vw - 16px);
}
.tool {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-width: 62px; height: 60px; padding: 4px 6px; border-radius: 14px;
  font-size: 12px; font-weight: 800;
}
.tool .ico { font-size: 24px; line-height: 1; height: 30px; display: grid; place-items: center; }
.tool .mini { width: 32px; height: 32px; object-fit: contain; }
.tool .mini.emoji { font-size: 24px; }
.tool.active { background: #ffe2a8; box-shadow: inset 0 -3px 0 var(--accent-dark); }
.tool:active { transform: translateY(1px); }
.sep { width: 2px; margin: 6px 2px; border-radius: 2px; background: rgba(0, 0, 0, .08); }

/* ---- Bildirimler ---- */
#toasts {
  position: absolute; top: calc(env(safe-area-inset-top) + 76px); left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  width: max-content; max-width: 92vw; pointer-events: none; z-index: 30;
}
.toast {
  padding: 9px 16px; border-radius: 14px; text-align: center;
  background: rgba(59, 42, 26, .9); color: #fff; font-weight: 800; font-size: 14px;
  animation: toast .25s ease-out; transition: opacity .3s;
}
.toast.out { opacity: 0; }
#floaters { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.floater {
  position: absolute; transform: translate(-50%, -50%); white-space: nowrap;
  font-weight: 900; font-size: 16px; color: #fff;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .35), 0 0 6px rgba(0, 0, 0, .25);
  animation: rise 1.3s ease-out forwards;
}
.floater.minus { color: #ffd0c4; }
.floater.xp { color: #c6f7a0; }

/* ---- Paneller ---- */
#panel {
  position: fixed; inset: 0; z-index: 20; padding: 16px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(30, 20, 10, .35);
}
#panel[hidden] { display: none; }
.sheet {
  width: min(580px, 100%); max-height: min(82dvh, 720px);
  display: flex; flex-direction: column;
  background: var(--panel); border: 4px solid #fff; border-radius: 22px;
  box-shadow: 0 8px 0 rgba(0, 0, 0, .15), 0 20px 50px rgba(0, 0, 0, .3);
  animation: pop .18s ease-out;
}
.sheet header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 8px; }
.sheet h2 { margin: 0; font-size: 22px; font-weight: 900; }
#panel-close { width: 38px; height: 38px; border-radius: 50%; background: #f3e3c8; font-size: 16px; font-weight: 900; }
#panel-body { overflow: auto; padding: 4px 16px 18px; -webkit-overflow-scrolling: touch; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.card {
  display: flex; flex-direction: column; align-items: center; gap: 3px; text-align: center;
  padding: 10px; border-radius: 16px; background: #fff;
  border: 3px solid transparent; box-shadow: 0 3px 0 var(--card-edge);
}
.card.selected { border-color: var(--accent); }
.card.locked { opacity: .55; filter: grayscale(.6); cursor: not-allowed; }
.card b { font-size: 15px; }
.meta { font-size: 12px; opacity: .8; }
.tag {
  margin-top: 3px; padding: 2px 8px; border-radius: 8px;
  font-size: 11px; font-weight: 800; background: #eef7e6; color: var(--green-dark);
}
.card.locked .tag { background: #f1e6e6; color: #8a3b3b; }
.thumb { width: 76px; height: 76px; object-fit: contain; }
.thumb.emoji { display: grid; place-items: center; font-size: 46px; }

.list { display: flex; flex-direction: column; gap: 8px; }
.row {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border-radius: 14px; background: #fff; box-shadow: 0 3px 0 var(--card-edge);
  color: inherit; text-decoration: none;
}
.row .thumb { width: 50px; height: 50px; }
.row .thumb.emoji { font-size: 32px; }
.row .info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row.city.current { outline: 3px solid var(--accent); }
.ep {
  flex: none; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: #fff; font-weight: 900; font-size: 18px;
}

.btn {
  flex: none; padding: 9px 13px; border-radius: 12px; font-weight: 900;
  background: var(--accent); color: #fff; box-shadow: 0 3px 0 var(--accent-dark);
}
.btn.alt { background: var(--green); box-shadow: 0 3px 0 var(--green-dark); }
.btn.ghost { background: #eee2cc; color: var(--ink); box-shadow: 0 3px 0 #d4c2a0; }
.btn.wide { width: 100%; margin-bottom: 10px; padding: 12px; font-size: 16px; }
.btn:active { transform: translateY(2px); box-shadow: none; }
.actions { display: flex; gap: 10px; justify-content: center; margin-top: 8px; }
.empty, .hint { text-align: center; opacity: .85; line-height: 1.5; }
.soon { text-align: center; padding: 6px 10px; line-height: 1.5; }
.soon .big { font-size: 56px; }

#loading {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; text-align: center;
  background: var(--bg); font-weight: 900; font-size: 22px;
}

/* ---- Telefon ---- */
@media (max-width: 560px) {
  #toolbar { gap: 2px; width: calc(100vw - 12px); padding: 4px; }
  .tool { flex: 1; min-width: 0; height: 56px; padding: 2px; font-size: 10.5px; }
  .tool .ico { font-size: 21px; height: 26px; }
  .tool .mini { width: 28px; height: 28px; }
  .sep { margin: 6px 0; }
  .level-badge { width: 42px; height: 42px; font-size: 17px; }
  .xpbar { width: 108px; }
  .chip { font-size: 12px; padding: 7px 9px; max-width: 30vw; }
  .icon-btn { width: 38px; height: 38px; font-size: 18px; }
  #toasts { top: calc(env(safe-area-inset-top) + 66px); }
  #panel { align-items: flex-end; padding: 0; }
  .sheet {
    width: 100%; max-height: 80dvh; border-radius: 22px 22px 0 0; border-bottom: 0;
    padding-bottom: env(safe-area-inset-bottom); animation: up .2s ease-out;
  }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .thumb { width: 64px; height: 64px; }
}
/* Yatay telefon: dikey alan az */
@media (max-height: 460px) {
  .tool { height: 48px; }
  .tool .ico { height: 24px; font-size: 20px; }
  .sheet { max-height: 92dvh; }
  #toasts { top: calc(env(safe-area-inset-top) + 60px); }
}

@keyframes rise { from { opacity: 1; margin-top: 0; } to { opacity: 0; margin-top: -60px; } }
@keyframes pop { from { transform: scale(.92); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toast { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---- v2: köy, borsa, görevler, hava ---- */
.hud-left { flex: none; }
.hud-right { flex: 1 1 0; flex-wrap: wrap; justify-content: flex-end; }
.hud-icons { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; max-width: 100%; }
.chip.boost { background: #fff3c4; color: #8a5a00; }
#labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.blabel {
  position: absolute; left: 0; top: 0; white-space: nowrap;
  padding: 2px 7px; border-radius: 9px; font-size: 11px; font-weight: 800;
  background: rgba(255, 250, 240, .9); box-shadow: 0 2px 0 rgba(0, 0, 0, .15);
}
.blabel b { color: var(--accent-dark); }
.blabel.locked { opacity: .55; }
.tarp-btn {
  position: absolute; left: 50%; transform: translateX(-50%); z-index: 15;
  top: calc(env(safe-area-inset-top) + 120px);
  padding: 12px 20px; border-radius: 16px; font-weight: 900; font-size: 17px;
  background: #1e63c6; color: #fff; box-shadow: 0 5px 0 #123f80, 0 10px 30px rgba(0, 0, 0, .25);
  animation: pulse 1s ease-in-out infinite alternate;
}
.tarp-btn[hidden] { display: none; }
@keyframes pulse { from { transform: translateX(-50%) scale(1); } to { transform: translateX(-50%) scale(1.06); } }

.tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.tab { flex: 1; padding: 9px 6px; border-radius: 12px; font-weight: 900; background: #f0e4cc; font-size: 13px; }
.tab.on { background: var(--accent); color: #fff; box-shadow: 0 3px 0 var(--accent-dark); }
.pico { font-size: 18px; line-height: 1; }
.pico.big { font-size: 30px; width: 40px; text-align: center; flex: none; }
.pico.huge { font-size: 44px; }
.spark { width: 90px; height: 26px; flex: none; }
.price { display: flex; flex-direction: column; align-items: flex-end; flex: none; }
.trend { font-size: 11px; font-weight: 900; }
.trend.up { color: #3c9a2b; } .trend.down { color: #d0453a; }
.sellhead { display: flex; align-items: center; gap: 12px; margin: 8px 0 12px; }
.sellhead > div { flex: 1; display: flex; flex-direction: column; }
.needs { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0; }
.need { font-size: 12px; font-weight: 800; padding: 2px 7px; border-radius: 8px; background: #f3ecdd; }
.need.ok { background: #e3f4d9; color: #2f6f1f; } .need.no { background: #fbe3df; color: #a23a2c; }
.needs.out .need { background: #fff3c4; color: #7a5200; }
.row.muted { opacity: .6; }
.row .col { display: flex; flex-direction: column; gap: 6px; }
.bar { position: relative; height: 16px; border-radius: 8px; background: #eee2cc; overflow: hidden; margin: 4px 0; }
.bar > div { height: 100%; background: linear-gradient(#8fdc5f, var(--green)); }
.bar > span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 11px; font-weight: 900; }
.box { display: flex; flex-direction: column; gap: 6px; padding: 12px; margin: 10px 0; border-radius: 14px; background: #fff; box-shadow: 0 3px 0 var(--card-edge); }
.box.rain { background: #e3eefc; }
.box .btn { align-self: flex-start; }
.warn { color: #a23a2c; font-size: 12px; font-weight: 800; }
.ok { color: #2f6f1f; }
.desc { margin: 6px 0; opacity: .85; line-height: 1.45; }
h3 { margin: 16px 0 8px; font-size: 16px; }
.btn.small { padding: 6px 10px; font-size: 12px; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
@media (max-width: 560px) {
  .hud-icons .icon-btn { width: 34px; height: 34px; font-size: 16px; }
  .spark { width: 60px; }
  .tarp-btn { top: calc(env(safe-area-inset-top) + 110px); }
}

/* ---- Üyelik ve Ordu haritası ---- */
#loading[hidden] { display: none; }
#auth {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px;
  background: linear-gradient(#bfe6ff, #7cc25a);
}
.auth-card {
  width: min(420px, 100%); padding: 22px 20px; border-radius: 22px; background: var(--panel);
  border: 4px solid #fff; box-shadow: 0 8px 0 rgba(0, 0, 0, .15), 0 20px 50px rgba(0, 0, 0, .25);
}
.auth-card h1 { margin: 0 0 4px; font-size: 26px; font-weight: 900; text-align: center; }
.auth-card form { display: flex; flex-direction: column; gap: 10px; }
.auth-card label { display: flex; flex-direction: column; gap: 4px; font-weight: 800; font-size: 13px; }
.auth-card input, .auth-card select {
  font: inherit; font-size: 16px; padding: 10px 12px; border-radius: 12px; border: 2px solid #e6d3b3; background: #fff; color: var(--ink);
}
.auth-card [hidden] { display: none; }
.auth-err { color: #a23a2c; font-weight: 800; margin: 0; }
.ordu-map { width: 100%; height: auto; display: block; border-radius: 16px; margin: 8px 0; }
.ordu-map .sea { fill: #4f9fd6; }
.ordu-map .sea-label { fill: rgba(255, 255, 255, .7); font-weight: 900; font-size: 16px; text-anchor: middle; letter-spacing: 4px; }
.ordu-map .cell { stroke: #4e7d3a; stroke-width: 1.2; cursor: pointer; }
.ordu-map .cell:hover { filter: brightness(1.08); }
.ordu-map .cell.mine { stroke: #f4a52c; stroke-width: 3; }
.ordu-map .cell.sel { filter: brightness(1.15); }
.ordu-map .border { fill: none; stroke: #3c6a2a; stroke-width: 2.5; }
.ordu-map .mlabel { cursor: pointer; }
.econ { display: flex; flex-direction: column; gap: 3px; margin: 4px 0 2px; }
.econ-bar { display: flex; height: 8px; border-radius: 6px; overflow: hidden; background: #eee; min-width: 120px; }
.econ-bar i { display: block; height: 100%; }
.econ-lbl { display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: 12px; font-weight: 800; opacity: .8; }
.sortbar { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.sortbar .chip { padding: 4px 10px; border-radius: 12px; background: #fff; box-shadow: 0 2px 0 #e6d3b3; font-weight: 800; font-size: 13px; }
.sortbar .chip.on { background: var(--accent, #f0a030); color: #fff; }
.ordu-map .mlabel circle { fill: #3b2a1a; }
.ordu-map .mlabel text { font-size: 11px; font-weight: 900; text-anchor: middle; fill: #3b2a1a; paint-order: stroke; stroke: #fffaf0; stroke-width: 3px; }
.ordu-map .mlabel .cnt { fill: #1f6f14; font-size: 12px; }
.row.current { outline: 3px solid var(--accent); }

/* ---- Mağaza: tohum alma ---- */
.card-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; margin-top: 6px; }
.card-actions .btn { padding: 7px 10px; font-size: 13px; }
.card.locked .card-actions { display: none; }

/* ---- Komşular ve ziyaret ---- */
.badge-host { position: relative; }
.badge {
  position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 4px;
  border-radius: 9px; background: #e53935; color: #fff; font-size: 11px; font-weight: 900; display: grid; place-items: center;
}
.badge[hidden] { display: none; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: #c7b9a0; flex: none; }
.dot.on { background: #3fbf3a; box-shadow: 0 0 0 3px rgba(63, 191, 58, .2); }
.addform { display: flex; gap: 8px; }
.addform input { flex: 1; min-width: 0; font: inherit; font-size: 16px; padding: 9px 12px; border-radius: 12px; border: 2px solid #e6d3b3; }
#visit-bar {
  position: absolute; left: 50%; transform: translateX(-50%); z-index: 12;
  bottom: calc(env(safe-area-inset-bottom) + 12px); width: min(560px, calc(100vw - 16px));
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 18px;
  background: rgba(255, 250, 240, .96); box-shadow: 0 6px 0 rgba(0, 0, 0, .15), 0 10px 30px rgba(0, 0, 0, .15);
}
#visit-bar[hidden] { display: none; }
#visit-bar .info { flex: 1; display: flex; flex-direction: column; min-width: 0; }
body.visiting #toolbar, body.visiting #btn-tarp { display: none; }

/* ---- Haber bandı ---- */
#news {
  position: absolute; left: 50%; transform: translateX(-50%); z-index: 14;
  top: calc(env(safe-area-inset-top) + 64px); width: min(620px, calc(100vw - 16px));
  display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 14px;
  background: rgba(59, 42, 26, .88); color: #fff; box-shadow: 0 4px 0 rgba(0, 0, 0, .18); pointer-events: none;
}
#news[hidden] { display: none; }
.news-tag { flex: none; padding: 3px 8px; border-radius: 9px; background: #e53935; font-size: 12px; font-weight: 900; }
.news-win { flex: 1; overflow: hidden; white-space: nowrap; }
.news-track { display: inline-block; font-weight: 800; font-size: 14px; will-change: transform; }
.news-track i { margin: 0 14px; opacity: .5; font-style: normal; }
@media (max-width: 560px) { #news { top: calc(env(safe-area-inset-top) + 58px); } .news-track { font-size: 13px; } }
#toasts { top: calc(env(safe-area-inset-top) + 108px); }
@media (max-width: 560px) { #toasts { top: calc(env(safe-area-inset-top) + 100px); } }

/* ---- #numara, yönetici, Ek menüsü ---- */
.tag-no { opacity: .55; font-weight: 800; font-size: .82em; margin-left: 1px; }
#btn-admin[hidden] { display: none; }
#seed-pop {
  position: absolute; left: 50%; transform: translateX(-50%); z-index: 16;
  bottom: calc(env(safe-area-inset-bottom) + 84px); width: min(440px, calc(100vw - 16px));
  max-height: 55dvh; overflow: auto; padding: 8px; border-radius: 18px;
  background: rgba(255, 250, 240, .98); box-shadow: 0 6px 0 rgba(0, 0, 0, .15), 0 10px 30px rgba(0, 0, 0, .2);
  display: flex; flex-direction: column; gap: 6px; animation: popup .15s ease-out;
}
#seed-pop[hidden] { display: none; }
.pop-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 6px; }
.pop-item { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 12px; background: #fff; box-shadow: 0 2px 0 var(--card-edge); text-align: left; }
.pop-item.on { outline: 3px solid var(--accent); }
.pop-item:disabled { opacity: .45; }
.pop-item .mini { width: 34px; height: 34px; object-fit: contain; flex: none; }
.pop-name { flex: 1; min-width: 0; font-weight: 900; font-size: 13px; line-height: 1.1; }
.pop-meta { font-size: 11px; font-weight: 800; opacity: .75; white-space: nowrap; }
@media (max-width: 560px) { #seed-pop { bottom: calc(env(safe-area-inset-bottom) + 72px); } .pop-list { grid-template-columns: 1fr 1fr; } }
@keyframes popup { from { transform: translate(-50%, 20px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

/* Taşıma onayı: ✕ eski yer, ✓ yeni yer */
.move-ok { position: absolute; left: 0; top: 0; z-index: 12; display: flex; gap: 6px; pointer-events: auto; }
.move-ok[hidden] { display: none; }
.move-ok button { width: 40px; height: 40px; border-radius: 50%; border: 3px solid #fff; font-size: 20px; font-weight: 800; color: #fff; cursor: pointer; box-shadow: 0 3px 8px rgba(0,0,0,.3); }
.move-ok .no { background: #e53935; }
.move-ok .yes { background: #43a047; }
.move-ok.bad .yes { background: #9e9e9e; }

/* Dayıbaşı yetenekleri */
.skills { display: grid; gap: 4px; margin: 6px 0; }
.skill { display: block; font-size: 12px; padding: 5px 8px; border-radius: 8px; background: rgba(0,0,0,.05); color: #6d6d6d; }
.skill b { display: block; font-size: 12px; color: #757575; }
.skill.on { background: #e8f5e9; color: #2e5a2f; }
.skill.on b { color: #2e7d32; }

/* Radyo düğmesi: kanal çevrilince sallanır */
#btn-radio.tune { animation: tune .6s ease; }
@keyframes tune { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-14deg); } 60% { transform: rotate(12deg); } }

/* İnşaat ilerleme çubuğu: bina etiketinin altında ve panelde */
.blabel .bbar { position: relative; display: block; width: 120px; height: 16px; margin: 3px auto 0; border-radius: 8px; background: #5d4037; overflow: hidden; box-shadow: inset 0 1px 2px rgba(0,0,0,.4); }
.blabel .bbar i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(#ffd54f, #ffb300); border-radius: 8px; transition: width .9s linear; }
.blabel .bbar em { position: relative; display: block; font-style: normal; font-size: 10px; line-height: 16px; color: #fff; text-align: center; text-shadow: 0 1px 1px rgba(0,0,0,.6); }
.bar.big { height: 24px; }
.bar.big span { font-size: 13px; }

/* ---- Global sohbet ---- */
#chat {
  position: absolute; left: 10px; bottom: 86px; z-index: 18; width: min(380px, calc(100% - 20px)); height: min(460px, 62vh);
  display: flex; flex-direction: column; border-radius: 18px; background: rgba(255, 250, 240, .97); box-shadow: 0 6px 24px rgba(0, 0, 0, .25); overflow: hidden;
  user-select: text; -webkit-user-select: text;
}
#chat[hidden] { display: none; }
#chat header { display: flex; align-items: baseline; gap: 8px; padding: 10px 12px; background: var(--accent, #f0a030); color: #fff; }
#chat header .meta { color: rgba(255, 255, 255, .85); font-size: 11px; flex: 1; }
#chat header .x { color: #fff; font-weight: 900; font-size: 16px; }
#chat .msgs { flex: 1; overflow-y: auto; padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; -webkit-overflow-scrolling: touch; }
#chat .m { align-self: flex-start; max-width: 86%; padding: 6px 10px; border-radius: 14px 14px 14px 4px; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
#chat .m.mine { align-self: flex-end; border-radius: 14px 14px 4px 14px; background: #e3f5d6; }
#chat .m .who { font-weight: 900; font-size: 12px; color: var(--accent-dark, #b06a00); padding: 0; }
#chat .m .where { font-size: 10px; opacity: .55; margin-left: 4px; }
#chat .m p { margin: 2px 0 0; font-size: 14px; line-height: 1.3; word-break: break-word; }
#chat .m time { display: block; text-align: right; font-size: 10px; opacity: .5; }
#chat .empty, #chat .warn { text-align: center; font-size: 13px; }
#chat form { display: flex; gap: 6px; padding: 8px; border-top: 1px solid #eadcc0; }
#chat form input { flex: 1; min-width: 0; font: inherit; font-size: 15px; padding: 8px 10px; border-radius: 12px; border: 2px solid #e6d3b3; background: #fff; }
#chat .emo-btn { font-size: 20px; }
#chat .emo { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; padding: 6px; max-height: 130px; overflow-y: auto; border-top: 1px solid #eadcc0; background: #fffaf0; }
#chat .emo[hidden] { display: none; }
#chat .emo button { font-size: 20px; padding: 4px; border-radius: 8px; }
#chat .emo button:active { background: #f3e3c8; }
@media (max-width: 600px) { #chat { bottom: 80px; height: 55vh; } }

/* ---- Oyuncu kartı ---- */
.pcard { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 16px; background: #fff; box-shadow: 0 3px 0 var(--card-edge, #e6d3b3); margin-bottom: 10px; }
.pav { font-size: 40px; width: 60px; height: 60px; display: grid; place-items: center; border-radius: 50%; background: #f3e3c8; flex: none; }
.pinfo { display: flex; flex-direction: column; gap: 3px; }
.pname { font-size: 18px; }
.pinfo .dot { display: inline-block; vertical-align: middle; }
.stallform { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 6px 0; }
.stallform select { grid-column: 1 / -1; }
.stallform select, .stallform input { font: inherit; padding: 7px 9px; border-radius: 10px; border: 2px solid #e6d3b3; width: 100%; }
.stallform label { display: flex; flex-direction: column; font-size: 12px; font-weight: 800; }
.stallform .btn { grid-column: 1 / -1; }
.link { cursor: pointer; text-decoration: underline dotted; }

/* Bölümler: şehrin altında sahip olunan köyler */
.farms-sub { display: flex; flex-direction: column; gap: 6px; margin: -2px 0 6px 22px; padding-left: 10px; border-left: 3px solid #f0d6a8; }
.farms-sub .row { text-decoration: none; color: inherit; }
.farms-sub .btn.small { align-self: flex-start; }
.ep.small { width: 26px; height: 26px; font-size: 13px; }

/* İşçilerim paneli */
.wcard > b { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.wstats { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; font-weight: 800; margin: 2px 0; }
.wstats i { font-style: normal; opacity: .55; font-weight: 700; }

/* Bina etiketleri: küçük; uzaktan sadece durum simgesi */
.blabel { font-size: 9.5px; padding: 1px 5px; border-radius: 7px; }
#labels.far .blabel .bn { display: none; }
#labels.far .blabel { padding: 1px 4px; font-size: 12px; background: rgba(255, 250, 240, .8); }
/* Bildirim duyuruları */
.toast.note { display: flex; align-items: center; gap: 8px; cursor: pointer; pointer-events: auto; text-align: left; }
.toast.note .ni { font-size: 18px; }
.toast.note .nt { flex: 1; }
.toast.note .nx { font-weight: 900; opacity: .6; padding: 0 2px 0 6px; color: inherit; }
.toast.note.big { font-size: 15px; padding: 10px 14px; background: linear-gradient(#fff8e1, #ffe082); color: #5d3b00; box-shadow: 0 6px 18px rgba(0, 0, 0, .25); animation: notepop .45s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes notepop { from { transform: scale(.6) translateY(-10px); opacity: 0; } to { transform: none; opacity: 1; } }
.note-row .info { cursor: pointer; }

/* Şehir merkezi meydanı */
.plaza { width: 100%; height: auto; display: block; margin: 4px 0 10px; }
.plaza .stall { cursor: pointer; }
.plaza .stall:hover rect { fill: #fff3e0; }
/* 9 düğmeli alt menü dar ekrana sığsın */
@media (max-width: 430px) { #toolbar .tool { min-width: 0; padding-left: 2px; padding-right: 2px; } #toolbar .tool span:not(.ico) { font-size: 10px; } }

/* Mini oyunlar */
#mini { position: fixed; inset: 0; z-index: 100; background: #263238; display: flex; flex-direction: column; touch-action: none; user-select: none; -webkit-user-select: none; }
#mini canvas { display: block; flex: 1; touch-action: none; }
.mini-top { height: 52px; display: flex; align-items: center; gap: 14px; padding: 0 14px; background: #fff8e1; font-weight: 900; }
.mini-top b { flex: 1; }
.mini-top .mini-x { font-size: 20px; font-weight: 900; color: #5d4037; }
.mini-intro { position: absolute; inset: 52px 0 0 0; display: grid; place-items: center; background: rgba(0, 0, 0, .35); }
.mini-card { background: #fffaf0; border-radius: 20px; padding: 22px 26px; text-align: center; max-width: 320px; box-shadow: 0 10px 30px rgba(0, 0, 0, .35); }
.mini-card p { margin: 8px 0 14px; }
.mini-big { font-size: 64px; line-height: 1; margin-bottom: 6px; }

/* Asistan Ayşe */
#ayse { position: absolute; left: 10px; bottom: 96px; z-index: 40; display: flex; align-items: flex-end; gap: 8px; max-width: min(420px, calc(100vw - 20px));
  transform: translateY(20px) scale(.9); opacity: 0; pointer-events: none; transition: transform .35s cubic-bezier(.2, 1.5, .4, 1), opacity .25s; cursor: pointer; }
#ayse.on { transform: none; opacity: 1; pointer-events: auto; }
#ayse .ay-face { flex: none; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-size: 42px; background: radial-gradient(#fff8e1, #ffcc80); box-shadow: 0 4px 12px rgba(0, 0, 0, .3); border: 3px solid #fff; }
#ayse .ay-bubble { position: relative; background: #fffaf0; border-radius: 16px 16px 16px 4px; padding: 8px 12px; box-shadow: 0 4px 14px rgba(0, 0, 0, .25); font-weight: 700; font-size: 14px; line-height: 1.3; }
#ayse .ay-bubble b { display: block; color: #c2185b; font-size: 12px; }
#ayse .ay-x { position: absolute; top: -8px; right: -8px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .25); font-weight: 900; }
/* Köylü kartı */
.npc-card { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.npc-arrow { flex: none; width: 40px; height: 40px; border-radius: 50%; background: #fff; box-shadow: 0 2px 0 #e6d3b3; font-size: 18px; font-weight: 900; }
.npc-main { flex: 1; display: flex; align-items: center; gap: 10px; }
.npc-img { flex: none; width: 120px; height: 172px; border-radius: 16px; background: linear-gradient(#e3f2fd, #c5e1a5); display: grid; place-items: center; overflow: hidden; }
.npc-img img { width: 100%; height: 100%; object-fit: contain; }
.npc-img span { font-size: 64px; }
.npc-say { position: relative; background: #fff; border-radius: 16px; padding: 10px 12px; font-weight: 800; font-size: 15px; box-shadow: 0 2px 6px rgba(0, 0, 0, .12); }

/* ---- Taşma olmasın: düğmeler sığmazsa alt satıra geçer, hiçbir şey kutudan taşmaz ---- */
.actions { flex-wrap: wrap; }
.btn { max-width: 100%; white-space: normal; overflow-wrap: anywhere; text-align: center; }
.box, .row, .info, .card { min-width: 0; overflow-wrap: anywhere; }
.box > *, .row > * { max-width: 100%; }
.row .col { flex: none; max-width: 46%; align-items: stretch; }
#panel-body, .panel-body { overflow-x: hidden; }
.wstats, .econ-lbl { flex-wrap: wrap; }
/* ---- Üst menü: ☰ ile açılıp kapanan tek panel; simgeler yan yana, sığmayan alt satıra ---- */
#hud .hud-right { position: relative; }
#btn-menu { order: 5; }
#hud-icons { position: absolute; top: calc(100% + 8px); right: 0; z-index: 25; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px;
  width: max-content; max-width: calc(100vw - 20px); padding: 8px; border-radius: 16px; background: rgba(255, 250, 240, .96); box-shadow: 0 6px 20px rgba(0, 0, 0, .25); }
#hud-icons[hidden] { display: none; }
#hud-icons .icon-btn { box-shadow: 0 2px 0 #e6d3b3; }
