/* ═══════════════════════════════════════════════════════════════
   TRAVIAN CLASSIC — Visual Polish Layer
   Overrides style.css for a richer, more atmospheric game feel.
═══════════════════════════════════════════════════════════════ */

/* ── Refined palette & tokens ───────────────────────────────── */
:root {
  /* Gold — warmer, more saturated */
  --gold:         #f2cc52;
  --gold-mid:     #d0a020;
  --gold-dark:    #9a6a08;
  --gold-glow:    rgba(242,204,82,.14);
  --gold-shine:   linear-gradient(135deg, #f8e070 0%, #c88a10 50%, #f0c040 100%);

  /* Background — clearly distinct depth layers */
  --bg-dark:      #0b0906;
  --bg-panel:     #161008;
  --bg-card:      #1c1409;
  --bg-input:     #0e0b05;
  --bg-hover:     #221a0c;

  /* Borders */
  --border:       #5e3e0e;
  --border-soft:  rgba(94,62,14,.4);
  --border-hi:    rgba(220,170,40,.35);

  /* Text */
  --text:         #ccab62;
  --text-light:   #f2e4b0;
  --text-bright:  #fdf0d0;
  --text-dim:     #6a5222;

  /* Status */
  --green:        #4a9030;
  --green-bright: #70c048;
  --red:          #c02828;
  --red-bright:   #e84848;
  --blue:         #3a6898;

  /* Elevation shadows */
  --shadow-xs:    0 1px 4px rgba(0,0,0,.55);
  --shadow:       0 3px 14px rgba(0,0,0,.75);
  --shadow-lg:    0 6px 32px rgba(0,0,0,.9);
  --shadow-gold:  0 0 20px rgba(220,160,20,.08);

  --radius:       5px;
  --radius-lg:    8px;
}

/* ── Body — atmospheric stone floor texture ─────────────────── */
body {
  background-color: var(--bg-dark);
  background-image:
    url("data:image/svg+xml,%3Csvg width='80' height='80' viewBox='0 0 80 80' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23ffffff' fill-opacity='0.012'%3E%3Cpath d='M0 0h40v40H0zm40 40h40v40H40z'/%3E%3C/g%3E%3C/svg%3E"),
    radial-gradient(ellipse at 15% 0%,  rgba(110,70,18,.1) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 100%, rgba(70,40,10,.14) 0%, transparent 55%);
  color: var(--text);
  font-size: 1.05rem;
  line-height: 1.6;
}

/* ── Typography hierarchy ───────────────────────────────────── */
h1 { font-size: 2rem;   letter-spacing: .08em; }
h2 { font-size: 1.35rem; letter-spacing: .05em; color: var(--gold); }
h3 { font-size: 1rem;   letter-spacing: .04em; color: var(--gold); }

/* ── Links ──────────────────────────────────────────────────── */
a { transition: color .15s; }

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar       { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold-dark); }

/* ══════════════════════════════════════════════════════════════
   ALERTS
   ══════════════════════════════════════════════════════════════ */
