/* ═══════════════════════════════════════════════════════════════
   Travian Classic – Main Stylesheet
   Mobile-first, vanilla CSS
═══════════════════════════════════════════════════════════════ */

/* ── Reset & Variables ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --gold:        #e8c84a;
  --gold-dark:   #b8941a;
  --gold-glow:   rgba(232,200,74,.18);
  --brown:       #6b3e1a;
  --bg-dark:     #131109;
  --bg-panel:    #221808;
  --bg-card:     #1c1508;
  --bg-card2:    #241a0a;
  --border:      #4a3010;
  --border-soft: rgba(90,58,16,.5);
  --text:        #d4b870;
  --text-light:  #ede0b0;
  --text-dim:    #7a6030;
  --green:       #5a9a3a;
  --red:         #c03030;
  --blue:        #4a7aaa;
  --shadow:      0 2px 12px rgba(0,0,0,.6);
  --shadow-lg:   0 4px 24px rgba(0,0,0,.8);
  --font:        'Crimson Text', 'Segoe UI', Tahoma, Georgia, serif;
  --font-title:  'Cinzel', 'Trajan Pro', serif;
  --radius:      6px;
}

html { font-size: 16px; }

body {
  font-family: var(--font);
  background: var(--bg-dark);
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(90,58,16,.12) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 100%, rgba(60,30,8,.18) 0%, transparent 60%);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.55;
  font-size: 1.0125rem;
}

h1, h2, h3 { font-family: var(--font-title); letter-spacing: .03em; }

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--text-light); text-decoration: underline; }

img { max-width: 100%; display: block; }

/* ── Utility ────────────────────────────────────────────────── */
.pos { color: var(--green); }
.neg { color: var(--red);   }
.highlight { background: var(--gold-glow); }

