* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --ui-scale: 1;
  --ui-pad: clamp(0.4rem, 1.2vw, 0.95rem);
  --ui-gap: clamp(0.28rem, 0.85vw, 0.55rem);
  --btn-min: clamp(36px, 5.5vw, 44px);
  --btn-font: clamp(0.72rem, 1.85vw, 0.9rem);
  --panel-w: min(92vw, 400px);
  --panel-max-h: min(72vh, 640px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #1a2230;
  font-family: Arial, Helvetica, sans-serif;
  -webkit-text-size-adjust: 100%;
}

body.game-active {
  background:
    radial-gradient(ellipse at 40% 30%, #1a4a6e 0%, transparent 50%),
    radial-gradient(ellipse at 70% 75%, #0c2438 0%, transparent 55%),
    #071422;
}

body.game-active.era-ancient {
  background:
    radial-gradient(ellipse at 35% 25%, #e8d4a8 0%, transparent 55%),
    radial-gradient(ellipse at 70% 80%, #8b6914 0%, transparent 50%),
    #c4a574;
}

body.game-active.layer-solar,
body.game-active.layer-galaxy {
  background:
    radial-gradient(ellipse at 30% 20%, rgba(80, 40, 120, 0.45) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 70%, rgba(20, 50, 100, 0.35) 0%, transparent 55%),
    #050510;
}

/* —— Auth / Lobi / Profil —— */
.auth-modal,
.lobby-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(47, 111, 237, 0.28), transparent 50%),
    rgba(4, 10, 18, 0.88);
  backdrop-filter: blur(8px);
}

.auth-modal[hidden],
.lobby-modal[hidden] {
  display: none !important;
}

.auth-card,
.lobby-card {
  width: min(400px, 94vw);
  max-height: min(88vh, 640px);
  overflow-y: auto;
  padding: 1.25rem 1.2rem;
  border-radius: 14px;
  background: rgba(14, 20, 30, 0.96);
  border: 1px solid rgba(255, 215, 106, 0.35);
  color: #fff;
  text-align: center;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
}

.auth-title {
  margin: 0 0 0.35rem;
  font-size: 1.45rem;
}

.auth-subtitle {
  margin: 0 0 1rem;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.6);
}

.auth-tabs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
}

.auth-tab {
  flex: 1;
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  border-radius: 8px;
  padding: 0.55rem;
  font-weight: 600;
  cursor: pointer;
}

.auth-tab.active {
  background: #2f6fed;
  border-color: #2f6fed;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  text-align: left;
  margin-bottom: 0.75rem;
}

.auth-form[hidden] {
  display: none !important;
}

.auth-form .settings-field input {
  width: 100%;
  box-sizing: border-box;
  margin-top: 0.25rem;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
}

.auth-error {
  color: #ff8f8f;
  font-size: 0.8rem;
  margin: 0 0 0.65rem;
}

.auth-error[hidden] {
  display: none !important;
}

.menu-user-chip {
  display: inline-block;
  margin: -0.6rem 0 1rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.72rem;
  color: rgba(255, 215, 106, 0.9);
  background: rgba(255, 215, 106, 0.1);
  border: 1px solid rgba(255, 215, 106, 0.25);
}

.profile-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
  margin-bottom: 0.85rem;
}

.profile-stat {
  text-align: left;
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.profile-stat strong {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.95rem;
}

.lobby-actions {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin: 0.75rem 0;
}

.lobby-join-row {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.lobby-join-row input {
  flex: 1;
  min-width: 0;
}

.lobby-browser {
  margin: 0.75rem 0 0.35rem;
  text-align: left;
}

.lobby-browser-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.lobby-browser-head .lobby-settings-title {
  margin: 0;
}

.lobby-refresh-btn {
  padding: 0.35rem 0.65rem !important;
  font-size: 0.75rem !important;
  width: auto !important;
  min-width: 0;
}

.lobby-list {
  max-height: 160px;
  overflow-y: auto;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.28);
}

.lobby-list-empty {
  margin: 0;
  padding: 0.75rem;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.45);
}

.lobby-list-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.45rem;
  align-items: center;
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.78rem;
}

.lobby-list-row:last-child {
  border-bottom: none;
}

.lobby-list-meta {
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.72rem;
}

.lobby-list-lock {
  color: #ffd76a;
  font-size: 0.85rem;
}

.lobby-list-live {
  color: #7dffb0;
  font-size: 0.72rem;
  font-weight: 700;
  margin-left: 0.25rem;
}

.lobby-list-row .menu-btn {
  padding: 0.35rem 0.55rem !important;
  font-size: 0.72rem !important;
  width: auto !important;
  margin: 0;
}

.lobby-room-code {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: #ffd76a;
  margin: 0.5rem 0;
}

.lobby-chat {
  margin-top: 0.75rem;
  text-align: left;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 0.65rem;
}

.lobby-chat[hidden] {
  display: none !important;
}

.lobby-chat-log {
  height: 140px;
  overflow-y: auto;
  padding: 0.45rem 0.55rem;
  margin-bottom: 0.45rem;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.78rem;
  line-height: 1.35;
}