.alert {
  border-radius: var(--radius);
  border-width: 0;
  border-left: 3px solid;
  padding: .7rem 1rem .7rem 1.1rem;
  font-size: .92rem;
  box-shadow: var(--shadow-xs);
}
.alert-error   { background: rgba(192,40,40,.15);  border-color: var(--red-bright);   color: #f0a0a0; }
.alert-success { background: rgba(74,144,48,.15);  border-color: var(--green-bright); color: #90d870; }
.alert-warning { background: rgba(210,160,20,.15); border-color: var(--gold-mid);     color: var(--gold); }
.alert-info    { background: rgba(58,104,152,.15); border-color: var(--blue);          color: #80b8e8; }

/* ══════════════════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════════════════ */
.btn {
  font-family: var(--font-title);
  font-size: .8rem;
  letter-spacing: .05em;
  padding: .42rem .95rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #2a1e0c 0%, #171008 100%);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.04);
  transition: background .14s, border-color .14s, box-shadow .14s, color .14s, transform .1s;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}
@media (max-width: 768px) {
    .btn {
      font-family: var(--font-title);
      font-size: .4rem;
      letter-spacing: .05em;
      padding: .25rem .50rem;
      border-radius: var(--radius);
      border: 1px solid var(--border);
      background: linear-gradient(180deg, #2a1e0c 0%, #171008 100%);
      color: var(--text);
      box-shadow: 0 1px 4px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.04);
      transition: background .14s, border-color .14s, box-shadow .14s, color .14s, transform .1s;
      cursor: pointer;
      white-space: nowrap;
      text-decoration: none;
      display: inline-block;
      text-align: center;
    }
}
.btn:hover {
  background: linear-gradient(180deg, #382810 0%, #201508 100%);
  border-color: var(--gold-dark);
  color: var(--text-light);
  box-shadow: 0 2px 8px rgba(0,0,0,.6), 0 0 0 1px rgba(180,130,20,.2);
  text-decoration: none;
  transform: translateY(-1px);
}
.btn:active { transform: translateY(0); box-shadow: 0 1px 3px rgba(0,0,0,.5); }

.btn-primary {
  background: linear-gradient(180deg, #d4a020 0%, #7a4e06 100%);
  border-color: #e0b030;
  color: #fef8e0;
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,230,80,.25), inset 0 -1px 0 rgba(0,0,0,.3);
  text-shadow: 0 1px 2px rgba(0,0,0,.5);
}
.btn-primary:hover {
  background: linear-gradient(180deg, #e8b030 0%, #9a6210 100%);
  border-color: #f0c040;
  color: #fff;
  box-shadow: 0 3px 16px rgba(0,0,0,.7), 0 0 16px rgba(220,160,20,.18), inset 0 1px 0 rgba(255,230,80,.3);
}

.btn-small, .btn-sm {
  font-size: .72rem;
  padding: .28rem .65rem;
  letter-spacing: .04em;
}

.btn-demolish {
  background: linear-gradient(180deg, #5a1a1a 0%, #2a0808 100%);
  border-color: #8a2020;
  color: #f09090;
  box-shadow: 0 1px 4px rgba(0,0,0,.5);
}
.btn-demolish:hover {
  background: linear-gradient(180deg, #701e1e 0%, #3a0a0a 100%);
  border-color: #c03030;
  color: #ffb0b0;
}

.btn-active {
  background: linear-gradient(180deg, #d4a020 0%, #7a4e06 100%) !important;
  border-color: var(--gold) !important;
  color: #fef8e0 !important;
  box-shadow: 0 2px 8px rgba(0,0,0,.5), 0 0 8px rgba(200,150,20,.15) !important;
}

/* ══════════════════════════════════════════════════════════════
   GAME HEADER
   ══════════════════════════════════════════════════════════════ */
.game-header {
/*
  background: linear-gradient(180deg, #1e1508 0%, #120e06 100%);
*/
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 20px rgba(0,0,0,.9);
}

.header-top {
  border-bottom: 1px solid rgba(94,62,14,.4);
  padding: .5rem 1.2rem;
  gap: 1.2rem;
}

.logo-text {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: .08em;
  color: var(--gold);
  text-shadow: 0 0 18px rgba(220,160,20,.35), 0 1px 2px rgba(0,0,0,.8);
}

.header-village-name strong {
  font-size: .92rem;
  color: var(--text-light);
}

/* Resource chips */
.res-item {
  background: rgba(0,0,0,.45);
  border: 1px solid rgba(94,62,14,.55);
  border-radius: 4px;
  padding: .22rem .55rem;
  min-width: 96px;
  font-size: .8rem;
  box-shadow: inset 0 1px 3px rgba(0,0,0,.4);
}
.res-item:hover { border-color: var(--border-hi); }
.res-amount { color: var(--text-light); font-weight: 700; font-size: .83rem; }
.res-cap    { color: var(--text-dim); font-size: .7rem; }
.res-prod   { font-size: .7rem; }
.res-almost-full { border-color: rgba(242,204,82,.45) !important; }
.res-almost-full .res-amount { color: var(--gold); }

/* Nav row */
.header-nav {
  padding: 0 1.2rem;
}
.header-nav a {
  font-family: var(--font-title);
  font-size: .75rem;
  letter-spacing: .05em;
  color: #ad8128;
  padding: .38rem .65rem;
  border-bottom: 2px solid transparent;
  transition: color .14s, border-color .14s, background .14s;
}
.header-nav a:hover {
  color: var(--gold);
  background: rgba(242,204,82,.06);
  text-decoration: none;
}
.header-nav a.nav-active {
  color: var(--gold);
  border-bottom-color: var(--gold);
  background: rgba(242,204,82,.08);
}
.header-nav .nav-logout { color: var(--text-dim); opacity: .6; }
.header-nav .nav-logout:hover { color: #f08080; opacity: 1; }

/* Tribe badges */
.tribe-badge {
  font-family: var(--font-title);
  font-size: .65rem;
  letter-spacing: .07em;
  padding: 2px 8px;
  border-radius: 10px;
}
.tribe-roman  { background: linear-gradient(135deg,#1e3268,#2a4a8a); color: #b8ccff; box-shadow: inset 0 1px 0 rgba(255,255,255,.12); }
.tribe-teuton { background: linear-gradient(135deg,#521a0a,#7a2a14); color: #ffbcaa; box-shadow: inset 0 1px 0 rgba(255,255,255,.1); }
.tribe-gaul   { background: linear-gradient(135deg,#123d1c,#1c5a2a); color: #98ee98; box-shadow: inset 0 1px 0 rgba(255,255,255,.1); }

/* ══════════════════════════════════════════════════════════════
   AUTH PAGES
   ══════════════════════════════════════════════════════════════ */
.auth-page {
  background-color: var(--bg-dark);
  background-image:
    radial-gradient(ellipse 80% 60% at 50% 0%,  rgba(110,70,18,.18) 0%, transparent 70%),
    radial-gradient(ellipse 60% 80% at 50% 100%, rgba(60,30,8,.22) 0%, transparent 70%),
    url("data:image/svg+xml,%3Csvg width='80' height='80' viewBox='0 0 80 80' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23ffffff' fill-opacity='0.01'%3E%3Cpath d='M0 0h40v40H0zm40 40h40v40H40z'/%3E%3C/g%3E%3C/svg%3E");
}

.auth-container {
  background: linear-gradient(180deg, #201808 0%, #160f06 100%);
  border: 1px solid var(--border);
  border-top: 1px solid rgba(180,130,30,.4);
  border-radius: var(--radius-lg);
  padding: 2.4rem 2.2rem;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(94,62,14,.3), 0 0 40px rgba(0,0,0,.6);
}

.auth-logo h1 {
  font-size: 2.1rem;
  letter-spacing: .16em;
  color: var(--gold);
  text-shadow: 0 0 30px rgba(220,160,20,.3), 0 2px 4px rgba(0,0,0,.8);
}

.auth-logo-divider {
  color: var(--text-dim);
  font-size: .7rem;
  letter-spacing: .2em;
}

.auth-form .form-group label {
  font-family: var(--font-title);
  font-size: .75rem;
  letter-spacing: .08em;
  color: var(--text-dim);
  text-transform: uppercase;
}

/* ══════════════════════════════════════════════════════════════
   FORM INPUTS
   ══════════════════════════════════════════════════════════════ */
.form-group input,
.form-group textarea,
.form-group select,
input[type="text"],
input[type="number"],
input[type="password"],
input[type="email"],
textarea,
select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-light);
  font-family: var(--font);
  box-shadow: inset 0 1px 4px rgba(0,0,0,.5);
  transition: border-color .15s, box-shadow .15s;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus,
input[type="text"]:focus,
input[type="number"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
textarea:focus,
select:focus {
  border-color: var(--gold-dark) !important;
  box-shadow: 0 0 0 2px rgba(180,130,20,.2), inset 0 1px 4px rgba(0,0,0,.4) !important;
  outline: none !important;
}

/* Tribe cards */
.tribe-card {
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #1e1508 0%, #130e06 100%);
  box-shadow: var(--shadow-xs);
  transition: border-color .18s, background .18s, box-shadow .18s, transform .15s;
}
.tribe-option:hover .tribe-card {
  border-color: var(--gold-dark);
  background: linear-gradient(180deg, #2a1c0c 0%, #1c1208 100%);
  box-shadow: 0 4px 18px rgba(0,0,0,.6), 0 0 0 1px rgba(180,130,20,.2);
  transform: translateY(-2px);
}
.tribe-option.selected .tribe-card {
  border-color: var(--gold);
  background: linear-gradient(180deg, #321e08 0%, #201408 100%);
  box-shadow: 0 4px 20px rgba(0,0,0,.7), 0 0 16px rgba(220,160,20,.12);
}
.tribe-icon {
  width: 44px; height: 44px;
  border-radius: 50%;
  font-size: 1.2rem; font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.15), 0 2px 6px rgba(0,0,0,.4);
}
.tribe-roman  .tribe-icon { background: linear-gradient(135deg,#1e3268,#3a60aa); }
.tribe-teuton .tribe-icon { background: linear-gradient(135deg,#5a1e0a,#8a3018); }
.tribe-gaul   .tribe-icon { background: linear-gradient(135deg,#143a1c,#246030); }

/* ══════════════════════════════════════════════════════════════
   UNIVERSAL PANEL TREATMENT
   ══════════════════════════════════════════════════════════════ */
.build-card,
.queue-section,
.production-summary,
.troops-overview-panel,
.troops-section,
.train-header,
.train-queue-box,
.troops-home-summary,
.blist-section,
.mov-section,
.report-detail,
.sim-col,
.unit-train-card,
.rally-card,
.map-toolbar,
.hero-card,
.hero-actions,
.mp-card,
.alliance-card,
.alliance-sidebar,
.invite-card,
.msg-compose,
.msg-detail,
.admin-section,
.admin-stat-card {
  background: linear-gradient(180deg, #201608 0%, #170f06 100%);
  border: 1px solid var(--border);
  border-top-color: rgba(160,110,20,.5);
  border-radius: var(--radius);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.025);
}

/* Section headings — all consistent */
.queue-section > h3,
.production-summary > h3,
.troops-section h3,
.train-queue-box h3,
.troops-home-summary h3,
.blist-section h3,
.mov-section h3,
.mp-card h3,
.alliance-card h3,
.admin-section h3,
.build-upgrade h3,
.report-detail-header h3 {
  font-family: var(--font-title);
  font-size: .85rem;
  font-weight: 600;
  letter-spacing: .08em;
  color: var(--gold);
  text-transform: uppercase;
  padding-bottom: .5rem;
  margin-bottom: .75rem;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  gap: .5rem;
}
.queue-section > h3::before,
.production-summary > h3::before,
.troops-section h3::before,
.train-queue-box h3::before,
.troops-home-summary h3::before,
.blist-section h3::before,
.mov-section h3::before,
.admin-section h3::before {
  content: '';
  width: 3px;
  height: .9em;
  background: linear-gradient(180deg, var(--gold), var(--gold-dark));
  border-radius: 2px;
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════════
   TABLES — unified clean treatment
   ══════════════════════════════════════════════════════════════ */
.movements-table th,
.reports-table th,
.blist-table th,
.prod-table th,
.troops-full-table th,
.sim-troop-table th,
.alliance-members-table th,
.alliance-list-table th,
.admin-settings-form label {
  font-family: var(--font-title);
  font-size: .72rem;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-dim);
  background: rgba(0,0,0,.25);
  border-bottom: 1px solid var(--border);
}

.movements-table tr:hover td,
.reports-table tr:hover td,
.blist-table tr:hover td,
.prod-table tr:hover td,
.alliance-members-table tr:hover td,
.alliance-list-table tr:hover td {
  background: rgba(242,204,82,.07);
}

/* ══════════════════════════════════════════════════════════════
   QUEUE
   ══════════════════════════════════════════════════════════════ */
.queue-item {
  background: linear-gradient(180deg, #1e1608 0%, #151008 100%);
  border: 1px solid var(--border-soft);
  border-left: 3px solid var(--gold-dark);
  box-shadow: var(--shadow-xs);
}
.queue-item:first-child {
  border-left-color: var(--gold);
}
.queue-timer {
  font-family: 'Consolas', 'Courier New', monospace;
  color: var(--gold);
  letter-spacing: .05em;
}

/* ══════════════════════════════════════════════════════════════
   VILLAGE MAP
   ══════════════════════════════════════════════════════════════ */
.village-map-wrapper {
/*
  border: 1px solid var(--border);
  border-top-color: rgba(160,110,20,.4);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(94,62,14,.3);
  border-radius: var(--radius-lg);
*/
}

/* 1:1 background image — overrides style.css 4:3 default and its >601px media rule */
.village-map {
  background-image: url('../images/village_background_2.webp');
  aspect-ratio: 1 / 1;
}
@media (min-width: 601px) {
  .village-map { aspect-ratio: 1 / 1; }
}

.village-building .bld-label {
  background: rgba(0,0,0,.8);
  border: 1px solid rgba(180,130,20,.25);
  color: var(--text);
  font-family: var(--font-title);
  font-size: clamp(7px, 1vw, 10px);
  letter-spacing: .03em;
  transition: background .15s, border-color .15s, color .15s;
}
.village-building:hover .bld-label {
  background: rgba(0,0,0,.92);
  border-color: var(--gold-dark);
  color: var(--gold);
}
.village-building.in-queue .bld-label {
  border-color: rgba(220,160,20,.5);
  color: var(--gold);
}

/* ══════════════════════════════════════════════════════════════
   BUILD PAGE
   ══════════════════════════════════════════════════════════════ */
.build-card {
  padding: 1.6rem;
}
.build-title h2 {
  color: var(--gold);
  text-shadow: 0 1px 4px rgba(0,0,0,.6);
}
.build-in-progress {
  background: rgba(242,204,82,.06);
  border: 1px solid rgba(180,130,20,.4);
  border-radius: var(--radius);
}
.build-in-progress .queue-timer {
  font-size: 1.5rem;
}

/* Cost items */
.cost-item {
  background: linear-gradient(180deg, #1a1408 0%, #100c06 100%);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  transition: border-color .12s;
}
.cost-item.ok    { border-color: rgba(74,144,48,.6); }
.cost-item.short { border-color: rgba(192,40,40,.6); }
.cost-label { color: var(--text-dim); font-family: var(--font-title); font-size: .68rem; letter-spacing: .06em; }
.cost-need  { color: var(--text-light); font-weight: 700; }
.cost-item.short .cost-need { color: #f09090; }

/* ══════════════════════════════════════════════════════════════
   TROOPS
   ══════════════════════════════════════════════════════════════ */
.unit-train-card {
  padding: 1rem 1.2rem;
  transition: border-top-color .15s, box-shadow .15s, transform .15s;
}
.unit-train-card:hover {
  border-top-color: var(--gold-dark);
  box-shadow: var(--shadow-lg), 0 0 12px rgba(220,160,20,.08);
  transform: translateY(-2px);
}

.ustat {
  background: linear-gradient(180deg, #1a1408 0%, #100c06 100%);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
}
.ustat-label { font-family: var(--font-title); font-size: .62rem; letter-spacing: .06em; color: var(--text-dim); }
.ustat strong { color: var(--text-light); }

.troop-home-card {
  background: linear-gradient(180deg, #1a1408 0%, #110d06 100%);
  border: 1px solid var(--border-soft);
  transition: border-color .12s, background .12s;
}
.troop-home-card:hover { border-color: var(--gold-dark); }

.troop-mini-item {
  background: linear-gradient(180deg, #1c1609 0%, #130e06 100%);
  border: 1px solid var(--border-soft);
  transition: border-color .12s, background .12s;
}
.troop-mini-item:hover { border-color: var(--gold-dark); background: var(--bg-hover); }

/* ══════════════════════════════════════════════════════════════
   MOVEMENTS & REPORTS
   ══════════════════════════════════════════════════════════════ */
.mov-troop-chip {
  background: linear-gradient(180deg, #1c1609 0%, #130e06 100%);
  border: 1px solid var(--border-soft);
  border-radius: 3px;
  color: var(--text-light);
  font-size: .76rem;
}

.report-pill.gain    { background: rgba(74,144,48,.2);  color: #90d870; border: 1px solid rgba(74,144,48,.4); }
.report-pill.loss    { background: rgba(192,40,40,.2);  color: #f09090; border: 1px solid rgba(192,40,40,.4); }
.report-pill.scout   { background: rgba(58,104,152,.2); color: #80b8e8; border: 1px solid rgba(58,104,152,.4); }
.report-pill.neutral { background: rgba(94,62,14,.2);   color: var(--text-dim); border: 1px solid var(--border-soft); }

.report-outcome-banner {
  border-radius: var(--radius);
  font-family: var(--font-title);
  letter-spacing: .05em;
}
.ban-att-win { background: rgba(74,144,48,.15); border: 1px solid rgba(74,144,48,.5); color: #90d870; }
.ban-def-win { background: rgba(192,40,40,.15); border: 1px solid rgba(192,40,40,.5); color: #f09090; }

/* ══════════════════════════════════════════════════════════════
   RALLY / SEND TROOPS
   ══════════════════════════════════════════════════════════════ */
.rally-card {
  padding: 1.5rem;
}
.rally-card h2 { color: var(--gold); }

.move-type-card {
  background: linear-gradient(180deg, #1c1508 0%, #130e06 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color .15s, background .15s, box-shadow .15s, transform .12s;
}
.move-type-card:hover, .move-type-card.selected {
  border-color: var(--gold-dark);
  background: linear-gradient(180deg, #2a1e0c 0%, #1c1408 100%);
  box-shadow: 0 4px 14px rgba(0,0,0,.6), 0 0 0 1px rgba(180,130,20,.2);
  transform: translateY(-1px);
}
.move-type-card.selected {
  border-color: var(--gold);
  box-shadow: 0 4px 14px rgba(0,0,0,.7), 0 0 12px rgba(220,160,20,.1);
}

.rally-troop {
  background: linear-gradient(180deg, #1c1508 0%, #130e06 100%);
  border: 1px solid var(--border-soft);
  transition: border-color .12s;
}
.rally-troop:hover { border-color: var(--gold-dark); }

.rally-preview {
  background: linear-gradient(180deg, #1c1508 0%, #130e06 100%);
  border: 1px solid var(--border);
}

/* ══════════════════════════════════════════════════════════════
   WORLD MAP
   ══════════════════════════════════════════════════════════════ */
.map-toolbar {
  background: linear-gradient(180deg, #1c1508 0%, #130e06 100%);
  padding: .65rem 1rem;
}

@media (max-width: 768px) {
    .map-toolbar  {

      display: none;

    }
    .map-toolbar-mobile  {
      /*
      background: linear-gradient(180deg, #1c1508 0%, #130e06 100%);

      background: rgba(0, 0, 0, 0.5);
            */
      padding: .5rem .5rem;
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: .6rem;
      border-radius: 0px;
      border-bottom: 2px solid rgba(0, 0, 0, 0.5);
      top: 0px;
      position: absolute;
      z-index: 999;
    }
}

@media (min-width: 768px) {
    .map-toolbar-mobile  {

      display: none;

    }
}

@media (max-width: 768px) {

    .map-chat-background-mobile  {
      /*
      background: linear-gradient(180deg, #1c1508 0%, #130e06 100%);
      
      background: rgba(0, 0, 0, 0.5);
*/
      display: flex;
      width: 100%;
      height: 60px;
      border-radius: 0px;
      border-top: 2px solid rgba(0, 0, 0, 0.5);
      bottom: 0px;
      position: absolute;
      z-index: 500;
    }
}

@media (min-width: 768px) {
    .map-chat-background-mobile  {

      display: none;

    }
}

.map-info-panel {
  background: linear-gradient(180deg, #201608 0%, #160f06 100%);
  border: 1px solid var(--gold-dark);
  border-top-color: rgba(220,160,20,.5);
  box-shadow: var(--shadow-lg), 0 0 20px rgba(0,0,0,.5);
}

/* ══════════════════════════════════════════════════════════════
   HERO PAGE
   ══════════════════════════════════════════════════════════════ */
.hero-avatar {
  border: 2px solid var(--gold-dark);
  background: linear-gradient(135deg, #1e1608, #2a1e0c);
  box-shadow: 0 0 16px rgba(180,130,20,.2), inset 0 2px 6px rgba(0,0,0,.5);
}
.status-alive { background: rgba(74,144,48,.2);  color: #90d870; border: 1px solid rgba(74,144,48,.4); }
.status-dead  { background: rgba(192,40,40,.2);  color: #f09090; border: 1px solid rgba(192,40,40,.4); }

.hero-hp-bar, .hero-xp-bar {
  background: rgba(0,0,0,.5);
  border: 1px solid var(--border-soft);
  border-radius: 4px;
  height: 11px;
}
.hero-hp-fill       { background: linear-gradient(90deg, #3a7a28, #60c040); }
.hero-hp-fill.hp-fill-low { background: linear-gradient(90deg, #882020, #e04040); }
.hero-xp-fill       { background: linear-gradient(90deg, var(--gold-dark), var(--gold)); }

/* ══════════════════════════════════════════════════════════════
   ADMIN
   ══════════════════════════════════════════════════════════════ */
.admin-stat-card {
  transition: border-top-color .15s, box-shadow .15s, transform .15s;
}
.admin-stat-card:hover {
  border-top-color: var(--gold-dark);
  box-shadow: var(--shadow-lg), 0 0 10px rgba(220,160,20,.07);
  transform: translateY(-2px);
}
.asc-val   { font-family: var(--font-title); color: var(--gold); }
.asc-label { font-family: var(--font-title); letter-spacing: .07em; color: var(--text-dim); }
.admin-nav .btn-active {
  background: linear-gradient(180deg, #d4a020, #7a4e06) !important;
  color: #fef8e0 !important;
}

/* ══════════════════════════════════════════════════════════════
   MARKETPLACE & ALLIANCE & MESSAGES
   ══════════════════════════════════════════════════════════════ */
.mp-status-item {
  background: linear-gradient(180deg, #1a1408 0%, #110d06 100%);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
}
.mp-status-item strong { color: var(--gold); }

.alliance-role-badge {
  font-family: var(--font-title);
  font-size: .68rem;
  letter-spacing: .06em;
}
.role-leader  { background: rgba(220,160,20,.15); color: var(--gold);    border: 1px solid rgba(180,130,20,.4); }
.role-officer { background: rgba(58,104,152,.15); color: #80b8e8;        border: 1px solid rgba(58,104,152,.4); }
.role-member  { background: rgba(0,0,0,.2);       color: var(--text-dim); border: 1px solid var(--border-soft); }

.msg-body {
  background: linear-gradient(180deg, #181208, #100c06);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  line-height: 1.7;
}

/* ══════════════════════════════════════════════════════════════
   INCOMING ATTACK PULSE
   ══════════════════════════════════════════════════════════════ */
.incoming-attack-alert {
  border-left: 3px solid var(--red-bright) !important;
  background: rgba(192,40,40,.1) !important;
  animation: attack-pulse 1.8s ease-in-out infinite;
}
@keyframes attack-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(192,40,40,0); }
  50%       { box-shadow: 0 0 0 3px rgba(192,40,40,.2); }
}

/* ══════════════════════════════════════════════════════════════
   SIMULATOR
   ══════════════════════════════════════════════════════════════ */
.sim-result {
  border-radius: var(--radius);
  border-width: 1px;
}
.result-win  { background: rgba(74,144,48,.1);  border-color: rgba(74,144,48,.5); }
.result-lose { background: rgba(192,40,40,.1);  border-color: rgba(192,40,40,.5); }
.sim-result-headline { font-family: var(--font-title); letter-spacing: .06em; }
.result-win  .sim-result-headline { color: #90d870; }
.result-lose .sim-result-headline { color: #f09090; }

.sim-live-bar {
  background: linear-gradient(180deg, #1c1508 0%, #130e06 100%);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}

/* ══════════════════════════════════════════════════════════════
   PAGE TITLES — decorative rule
   ══════════════════════════════════════════════════════════════ */
.reports-page h2,
.movements-header h2,
.marketplace-page h2,
.alliance-page h2,
.ranking-page h2,
.hero-identity h2,
.messages-page h2,
.simulator-header h2,
.map-page h2,
.troops-page .page-title,
.rally-card h2 {
  font-family: var(--font-title);
  color: var(--gold);
  letter-spacing: .08em;
  text-shadow: 0 1px 4px rgba(0,0,0,.7);
}

/* ══════════════════════════════════════════════════════════════
   OVERVIEW — production table bars
   ══════════════════════════════════════════════════════════════ */
.res-mini-bar {
  height: 5px;
  background: rgba(255,255,255,.07);
  border-radius: 3px;
  border: none;
}
.res-mini-bar-fill { border-radius: 3px; }
.rmbf-wood { background: linear-gradient(90deg, #8a4a18, #c07030); }
.rmbf-clay { background: linear-gradient(90deg, #8a3018, #c05030); }
.rmbf-iron { background: linear-gradient(90deg, #3a5878, #6090b8); }
.rmbf-crop { background: linear-gradient(90deg, #3a7820, #60b040); }
.rmbf-crit { background: linear-gradient(90deg, #881818, #e83030); }

/* ══════════════════════════════════════════════════════════════
   MISC POLISH
   ══════════════════════════════════════════════════════════════ */

/* Badge unread */
.badge-unread {
  background: linear-gradient(135deg, var(--gold-mid), var(--gold-dark));
  color: #fff8e0;
  font-family: var(--font-title);
  font-size: .7rem;
  letter-spacing: .05em;
  box-shadow: 0 1px 4px rgba(0,0,0,.5);
}

/* Unread count pill inside a tab button */
.tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--gold-dark);
  color: var(--bg-dark);
  font-family: var(--font-title);
  font-size: .65rem;
  font-weight: 700;
  min-width: 1.2em;
  padding: 0 .32em;
  border-radius: 8px;
  margin-left: .3em;
  vertical-align: middle;
  line-height: 1.4;
}

/* Field slot badges */
.field-slot-badge {
  background: linear-gradient(180deg, #1a1408, #110d06);
  border: 1px solid var(--border-soft);
  border-radius: 3px;
  color: var(--text);
  transition: border-color .12s, color .12s;
}
.field-slot-badge:hover        { border-color: var(--gold-dark); color: var(--gold); }
.field-slot-badge.in-queue     { border-color: rgba(180,130,20,.6); color: var(--gold); }
.field-slot-badge.maxed        { border-color: rgba(74,144,48,.6); color: var(--green-bright); }

/* Oasis list */
.oasis-list li {
  background: linear-gradient(180deg, #0e2210, #0a1a0c);
  border: 1px solid rgba(74,144,48,.4);
  color: var(--green-bright);
}

/* Page fade in */
@keyframes page-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
/* animation removed — see style.css comment */

/* Footer */
.game-footer {
  font-family: var(--font-title);
  letter-spacing: .08em;
  font-size: .72rem;
  color: var(--text-dim);
  border-top: 1px solid var(--border-soft);
}

/* ── Ranking page ─────────────────────────────────────────── */
.ranking-page { max-width: 960px; margin: 1.5rem auto; padding: 0 1rem; }
.ranking-page h2 { font-family: var(--font-title); color: var(--gold); margin-bottom: 1rem; }
.ranking-page .alliance-card { padding: 0 0 1.1rem; }

/* Secondary (smaller) tabs sit below the primary row */
.rank-secondary-tabs { border-top: 1px solid var(--border-soft); margin-top: 0; }
.ally-tab-sm { font-size: .78rem; padding: .4rem .85rem; font-family: var(--font-body); letter-spacing: 0; }

/* Toolbar row: search + week note */
.rank-toolbar {
  display: flex; align-items: center; gap: .75rem;
  flex-wrap: wrap; margin-bottom: .9rem;
}
.rank-search { display: flex; gap: .4rem; align-items: center; }
.rank-search input[type=number] {
  background: var(--bg-dark); border: 1px solid var(--border);
  color: var(--text-light); border-radius: var(--radius);
  padding: .32rem .55rem; width: 130px; font-size: .85rem;
}
.rank-week-note { color: var(--text-dim); font-size: .85rem; margin: 0; }

/* Table */
.rank-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.rank-table th {
  text-align: left; padding: .42rem .65rem;
  font-family: var(--font-title); font-size: .72rem;
  letter-spacing: .07em; text-transform: uppercase;
  color: var(--text-dim); background: rgba(0,0,0,.25);
  border-bottom: 1px solid var(--border);
}
.rank-table td { padding: .38rem .65rem; border-bottom: 1px solid rgba(90,58,16,.12); }
.rank-table tbody tr:hover td { background: rgba(242,204,82,.04); }
.rank-me td { background: rgba(242,204,82,.09) !important; font-weight: 600; }
.rank-num   { color: var(--text-dim); font-size: .82rem; text-align: center; width: 2.8rem; }
.rank-score { text-align: right; font-weight: 700; color: var(--gold); }
.rank-dim   { color: var(--text-dim); }

/* Pagination */
.rank-pagination {
  display: flex; align-items: center; gap: .5rem;
  margin-top: 1rem; justify-content: center; flex-wrap: wrap;
}
.rank-page-info { color: var(--text-dim); font-size: .85rem; }

/* Top 10 */
.top10-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: .85rem;
}
.top10-list {
  background: rgba(255,255,255,.03);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  overflow: hidden;
}
.top10-list-header {
  font-family: var(--font-title); font-size: .78rem;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--gold); background: rgba(0,0,0,.3);
  border-bottom: 1px solid var(--border-soft);
  padding: .55rem .75rem;
}
.top10-ol { list-style: none; margin: 0; padding: .3rem 0; }
.top10-li {
  display: flex; align-items: center; gap: .5rem;
  padding: .32rem .75rem; font-size: .84rem;
  border-bottom: 1px solid rgba(255,255,255,.04);
  transition: background .1s;
}
.top10-li:last-child { border-bottom: none; }
.top10-li:hover { background: rgba(242,204,82,.04); }
.top10-pos {
  width: 1.4rem; text-align: center; flex-shrink: 0;
  font-size: .75rem; color: var(--text-dim);
}
.top10-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top10-score { color: var(--gold); font-weight: 700; flex-shrink: 0; font-size: .82rem; }
.top10-gold   .top10-pos { color: #ffd700; font-weight: 700; }
.top10-silver .top10-pos { color: #c0c0c0; font-weight: 700; }
.top10-bronze .top10-pos { color: #cd7f32; font-weight: 700; }

/* ── Farm List (rally.php) ────────────────────────────────── */
.rally-tabs {
  display: flex; gap: .4rem; margin-bottom: 1.25rem;
  flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.rally-tabs::-webkit-scrollbar { display: none; }
.rally-tabs .btn { flex-shrink: 0; white-space: nowrap; }

.fl-section { margin-top: 1.5rem; }
.fl-section > h3 { font-family: var(--font-title); color: var(--gold); margin-bottom: .9rem; font-size: 1rem; }

/* Create form */
.fl-create-form {
  display: flex; gap: .5rem; align-items: center; flex-wrap: wrap;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .75rem 1rem; margin-bottom: 1.25rem;
}
.fl-create-form input[type=text] {
  flex: 1; min-width: 180px;
  background: var(--bg-dark); border: 1px solid var(--border);
  color: var(--text-light); border-radius: var(--radius);
  padding: .38rem .65rem; font-size: .9rem;
}
.fl-create-form input[type=text]:focus { border-color: var(--gold-dark); outline: none; }

/* Per-list card */
.fl-list {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 1.25rem;
  overflow: hidden;
}
.fl-list-header {
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
  padding: .65rem 1rem; background: rgba(242,204,82,.05);
  border-bottom: 1px solid var(--border);
}
.fl-list-header h4 {
  font-family: var(--font-title); color: var(--gold);
  font-size: .95rem; margin: 0; flex: 1;
}
.fl-slot-count { color: var(--text-dim); font-size: .82rem; margin-left: auto; }

/* Farm list table */
.fl-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.fl-table th {
  text-align: left; padding: .4rem .65rem;
  color: var(--gold); font-family: var(--font-title);
  font-size: .78rem; letter-spacing: .04em;
  border-bottom: 1px solid var(--border);
  background: var(--bg-dark);
}
.fl-table td { padding: .38rem .65rem; border-bottom: 1px solid rgba(90,58,16,.15); vertical-align: middle; }
.fl-table tbody tr:hover td { background: rgba(242,204,82,.03); }
.fl-table tbody tr:last-child td { border-bottom: none; }

.fl-coords { font-weight: 600; color: var(--gold); font-size: .9rem; letter-spacing: .02em; }
.fl-troops { color: var(--text-dim); font-size: .82rem; max-width: 200px; }
.fl-note   { color: var(--text-light); font-size: .85rem; font-style: italic; }
.fl-report { font-size: .82rem; }
.fl-win    { color: var(--green-bright); font-weight: 600; }
.fl-loss   { color: #e55; font-weight: 600; }
.fl-no-rep { color: var(--text-dim); }

/* Send bar below list */
.fl-send-bar {
  display: flex; gap: .5rem; align-items: center; flex-wrap: wrap;
  padding: .6rem 1rem; border-top: 1px solid var(--border);
  background: rgba(0,0,0,.15);
}

/* Add entry form (collapsible via <details>) */
.fl-add-details {
  border-top: 1px dashed var(--border);
  background: rgba(0,0,0,.12);
  padding: .6rem 1rem .8rem;
}
.fl-add-details summary { list-style: none; }
.fl-add-details summary::-webkit-details-marker { display: none; }
.fl-add-form {
  margin-top: .75rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: .55rem;
}
.fl-add-form label { font-size: .8rem; color: var(--text-dim); display: block; margin-bottom: .2rem; }
.fl-add-form input[type=text],
.fl-add-form input[type=number],
.fl-add-form select {
  width: 100%;
  background: var(--bg-dark); border: 1px solid var(--border);
  color: var(--text-light); border-radius: var(--radius);
  padding: .35rem .55rem; font-size: .85rem;
}
.fl-add-form input:focus,
.fl-add-form select:focus { border-color: var(--gold-dark); outline: none; }
.fl-add-troops {
  grid-column: 1 / -1;
  display: flex; flex-wrap: wrap; gap: .4rem; align-items: flex-end;
}
.fl-troop-input { display: flex; flex-direction: column; align-items: center; gap: .2rem; min-width: 60px; }
.fl-troop-input span { font-size: .75rem; color: var(--text-dim); }
.fl-troop-input input { width: 56px; text-align: center; }
.fl-add-submit { grid-column: 1 / -1; }

.fl-empty { padding: .75rem 1rem; color: var(--text-dim); font-size: .88rem; font-style: italic; }

/* ── Building Picker (free slot) ─────────────────────────── */
.picker-category { margin-bottom: 1.5rem; }
.picker-cat-label {
  font-family: var(--font-title); color: var(--gold);
  font-size: .85rem; letter-spacing: .06em;
  margin-bottom: .65rem; padding-bottom: .3rem;
  border-bottom: 1px solid var(--border);
}
.picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: .65rem;
}
.picker-item {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .75rem .8rem;
  display: flex; flex-direction: column; align-items: center;
  gap: .35rem; text-align: center; transition: border-color .15s;
}
.picker-item:not(.picker-disabled):not(.picker-locked):hover {
  border-color: var(--gold-dark);
}
.picker-disabled { opacity: .45; }
.picker-locked   { opacity: .6; }
.picker-poor     { border-color: rgba(200,80,60,.35); }

.picker-img {
  width: 44px; height: 44px; object-fit: contain;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,.6));
}
.picker-img-ph {
  width: 44px; height: 44px; background: var(--bg-dark);
  border: 1px solid var(--border); border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-title); color: var(--gold); font-size: 1.1rem;
}
.picker-name   { font-size: .82rem; font-weight: 600; color: var(--text-light); }
.picker-cost   { font-size: .72rem; color: var(--text-dim); line-height: 1.5; }
.picker-status { font-size: .72rem; }
.picker-status.built  { color: var(--green-bright); }
.picker-status.locked { color: #e55; }
.picker-btn    { margin-top: .15rem; width: 100%; }

/* ── Picker tabs ──────────────────────────────────────────── */
.picker-tabs {
  display: flex; gap: .4rem; flex-wrap: nowrap;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  margin-bottom: .25rem;
}
.picker-tabs::-webkit-scrollbar { display: none; }
.picker-tabs .btn { flex-shrink: 0; white-space: nowrap; }

/* ── Picker prereq list ───────────────────────────────────── */
.picker-prereq-list {
  list-style: none; padding: 0; margin: 0;
  font-size: .72rem; color: #e55;
  text-align: left; width: 100%;
}
.picker-prereq-list li { padding: .1rem 0; line-height: 1.4; }

/* ══════════════════════════════════════════════════════════════
   BUILD MODAL
   ══════════════════════════════════════════════════════════════ */
.bmodal-overlay {
  display: none;
  /* position:fixed intentionally NOT set here — a hidden fixed element on Android
     Chrome corrupts the compositor layer list and breaks other position:fixed
     elements (like #chat-bar). Only apply fixed when actually open. */
  z-index: 500;
  background: rgba(0, 0, 0, .80);
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.bmodal-overlay.open {
  display: flex;
  position: fixed;
  inset: 0;
}

.bmodal-box {
  position: relative;
  background: var(--bg-card, #1a1208);
  border: 1px solid var(--border, rgba(90,58,16,.45));
  border-radius: 8px;
  box-shadow: 0 8px 48px rgba(0,0,0,.92), 0 0 0 1px rgba(232,200,74,.06);
  width: 100%;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: rgba(90,58,16,.5) transparent;
  margin-top: -50%;
}

.bmodal-close {
  position: sticky;
  top: .6rem;
  float: right;
  display: block;
  margin: .6rem .6rem -.5rem auto;
  background: rgba(0,0,0,.45);
  border: 1px solid var(--border, rgba(90,58,16,.4));
  color: var(--text-dim, #888);
  border-radius: 4px;
  font-size: 1rem;
  line-height: 1;
  width: 2rem;
  height: 2rem;
  cursor: pointer;
  z-index: 1;
  transition: color .14s, border-color .14s, background .14s;
  flex-shrink: 0;
}
.bmodal-close:hover,
.bmodal-close:focus { color: var(--gold, #e8c84a); border-color: var(--gold, #e8c84a); background: rgba(232,200,74,.08); outline: none; }

.bmodal-body {
  padding: 1.25rem;
  /* Remove the outer page wrapper padding build-page adds */
}

/* In modal: strip page-level chrome that doesn't belong */
.bmodal-body .build-page { padding: 0; max-width: none; }
.bmodal-body .back-link  { display: none !important; }

.bmodal-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  color: var(--text-dim, #888);
  font-size: 1rem;
  gap: .6rem;
}
.bmodal-loading::before {
  content: '';
  display: inline-block;
  width: 1.1rem;
  height: 1.1rem;
  border: 2px solid rgba(232,200,74,.25);
  border-top-color: var(--gold, #e8c84a);
  border-radius: 50%;
  animation: bmodal-spin .7s linear infinite;
}
@keyframes bmodal-spin { to { transform: rotate(360deg); } }

.bmodal-err {
  padding: 1rem;
  color: #e55;
  font-size: .9rem;
}

@media (max-width: 600px) {
  /* ── Sheet geometry ── */
  .bmodal-overlay { padding: 0; align-items: flex-end; }
  .bmodal-box {
    max-height: 92vh;
    border-radius: 12px 12px 0 0;
    max-width: 100%;
    /* Respect iPhone home-bar / notch */
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  /* Drag-handle hint at top of sheet */
  .bmodal-box::before {
    content: '';
    display: block;
    width: 2.5rem;
    height: 4px;
    background: rgba(255,255,255,.18);
    border-radius: 2px;
    margin: .6rem auto -.2rem;
    flex-shrink: 0;
  }

  /* ── Close button — 44 px touch target ── */
  .bmodal-close {
    width:  2.75rem;
    height: 2.75rem;
    font-size: 1.05rem;
    top: .5rem;
    margin: .5rem .5rem -.25rem auto;
  }

  /* ── Body padding — strip the double-padding ── */
  .bmodal-body { padding: .65rem .75rem .75rem; }

  /* ── Build card — tighten internal padding ── */
  .bmodal-body .build-card { padding: .9rem .75rem; }

  /* ── Build header — keep side-by-side with smaller image ──
     (style.css flips to column at ≤700 px; override back to row
      here so the image doesn't eat the full width on small phones) */
  .bmodal-body .build-header {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: flex-start;
    gap: .75rem;
    margin-bottom: .9rem;
  }
  .bmodal-body .build-img { width: 56px; height: 56px; flex-shrink: 0; }
  .bmodal-body .build-title { flex: 1; min-width: 0; }
  .bmodal-body .build-title h2 { font-size: 1rem; line-height: 1.2; }

  /* Level pips — shrink on very narrow screens */
  .bmodal-body .lvl-pip { width: 8px; height: 8px; }

  /* ── Picker tabs — scrollable row on mobile ── */
  .bmodal-body .picker-tabs {
    gap: .3rem;
  }
  .bmodal-body .picker-tabs .btn {
    font-size: .72rem;
    padding: .35rem .6rem;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* ── Picker grid — 2 columns ── */
  .bmodal-body .picker-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: .5rem;
  }
  .bmodal-body .picker-item { padding: .6rem .5rem; }
  .bmodal-body .picker-img  { width: 36px; height: 36px; }
  .bmodal-body .picker-img-ph { width: 36px; height: 36px; }
  .bmodal-body .picker-name { font-size: .78rem; }

  /* ── Cost grid — 2 × 2 ── */
  .bmodal-body .cost-grid { grid-template-columns: repeat(2, 1fr); }

  /* ── Upgrade button — full width ── */
  .bmodal-body .btn-build { width: 100%; justify-content: center; }

  /* ── Level/effects table — compact font ── */
  .bmodal-body .level-table      { font-size: .72rem; }
  .bmodal-body .level-table th,
  .bmodal-body .level-table td   { padding: .22rem .3rem; }

  /* ── Free-slot title ── */
  .bmodal-body .build-title > p  { font-size: .8rem; margin-bottom: .5rem; }
}

/* ══════════════════════════════════════════════════════════════
   MOBILE NAV (hamburger)
   ══════════════════════════════════════════════════════════════ */

/* Hamburger button — hidden on desktop */
.nav-toggle {
  display: none;
  order: -1;          /* sits before res-bar */
  margin-left: auto;
  background: none;
  border: 1px solid rgba(232,200,74,.3);
  border-radius: 4px;
  color: var(--gold);
  font-size: 1.2rem;
  line-height: 1;
  padding: .3rem .55rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s, border-color .15s;
  -webkit-tap-highlight-color: transparent;
}
.nav-toggle:hover,
.nav-toggle:focus { background: rgba(232,200,74,.1); border-color: var(--gold); outline: none; }

@media (max-width: 768px) {
  /* Show hamburger, hide resource bar by default on small screens */
  .nav-toggle { display: flex; align-items: center; justify-content: center; }

  /* Resource bar: shrink items and hide production rate */
  .res-bar { gap: .2rem; margin-left: 0; flex-wrap: nowrap; overflow-x: auto; }
  .res-item { min-width: unset; padding: .15rem .3rem; font-size: .72rem; }
  .res-prod { display: none; }
  .res-cap  { display: none; }

  /* Collapse nav by default */
  .header-nav {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 200;
    background: linear-gradient(180deg, #1e1508 0%, #120e06 100%);
    border-bottom: 2px solid var(--border);
    box-shadow: 0 6px 20px rgba(0,0,0,.7);
    padding: .25rem 0;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
  }

  /* Open state */
  .game-header.nav-open .header-nav { display: flex; }

  /* Nav links: full-width rows */
  .header-nav a {
    padding: .65rem 1.2rem;
    border-bottom: 1px solid rgba(90,58,16,.2);
    border-left: 3px solid transparent;
    font-size: .85rem;
    white-space: nowrap;
  }
  .header-nav a:last-child  { border-bottom: none; }
  .header-nav a.nav-active  {
    border-left-color: var(--gold);
    border-bottom-color: rgba(90,58,16,.2);
    background: rgba(242,204,82,.07);
  }
  .header-nav .nav-logout { margin-left: 0; }

  /* Keep header-top layout tidy */
  .header-top { position: relative; flex-wrap: nowrap; align-items: center; gap: .5rem; }
  .header-village-name { flex-shrink: 1; min-width: 0; }
  .header-village-name strong,
  .coords { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* ══════════════════════════════════════════════════════════════
   DIPLOMACY SECTION (alliance.php)
   ══════════════════════════════════════════════════════════════ */
.diplomacy-section {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-soft);
}
.diplomacy-section h4 { margin-bottom: .75rem; }

.dip-group {
  margin-bottom: 1rem;
}
.dip-group-title {
  font-size: .72rem;
  font-family: var(--font-title);
  letter-spacing: .07em;
  text-transform: uppercase;
  padding: .25rem .5rem;
  border-radius: 4px;
  margin-bottom: .4rem;
  display: inline-block;
}
.dip-war { background: rgba(192,40,40,.15); color: #f07070; border: 1px solid rgba(192,40,40,.3); }
.dip-nap { background: rgba(20,130,60,.15); color: #60d090; border: 1px solid rgba(20,130,60,.3); }

.dip-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .3rem .4rem;
  border-radius: 4px;
  background: rgba(255,255,255,.03);
  margin-bottom: .25rem;
  font-size: .88rem;
}
.dip-tag-war { color: #f07070; border-color: rgba(192,40,40,.4); }
.dip-tag-nap { color: #60d090; border-color: rgba(20,130,60,.4); }

.dip-empty {
  font-size: .82rem;
  color: var(--text-dim);
  margin: .2rem 0 .4rem .2rem;
}

.dip-add-form {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
  align-items: center;
  margin-top: .75rem;
}

/* ══════════════════════════════════════════════════════════════
   ALLIANCE TABS
   ══════════════════════════════════════════════════════════════ */
.ally-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border-soft);
  margin: .9rem 0rem 0;   /* bleed to card edges */
  padding: 0 1.1rem;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;        /* Firefox */
}
.ally-tabs::-webkit-scrollbar { display: none; } /* Chrome/Safari */
.ally-tab {
  padding: .55rem 1.1rem;
  font-size: .85rem;
  font-family: var(--font-title);
  letter-spacing: .04em;
  color: var(--text-dim);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;       /* overlap card border */
  transition: color .15s, border-color .15s;
  display: flex;
  align-items: center;
  gap: .4rem;
  white-space: nowrap;
  flex-shrink: 0;
}
.ally-tab:hover { color: var(--text-light); }
.ally-tab-active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}
.ally-tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: rgba(232,200,74,.15);
  border: 1px solid rgba(232,200,74,.25);
  color: var(--gold);
  font-size: .68rem;
  font-family: var(--font-body);
  font-weight: 700;
  letter-spacing: 0;
}
.ally-tab-panel {
  padding-top: 1rem;
}

/* ══════════════════════════════════════════════════════════════
   ADMIN – OASIS GENERATOR
   ══════════════════════════════════════════════════════════════ */
.admin-settings-grid {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 1.25rem;
  align-items: start;
}
@media (max-width: 900px) {
  .admin-settings-grid { grid-template-columns: 1fr; }
}

/* Stat strip */
.oasis-stats-bar {
  display: flex;
  gap: .5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.oasis-stat-item {
  flex: 1;
  min-width: 70px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  padding: .5rem .6rem;
  text-align: center;
}
.oasis-stat-num {
  display: block;
  font-size: 1.3rem;
  font-family: var(--font-title);
  color: var(--gold);
  line-height: 1.1;
}
.oasis-stat-lbl {
  font-size: .72rem;
  color: var(--text-dim);
}

/* Type breakdown bars */
.oasis-type-breakdown {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1.1rem;
  border-bottom: 1px solid var(--border-soft);
}
.oasis-type-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .82rem;
}
.oasis-type-icon { width: 1.6rem; text-align: center; flex-shrink: 0; }
.oasis-type-lbl  { width: 200px; flex-shrink: 0; color: var(--text-dim); }
.oasis-type-track {
  flex: 1;
  height: 7px;
  background: rgba(255,255,255,.07);
  border-radius: 4px;
  overflow: hidden;
}
.oasis-type-fill {
  height: 100%;
  background: linear-gradient(90deg, #1a7a3a, #30c060);
  border-radius: 4px;
  transition: width .4s ease;
}
.oasis-type-count { width: 90px; text-align: right; flex-shrink: 0; color: var(--text-light); }

/* Generator form */
.oasis-gen-form { display: flex; flex-direction: column; gap: .9rem; }
.oasis-gen-top  { display: flex; gap: 1rem; align-items: flex-end; flex-wrap: wrap; }
.oasis-gen-top .form-group { margin: 0; }
.oasis-gen-top label small { display: block; font-size: .72rem; color: var(--text-dim); margin-top: .15rem; }

.oasis-pct-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: .65rem;
}
.oasis-pct-item {
  background: rgba(255,255,255,.03);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  padding: .55rem .65rem;
  display: flex;
  flex-direction: column;
  gap: .25rem;
}
.oasis-pct-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .82rem;
  color: var(--text-dim);
}
.oasis-pct-header strong { color: var(--gold); font-size: .88rem; }
.oasis-pct-item input[type=range] {
  width: 100%;
  accent-color: var(--gold);
  cursor: pointer;
}
.oasis-pct-num {
  width: 52px;
  padding: .2rem .3rem;
  background: var(--bg-dark);
  border: 1px solid var(--border-soft);
  border-radius: 4px;
  color: var(--text-light);
  font-size: .82rem;
  text-align: center;
  align-self: flex-end;
}

.oasis-pct-total-row {
  font-size: .88rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: .5rem;
}
.oasis-pct-total-row strong { color: var(--gold); font-size: 1rem; }
.oasis-pct-warning { color: #e8a030; font-size: .8rem; }

.oasis-gen-btn { align-self: flex-start; }
.oasis-gen-note {
  font-size: .8rem;
  color: var(--text-dim);
  margin: 0;
  line-height: 1.5;
}

/* ── Building modal: Build/Functions tabs ─────────────────── */
.btab-nav {
  margin: 0 0 1.25rem;
  border-bottom: 1px solid var(--border-soft);
  padding-bottom: .5rem;
}

.btab-functions {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.btab-section {
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  padding: 1rem 1.1rem;
}
.btab-section h3 {
  margin: 0 0 .5rem;
  color: var(--gold);
  font-size: 1rem;
}
.btab-desc {
  font-size: .85rem;
  color: var(--text-dim);
  margin: 0 0 .8rem;
  line-height: 1.5;
}

.btab-queue-bar {
  font-size: .85rem;
  color: var(--text-light);
  background: rgba(242,204,82,.07);
  border: 1px solid var(--border-soft);
  border-radius: 4px;
  padding: .4rem .75rem;
  margin-bottom: .75rem;
}

.btab-unit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: .6rem;
  margin-bottom: .8rem;
}
.btab-unit-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: 5px;
  padding: .5rem .65rem;
  display: flex;
  flex-direction: column;
  gap: .2rem;
}
.btab-unit-name { font-size: .82rem; color: var(--text-light); }
.btab-unit-stat { font-size: .75rem; color: var(--text-dim); }
.btab-unit-home { font-size: .75rem; }

.btab-goto-btn { margin-top: .25rem; }
.btab-btn-row { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .25rem; }

.btab-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .4rem;
  padding: 1.25rem;
  color: var(--text-dim);
  font-size: .9rem;
  text-align: center;
}
.btab-placeholder-icon { font-size: 2rem; }

/* Embassy: invitation list */
.invite-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.invite-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: 5px;
  padding: .55rem .75rem;
}
.invite-info {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  min-width: 0;
}
.invite-ally { font-size: .9rem; color: var(--text-light); }
.invite-by   { font-size: .78rem; }
.invite-actions { display: flex; gap: .4rem; flex-shrink: 0; }

/* ── Academy — Research ──────────────────────────────────────────── */
.ac-queue-bar {
  display: flex;
  align-items: center;
  gap: .75rem;
  background: var(--bg-card);
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: .6rem .9rem;
  margin-bottom: 1rem;
}
.ac-queue-icon { font-size: 1.4rem; }
.ac-queue-info { display: flex; flex-direction: column; gap: .15rem; }
.ac-queue-timer { font-size: .82rem; color: var(--accent); font-family: monospace; }

.ac-unit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: .75rem;
}
.ac-unit-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  padding: .65rem .75rem;
  display: flex;
  flex-direction: column;
  gap: .45rem;
}
.ac-unit-card.ac-done { opacity: .65; }
.ac-unit-card.ac-locked { opacity: .5; }

.ac-unit-header {
  display: flex;
  align-items: center;
  gap: .55rem;
}
.ac-unit-img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  flex-shrink: 0;
}
.ac-unit-name   { font-size: .88rem; font-weight: 600; }
.ac-unit-building { font-size: .75rem; color: var(--text-dim); }
.ac-badge {
  margin-left: auto;
  font-size: .7rem;
  padding: .15rem .4rem;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}
.ac-badge-done   { background: #2a6e2a; color: #8fff8f; }
.ac-badge-queue  { background: #5a4500; color: #ffd060; }
.ac-badge-locked { background: #3a3a3a; color: #aaa; }

.ac-unit-cost {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem .6rem;
  font-size: .78rem;
  color: var(--text-dim);
}

.btab-btn-sm {
  margin-top: .25rem;
  padding: .3rem .75rem;
  font-size: .82rem;
  border: none;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  transition: opacity .15s;
}
.btab-btn-sm:hover:not(:disabled) { opacity: .85; }
.btab-btn-sm.btn-disabled,
.btab-btn-sm:disabled {
  background: #444;
  color: #888;
  cursor: not-allowed;
  opacity: 1;
}

/* ── Smithy — Unit Upgrades ──────────────────────────────────────── */
.sm-unit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: .75rem;
}
.sm-unit-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  padding: .65rem .75rem;
  display: flex;
  flex-direction: column;
  gap: .4rem;
}
.sm-unit-header {
  display: flex;
  align-items: center;
  gap: .55rem;
}
.sm-unit-img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  flex-shrink: 0;
}
.sm-unit-info   { flex: 1; min-width: 0; }
.sm-unit-name   { font-size: .88rem; font-weight: 600; }
.sm-unit-level  { font-size: .78rem; color: var(--text-dim); }
.sm-bonus       { color: #7fd87f; margin-left: .25rem; }
.sm-badge       {
  font-size: .7rem;
  padding: .15rem .4rem;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}
.sm-badge-max   { background: #2a5a8a; color: #8fd8ff; }
.sm-badge-queue { background: #5a4500; color: #ffd060; }

.sm-next-level  { display: flex; flex-direction: column; gap: .3rem; }
.sm-unit-cost {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem .5rem;
  font-size: .77rem;
  color: var(--text-dim);
}
.sm-locked-msg {
  font-size: .78rem;
  color: #888;
  font-style: italic;
}

/* ── Settlers / Palace UI ────────────────────────────────────────── */
.sett-notice {
  background: rgba(255,200,50,.07);
  border: 1px solid rgba(255,200,50,.25);
  border-radius: 5px;
  padding: .6rem .9rem;
  font-size: .85rem;
  color: #c8b97a;
  margin-bottom: .75rem;
}

.sett-count-bar {
  display: flex;
  gap: .75rem;
  margin-bottom: .9rem;
}
.sett-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .2rem;
  padding: .55rem .8rem;
  border-radius: 6px;
  border: 1px solid var(--border-soft);
  font-size: .75rem;
  min-width: 70px;
  text-align: center;
}
.sett-slot-icon { font-size: 1.4rem; }
.sett-home  { background: #1a3a1a; border-color: #3a6a3a; color: #8fff8f; }
.sett-queue { background: #3a2a00; border-color: #7a5a00; color: #ffd060; }
.sett-empty { background: var(--bg-card); color: var(--text-dim); }

.sett-train-card,
.sett-found-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  padding: .75rem .9rem;
  margin-bottom: .75rem;
}
.sett-train-card h4,
.sett-found-card h4 {
  margin: 0 0 .5rem;
  font-size: .92rem;
  color: var(--accent);
}

.sett-form-row {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
  margin-bottom: .55rem;
}
.sett-form-row label {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-size: .85rem;
}
.sett-text-input {
  width: 160px;
  padding: .3rem .5rem;
  background: var(--bg-input, #1a1a2a);
  border: 1px solid var(--border-soft);
  border-radius: 4px;
  color: var(--text-light);
  font-size: .85rem;
}
.sett-coord-input {
  width: 70px;
  padding: .3rem .4rem;
  background: var(--bg-input, #1a1a2a);
  border: 1px solid var(--border-soft);
  border-radius: 4px;
  color: var(--text-light);
  font-size: .85rem;
  text-align: center;
}

/* Conquer troop selector */
.sett-troop-grid {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  margin-top: .5rem;
}
.sett-troop-row {
  display: flex;
  align-items: center;
  gap: .6rem;
}
.sett-troop-img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex-shrink: 0;
}
.sett-troop-name {
  flex: 1;
  font-size: .83rem;
}
.sett-troop-input {
  width: 70px;
  padding: .25rem .4rem;
  background: var(--bg-input, #1a1a2a);
  border: 1px solid var(--border-soft);
  border-radius: 4px;
  color: var(--text-light);
  font-size: .83rem;
  text-align: center;
}

@media (max-width: 480px) {
  .sett-count-bar { gap: .4rem; }
  .sett-slot { min-width: 56px; padding: .4rem .5rem; }
}