.alert {
  padding: .65rem 1rem .65rem 1.1rem;
  border-radius: var(--radius);
  border-left-width: 3px;
  border-left-style: solid;
  margin-bottom: 1rem;
  font-size: .9rem;
  box-shadow: var(--shadow);
}
.alert-error   { background: rgba(192,48,48,.18);  border-color: var(--red);   color: #f09090; border: 1px solid rgba(192,48,48,.4); border-left: 3px solid var(--red); }
.alert-success { background: rgba(90,154,58,.18);  border-color: var(--green); color: #90e060; border: 1px solid rgba(90,154,58,.4); border-left: 3px solid var(--green); }
.alert-warning { background: rgba(200,160,40,.18); border-color: var(--gold);  color: var(--gold); border: 1px solid rgba(200,160,40,.4); border-left: 3px solid var(--gold); }
.alert-info    { background: rgba(74,122,170,.18); border-color: var(--blue);  color: #80b0e0; border: 1px solid rgba(74,122,170,.4); border-left: 3px solid var(--blue); }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: .42rem .9rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: linear-gradient(to bottom, #2e2010, #1e1608);
  color: var(--text);
  cursor: pointer;
  font-size: .88rem;
  font-family: var(--font);
  text-align: center;
  transition: background .15s, border-color .15s, box-shadow .15s, color .15s;
  text-decoration: none;
  box-shadow: 0 1px 3px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.04);
  white-space: nowrap;
}
.btn:hover {
  background: linear-gradient(to bottom, #3e2a14, #28180a);
  border-color: var(--gold-dark);
  color: var(--text-light);
  box-shadow: 0 2px 8px rgba(0,0,0,.5), 0 0 0 1px rgba(184,148,26,.2);
  text-decoration: none;
}
.btn-primary {
  background: linear-gradient(to bottom, #c8941a, #7a4a06);
  border-color: #d4a020;
  color: #fff8e0;
  font-weight: 600;
  font-family: var(--font-title);
  letter-spacing: .04em;
  box-shadow: 0 2px 8px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,220,80,.2);
}
.btn-primary:hover {
  background: linear-gradient(to bottom, #daa422, #9a6010);
  border-color: #e0b030;
  color: #fff;
  box-shadow: 0 3px 12px rgba(0,0,0,.6), 0 0 12px rgba(232,200,74,.15);
}
.btn-full   { display: block; width: 100%; }
.btn-build  { font-size: 1rem; padding: .6rem 2rem; margin-top: .5rem; }
.btn-active {
  background: linear-gradient(to bottom, #c8941a, #7a4a06);
  border-color: var(--gold);
  color: #fff8e0;
  font-weight: 600;
}
.btn-active:hover { color: #fff; }

/* ── Game Header ─────────────────────────────────────────────── */
.game-header {
  background: linear-gradient(180deg, #2e2008 0%, #1a1006 100%);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 16px rgba(0,0,0,.8);
  position: sticky;
  top: 0;
  z-index: 100;
}

/* Top row */
.header-top {
  max-width: 1300px;
  margin: 0 auto;
  padding: .45rem 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid rgba(90,58,16,.35);
  flex-wrap: wrap;
}

.header-logo {
  flex-shrink: 0;
}
.logo-text {
  font-family: var(--font-title);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: .08em;
  text-shadow: 0 0 12px rgba(232,200,74,.3);
}

.header-village-name {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .95rem;
}
.header-village-name strong { color: var(--text-light); font-family: var(--font-title); font-size: .9rem; }
.coords { color: var(--text-dim); font-size: .78rem; }

.tribe-badge {
  font-size: .68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-family: var(--font-title);
}
.tribe-roman  { background: #1e3570; color: #aac4ff; box-shadow: inset 0 1px 0 rgba(255,255,255,.1); }
.tribe-teuton { background: #5a1e0e; color: #ffb8a8; box-shadow: inset 0 1px 0 rgba(255,255,255,.1); }
.tribe-gaul   { background: #154520; color: #98e898; box-shadow: inset 0 1px 0 rgba(255,255,255,.1); }

/* Resource bar */
.res-bar {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-left: auto;
}
.res-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: .3rem;
  padding: .2rem .5rem;
  background: rgba(0,0,0,.3);
  border: 1px solid var(--border-soft);
  border-radius: 4px;
  overflow: hidden;
  white-space: nowrap;
  font-size: .82rem;
  min-width: 90px;
}
.res-fill-bar {
  position: absolute;
  left: 0; top: 0; height: 100%;
  transition: width .5s ease;
  pointer-events: none;
  z-index: 0;
}
.res-icon-emoji { font-size: .95rem; z-index: 1; line-height: 1; }
.res-vals { display: flex; align-items: baseline; gap: .2rem; z-index: 1; }
.res-amount { color: var(--text-light); font-weight: 600; font-size: .85rem; }
.res-cap  { color: var(--text-dim); font-size: .72rem; }
.res-prod { font-size: .72rem; }
.res-almost-full { border-color: rgba(232,200,74,.5); }
.res-almost-full .res-amount { color: var(--gold); }

/* Nav row */
.header-nav {
  max-width: 1300px;
  margin: 0 auto;
  padding: .0rem 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  font-size: .82rem;
}
.header-nav a {
  color: var(--text-dim);
  padding: .35rem .6rem;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s, background .15s;
  text-decoration: none;
  font-family: var(--font);
  white-space: nowrap;
}
.header-nav a:hover {
  color: var(--gold);
  background: rgba(232,200,74,.06);
  text-decoration: none;
}
.header-nav a.nav-active {
  color: var(--gold);
  border-bottom-color: var(--gold);
  background: rgba(232,200,74,.08);
  font-weight: 600;
}
.header-nav .nav-logout {
  margin-left: auto;
  color: var(--text-dim);
  opacity: .7;
}
.header-nav .nav-logout:hover { color: #e08080; opacity: 1; }

/* ── Auth Pages ──────────────────────────────────────────────── */
.auth-page {
  display: flex; align-items: center; justify-content: center; min-height: 100vh;
  background-image:
    radial-gradient(ellipse at 50% 0%, rgba(90,58,16,.2) 0%, transparent 70%);
}

.auth-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2.2rem 2rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(90,58,16,.3);
}
.auth-register { max-width: 780px; }

.auth-logo { text-align: center; margin-bottom: 1.8rem; }
.auth-logo h1 {
  font-family: var(--font-title);
  color: var(--gold);
  font-size: 2rem;
  letter-spacing: .12em;
  text-shadow: 0 0 20px rgba(232,200,74,.25);
}
.auth-logo p  { color: var(--text-dim); font-size: .88rem; margin-top: .3rem; }

.auth-form { display: flex; flex-direction: column; gap: 1rem; }
.auth-link { text-align: center; margin-top: 1rem; font-size: .85rem; color: var(--text-dim); }

.form-group { display: flex; flex-direction: column; gap: .3rem; }
.form-group label { font-size: .85rem; color: var(--text-dim); font-weight: 600; }
.form-group input, .form-group textarea, .form-group select {
  background: #120e06;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-light);
  padding: .5rem .75rem;
  font-size: .95rem;
  width: 100%;
  outline: none;
  transition: border-color .15s;
}
.form-group input:focus, .form-group textarea:focus {
  border-color: var(--gold-dark);
}

/* ── Tribe Selector ──────────────────────────────────────────── */
.tribe-selector {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: .75rem;
}
.tribe-option { display: block; cursor: pointer; }
.tribe-option input[type="radio"] { display: none; }
.tribe-card {
  border: 2px solid var(--border);
  border-radius: 6px;
  padding: .75rem;
  background: var(--bg-panel);
  text-align: center;
  transition: border-color .15s, background .15s;
}
.tribe-card p { font-size: .78rem; color: var(--text-dim); margin-top: .3rem; line-height: 1.4; }
.tribe-card strong { color: var(--text-light); }
.tribe-option:hover .tribe-card { border-color: var(--gold-dark); background: #301e08; }
.tribe-option.selected .tribe-card { border-color: var(--gold); background: #3a2408; }

.tribe-icon {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; font-weight: 700;
  margin: 0 auto .5rem;
}
.tribe-roman  .tribe-icon { background: #2a4a8a; color: #aac0ff; }
.tribe-teuton .tribe-icon { background: #6a2a1a; color: #ffb0a0; }
.tribe-gaul   .tribe-icon { background: #1a5a2a; color: #90e090; }

/* ── Main Layout ─────────────────────────────────────────────── */
main {
  max-width: 1200px;
  margin: 0 auto;
/*
  padding: 1.2rem 1rem;
*/
}

.game-footer {
  text-align: center;
  padding: 1rem;
  color: var(--text-dim);
  font-size: .78rem;
  border-top: 1px solid var(--border);
  margin-top: 2rem;
  font-family: var(--font-title);
  letter-spacing: .05em;
}

/* ── Village Page ────────────────────────────────────────────── */
.village-page { display: flex; flex-direction: column; gap: 1rem; }

.view-toggle {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  padding-top: 15px;
  padding-left: 15px;

}

@media (max-width: 768px) {
    .view-toggle {
      display: flex;
      gap: .5rem;
      flex-wrap: wrap;
      padding-top: 10px;
      padding-left: 50px;
    }
}

/* ── Village Map ─────────────────────────────────────────────── */
.village-map-wrapper {
  width: 100%;
/*
  border: 1px solid var(--border);
  border-radius: var(--radius);
*/
  overflow: hidden;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(90,58,16,.3);
}

.village-map {
  position: relative;
  width: 100%;
  /* maintain 4:3 aspect ratio */
  aspect-ratio: 4 / 3;
  background-image: url('../images/village_background.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-color: #2a3a1a; /* fallback */
}
@media (max-width: 768px) {
    .village-map {
      position: relative;
      width: 120%;
      /* maintain 4:3 aspect ratio */
      aspect-ratio: 4 / 3;
      background-image: url('../images/village_background.png');
      background-size: cover;
      background-position: center;
      background-repeat: no-repeat;
      background-color: #2a3a1a; /* fallback */
      margin-left: -40px;
    }
}

/* ── Individual Building Slots ──────────────────────────────── */
.village-building {
  position: absolute;
  transform: translate(-50%, -50%);
  cursor: pointer;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 2;
  transition: transform .15s;
}
.village-building:hover { transform: translate(-50%, -50%) scale(1.1); z-index: 10; }

/*
.village-building img {

  width: clamp(32px,11vw, 160px);
  height: clamp(32px, 11vw, 160px);
  object-fit: contain;
  display: block;
}

*/

/* Desktop standaard */
.village-building img {
  width: clamp(32px,11vw, 160px);
  height: clamp(32px, 11vw, 160px);
  object-fit: contain;
  display: block;
}

/* Mobiel (max 768px) */
@media (max-width: 768px) {
  .village-building img {
    width: 80px;
    height: 80px;
  }
}

/* Zeer kleine schermen (max 480px) */
@media (max-width: 480px) {
  .village-building img {
    width: 70px;
    height: 70px;
  }
}




.bld-label {
  background: rgba(0,0,0,.7);
  color: var(--gold);
  font-size: clamp(8px, 1.1vw, 11px);
  padding: 1px 4px;
  border-radius: 3px;
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
  line-height: 1.3;
  margin-top: 2px;
  border: 1px solid rgba(232,200,74,.3);
}

.village-building.not-built .bld-label { color: var(--text-dim); }

.empty-plot {
  width: clamp(24px, 4vw, 48px);
  height: clamp(24px, 4vw, 48px);
  border: 2px dashed rgba(232,200,74,.3);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.3);
}
.empty-plot span {
  color: rgba(232,200,74,.4);
  font-size: clamp(14px, 2.5vw, 24px);
  font-weight: 700;
  line-height: 1;
}
.village-building:hover .empty-plot {
  border-color: var(--gold);
  background: rgba(232,200,74,.1);
}
.village-building:hover .empty-plot span { color: var(--gold); }

.queue-badge {
  position: absolute;
  top: -4px;
  right: -8px;
  background: var(--gold);
  color: #000;
  font-size: 9px;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

/* ── Queue Section ───────────────────────────────────────────── */
.queue-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}
.queue-section h3 { color: var(--gold); margin-bottom: .6rem; font-size: .95rem; font-family: var(--font-title); letter-spacing: .05em; }
.queue-empty { color: var(--text-dim); font-size: .9rem; font-style: italic; }

.queue-list { list-style: none; display: flex; flex-direction: column; gap: .35rem; }
.queue-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-panel);
  padding: .45rem .75rem;
  border-radius: 4px;
  border-left: 3px solid var(--gold-dark);
  font-size: .88rem;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.02);
}
.queue-item:hover { border-left-color: var(--gold); }
.queue-timer { color: var(--gold); font-family: monospace; font-size: .9rem; letter-spacing: .03em; }

/* ── Production Summary ──────────────────────────────────────── */
.production-summary {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  overflow-x: auto;
  box-shadow: var(--shadow);
}
.production-summary h3 { color: var(--gold); margin-bottom: .6rem; font-size: .95rem; font-family: var(--font-title); letter-spacing: .05em; }

.prod-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}
.prod-table th, .prod-table td {
  padding: .4rem .65rem;
  text-align: left;
  border-bottom: 1px solid var(--border-soft);
}
.prod-table th { color: var(--gold); font-weight: 600; font-family: var(--font-title); font-size: .8rem; letter-spacing: .04em; background: rgba(0,0,0,.2); }
.prod-table td:not(:first-child) { text-align: right; }
.prod-table tr:nth-child(even) td { background: rgba(255,255,255,.02); }
.prod-table tr:hover td { background: var(--gold-glow); }
.prod-table small { color: var(--text-dim); font-size: .8em; }

/* ── Build Page ──────────────────────────────────────────────── */
.build-page { max-width: 800px; margin: 0 auto; }
.back-link { display: inline-block; margin-bottom: 1rem; font-size: .85rem; color: var(--text-dim); }
.back-link:hover { color: var(--gold); }

.build-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}
.build-header {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.build-img {
  width: 96px;
  height: 96px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.6));
}
.build-title h2 { color: var(--gold); margin-bottom: .25rem; }
.build-level { color: var(--text-dim); font-size: .85rem; margin-bottom: .5rem; }
.build-desc  { font-size: .88rem; color: var(--text-dim); }

.build-upgrade h3 { color: var(--gold); margin-bottom: .75rem; font-size: .95rem; }
.build-time { color: var(--text-dim); font-size: .85rem; margin: .5rem 0; }
.not-enough { color: var(--red); font-size: .9rem; margin-top: .5rem; }
.wait-time  { color: var(--text-dim); font-size: .85rem; }

/* Cost grid */
.cost-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .5rem;
  margin-bottom: .75rem;
}
@media (min-width: 480px) {
  .cost-grid { grid-template-columns: repeat(4, 1fr); }
}
.cost-item {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: .4rem .6rem;
  font-size: .85rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cost-item.ok   { border-color: var(--green); }
.cost-item.short{ border-color: var(--red);   }
.cost-label { font-size: .78rem; color: var(--text-dim); }
.cost-need  { font-weight: 700; color: var(--text-light); }
.cost-have  { font-size: .78rem; color: var(--text-dim); }
.cost-item.short .cost-need { color: var(--red); }

.build-in-progress {
  background: rgba(232,200,74,.08);
  border: 1px solid var(--gold-dark);
  border-radius: 6px;
  padding: .75rem 1rem;
  text-align: center;
}
.build-in-progress .queue-timer { font-size: 1.4rem; color: var(--gold); font-family: monospace; }

/* Level table */
.level-table-section { margin-top: 1.5rem; }
.level-table-section h3 { color: var(--gold); margin-bottom: .5rem; font-size: .95rem; }
.level-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
  overflow-x: auto;
  display: block;
}
.level-table th, .level-table td {
  padding: .3rem .5rem;
  border-bottom: 1px solid var(--border);
  text-align: right;
  white-space: nowrap;
}
.level-table th:first-child, .level-table td:first-child { text-align: left; }
.level-table th { color: var(--gold); }
.level-table tr.highlight   { background: rgba(232,200,74,.12); }
.level-table tr.row-current { background: rgba(255,255,255,.04); }
.level-table-scroll { overflow-x: auto; }

/* Level badges inside table */
.lvl-badge {
  display: inline-block;
  font-size: .68rem;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
  margin-left: 3px;
  vertical-align: middle;
}
.lvl-badge.cur { background: var(--text-dim);  color: var(--bg-dark); }
.lvl-badge.nxt { background: var(--gold);       color: var(--bg-dark); }

/* ── Level bar in build header ───────────────────────────────── */
.build-level-bar {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-wrap: wrap;
  margin: .4rem 0;
}
.build-level-label { font-size: .75rem; color: var(--text-dim); margin-right: 2px; }
.build-level-num   { font-size: .82rem; color: var(--text-dim); margin-left: 4px; }

.lvl-pip {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  border: 1px solid var(--border);
  background: var(--bg-dark);
  flex-shrink: 0;
}
.lvl-pip.filled { background: var(--gold-dark); border-color: var(--gold); }
.lvl-pip.next   { border-color: var(--gold); border-style: dashed; }

.build-current-effect { font-size: .85rem; color: var(--green); margin-bottom: .25rem; }

/* Upgrade effect preview in header */
.upgrade-effect-preview {
  font-size: .8rem;
  font-weight: 400;
  color: var(--green);
  margin-left: .5rem;
}

.build-effect-preview { font-size: .82rem; color: var(--text-dim); margin-top: .3rem; }
.build-time-detail    { font-size: .78rem; color: var(--text-dim); margin-left: .3rem; }

/* Tribe queue note */
.tribe-queue-note {
  font-size: .82rem;
  padding: .4rem .75rem;
  border-radius: 4px;
  margin-bottom: 1rem;
  border: 1px solid;
}
.tribe-queue-note.roman { background: rgba(42,74,138,.15); border-color: #4a6aaa; color: #9ab0e0; }

/* ── Demolish section ────────────────────────────────────────── */
.demolish-section {
  margin-top: 1.5rem;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}
.demolish-toggle {
  cursor: pointer;
  color: var(--red);
  font-size: .88rem;
  list-style: none;
  user-select: none;
}
.demolish-toggle:hover { color: #e05050; }
.demolish-body {
  margin-top: .75rem;
  padding: .75rem;
  background: rgba(192,48,48,.08);
  border: 1px solid rgba(192,48,48,.3);
  border-radius: 4px;
}
.demolish-body p { font-size: .88rem; margin-bottom: .4rem; }
.demolish-warning { color: var(--red); font-size: .82rem; }
.demolish-locked  { font-size: .8rem; color: var(--text-dim); margin-top: 1rem; }

.btn-demolish {
  background: rgba(192,48,48,.2);
  border: 1px solid var(--red);
  color: #f08080;
  margin-top: .5rem;
}
.btn-demolish:hover { background: rgba(192,48,48,.35); color: #fff; }

/* ── Queue icon ──────────────────────────────────────────────── */
.queue-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
  border-radius: 2px;
  flex-shrink: 0;
}
.queue-item { gap: .6rem; }
.queue-item small { display: block; font-size: .75rem; color: var(--text-dim); }

.queue-slots-info {
  font-size: .78rem;
  font-weight: 400;
  color: var(--text-dim);
  margin-left: .5rem;
}

/* ── Buildings List View ─────────────────────────────────────── */
.buildings-list-page { display: flex; flex-direction: column; gap: 1rem; }

.blist-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  overflow-x: auto;
  box-shadow: var(--shadow);
}
.blist-section h3 { color: var(--gold); margin-bottom: .6rem; font-size: .95rem; font-family: var(--font-title); letter-spacing: .05em; }

.blist-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .84rem;
}
.blist-table th, .blist-table td {
  padding: .38rem .55rem;
  border-bottom: 1px solid var(--border-soft);
  text-align: left;
  white-space: nowrap;
}
.blist-table th { color: var(--gold); font-weight: 600; font-family: var(--font-title); font-size: .78rem; letter-spacing: .04em; background: rgba(0,0,0,.2); }
.blist-table tr:nth-child(even) td { background: rgba(255,255,255,.015); }
.blist-table tr:hover td { background: var(--gold-glow); }

.blist-name { display: flex; align-items: center; gap: .4rem; }
.blist-icon {
  width: 26px;
  height: 26px;
  object-fit: contain;
  flex-shrink: 0;
}
.blist-level { text-align: center; }
.blist-cost  { color: var(--text-dim); font-size: .8rem; }
.blist-time  { color: var(--text-dim); font-size: .8rem; }
.blist-effect { color: var(--green); font-size: .82rem; }
.blist-action { text-align: center; }

.blist-timer { font-family: monospace; font-size: .9rem; color: var(--gold); }

.brow-unbuilt td { color: var(--text-dim); }
.brow-unbuilt .blist-name a { color: var(--text-dim); }
.brow-inqueue { background: rgba(232,200,74,.06); }
.brow-maxed   { background: rgba(90,154,58,.05); }
.brow-maxed td { color: var(--text-dim); }

/* Field slot badges */
.field-slot-badge {
  display: inline-block;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
  font-size: .78rem;
  margin: 1px;
  color: var(--text);
  text-decoration: none;
}
.field-slot-badge:hover { border-color: var(--gold); color: var(--gold); }
.field-slot-badge.in-queue { border-color: var(--gold-dark); color: var(--gold); }
.field-slot-badge.maxed    { border-color: var(--green); color: var(--green); }

.maxed-label  { color: var(--green); font-size: .8rem; }
.unbuilt-label{ color: var(--text-dim); }
.locked-label { font-size: 1rem; }

.btn-sm {
  padding: .2rem .55rem;
  font-size: .78rem;
  border-radius: 3px;
}

.text-dim { color: var(--text-dim); }

/* Production table: full-in column */
.prod-table td:last-child { text-align: right; color: var(--text-dim); font-size: .82rem; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 700px) {
  .header-top { gap: .5rem; }
  .res-bar { gap: .25rem; }
  .res-item { min-width: unset; padding: .15rem .35rem; font-size: .75rem; }
  .res-prod { display: none; }
  .village-map { aspect-ratio: 1 / 1; }
  .build-header { flex-direction: column; }
}
@media (max-width: 480px) {
  .res-bar { display: none; }
  .header-top { flex-wrap: wrap; }
}

@media (min-width: 601px) {
  .village-map { aspect-ratio: 4 / 3; }
}

/* ── Phase 3: Training & Troops ─────────────────────────────── */

/* Training page */
.train-page { max-width: 900px; margin: 0 auto; display: flex; flex-direction: column; gap: 1rem; }

.train-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
}
.train-bld-img { width: 72px; height: 72px; object-fit: contain; flex-shrink: 0; }
.train-header h2 { color: var(--gold); margin-bottom: .25rem; }
.train-sub { color: var(--text-dim); font-size: .88rem; }
.bld-lvl-badge {
  font-size: .72rem; font-weight: 600;
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: 3px; padding: 2px 6px;
  color: var(--text-dim); vertical-align: middle; margin-left: .35rem;
}

/* Training queue box */
.train-queue-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
}
.train-queue-box h3 { color: var(--gold); margin-bottom: .5rem; font-size: 1rem; }
.queue-count-badge {
  font-size: .75rem; font-weight: 400;
  background: var(--gold-dark); color: #fff;
  border-radius: 10px; padding: 1px 8px; margin-left: .4rem;
}

.train-queue-list { list-style: none; display: flex; flex-direction: column; gap: .35rem; }
.train-queue-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  background: var(--bg-panel);
  padding: .35rem .75rem;
  border-radius: 4px;
  border-left: 3px solid var(--border);
  font-size: .88rem;
}
.train-queue-item.active-batch { border-left-color: var(--gold); }
.tq-name  { color: var(--text-light); font-weight: 600; }
.tq-count { color: var(--gold); font-weight: 700; }
.tq-next  { color: var(--text-dim); font-size: .82rem; }
.tq-finish{ color: var(--text-dim); font-size: .82rem; margin-left: auto; }

.queue-finish-note { font-size: .82rem; color: var(--text-dim); margin-top: .4rem; }

/* Unit training cards */
.units-train-list h3 { color: var(--gold); margin-bottom: .75rem; font-size: 1rem; }

.unit-train-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: .75rem;
  transition: border-color .15s;
}
.unit-train-card:hover { border-color: var(--gold-dark); }

.utc-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: .6rem;
}
.utc-header h4 { color: var(--text-light); margin-bottom: 0; font-size: .98rem; }
.at-home-note { font-size: .78rem; color: var(--text-dim); }

/* Unit stats grid */
.unit-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .35rem .5rem;
  margin-bottom: .6rem;
}
@media (min-width: 500px) { .unit-stats-grid { grid-template-columns: repeat(6, 1fr); } }
.ustat {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: .25rem .4rem;
  text-align: center;
}
.ustat-label { display: block; font-size: .68rem; color: var(--text-dim); }
.ustat strong { font-size: .92rem; color: var(--text-light); }