.lobby-chat-line {
  margin: 0.2rem 0;
  word-break: break-word;
}

.lobby-chat-line .chat-user {
  color: #ffd76a;
  font-weight: 700;
}

.lobby-chat-line.chat-system .chat-user {
  color: #8ec8ff;
}

.lobby-chat-form {
  display: flex;
  gap: 0.35rem;
}

.lobby-chat-form input {
  flex: 1;
  min-width: 0;
}

.profile-history {
  max-height: 140px;
  overflow-y: auto;
  text-align: left;
  margin: 0 0 0.75rem;
  padding: 0.45rem 0.55rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.78rem;
}

.profile-history-empty {
  color: rgba(255, 255, 255, 0.45);
  margin: 0;
}

.profile-history-row {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.25rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.profile-history-row:last-child {
  border-bottom: none;
}

.ingame-chat {
  position: fixed;
  right: 0.75rem;
  bottom: 4.5rem;
  z-index: 55;
}

.ingame-chat[hidden] {
  display: none !important;
}

.ingame-chat-toggle {
  appearance: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 215, 106, 0.4);
  background: rgba(14, 20, 30, 0.92);
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.ingame-chat-panel {
  position: absolute;
  right: 0;
  bottom: 52px;
  width: min(280px, 78vw);
  padding: 0.5rem;
  border-radius: 12px;
  background: rgba(14, 20, 30, 0.96);
  border: 1px solid rgba(255, 215, 106, 0.3);
}

.ingame-chat-panel[hidden] {
  display: none !important;
}

.ingame-chat-panel .lobby-chat-log {
  height: 120px;
}

.lobby-card .panel-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-align: left;
}

.lobby-card .menu-section-title {
  flex: 1;
  margin: 0;
}

/* —— Ana Menü —— */
.main-menu {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background:
    radial-gradient(ellipse at 20% 10%, rgba(60, 100, 180, 0.35), transparent 50%),
    radial-gradient(ellipse at 80% 90%, rgba(180, 60, 60, 0.25), transparent 45%),
    linear-gradient(160deg, #121820 0%, #1c2838 45%, #152030 100%);
}

.main-menu[hidden] {
  display: none !important;
}

.menu-card {
  width: min(480px, 100%);
  text-align: center;
  color: #fff;
}

.menu-eyebrow {
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 215, 106, 0.75);
  margin-bottom: 0.5rem;
}

.menu-title {
  font-size: clamp(2.6rem, 8vw, 4rem);
  font-weight: 800;
  letter-spacing: 0.02em;
  margin-bottom: 0.5rem;
}

.menu-subtitle {
  color: rgba(255, 255, 255, 0.65);
  margin-bottom: 1.75rem;
  line-height: 1.45;
}

.menu-section {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.menu-section[hidden] {
  display: none !important;
}

.menu-sandbox {
  width: 100%;
  max-width: 450px;
  max-height: 85vh;
  overflow-x: hidden;
  overflow-y: auto;
  text-align: left;
  padding-right: 0.25rem;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
}

.menu-sandbox .country-pick-search {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.settings-slider {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.85);
  margin-top: 0.35rem;
}

.settings-slider input[type="range"] {
  width: 100%;
  accent-color: #ffd76a;
}

.settings-slider em {
  color: #ffd76a;
  font-style: normal;
  float: right;
}

.settings-slider.lobby-ai-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.country-pick-overlay {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(8, 12, 20, 0.72);
  backdrop-filter: blur(6px);
}

.country-pick-overlay[hidden] {
  display: none !important;
}

.country-pick-card {
  width: clamp(300px, 90vw, 450px);
  max-height: 85vh;
  overflow-x: hidden;
  overflow-y: auto;
  background: rgba(18, 24, 36, 0.96);
  border: 1px solid rgba(255, 215, 106, 0.35);
  border-radius: 14px;
  padding: 1.25rem 1.35rem;
  color: #fff;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

.country-pick-search {
  width: 100%;
  margin: 0.75rem 0 0.5rem;
  padding: 0.65rem 0.8rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  font-size: 0.95rem;
}

.country-pick-list {
  max-height: 280px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.85rem;
}

.country-pick-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  text-align: left;
  color: #fff;
  font: inherit;
}

.country-pick-item--locked,
.country-pick-item:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.35);
}

.country-pick-item:hover:not(:disabled),
.country-pick-item.selected {
  border-color: rgba(255, 215, 106, 0.55);
  background: rgba(255, 215, 106, 0.12);
}

.country-pick-item img {
  width: 28px;
  height: 20px;
  object-fit: cover;
  border-radius: 2px;
  background: #333;
}

.country-pick-item strong {
  display: block;
  font-size: 0.92rem;
}

.country-pick-item span {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.55);
}

.country-pick-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