/* Unit cost row */
.unit-cost-row {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1rem;
  font-size: .84rem;
  margin-bottom: .6rem;
  color: var(--text-dim);
}
.unit-cost-row span { white-space: nowrap; }

/* Train form */
.train-form { display: flex; flex-direction: column; gap: .4rem; }
.train-input-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .35rem;
}
.qty-input {
  width: 70px;
  background: #120e06;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-light);
  padding: .3rem .5rem;
  font-size: .95rem;
  text-align: center;
}
.qty-input:focus { border-color: var(--gold-dark); outline: none; }
.qty-max { font-size: .74rem !important; }

.train-total-cost {
  font-size: .82rem;
  color: var(--text-dim);
  padding: .2rem 0;
}
.train-total-cost .neg { color: var(--red); font-weight: 700; }

.btn-train {
  align-self: flex-start;
  padding: .4rem 1.2rem;
  font-size: .9rem;
}
.btn-train:disabled { opacity: .4; cursor: not-allowed; }

/* Troops home summary on train page */
.troops-home-summary {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
}
.troops-home-summary h3 { color: var(--gold); margin-bottom: .6rem; font-size: 1rem; }
.troops-grid { display: flex; flex-wrap: wrap; gap: .5rem; }
.troop-home-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .2rem;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: .4rem .6rem;
  font-size: .78rem;
  min-width: 64px;
  text-align: center;
}
.troop-home-card .troop-count { color: var(--gold); font-size: 1rem; }