.map-layers {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 8;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

/* Sağ üst burger menü — Kaydet / Ayarlar / Ses */
.hud-burger-wrap {
  position: fixed;
  top: calc(10px + var(--safe-t));
  right: calc(10px + var(--safe-r));
  z-index: 60;
  pointer-events: auto;
}

.hud-burger-wrap[hidden] {
  display: none !important;
}

.hud-burger-btn {
  appearance: none;
  width: var(--btn-min);
  height: var(--btn-min);
  min-width: 40px;
  min-height: 40px;
  border-radius: 10px;
  border: 1px solid rgba(255, 215, 106, 0.4);
  background: rgba(14, 18, 26, 0.92);
  color: #ffd76a;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px);
}

.hud-burger-btn[aria-expanded="true"] {
  background: rgba(47, 111, 237, 0.45);
  border-color: rgba(47, 111, 237, 0.7);
}

.hud-burger-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 168px;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.5rem;
  border-radius: 12px;
  background: rgba(14, 18, 26, 0.96);
  border: 1px solid rgba(255, 215, 106, 0.3);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
}

.hud-burger-menu[hidden] {
  display: none !important;
}

.hud-dock-btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.5rem 0.7rem;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  width: 100%;
  text-align: left;
}

.hud-dock-btn:hover {
  background: rgba(47, 111, 237, 0.55);
  border-color: rgba(47, 111, 237, 0.7);
}

.hud-burger-toggle {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.45rem;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
}

.lobby-card--wide {
  width: min(440px, 96vw);
  max-height: min(90vh, 720px);
  text-align: left;
}

.lobby-settings {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin: 0.75rem 0 1rem;
  padding: 0.75rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.lobby-settings-title {
  margin: 0 0 0.15rem;
  font-size: 0.85rem;
  color: #ffd76a;
}

.map-layers[hidden] {
  display: none !important;
}

.map-layer-btn {
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(14, 18, 26, 0.88);
  color: #fff;
  cursor: pointer;
  font-size: 0.78rem;
  text-align: left;
  min-width: 128px;
}

.map-layer-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.map-layer-btn.active {
  border-color: rgba(255, 215, 106, 0.7);
  background: rgba(60, 50, 20, 0.9);
  color: #ffd76a;
}

body.layer-solar {
  background: #0a0614 !important;
}

body.layer-galaxy {
  background: #050510 !important;
}

.settings-toggle {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  text-align: left;
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.9rem;
  line-height: 1.35;
  cursor: pointer;
}

.settings-toggle input {
  margin-top: 0.15rem;
  width: 1.05rem;
  height: 1.05rem;
  accent-color: #2f6fed;
  flex-shrink: 0;
}

.settings-hint {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.5);
  line-height: 1.4;
  margin: 0.25rem 0 0.5rem;
}

.sandbox-tabs {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
}

.sandbox-tab {
  flex: 1;
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.5rem 0.4rem;
  border-radius: 8px;
  cursor: pointer;
}

.sandbox-tab.active {
  border-color: rgba(255, 215, 106, 0.55);
  background: rgba(60, 50, 20, 0.85);
  color: #ffd76a;
}

.sandbox-panel {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-bottom: 0.75rem;
}

.sandbox-panel[hidden] {
  display: none !important;
}

.settings-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  text-align: left;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.82rem;
}

.settings-select {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  font-size: 0.88rem;
}

.rel-edit-scale {
  display: flex;
  justify-content: space-between;
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.45);
  margin-top: -0.15rem;
}

.tech-tree-panel {
  max-height: 52vh;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.menu-section-title {
  font-size: 1rem;
  margin-bottom: 0.35rem;
  color: rgba(255, 255, 255, 0.85);
}

.menu-btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.menu-btn.primary {
  background: #2f6fed;
  border-color: #2f6fed;
}

.menu-btn.secondary {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.22);
  font-weight: 500;
}

.menu-btn:hover {
  transform: translateY(-1px);
  background: rgba(47, 111, 237, 0.75);
}

.menu-btn.primary:hover {
  background: #1a4bb8;
}

.scenario-card {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  text-align: left;
  padding: 0.9rem 1rem;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.scenario-card strong {
  font-size: 1.05rem;
}

.scenario-card span {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.55);
  line-height: 1.35;
}

.scenario-card:hover {
  border-color: rgba(255, 215, 106, 0.55);
  background: rgba(255, 215, 106, 0.08);
}

.top-bar[hidden],
.minimap[hidden] {
  display: none !important;
}

#gameCanvas {
  display: block;
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  background: transparent;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  pointer-events: auto;
}

/* —— Üst Bilgi Çubuğu —— */
.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 1.1rem;
  background: rgba(14, 18, 26, 0.88);
  border-bottom: 1px solid rgba(255, 215, 106, 0.28);
  color: #fff;
  backdrop-filter: blur(8px);
}

.top-label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 0.1rem;
}

.top-selected {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.top-flag {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  background: #666;
  flex-shrink: 0;
}

.top-selected-text strong {
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 28vw;
  display: block;
}

.top-gold-block {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.top-coin {
  font-size: 1.35rem;
}

.top-gold-row {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
}

.top-gold-row strong {
  font-size: 1.2rem;
  color: #ffd76a;
}

.top-income {
  font-size: 0.9rem;
  color: #8dffb0;
  font-weight: 600;
}

.top-manpower-block {
  min-width: 100px;
}

.top-manpower-block strong {
  font-size: 1.1rem;
  color: #9ec5ff;
}

.top-casualties-block {
  min-width: 88px;
}

.top-casualties-block strong {
  font-size: 1.1rem;
  color: #ff8a8a;
}

.top-focus-block {
  min-width: 140px;
  flex: 0 1 200px;
}

.top-focus-block strong {
  font-size: 0.85rem;
  color: #ffd76a;
}

.focus-bar {
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
  margin: 0.15rem 0 0.2rem;
}

.focus-fill {
  height: 100%;
  width: 0%;
  border-radius: 4px;
  background: linear-gradient(90deg, #c9a227, #ffd76a);
  transition: width 0.2s linear;
}

.top-level-block strong {
  font-size: 1.1rem;
}

.top-tension-block {
  min-width: 140px;
  flex: 0 1 180px;
}

.tension-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.tension-row strong {
  font-size: 0.95rem;
  color: #ffb48a;
  min-width: 2.4rem;
}

.tension-bar {
  flex: 1;
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.tension-fill {
  height: 100%;
  width: 0%;
  border-radius: 4px;
  background: linear-gradient(90deg, #e8a040, #e04545);
  transition: width 0.35s ease;
}

.top-tension-block.hot .tension-row strong {
  color: #ff8a8a;
}

.top-threat-block {
  min-width: 130px;
  flex: 0 1 170px;
}

.top-threat-block .tension-row strong {
  color: #c8b8ff;
}

.threat-fill {
  background: linear-gradient(90deg, #6a8cff, #a050ff);
}

.region-action-menu {
  position: fixed;
  inset: 0;
  z-index: 56;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: calc(0.6rem + var(--safe-b)) 0.6rem;
  background: rgba(4, 8, 14, 0.28);
  pointer-events: auto;
}

.region-action-menu[hidden] {
  display: none !important;
}

.region-action-card {
  width: var(--panel-w);
  max-width: 320px;
  background: rgba(14, 20, 30, 0.96);
  border: 1px solid rgba(255, 215, 106, 0.4);
  border-radius: 12px;
  padding: 0.7rem 0.75rem;
  color: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.region-action-title {
  margin: 0 0 0.5rem;
  font-size: 0.88rem;
  font-weight: 700;
  color: #ffd76a;
}

.region-action-btns {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.region-action-btns .menu-btn {
  min-height: var(--btn-min);
  font-size: var(--btn-font);
  width: 100%;
}

.region-action-hint {
  margin: 0.45rem 0 0;
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.5);
  line-height: 1.3;
}

.troop-send-overlay {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(6, 10, 18, 0.62);
  backdrop-filter: blur(4px);
}

.troop-send-overlay[hidden] {
  display: none !important;
}

.troop-send-card {
  width: 95vw;
  max-width: 450px;
  max-height: 85vh;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  background: rgba(16, 22, 34, 0.97);
  border: 1px solid rgba(255, 215, 106, 0.4);
  border-radius: 12px;
  padding: 1.1rem 1.2rem;
  color: #fff;
  text-align: left;
}

.troop-send-card .panel-header {
  margin-bottom: 0.35rem;
}

.troop-send-card .menu-section-title {
  margin: 0;
  flex: 1;
}

.troop-send-presets {
  display: flex;
  gap: 0.4rem;
  margin: 0.6rem 0;
}

.troop-send-presets .menu-btn {
  flex: 1;
  font-size: 0.85rem;
  padding: 0.45rem;
}

.troop-send-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.troop-send-actions .menu-btn {
  flex: 1;
}

.troop-send-warn {
  color: #ff8a6a !important;
}

.mgmt-upgrade.resettle {
  border-color: rgba(140, 200, 120, 0.45);
}

#tech-tree-dynamic {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

#tech-tree-dynamic .mgmt-law-label {
  margin-top: 0.35rem;
}

.main-menu.sandbox-over-game {
  background: rgba(8, 12, 20, 0.78);
  backdrop-filter: blur(8px);
}

.top-actions {
  display: flex;
  gap: 0.4rem;
}

.top-btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.4rem 0.65rem;
  border-radius: 6px;
  cursor: pointer;
}

.top-btn:hover {
  background: rgba(47, 111, 237, 0.55);
}

.minimap {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 4;
  width: 180px;
  height: 120px;
  border-radius: 10px;
  border: 2px solid rgba(255, 215, 106, 0.45);
  background: rgba(10, 14, 20, 0.85);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  cursor: crosshair;
  image-rendering: pixelated;
}

.map-modes {
  position: fixed;
  left: 210px;
  bottom: 18px;
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.map-modes[hidden] {
  display: none !important;
}

.map-mode-btn {
  appearance: none;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(14, 18, 26, 0.88);
  color: #fff;
  font-size: 1.15rem;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.map-mode-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 215, 106, 0.45);
}

.map-mode-btn.active {
  border-color: rgba(47, 111, 237, 0.85);
  background: rgba(47, 111, 237, 0.35);
  box-shadow: 0 0 0 1px rgba(47, 111, 237, 0.35);
}

.game-tooltip {
  position: fixed;
  z-index: 15;
  max-width: 260px;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  background: rgba(8, 10, 16, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.82rem;
  line-height: 1.45;
  pointer-events: none;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
}

.game-tooltip[hidden] {
  display: none !important;
}

.game-tooltip strong {
  display: block;
  font-size: 0.95rem;
  margin-bottom: 0.35rem;
  color: #ffd76a;
}

.game-tooltip .tt-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  color: rgba(255, 255, 255, 0.72);
}

.game-tooltip .tt-row span:last-child {
  color: #fff;
  font-weight: 600;
}

#ui-layer {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10;
  background: rgba(0, 0, 0, 0.7);
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow-y: auto;
}

#ui-layer.visible {
  display: flex;
}

.ui-panel {
  text-align: center;
  padding: 2rem 2.5rem;
  width: clamp(300px, 90vw, 450px);
  max-height: 85vh;
  overflow-x: hidden;
  overflow-y: auto;
}

#end-title {
  font-size: clamp(1.8rem, 5vw, 3rem);
  font-weight: 700;
  margin-bottom: 0.75rem;
  letter-spacing: 0.02em;
}

#end-title.win {
  color: #3dd68c;
}

#end-title.lose {
  color: #ff5c5c;
}