/* ── Troops overview page ──────────────────────────────────── */
.troops-page { display: flex; flex-direction: column; gap: 1rem; }
.page-title { color: var(--gold); font-size: 1.3rem; }

.troops-summary-bar {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}
.tsb-item {
  flex: 1 1 120px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .6rem .9rem;
  display: flex;
  flex-direction: column;
  gap: .2rem;
}
.tsb-label { font-size: .74rem; color: var(--text-dim); }
.tsb-item strong { font-size: 1.1rem; color: var(--text-light); }

.troops-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
}
.troops-section h3 { color: var(--gold); margin-bottom: .6rem; font-size: 1rem; }

.training-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .6rem;
}
.training-section-header h3 { margin-bottom: 0; display: flex; align-items: center; gap: .4rem; }

.troops-full-table-wrap, .unit-ref-scroll { overflow-x: auto; }
.troops-full-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .83rem;
  white-space: nowrap;
}
.troops-full-table th, .troops-full-table td {
  padding: .3rem .55rem;
  border-bottom: 1px solid var(--border);
  text-align: right;
}
.troops-full-table th:first-child,
.troops-full-table td:first-child { text-align: left; }
.troops-full-table th { color: var(--gold); }
.troops-total-row td { font-weight: 700; border-top: 2px solid var(--border); }

.troop-name-cell { display: flex; align-items: center; gap: .4rem; }
.scout-badge {
  font-size: .65rem; font-weight: 700;
  background: var(--blue); color: #fff;
  border-radius: 3px; padding: 1px 4px;
}

/* Unit images */
.unit-img-sm { width: 36px; height: 36px; object-fit: contain; flex-shrink: 0; }
.unit-img-xs { width: 22px; height: 22px; object-fit: contain; flex-shrink: 0; }
.unit-img-placeholder {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  color: var(--gold); font-weight: 700;
  flex-shrink: 0;
}
.unit-img-placeholder       { width: 36px; height: 36px; font-size: 1.1rem; }
.unit-img-placeholder.xs    { width: 22px; height: 22px; font-size: .8rem; }

/* ── Overview troops panel ─────────────────────────────────── */
.troops-overview-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
}
.top-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .5rem;
}
.top-header-row h3 { color: var(--gold); font-size: 1rem; margin: 0; }

.troops-mini-grid { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .5rem; }
.troop-mini-item {
  display: flex; align-items: center; gap: .3rem;
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: 4px; padding: .25rem .5rem; font-size: .82rem;
}
.troop-mini-item span { color: var(--text-dim); }
.troop-mini-item strong { color: var(--gold); }
.troop-mini-training {
  display: flex; align-items: center;
  background: rgba(232,200,74,.08); border: 1px solid var(--gold-dark);
  border-radius: 4px; padding: .25rem .5rem;
  font-size: .82rem; color: var(--gold);
}

.train-mini-queue { list-style: none; font-size: .82rem; color: var(--text-dim); }
.train-mini-queue li { padding: .15rem 0; }
.train-mini-queue a { color: var(--gold); }

/* Build page: train shortcut */
.train-shortcut {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1rem;
  padding: .75rem 1rem;
  background: rgba(90,154,58,.08);
  border: 1px solid rgba(90,154,58,.3);
  border-radius: 6px;
}
.train-queued-note { font-size: .82rem; color: var(--gold); }

/* ── Phase 4: World Map (isometric) ─────────────────────────── */
.map-page { padding: .5rem 1rem 1rem; }

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

      padding: 0px;

    }

}