#level-info {
  color: rgba(255, 255, 255, 0.85);
  font-size: 1.1rem;
  margin-bottom: 1.25rem;
}

.shop-section {
  margin: 0 0 1.5rem;
  padding: 1rem 1.1rem 1.15rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  text-align: left;
}

.shop-section[hidden] {
  display: none !important;
}

.shop-title {
  color: #fff;
  font-size: 1.15rem;
  margin-bottom: 0.4rem;
  text-align: center;
}

.upgrade-points {
  color: #ffd76a;
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 0.9rem;
}

.shop-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.shop-item:first-of-type {
  border-top: none;
}

.shop-item-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.shop-item-info strong {
  color: #fff;
  font-size: 0.95rem;
}

.shop-item-info span {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.85rem;
}

.upgrade-btn {
  appearance: none;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  background: #3d8b5a;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.55rem 0.7rem;
  border-radius: 7px;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.upgrade-btn:hover:not(:disabled) {
  background: #2f6f47;
}

.upgrade-btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  background: #555;
}

#end-button {
  appearance: none;
  border: none;
  cursor: pointer;
  background: #2f6fed;
  color: #fff;
  font-size: 1.1rem;
  font-weight: 600;
  padding: 0.85rem 1.75rem;
  border-radius: 8px;
  transition: background 0.15s ease, transform 0.15s ease;
}

#end-button:hover {
  background: #1a4bb8;
  transform: translateY(-1px);
}

#end-button:active {
  transform: translateY(0);
}

/* —— Panel X / tıklama feedback —— */
.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.15rem;
}

.panel-header .mgmt-title {
  margin: 0;
  flex: 1;
}

.panel-close-btn {
  appearance: none;
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease;
}

.panel-close-btn:hover {
  background: rgba(180, 40, 40, 0.55);
}

.panel-close-btn:active,
.mgmt-upgrade:active,
.mgmt-tab:active,
.menu-btn:active,
.hud-dock-btn:active,
.buy-mult-btn:active,
.scenario-card:active {
  transform: scale(0.95);
}

.management-panel:not([hidden]),
.spy-panel:not([hidden]) {
  animation: panelPopIn 0.18s ease-out;
}

@keyframes panelPopIn {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

/* Ekrana göre ölçeklenen dokunma hedefleri (mobil / tablet / masaüstü) */
.mgmt-upgrade,
.mgmt-tab,
.panel-close-btn,
.buy-mult-btn,
.hud-dock-btn,
.map-layer-btn,
.map-mode-btn,
.menu-btn,
.sandbox-tab,
.scenario-card,
#end-button,
.troop-send-presets .menu-btn,
.troop-send-actions .menu-btn {
  min-height: var(--btn-min);
  min-width: var(--btn-min);
  padding: clamp(0.45rem, 1.4vw, 0.75rem) clamp(0.55rem, 1.8vw, 0.95rem);
  font-size: var(--btn-font);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.panel-close-btn {
  width: var(--btn-min);
  height: var(--btn-min);
  min-width: var(--btn-min);
  min-height: var(--btn-min);
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1.1rem, 3vw, 1.4rem);
}

.buy-mult-btn {
  min-width: var(--btn-min);
  padding: clamp(0.35rem, 1vw, 0.55rem) clamp(0.5rem, 1.5vw, 0.75rem);
}

.hud-dock-btn {
  max-width: 100%;
}

.top-threat-block.coalition .tension-fill,
.top-threat-block.coalition .threat-fill {
  background: linear-gradient(90deg, #c0392b, #e74c3c);
}

/* —— Yönetim Paneli —— */
.management-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  right: auto;
  bottom: auto;
  transform: translate(-50%, -50%);
  z-index: 70;
  isolation: isolate;
  width: var(--panel-w);
  max-width: 520px;
  max-height: var(--panel-max-h);
  overflow-x: hidden;
  overflow-y: auto;
  padding: var(--ui-pad);
  border-radius: 14px;
  background: rgba(18, 24, 32, 0.92);
  border: 1px solid rgba(255, 215, 106, 0.35);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  color: #fff;
  backdrop-filter: blur(6px);
  pointer-events: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
}

.management-panel .mgmt-upgrade,
.management-panel .mgmt-tab,
.management-panel .panel-close-btn,
.management-panel .buy-mult-btn,
.spy-panel .mgmt-upgrade,
.spy-panel .mgmt-tab,
.spy-panel .panel-close-btn {
  position: relative;
  z-index: 2;
  pointer-events: auto;
  touch-action: manipulation;
}

.tech-row {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.tech-effect,
.law-effect {
  margin: 0 0 0.35rem;
  padding: 0 0.15rem;
  font-size: 0.72rem;
  line-height: 1.35;
  color: rgba(180, 210, 255, 0.85);
  pointer-events: none;
}

.management-panel[hidden] {
  display: none !important;
}

.mgmt-title {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
  margin-bottom: 0.35rem;
}

.mgmt-country {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.55rem;
  color: #ffd76a;
}

.mgmt-summary {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  margin-bottom: 0.85rem;
  font-size: 0.86rem;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.4;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.mgmt-summary em {
  font-style: normal;
  color: #8dffb0;
  font-size: 0.85rem;
  margin-left: 0.25rem;
}

.mgmt-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.mgmt-tabs-3 {
  grid-template-columns: 1fr 1fr 1fr;
}

.mgmt-tabs-4 {
  grid-template-columns: 1fr 1fr 1fr 1fr;
}

.mgmt-tabs-5 {
  grid-template-columns: repeat(5, 1fr);
  gap: 0.3rem;
}

.mgmt-tabs-6 {
  grid-template-columns: repeat(6, 1fr);
  gap: 0.25rem;
}

.mgmt-tabs-5 .mgmt-tab,
.mgmt-tabs-6 .mgmt-tab {
  font-size: 0.68rem;
  padding: 0.45rem 0.15rem;
}

.mgmt-upgrade.focus {
  background: rgba(80, 70, 30, 0.45);
}

.mgmt-upgrade.housing {
  background: rgba(40, 70, 55, 0.5);
}

.mgmt-upgrade.hq {
  background: rgba(50, 55, 80, 0.55);
}

.mgmt-upgrade.merc {
  background: rgba(90, 70, 20, 0.5);
}

.buy-mult-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin: 0.45rem 0 0.65rem;
  padding: 0.4rem 0.45rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.buy-mult-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.5);
  margin-right: 0.15rem;
}

.buy-mult-btn {
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  border-radius: 6px;
  padding: 0.28rem 0.55rem;
  font-size: 0.78rem;
  cursor: pointer;
  font-weight: 700;
}

.buy-mult-btn.active {
  border-color: rgba(255, 215, 106, 0.75);
  background: rgba(255, 215, 106, 0.22);
  color: #ffd76a;
}

.buy-mult-hint {
  margin-left: auto;
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.4);
}

.mgmt-upgrade.holding {
  filter: brightness(1.15);
  outline: 1px solid rgba(255, 215, 106, 0.55);
}

.mgmt-upgrade.focus:disabled {
  opacity: 0.55;
}

.market-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.35rem;
  align-items: center;
  margin-bottom: 0.35rem;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.85);
}

.mgmt-upgrade.market {
  width: auto;
  padding: 0.45rem 0.55rem;
  font-size: 0.78rem;
}

.mgmt-upgrade.market.sell {
  background: rgba(120, 60, 40, 0.45);
}

.mgmt-upgrade.coup {
  background: linear-gradient(135deg, rgba(80, 40, 90, 0.65), rgba(40, 25, 55, 0.75));
}

.mgmt-law-label {
  margin: 0.35rem 0 0.15rem;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255, 220, 160, 0.75);
}

.mgmt-upgrade.law.active-law {
  background: rgba(47, 111, 237, 0.35);
  border: 1px solid rgba(120, 170, 255, 0.55);
  box-shadow: inset 0 0 0 1px rgba(47, 111, 237, 0.25);
}

.mgmt-upgrade.supply {
  background: linear-gradient(135deg, rgba(60, 90, 50, 0.55), rgba(40, 55, 35, 0.7));
}

.mgmt-trait {
  color: #ffd76a !important;
}

.mgmt-tab {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.15);
  cursor: pointer;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.55rem 0.4rem;
  border-radius: 8px;
}

.mgmt-tab.active {
  background: #2f6fed;
  border-color: #2f6fed;
  color: #fff;
}

.mgmt-tab-panel {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.mgmt-tab-panel[hidden] {
  display: none !important;
}

.mgmt-upgrade {
  appearance: none;
  border: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
  padding: 0.7rem 0.8rem;
  border-radius: 9px;
  background: #3d8b5a;
  color: #fff;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.35;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.mgmt-upgrade:hover:not(:disabled) {
  background: #2f6f47;
}

.mgmt-upgrade:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  background: #555;
}

.mgmt-upgrade.army {
  background: #b4532a;
}

.mgmt-upgrade.army:hover:not(:disabled) {
  background: #8f3f1f;
}

.mgmt-upgrade.tech {
  background: #5b4cb8;
}