.map-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: .6rem;
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: 6px; padding: .5rem .9rem; margin-bottom: .5rem;
}
.map-search-form { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.map-search-form label { display: flex; align-items: center; gap: .3rem; font-size: .85rem; color: var(--text-dim); }
.map-search-form input[type="number"] {
  width: 64px; padding: .28rem .4rem;
  background: var(--bg-dark); border: 1px solid var(--border);
  color: var(--text-light); border-radius: 4px; font-size: .88rem;
}
.map-coords-display { color: var(--text-dim); font-size: .88rem; margin-left: auto; }

/* Zoom controls */
.map-zoom-ctrl { display: flex; align-items: center; gap: .3rem; }
#zoom-label    { font-size: .82rem; color: var(--text-dim); min-width: 3.4em; text-align: center; }

/* Legend */
.map-legend { font-size: .8rem; color: var(--text-dim); display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.leg        { font-size: 1rem; }
.leg.own    { color: rgba(255,140,0,.9); }
.leg.ally   { color: rgba(50,210,80,.9); }
.leg.nap    { color: rgba(26,154,74,.9); }
.leg.enemy  { color: rgba(220,50,50,.9); }

/* ── Isometric viewport ────────────────────────────────────── */
.map-viewport {
  position: relative;
  overflow: hidden;
  height: calc(100vh - 210px);
  min-height: 380px;
  background: #d7e6b5;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}
/*
@media (max-width: 768px) {

    .map-viewport  {

      position: relative;
      overflow: hidden;
      height: calc(100vh - 0px);
      min-height: 380px;
      background: #d7e6b5;
      border: 0px solid var(--border);
      border-radius: 0px;
      cursor: grab;
      user-select: none;
      -webkit-user-select: none;


    }
}
*/



.map-viewport:active { cursor: grabbing; }

/* Tile stage – the only element that gets translated during pan */
#map-stage {
  position: absolute;
  inset: 0;
  will-change: transform;
}

/* Coord label overlay – sibling of stage, NEVER translated */
#map-coord-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;   /* clip labels that fall just outside the viewport */
  z-index: 10;
}

/* ── Individual isometric tile ─────────────────────────────── */
.map-iso-tile {
  position: absolute;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  cursor: pointer;
}
.map-iso-tile.tile-hover { filter: brightness(1.22); }
.map-iso-tile.tile-is-origin { outline: 2px solid rgba(255,255,255,.25); outline-offset: -6px; }

/* Village name label inside tile */
.iso-tile-lbl {
  position: absolute;
  bottom: 3px; left: 2px; right: 2px;
  text-align: center;
  font-size: 8px; line-height: 1.2;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,1), 0 0 4px rgba(0,0,0,.8);
  pointer-events: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Coordinate labels (inside #map-coord-overlay, position: absolute relative to overlay) */
.map-coord-lbl {
  position: absolute;
  font-size: 9px; font-family: monospace; font-weight: 700;
  background: rgba(0,0,0,.55);
  padding: 1px 3px; border-radius: 3px;
  pointer-events: none; white-space: nowrap;
}
.map-coord-x { color: rgba(200,220,255,.9); }
.map-coord-y { color: rgba(210,255,200,.9); }

/* Loading / error */
.map-loading, .map-error {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; color: var(--text-dim);
}
.map-error { color: #e55; }

/* ── Minimap ──────────────────────────────────────────────── */
#map-minimap {
  position: absolute;
  bottom: .6rem; left: .6rem;
  width:  160px; height: 160px;
  border: 1px solid rgba(90,58,16,.65);
  border-radius: 5px;
  cursor: pointer;
  z-index: 30;
  background: #141e0d;
  box-shadow: 0 2px 12px rgba(0,0,0,.7);
}
#map-minimap:hover { border-color: var(--gold-dark); }

/* ── Tile popup ───────────────────────────────────────────── */
.tile-popup-backdrop {
  /* position:fixed only when visible — hidden fixed elements break Android Chrome */
  background: rgba(0,0,0,.50);
  z-index: 300;
}
.tile-popup-backdrop[hidden] { display: none; }
.tile-popup-backdrop:not([hidden]) { position: fixed; inset: 0; }

.tile-popup {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(10,8,4,.92);
  border: 1px solid var(--gold-dark);
  border-radius: 10px;
  min-width: 260px; max-width: 340px; width: 90%;
  box-shadow: 0 8px 40px rgba(0,0,0,.85);
  z-index: 301;
  overflow: hidden;
}
.tile-popup[hidden] { display: none; }

.tile-popup-close {
  position: absolute; top: .55rem; right: .7rem;
  background: none; border: none;
  color: var(--text-dim); cursor: pointer;
  font-size: 1.1rem; line-height: 1; padding: 2px 5px;
  border-radius: 4px; transition: color .15s, background .15s;
}
.tile-popup-close:hover { color: var(--gold); background: rgba(255,255,255,.06); }

/* Header strip */
.tp-header {
  display: flex; align-items: center; gap: .75rem;
  padding: .9rem 1rem .7rem;
  border-bottom: 1px solid var(--border-soft);
}
.tp-header.tp-village { background: linear-gradient(135deg, rgba(80,50,10,.6), rgba(30,18,4,.8)); }
.tp-header.tp-oasis   { background: linear-gradient(135deg, rgba(10,50,20,.7), rgba(4,20,8,.8)); }
.tp-icon { font-size: 2rem; line-height: 1; }
.tp-title {
  font-size: 1.05rem; font-weight: 700;
  color: var(--gold); margin-bottom: .2rem;
}
.tp-coords { font-size: .78rem; color: var(--text-dim); font-family: monospace; }

/* Data rows */
.tp-body { padding: .65rem 1rem .5rem; display: flex; flex-direction: column; gap: .35rem; }
.tp-row  { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; font-size: .88rem; }
.tp-lbl  { color: var(--text-dim); flex-shrink: 0; }
.tp-val  { color: var(--text-light); text-align: right; }
.tp-bonus { color: #5de87a; font-weight: 600; }

/* Action buttons */
.tp-actions {
  padding: .55rem 1rem .8rem;
  display: flex; gap: .5rem; flex-wrap: wrap;
  border-top: 1px solid var(--border-soft);
}

@media (max-width: 600px) {
  .map-viewport {
    height: calc(100vh - 0px);
    min-height: 300px;
    border: 0px solid var(--border);
    border-radius: 0px;
  }
  #map-minimap  { 
    width: 80px; 
    height: 80px;
    left: 10px;
    bottom: 70px;
  }
  .tile-popup   {
    max-width: none;
    width: calc(100% - 4rem);
  }
  .game-header{
    display: none;
  }
}

/* ── Phase 4: Rally Point ────────────────────────────────────── */
.rally-page { max-width: 760px; margin: 0 auto; padding: 1rem; }
.rally-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 8px; padding: 1.5rem;
}
.rally-card h2 { color: var(--gold); margin-bottom: .5rem; }
.rally-village { color: var(--text-dim); font-size: .9rem; margin-bottom: 1rem; }

.rally-section { margin: 1.2rem 0; }
.rally-section h3 { color: var(--gold-dark); font-size: 1rem; margin-bottom: .5rem; border-bottom: 1px solid var(--border); padding-bottom: .3rem; }

.coord-inputs {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
}
.coord-inputs label { display: flex; align-items: center; gap: .3rem; color: var(--text); }
.coord-inputs input[type="number"] {
  width: 80px; padding: .35rem .5rem;
  background: var(--bg-dark); border: 1px solid var(--border);
  color: var(--text-light); border-radius: 4px;
}
.coord-sep { color: var(--gold); font-weight: 700; font-size: 1.1rem; }

.move-type-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .5rem;
}
.move-type-card {
  display: flex; flex-direction: column; align-items: center; gap: .2rem;
  padding: .7rem .5rem; border: 1px solid var(--border); border-radius: 6px;
  cursor: pointer; transition: border-color .15s, background .15s;
  background: var(--bg-panel); text-align: center;
}
.move-type-card input[type="radio"] { display: none; }
.move-type-card:hover, .move-type-card.selected {
  border-color: var(--gold); background: #2a1f0e;
}
.mt-icon  { font-size: 1.5rem; }
.mt-label { font-weight: 700; color: var(--gold); font-size: .9rem; }
.mt-desc  { font-size: .72rem; color: var(--text-dim); }

.rally-troops-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .5rem;
}
.rally-troop {
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: 6px; padding: .6rem; display: flex; flex-direction: column; gap: .25rem;
}
.rally-troop-empty { opacity: .5; }
.rally-troop-name  { font-weight: 700; color: var(--gold); font-size: .85rem; }
.rally-troop-stats { display: flex; flex-wrap: wrap; gap: .3rem; font-size: .72rem; color: var(--text-dim); }
.rally-troop-avail { font-size: .8rem; color: var(--text); }
.rally-troop-input { display: flex; align-items: center; gap: .25rem; flex-wrap: wrap; }
.rally-troop-input input[type="number"] {
  width: 54px; padding: .25rem; text-align: center;
  background: var(--bg-dark); border: 1px solid var(--border);
  color: var(--text-light); border-radius: 4px; font-size: .85rem;
}
.btn-troop-adj, .btn-troop-all {
  padding: .2rem .45rem; background: var(--bg-dark); border: 1px solid var(--border);
  color: var(--gold); border-radius: 4px; cursor: pointer; font-size: .8rem;
}
.btn-troop-adj:hover, .btn-troop-all:hover { background: var(--border); }

.rally-preview {
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: 6px; padding: .6rem 1rem;
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem;
}
.preview-label { color: var(--text-dim); font-size: .85rem; }
.rally-preview strong { color: var(--gold); font-size: .95rem; }
.rally-no-troops { color: var(--text-dim); font-style: italic; }

.btn-send-troops {
  margin-top: 1rem; width: 100%; padding: .75rem;
  font-size: 1rem; font-weight: 700; letter-spacing: .5px;
}

.rally-outgoing { margin-top: 1.5rem; border-top: 1px solid var(--border); padding-top: 1rem; }
.rally-outgoing h3 { color: var(--gold-dark); margin-bottom: .5rem; }

/* ── Phase 4: Movements page ─────────────────────────────────── */
.movements-page { max-width: 900px; margin: 0 auto; padding: 1rem; }
.movements-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem;
}
.movements-header h2 { color: var(--gold); }

.mov-section {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 8px; padding: 1rem; margin-bottom: 1rem;
}
.mov-section h3 { color: var(--gold-dark); margin-bottom: .6rem; border-bottom: 1px solid var(--border); padding-bottom: .3rem; }
.mov-empty { color: var(--text-dim); font-style: italic; font-size: .9rem; }

.movements-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.movements-table th {
  text-align: left; padding: .4rem .6rem;
  color: var(--gold); border-bottom: 1px solid var(--border);
  font-family: var(--font-title); font-size: .78rem; letter-spacing: .04em;
  background: rgba(0,0,0,.2);
}
.movements-table td { padding: .4rem .6rem; border-bottom: 1px solid var(--border-soft); color: var(--text); }
.movements-table tr:last-child td { border-bottom: none; }
.movements-table tr:nth-child(even) td { background: rgba(255,255,255,.015); }
.movements-table tr:hover td { background: var(--gold-glow); }
.mov-hostile td { color: #e07050; }
.mov-hostile td:first-child::before { content: '⚠️ '; }

.mov-troops-cell { display: flex; flex-wrap: wrap; gap: .25rem; }
.mov-troop-chip {
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: 3px; padding: .1rem .35rem; font-size: .78rem; color: var(--text-light);
}

.incoming-attack-badge {
  display: inline-block; background: #5a1010; color: #ff9090;
  border-radius: 12px; padding: .15rem .6rem; font-size: .8rem; font-weight: 700; margin-left: .5rem;
}

.oasis-list { list-style: none; display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: .5rem; }
.oasis-list li {
  background: var(--bg-panel); border: 1px solid #2a5a2a;
  border-radius: 4px; padding: .2rem .5rem; font-size: .85rem; color: #8dda6a;
}
.oasis-bonus-note { font-size: .85rem; color: var(--text-dim); }

/* ── Phase 4: Reports ────────────────────────────────────────── */
.reports-page { max-width: 860px; margin: 0 auto; padding: 1rem; }
.reports-page h2 { color: var(--gold); margin-bottom: 1rem; }
.badge-unread {
  display: inline-block; background: var(--gold-dark); color: var(--bg-dark);
  border-radius: 12px; padding: .1rem .55rem; font-size: .78rem; margin-left: .5rem;
}

.reports-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.reports-table th {
  text-align: left; padding: .42rem .6rem;
  background: rgba(0,0,0,.2); color: var(--gold); border-bottom: 1px solid var(--border);
  font-family: var(--font-title); font-size: .78rem; letter-spacing: .04em;
}
.reports-table td { padding: .42rem .6rem; border-bottom: 1px solid var(--border-soft); color: var(--text); }
.reports-table tr:last-child td { border-bottom: none; }
.reports-table tr:nth-child(even) td { background: rgba(255,255,255,.015); }
.reports-table tr:hover td { background: var(--gold-glow); }
.report-unread td { color: var(--text-light); font-weight: 600; }
.report-unread td:first-child::before { content: '● '; color: var(--gold); }

.report-pill {
  display: inline-block; border-radius: 10px; padding: .1rem .5rem; font-size: .78rem; font-weight: 700;
}
.report-pill.gain    { background: #1a3a12; color: #8dda6a; }
.report-pill.loss    { background: #3a1210; color: #e08070; }
.report-pill.scout   { background: #1a2a3a; color: #6ab0e0; }
.report-pill.neutral { background: var(--bg-panel); color: var(--text-dim); }

.report-detail {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 8px; padding: 1.2rem;
}
.report-detail-header h3 { color: var(--gold); margin-bottom: .3rem; }
.report-time  { color: var(--text-dim); font-size: .85rem; margin-bottom: .3rem; }
.report-note  { color: var(--text-dim); font-style: italic; }
.report-section { margin-top: 1rem; }
.report-section h4 { color: var(--gold-dark); font-size: .9rem; margin-bottom: .4rem; }
.report-buildings { display: flex; flex-wrap: wrap; gap: .25rem; }
.report-total-plunder { margin-top: .4rem; font-weight: 700; color: var(--gold); }

/* ── Incoming attack alert ───────────────────────────────────── */
.incoming-attack-alert {
  font-size: .95rem; border-color: #7a2020 !important;
  background: #2a0e0e !important; animation: pulse-border 1.5s ease-in-out infinite;
}
.incoming-attack-alert a { color: var(--gold); font-weight: 700; }
@keyframes pulse-border {
  0%, 100% { border-color: #7a2020; }
  50%       { border-color: #cc4040; }
}

/* ── Phase 5: Battle Simulator ──────────────────────────────── */
.simulator-page { max-width: 1100px; margin: 0 auto; padding: 1rem; }
.simulator-header { margin-bottom: 1rem; }
.simulator-header h2 { color: var(--gold); }
.sim-desc { color: var(--text-dim); font-size: .88rem; }

.sim-result {
  border-radius: 8px; padding: 1.2rem; margin-bottom: 1.5rem;
  border: 2px solid var(--border);
}
.result-win  { background: #1a2e14; border-color: var(--green); }
.result-lose { background: #2e1414; border-color: #7a2020; }

.sim-result-headline { font-size: 1.3rem; margin-bottom: .8rem; color: var(--text-light); }
.result-win  .sim-result-headline { color: #8dda6a; }
.result-lose .sim-result-headline { color: #e08070; }

.sim-power-bar {
  display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem;
  flex-wrap: wrap;
}
.sim-vs { font-size: 1.2rem; color: var(--text-dim); font-weight: 700; }
.sim-power-item { display: flex; flex-direction: column; gap: .1rem; }
.spi-label { font-size: .78rem; color: var(--text-dim); }
.spi-val   { font-size: 1.3rem; font-weight: 700; }
.spi-val.att { color: #e0a050; }
.spi-val.def { color: #50a0e0; }
.spi-sub   { font-size: .75rem; color: var(--text-dim); }

.sim-sides {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1rem;
}
@media (max-width: 600px) { .sim-sides { grid-template-columns: 1fr; } }

.sim-side h3 { font-size: .95rem; margin-bottom: .4rem; color: var(--gold-dark); border-bottom: 1px solid var(--border); padding-bottom: .25rem; }
.sim-carry  { font-size: .85rem; color: var(--text-dim); margin-top: .4rem; }
.sim-damage { font-size: .85rem; color: #e08070; margin-top: .2rem; }
.sim-empty  { color: var(--text-dim); font-style: italic; font-size: .85rem; }

.sim-troop-table { width: 100%; border-collapse: collapse; font-size: .83rem; }
.sim-troop-table th { padding: .2rem .4rem; color: var(--text-dim); text-align: right; border-bottom: 1px solid var(--border); }
.sim-troop-table th:first-child { text-align: left; }
.sim-troop-table td { padding: .2rem .4rem; border-bottom: 1px solid rgba(90,58,16,.2); text-align: right; color: var(--text); }
.sim-troop-table td:first-child { text-align: left; }
.sim-troop-table.compact td, .sim-troop-table.compact th { padding: .15rem .3rem; }
.cell-loss { color: #e07050 !important; font-weight: 700; }
.cell-surv { color: #8dda6a !important; }
.cell-zero { color: var(--text-dim) !important; }

/* Simulator form */
.sim-form { margin-top: 1rem; }
.sim-columns {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem;
}
@media (max-width: 700px) { .sim-columns { grid-template-columns: 1fr; } }

.sim-col {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 8px; padding: 1rem;
}
.sim-col h3 { color: var(--gold-dark); margin-bottom: .5rem; font-size: 1rem; }
.sim-col-hint { color: var(--text-dim); font-size: .82rem; margin-bottom: .5rem; }
.sim-def-options { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin-bottom: .5rem; }
.sim-def-options label { display: flex; align-items: center; gap: .3rem; font-size: .88rem; color: var(--text); }
.sim-def-options select, .sim-def-options input {
  background: var(--bg-dark); border: 1px solid var(--border);
  color: var(--text-light); border-radius: 4px; padding: .25rem .4rem;
}

.sim-tribe-group {
  margin: .6rem 0; padding: .4rem; background: var(--bg-panel);
  border-radius: 5px; border: 1px solid var(--border);
}
.sim-tribe-label { font-size: .75rem; display: block; margin-bottom: .3rem; }
.sim-unit-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: .5rem; padding: .15rem 0;
}
.sim-unit-row label {
  flex: 1; font-size: .82rem; color: var(--text); display: flex; align-items: center; gap: .4rem;
}
.sim-unit-stats { font-size: .7rem; color: var(--text-dim); white-space: nowrap; }
.sim-unit-row input[type="number"] {
  width: 70px; padding: .2rem .3rem; text-align: right;
  background: var(--bg-dark); border: 1px solid var(--border);
  color: var(--text-light); border-radius: 4px; font-size: .83rem;
}

.sim-wall-preview { font-size: .82rem; color: #6ab0e0; margin-top: .4rem; min-height: 1.1em; }

.sim-live-bar {
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: 6px; padding: .6rem 1rem;
  display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; margin-bottom: .8rem;
}
.slb-item { display: flex; flex-direction: column; align-items: center; }
.slb-label { font-size: .75rem; color: var(--text-dim); }
.slb-item strong { font-size: 1rem; color: var(--gold); }

.btn-sim-submit { padding: .65rem 2rem; font-size: 1rem; margin-right: .5rem; }
.btn-sim-reset  {
  padding: .65rem 1.2rem; background: var(--bg-panel);
  border: 1px solid var(--border); color: var(--text); border-radius: 6px; cursor: pointer;
}
.btn-sim-reset:hover { border-color: var(--gold); color: var(--gold); }

/* Reports: Phase 5 additions */
.report-outcome-banner {
  padding: .7rem 1rem; border-radius: 6px; margin-bottom: .8rem;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem;
  font-weight: 700; font-size: 1rem;
}
.ban-att-win { background: #1a2e14; color: #8dda6a; border: 1px solid var(--green); }
.ban-def-win { background: #2e1414; color: #e08070; border: 1px solid #7a2020; }
.report-powers { font-size: .8rem; font-weight: 400; color: var(--text-dim); }

.report-casualties { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 600px) { .report-casualties { grid-template-columns: 1fr; } }
.report-cas-side h5 { color: var(--gold-dark); font-size: .88rem; margin-bottom: .3rem; }

/* Rally: catapult target */
.cat-target-select {
  background: var(--bg-dark); border: 1px solid var(--border);
  color: var(--text-light); border-radius: 4px; padding: .35rem .5rem; font-size: .9rem;
}
.badge-label {
  display: inline-block; background: #3a2810; border: 1px solid var(--gold-dark);
  color: var(--gold); border-radius: 10px; padding: .1rem .5rem; font-size: .72rem; margin-left: .4rem;
}

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

/* ══════════════════════════════════════════════════════════════
   Phase 6 styles
   ══════════════════════════════════════════════════════════════ */

/* ── Hero page ──────────────────────────────────────────────── */
.hero-page { max-width: 680px; margin: 0 auto; padding: 1rem; }
.hero-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem; margin-top: .8rem;
  box-shadow: var(--shadow);
}
.hero-header {
  display: flex; align-items: center; gap: 1.2rem; margin-bottom: 1.2rem;
}
.hero-avatar {
  position: relative; width: 70px; height: 70px; flex-shrink: 0;
  background: var(--bg-panel); border: 2px solid var(--gold-dark);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
}
.hero-avatar.hero-dead { border-color: #7a2020; filter: grayscale(60%); }
.hero-icon { font-size: 2rem; }
.hero-level-badge {
  position: absolute; bottom: -4px; left: 50%; transform: translateX(-50%);
  background: var(--gold-dark); color: var(--bg-dark);
  border-radius: 10px; padding: .05rem .4rem; font-size: .7rem; font-weight: 700; white-space: nowrap;
}
.hero-identity { display: flex; flex-direction: column; gap: .3rem; }
.hero-identity h2 { color: var(--gold); font-size: 1.2rem; margin: 0; }
.hero-status-badge {
  display: inline-block; border-radius: 10px; padding: .15rem .6rem; font-size: .8rem; font-weight: 700;
}
.status-alive { background: #1a3a12; color: #8dda6a; }
.status-dead  { background: #3a1210; color: #e08070; }

.hero-stats-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; margin-bottom: 1rem;
}
@media (max-width: 480px) { .hero-stats-grid { grid-template-columns: repeat(2, 1fr); } }
.hero-stat {
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: 6px; padding: .5rem; text-align: center;
  display: flex; flex-direction: column; gap: .15rem;
}
.hs-label { font-size: .72rem; color: var(--text-dim); }
.hs-val   { font-size: 1.1rem; font-weight: 700; color: var(--text-light); }
.hs-val.att { color: #e0a050; }
.hs-val.def { color: #50a0e0; }
.hp-low     { color: #e05050 !important; }

.hero-hp-bar-wrap, .hero-xp-wrap { margin-bottom: .8rem; }
.hero-hp-label, .hero-xp-label { font-size: .8rem; color: var(--text-dim); margin-bottom: .25rem; }
.hero-hp-bar, .hero-xp-bar {
  height: 10px; background: var(--bg-dark); border-radius: 5px;
  overflow: hidden; border: 1px solid var(--border);
}
.hero-hp-fill {
  height: 100%; border-radius: 5px; background: var(--green); transition: width .4s;
}
.hero-hp-fill.hp-fill-low { background: #e05050; }
.hero-xp-fill {
  height: 100%; border-radius: 5px; background: var(--gold-dark); transition: width .4s;
}

.hero-info-box {
  background: var(--bg-panel); border-left: 3px solid var(--gold-dark);
  border-radius: 0 6px 6px 0; padding: .75rem 1rem; margin-bottom: 1rem; font-size: .85rem;
  color: var(--text);
}
.hero-info-box p { margin: .2rem 0; }

.hero-actions {
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: 8px; padding: 1rem; margin-top: .5rem;
}
.hero-actions h3 { color: var(--gold-dark); margin-bottom: .5rem; }
.hero-healthy { text-align: center; color: #8dda6a; padding: 1rem; }

.cost-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: .4rem;
}
@media (max-width: 480px) { .cost-grid { grid-template-columns: repeat(2, 1fr); } }
.cost-item {
  background: var(--bg-dark); border: 1px solid var(--border);
  border-radius: 5px; padding: .4rem; text-align: center; font-size: .8rem;
}
.cost-item.ok    { border-color: #2a5a2a; }
.cost-item.short { border-color: #7a2020; }
.cost-label { display: block; color: var(--text-dim); margin-bottom: .15rem; }
.cost-need  { display: block; font-weight: 700; color: var(--text-light); }
.cost-have  { display: block; font-size: .72rem; color: var(--text-dim); }
.cost-have.neg { color: #e05050; }

/* ── Marketplace page ───────────────────────────────────────── */
.marketplace-page { max-width: 800px; margin: 0 auto; padding: 1rem; }
.marketplace-page h2 { color: var(--gold); margin-bottom: 1rem; }

.mp-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.2rem; margin-bottom: 1rem;
  box-shadow: var(--shadow);
}
.mp-card h3 { color: var(--gold); margin-bottom: .7rem; font-size: .95rem; font-family: var(--font-title); letter-spacing: .05em; border-bottom: 1px solid var(--border-soft); padding-bottom: .3rem; }

.mp-status {
  display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: .8rem;
}
.mp-status-item {
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: 6px; padding: .4rem .8rem; text-align: center; min-width: 100px;
}
.mp-status-item span:first-child { display: block; font-size: .72rem; color: var(--text-dim); }
.mp-status-item strong { font-size: 1.1rem; color: var(--gold); }

.mp-res-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; margin-bottom: .8rem;
}
@media (max-width: 480px) { .mp-res-grid { grid-template-columns: repeat(2, 1fr); } }
.mp-res-item {
  display: flex; flex-direction: column; gap: .2rem;
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: 5px; padding: .5rem;
}
.mp-res-item label { font-size: .78rem; color: var(--text-dim); }
.mp-res-item input[type="number"] {
  width: 100%; padding: .3rem; background: var(--bg-dark);
  border: 1px solid var(--border); color: var(--text-light);
  border-radius: 4px; font-size: .9rem;
}

.mp-dest-row {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .8rem;
}
.mp-dest-row label { font-size: .88rem; color: var(--text); }
.mp-dest-row input[type="number"] {
  width: 80px; padding: .3rem .4rem; background: var(--bg-dark);
  border: 1px solid var(--border); color: var(--text-light);
  border-radius: 4px; font-size: .9rem;
}

.mp-preview {
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: 6px; padding: .5rem .8rem; margin-bottom: .8rem;
  display: flex; flex-wrap: wrap; gap: .3rem 1rem; font-size: .85rem;
}
.mp-preview span { color: var(--text-dim); }
.mp-preview strong { color: var(--gold); }

/* ── Alliance page ──────────────────────────────────────────── */
.alliance-page { max-width: 960px; margin: 0 auto; padding: 1rem; }
.alliance-page h2 { color: var(--gold); margin-bottom: 1rem; }

.alliance-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.2rem; margin-bottom: 1rem;
  box-shadow: var(--shadow);
}
.alliance-card h3 { color: var(--gold-dark); margin-bottom: .5rem; }

.alliance-columns {
  display: grid; grid-template-columns: 2fr 1fr; gap: 1rem; align-items: start;
}
@media (max-width: 700px) { .alliance-columns { grid-template-columns: 1fr; } }

.alliance-tag {
  display: inline-block; background: #2a1f0e; border: 1px solid var(--gold-dark);
  color: var(--gold); border-radius: 4px; padding: .1rem .5rem;
  font-size: .9rem; font-weight: 700; letter-spacing: 1px; margin-right: .5rem;
}
.alliance-desc { color: var(--text-dim); font-size: .88rem; font-style: italic; margin-top: .3rem; }
.alliance-meta { font-size: .82rem; color: var(--text-dim); margin-top: .2rem; }

.alliance-role-badge {
  display: inline-block; border-radius: 10px; padding: .1rem .5rem; font-size: .75rem; font-weight: 700;
}
.role-leader  { background: #3a2810; color: var(--gold); }
.role-officer { background: #1a2a3a; color: #6ab0e0; }
.role-member  { background: var(--bg-panel); color: var(--text-dim); }

.alliance-members-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.alliance-members-table th {
  text-align: left; padding: .35rem .5rem;
  color: var(--text-dim); border-bottom: 1px solid var(--border);
}
.alliance-members-table td { padding: .35rem .5rem; border-bottom: 1px solid rgba(90,58,16,.3); }
.alliance-members-table tr:last-child td { border-bottom: none; }

.alliance-list-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.alliance-list-table th {
  text-align: left; padding: .4rem .6rem;
  background: var(--bg-panel); color: var(--text-dim); border-bottom: 1px solid var(--border);
}
.alliance-list-table td { padding: .4rem .6rem; border-bottom: 1px solid rgba(90,58,16,.3); }
.alliance-list-table tr:last-child td { border-bottom: none; }
.alliance-list-table tr:hover td { background: rgba(255,255,255,.02); }

.invite-card {
  background: #1a2e14; border: 1px solid #2a5a2a;
  border-radius: 8px; padding: 1rem; margin-bottom: 1rem;
}
.invite-card h3 { color: #8dda6a; margin-bottom: .5rem; font-size: .95rem; }

.alliance-sidebar {
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: 8px; padding: 1rem;
}
.alliance-sidebar h3 { color: var(--gold-dark); margin-bottom: .5rem; font-size: .95rem; border-bottom: 1px solid var(--border); padding-bottom: .3rem; }
.alliance-sidebar p  { font-size: .85rem; color: var(--text); margin: .3rem 0; }

/* ── Messages page ──────────────────────────────────────────── */
.messages-page { max-width: 860px; margin: 0 auto; padding: 1rem; }
.messages-page h2 { color: var(--gold); margin-bottom: .8rem; }

.msg-tabs { display: flex; gap: .4rem; margin-bottom: 1rem; flex-wrap: wrap; }

.msg-compose {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 8px; padding: 1.2rem; max-width: 560px;
}
.msg-compose h3 { color: var(--gold-dark); margin-bottom: .8rem; }
.msg-compose .form-group { margin-bottom: .7rem; }
.msg-compose label { display: block; font-size: .85rem; color: var(--text-dim); margin-bottom: .2rem; }
.msg-compose input,
.msg-compose textarea {
  width: 100%; padding: .4rem .5rem;
  background: var(--bg-dark); border: 1px solid var(--border);
  color: var(--text-light); border-radius: 4px; font-size: .9rem;
  font-family: inherit; box-sizing: border-box;
}
.msg-compose textarea { resize: vertical; }

.msg-detail {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 8px; padding: 1.2rem;
}
.msg-detail-header h3 { color: var(--gold); margin-bottom: .3rem; }
.msg-detail-header p  { font-size: .85rem; color: var(--text-dim); margin-bottom: .5rem; display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.msg-time { color: var(--text-dim); font-size: .82rem; margin-left: auto; }
.msg-body {
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: 5px; padding: .8rem 1rem;
  font-size: .9rem; color: var(--text-light); line-height: 1.6;
  white-space: pre-wrap; word-break: break-word; margin-top: .5rem;
}
.back-link { display: inline-block; color: var(--gold); font-size: .88rem; margin-bottom: .8rem; }
.back-link:hover { text-decoration: underline; }

/* ── Admin pages ────────────────────────────────────────────── */
.admin-page { max-width: 1100px; margin: 0 auto; padding: 1rem; }

.admin-header {
  display: flex; align-items: center; gap: 1rem;
  margin-bottom: 1.2rem; flex-wrap: wrap;
}
.admin-header h2 { color: var(--gold); flex: 1; min-width: 150px; }

.admin-nav { display: flex; gap: .4rem; flex-wrap: wrap; }
.admin-nav .btn { font-size: .85rem; padding: .3rem .7rem; }
.admin-nav .btn-active { background: var(--gold-dark); color: var(--bg-dark); }

.admin-stats-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: .6rem; margin-bottom: 1.2rem;
}
.admin-stat-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .8rem; text-align: center;
  display: flex; flex-direction: column; gap: .2rem;
  box-shadow: var(--shadow);
  transition: border-color .15s;
}
.admin-stat-card:hover { border-color: var(--gold-dark); }
.asc-val   { font-size: 1.6rem; font-weight: 700; color: var(--gold); }
.asc-label { font-size: .75rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: .5px; }

.admin-section {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem;
  box-shadow: var(--shadow);
}
.admin-section h3 { color: var(--gold); margin-bottom: .6rem; font-size: .9rem; font-family: var(--font-title); letter-spacing: .05em; border-bottom: 1px solid var(--border-soft); padding-bottom: .3rem; }

.admin-columns {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start;
}
@media (max-width: 700px) { .admin-columns { grid-template-columns: 1fr; } }

.admin-settings-form { display: flex; flex-direction: column; gap: .8rem; }
.admin-settings-form .form-group { display: flex; flex-direction: column; gap: .2rem; }
.admin-settings-form label { font-size: .85rem; color: var(--text-dim); }
.admin-settings-form input,
.admin-settings-form select {
  padding: .35rem .5rem; background: var(--bg-dark);
  border: 1px solid var(--border); color: var(--text-light);
  border-radius: 4px; font-size: .9rem; width: 100%; box-sizing: border-box;
}

.row-own td { background: rgba(180,130,40,.06); }

/* ══════════════════════════════════════════════════════════════
   UI POLISH LAYER
   ══════════════════════════════════════════════════════════════ */

/* ── Page fade-in ───────────────────────────────────────────── */
@keyframes page-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
/* animation removed from main — it created a compositor layer on Android Chrome
   that trapped position:fixed siblings/descendants incorrectly */

/* ── Universal panel inner glow ─────────────────────────────── */
.queue-section,
.production-summary,
.troops-overview-panel,
.troops-section,
.train-queue-box,
.troops-home-summary,
.blist-section,
.build-card,
.mov-section,
.report-detail,
.sim-col,
.unit-train-card,
.train-header {
  border-top-color: rgba(120,80,20,.9);
  box-shadow: 0 2px 14px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.035);
}

/* ── Uniform section heading ────────────────────────────────── */
.queue-section > h3,
.production-summary > h3,
.troops-overview-panel .top-header-row h3,
.troops-section h3,
.train-queue-box h3,
.troops-home-summary h3,
.blist-section h3,
.mov-section h3 {
  font-family: var(--font-title);
  font-size: .88rem;
  letter-spacing: .06em;
  color: var(--gold);
  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 {
  content: '';
  display: inline-block;
  width: 3px;
  height: 1em;
  background: linear-gradient(to bottom, var(--gold), var(--gold-dark));
  border-radius: 2px;
  flex-shrink: 0;
}

/* ── Form inputs: gold focus glow ───────────────────────────── */
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(184,148,26,.18), 0 0 10px rgba(184,148,26,.08) !important;
  outline: none !important;
}

/* ── Card hover lift ─────────────────────────────────────────── */
.unit-train-card,
.move-type-card,
.admin-stat-card,
.tsb-item,
.hero-stat {
  transition: transform .15s ease, border-color .15s, box-shadow .15s;
}
.unit-train-card:hover,
.tsb-item:hover,
.hero-stat:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,.65), inset 0 1px 0 rgba(255,255,255,.04);
}

/* ── Production mini-bars ────────────────────────────────────── */
.res-bar-cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: flex-end;
}
.res-mini-bar {
  width: 80px;
  height: 4px;
  background: rgba(255,255,255,.08);
  border-radius: 2px;
  overflow: hidden;
}
.res-mini-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width .6s ease;
}
.rmbf-wood { background: #a0622a; }
.rmbf-clay { background: #b05030; }
.rmbf-iron { background: #6080a0; }
.rmbf-crop { background: #70a030; }
.rmbf-crit { background: #c03030; }

/* ── Overview bottom grid ────────────────────────────────────── */
.overview-bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  align-items: start;
}

@media (max-width: 600px) {
    .overview-bottom-grid {
    display: none;
  }
  .overview-bottom-grid-mobile {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    align-items: start;
    z-index: 999;
    position: absolute;
    margin-top: 500px;
    padding-left: 25px;
    padding-right: 15px;
  }

}

@media (min-width: 600px) {
  .overview-bottom-grid-mobile {
    display: none;
  }

}


.overview-bottom-left  { display: flex; flex-direction: column; gap: 1rem; }
.overview-bottom-right { display: flex; flex-direction: column; gap: 1rem; }
@media (max-width: 800px) {
  .overview-bottom-grid { grid-template-columns: 1fr; }
}

/* ── Decorative page title ───────────────────────────────────── */
.page-title-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.2rem;
}
.page-title-bar h2 {
  color: var(--gold);
  font-family: var(--font-title);
  letter-spacing: .06em;
  white-space: nowrap;
}
.page-title-bar::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, var(--border), transparent);
}

/* ── Stat badge ──────────────────────────────────────────────── */
.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: .15rem .6rem;
  font-size: .78rem;
  color: var(--text-dim);
}
.stat-pill strong { color: var(--text-light); }

/* ── Building map label: cleaner hover ───────────────────────── */
.village-building .bld-label {
  opacity: .85;
  transition: opacity .15s, background .15s;
}
.village-building:hover .bld-label {
  opacity: 1;
  background: rgba(0,0,0,.85);
  border-color: rgba(232,200,74,.6);
  color: var(--gold);
}

/* ── Queue item progress pulse ───────────────────────────────── */
@keyframes queue-pulse {
  0%, 100% { border-left-color: var(--gold-dark); }
  50%       { border-left-color: var(--gold); }
}
.queue-item:first-child { animation: queue-pulse 2.5s ease-in-out infinite; }

/* ── Troop mini item polish ──────────────────────────────────── */
.troop-mini-item {
  transition: border-color .15s, background .15s;
}
.troop-mini-item:hover {
  border-color: var(--gold-dark);
  background: rgba(232,200,74,.06);
}

/* ── Login decorative lines ──────────────────────────────────── */
.auth-logo-divider {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin: .8rem 0 1.5rem;
  color: var(--text-dim);
  font-size: .72rem;
  letter-spacing: .15em;
  text-transform: uppercase;
  font-family: var(--font-title);
}
.auth-logo-divider::before,
.auth-logo-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--border), transparent);
}

/* ── Tribe card hover shimmer ────────────────────────────────── */
.tribe-card {
  transition: border-color .2s, background .2s, box-shadow .2s;
}
.tribe-option:hover .tribe-card {
  box-shadow: 0 4px 16px rgba(0,0,0,.5), 0 0 0 1px rgba(184,148,26,.2);
}
.tribe-option.selected .tribe-card {
  box-shadow: 0 4px 20px rgba(0,0,0,.6), 0 0 12px rgba(232,200,74,.12);
}

/* ── Field slot badge polish ────────────────────────────────── */
.field-slot-badge {
  transition: border-color .12s, color .12s, background .12s;
}

/* ── Reports: unread row pulse ───────────────────────────────── */
.report-unread td:first-child::before { animation: queue-pulse 3s ease-in-out infinite; }

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