.mgmt-upgrade.tech:hover:not(:disabled) {
  background: #463894;
}

.mgmt-upgrade.nuke {
  background: #2d6b2d;
  border: 1px solid #7dff7d;
}

.mgmt-upgrade.nuke:hover:not(:disabled) {
  background: #1f4d1f;
}

.mgmt-empire {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.55);
  margin: -0.35rem 0 0.6rem;
}

.mgmt-hint {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 0.35rem;
  line-height: 1.35;
}

/* —— Casusluk Paneli —— */
.spy-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  right: auto;
  bottom: auto;
  transform: translate(-50%, -50%);
  z-index: 70;
  isolation: isolate;
  width: var(--panel-w);
  max-width: 520px;
  max-height: var(--panel-max-h);
  overflow-x: hidden;
  overflow-y: auto;
  padding: var(--ui-pad);
  border-radius: 14px;
  background: rgba(22, 16, 28, 0.94);
  border: 1px solid rgba(180, 120, 255, 0.4);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: var(--ui-gap);
  backdrop-filter: blur(6px);
  pointer-events: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
}

.spy-panel[hidden] {
  display: none !important;
}

.spy-intel {
  font-size: 0.86rem;
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 0.25rem;
  line-height: 1.45;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

#diplo-status {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.45rem;
  align-items: flex-start;
}

.diplo-chip {
  display: inline-block;
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.78rem;
  line-height: 1.3;
  white-space: normal;
}

.mgmt-upgrade,
.mgmt-tab {
  white-space: normal;
  line-height: 1.25;
  text-align: left;
}

/* —— Toast stack (sol, küçük, fade-out) —— */
.toast-stack {
  position: fixed;
  top: 58px;
  left: 10px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  width: min(220px, calc(100vw - 24px));
  max-height: min(42vh, 280px);
  overflow: hidden;
  pointer-events: none;
}

.toast-item {
  padding: 0.28rem 0.45rem;
  border-radius: 6px;
  background: rgba(10, 14, 22, 0.78);
  color: rgba(255, 230, 170, 0.92);
  font-weight: 500;
  font-size: 0.68rem;
  line-height: 1.3;
  border: 1px solid rgba(255, 215, 106, 0.22);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.22);
  animation: toast-in 0.22s ease-out;
  opacity: 1;
  transition: opacity 0.85s ease, transform 0.85s ease;
}

.toast-item.danger {
  color: rgba(255, 170, 170, 0.95);
  border-color: rgba(255, 110, 110, 0.35);
}

.toast-item.fade-out {
  opacity: 0;
  transform: translateX(-8px);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Eski tek toast — gizli yedek */
.toast {
  display: none !important;
}

.toast[hidden] {
  display: none !important;
}

.toast.danger {
  color: #ff8a8a;
}

.explore-panel {
  border-color: rgba(160, 170, 190, 0.35);
}

.drama-phase {
  position: fixed;
  top: 58px;
  left: 16px;
  z-index: 6;
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  background: rgba(12, 16, 24, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  pointer-events: none;
}

.drama-phase[hidden] {
  display: none !important;
}

.drama-phase.comeback {
  border-color: rgba(255, 215, 106, 0.5);
  color: #ffe08a;
}

.achievement-toast {
  position: fixed;
  top: 88px;
  right: 18px;
  z-index: 12;
  width: min(320px, calc(100vw - 32px));
  padding: 0.85rem 1rem;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(18, 24, 36, 0.96), rgba(28, 40, 58, 0.96));
  border: 1px solid rgba(255, 215, 106, 0.45);
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  animation: ach-slide 0.35s ease;
  pointer-events: none;
}

.achievement-toast[hidden] {
  display: none !important;
}

.ach-badge {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 215, 106, 0.85);
}

.achievement-toast strong {
  font-size: 1.05rem;
}

.achievement-toast #achievement-desc {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.65);
  line-height: 1.35;
}

@keyframes ach-slide {
  from {
    opacity: 0;
    transform: translateX(24px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.mgmt-upgrade.diplo {
  background: #2a6f8f;
}

.mgmt-upgrade.diplo:hover:not(:disabled) {
  background: #1f5570;
}

/* —— Dünya Olayı Bandı —— */
.event-banner {
  position: fixed;
  top: 58px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 7;
  width: min(520px, calc(100vw - 24px));
  padding: 0.75rem 1.1rem;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(28, 22, 48, 0.95), rgba(18, 40, 48, 0.95));
  border: 1px solid rgba(255, 215, 106, 0.4);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  color: #fff;
  text-align: center;
  pointer-events: none;
  animation: eventPulse 0.45s ease;
}

.event-banner[hidden] {
  display: none !important;
}

/* İttifak / pakt talepleri — sağ üst küçük pano */
.diplo-offer-board {
  position: fixed;
  top: 56px;
  right: 10px;
  z-index: 45;
  width: min(240px, calc(100vw - 20px));
  max-height: min(48vh, 320px);
  overflow: auto;
  padding: 0.4rem 0.45rem 0.5rem;
  border-radius: 10px;
  background: rgba(12, 16, 26, 0.9);
  border: 1px solid rgba(255, 215, 106, 0.35);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  color: #fff;
  pointer-events: auto;
}

.diplo-offer-board[hidden] {
  display: none !important;
}

.diplo-offer-board-head {
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 215, 106, 0.85);
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.diplo-offer-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.diplo-offer-item {
  padding: 0.4rem 0.45rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.diplo-offer-item-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: #ffd76a;
  margin: 0 0 0.15rem;
}

.diplo-offer-item-text {
  font-size: 0.68rem;
  line-height: 1.3;
  color: rgba(255, 255, 255, 0.78);
  margin: 0 0 0.35rem;
}

.diplo-offer-item-actions {
  display: flex;
  gap: 0.25rem;
}

.diplo-offer-item-actions .menu-btn {
  flex: 1;
  width: auto !important;
  margin: 0 !important;
  padding: 0.28rem 0.35rem !important;
  font-size: 0.65rem !important;
}

.event-banner strong {
  display: block;
  color: #ffd76a;
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.event-banner span {
  display: block;
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.35;
}

@keyframes eventPulse {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* Tablet */
@media (min-width: 641px) and (max-width: 1024px) {
  :root {
    --ui-scale: 0.92;
    --btn-min: clamp(40px, 4.5vw, 46px);
    --btn-font: clamp(0.78rem, 1.4vw, 0.92rem);
    --panel-w: min(70vw, 420px);
    --panel-max-h: min(70vh, 620px);
  }

  .mgmt-tabs-5,
  .mgmt-tabs-6 {
    grid-template-columns: repeat(3, 1fr);
  }

  .minimap {
    width: 180px;
    height: 120px;
  }

  .map-mode-btn {
    width: var(--btn-min);
    height: var(--btn-min);
  }
}

/* Telefon — paneller ekranın küçük bir kısmını kaplasın */
@media (max-width: 640px) {
  :root {
    --ui-scale: 0.82;
    --btn-min: 36px;
    --btn-font: 0.7rem;
    --panel-w: min(78vw, 300px);
    --panel-max-h: min(58vh, 420px);
    --ui-pad: 0.45rem;
    --ui-gap: 0.28rem;
  }

  .top-bar {
    flex-wrap: wrap;
    padding: 0.28rem 0.4rem;
    padding-top: calc(0.28rem + var(--safe-t));
    gap: 0.25rem;
    font-size: 0.78em;
  }

  .top-bar .top-label {
    font-size: 0.62rem;
  }

  .top-bar strong {
    font-size: 0.78rem;
  }

  .menu-card {
    width: min(92vw, 340px);
    padding: 0.85rem 0.9rem;
    transform: scale(var(--ui-scale));
    transform-origin: center top;
  }

  .menu-btn {
    min-height: var(--btn-min);
    font-size: var(--btn-font);
    padding: 0.45rem 0.65rem;
  }

  .panel-header h2,
  .mgmt-title {
    font-size: 0.95rem;
  }

  .mgmt-upgrade,
  .mgmt-tab {
    min-height: 34px;
    font-size: 0.68rem;
    padding: 0.35rem 0.45rem;
  }

  .hud-dock-btn {
    min-height: 34px;
    padding: 0.3rem 0.35rem;
  }

  .map-layers {
    top: calc(68px + var(--safe-t));
    right: calc(8px + var(--safe-r));
  }

  .map-layer-btn {
    min-width: var(--btn-min);
    font-size: 0.75rem;
  }

  .hud-burger-wrap {
    top: calc(8px + var(--safe-t));
    right: calc(8px + var(--safe-r));
  }

  .hud-dock-btn {
    font-size: 0.72rem;
  }

  .management-panel,
  .spy-panel {
    width: var(--panel-w);
    max-width: none;
    max-height: var(--panel-max-h);
  }

  .management-panel:not([hidden]),
  .spy-panel:not([hidden]) {
    animation: panelPopIn 0.18s ease-out;
  }

  .minimap {
    left: calc(8px + var(--safe-l));
    bottom: calc(58px + var(--safe-b));
    width: min(132px, 36vw);
    height: 90px;
  }

  .map-modes {
    left: calc(148px + var(--safe-l));
    bottom: calc(58px + var(--safe-b));
  }

  .map-mode-btn {
    width: var(--btn-min);
    height: var(--btn-min);
    font-size: 1rem;
  }

  .mgmt-tabs-3,
  .mgmt-tabs-4,
  .mgmt-tabs-5,
  .mgmt-tabs-6 {
    grid-template-columns: 1fr 1fr;
  }

  .top-threat-block {
    min-width: 100px;
    flex: 1 1 120px;
  }

  .menu-sandbox {
    max-height: min(78vh, 620px);
  }

  .sandbox-tabs {
    flex-wrap: wrap;
  }

  .sandbox-tab {
    min-width: calc(50% - 0.2rem);
  }

  .troop-send-card {
    width: var(--panel-w);
    max-width: none;
  }
}

/* Geniş masaüstü */
@media (min-width: 1025px) {
  :root {
    --btn-min: 44px;
    --panel-w: min(92vw, 480px);
    --panel-max-h: min(86vh, 820px);
  }
}
