:root {
  --wine: #7a0f1c; --wine-d: #5c0a14; --gold: #d4a537; --gold-l: #f0d58a;
  --parch: #f8f2e4; --parch-d: #ece1c8; --ink: #2a1d14; --muted: #6b5a48;
  --shadow: 0 10px 30px rgba(40, 20, 10, .25);
}
[hidden] { display: none !important; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font-family: Inter, system-ui, sans-serif; color: var(--ink); }
#map { position: fixed; inset: 0; background: #e8e2d4; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 10px; padding: 11px 16px; font: 600 14px Inter, sans-serif;
  cursor: pointer; text-decoration: none; transition: transform .1s, filter .15s, box-shadow .15s;
}
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: wait; }
.btn.primary { background: linear-gradient(180deg, #9b1426, var(--wine)); color: #fff; box-shadow: 0 3px 0 var(--wine-d), 0 6px 14px rgba(122,15,28,.35); }
.btn.gold { background: linear-gradient(180deg, var(--gold-l), var(--gold)); color: var(--ink); box-shadow: 0 2px 0 #a67d1f; }
.btn.icon { background: var(--parch-d); color: var(--ink); width: 40px; padding: 10px 0; font-size: 18px; }
.btn.google { background: #fff; color: #333; border: 1px solid #ddd; width: 100%; }
.link { background: none; border: 0; color: var(--wine); font: 600 13px Inter, sans-serif; cursor: pointer; padding: 4px; }
.link:hover { text-decoration: underline; }

/* ---------- Barra superior ---------- */
#topbar {
  position: fixed; top: 12px; left: 12px; right: 12px; z-index: 1000;
  display: flex; align-items: center; gap: 16px; padding: 8px 10px 8px 14px;
  background: rgba(248, 242, 228, .92); backdrop-filter: blur(10px);
  border: 1px solid rgba(212, 165, 55, .5); border-radius: 16px; box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 10px; font: 800 18px Cinzel, serif; color: var(--wine); letter-spacing: .5px; }
.crest { width: 28px; height: 32px; flex: none; }
.me { display: flex; align-items: center; gap: 10px; margin-left: auto; min-width: 0; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--wine); color: #fff; font: 800 16px Cinzel, serif; border: 2px solid #fff; box-shadow: 0 0 0 2px var(--gold);
}
.me-text { min-width: 0; line-height: 1.2; }
.me-name { font-weight: 700; font-size: 14px; }
.me-role { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.points {
  display: flex; align-items: center; gap: 5px; padding: 6px 12px; border-radius: 999px;
  background: var(--ink); color: var(--gold-l); font-size: 14px;
}
.actions { display: flex; gap: 8px; }

/* ---------- Leyenda ---------- */
#legend {
  position: fixed; left: 12px; bottom: 24px; z-index: 900; padding: 10px 14px;
  background: rgba(248, 242, 228, .92); backdrop-filter: blur(8px); border-radius: 12px;
  border: 1px solid rgba(212, 165, 55, .4); box-shadow: var(--shadow); font-size: 12px; display: grid; gap: 5px;
}
#legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--c); margin-right: 8px; }

/* ---------- Tarjetas ---------- */
#overlay {
  position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(ellipse at center, rgba(60, 10, 18, .45), rgba(30, 8, 10, .8));
  backdrop-filter: blur(3px);
}
.card {
  position: relative; width: 100%; max-width: 380px; padding: 30px 28px 24px; text-align: center;
  background: var(--parch); border-radius: 18px; box-shadow: 0 25px 60px rgba(0,0,0,.45);
  border: 1px solid var(--gold); outline: 6px solid rgba(248, 242, 228, .15);
  animation: pop .35s cubic-bezier(.2, .9, .3, 1.2);
}
.card::before {
  content: ""; position: absolute; inset: 6px; border: 1px solid rgba(212, 165, 55, .45); border-radius: 13px; pointer-events: none;
}
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.97); } }
.card h1 { margin: 6px 0 6px; font: 800 24px Cinzel, serif; color: var(--wine); }
.crest.big { width: 56px; height: 64px; filter: drop-shadow(0 4px 6px rgba(0,0,0,.25)); }
.seal {
  width: 60px; height: 60px; margin: 0 auto; display: grid; place-items: center; font-size: 28px;
  border-radius: 50%; background: var(--wine); border: 3px solid var(--gold); box-shadow: 0 4px 10px rgba(0,0,0,.25);
}
.sub { margin: 0 0 20px; color: var(--muted); font-size: 14px; line-height: 1.45; }
form { display: flex; flex-direction: column; gap: 12px; text-align: left; }
label span { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin: 0 0 5px 2px; }
input, select {
  width: 100%; padding: 11px 13px; font: 15px Inter, sans-serif; color: var(--ink);
  background: #fffdf8; border: 1px solid #d8c9a8; border-radius: 10px; outline: none; transition: border .15s, box-shadow .15s;
}
input:focus, select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(212, 165, 55, .25); }
.at { display: flex; align-items: center; background: #fffdf8; border: 1px solid #d8c9a8; border-radius: 10px; }
.at:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(212, 165, 55, .25); }
.at b { padding-left: 13px; color: var(--muted); }
.at input { border: 0; box-shadow: none !important; padding-left: 4px; }
input.code { text-align: center; font: 700 30px Inter, sans-serif; letter-spacing: 12px; padding: 12px; }
form .btn { margin-top: 4px; }
.tabs { display: flex; padding: 4px; margin-bottom: 18px; background: var(--parch-d); border-radius: 12px; }
.tabs button {
  flex: 1; padding: 9px; border: 0; border-radius: 9px; background: none; cursor: pointer;
  font: 600 14px Inter, sans-serif; color: var(--muted);
}
.tabs button.active { background: #fff; color: var(--wine); box-shadow: 0 2px 6px rgba(0,0,0,.08); }
.or { display: flex; align-items: center; gap: 10px; margin: 16px 0; color: var(--muted); font-size: 12px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: #d8c9a8; }
.links { display: flex; justify-content: space-between; margin-top: 12px; }
.error { color: #b3121f; font-size: 13px; min-height: 1em; margin: 12px 0 0; }

/* ---------- Marcadores ---------- */
.pin { position: relative; width: 40px; height: 48px; filter: drop-shadow(0 3px 3px rgba(0,0,0,.35)); transition: transform .15s; }
.pin:hover { transform: translateY(-3px) scale(1.08); }
.pin svg { width: 100%; height: 100%; }
.pin.mia::after {
  content: ""; position: absolute; left: 50%; bottom: -2px; width: 18px; height: 6px; margin-left: -9px;
  border-radius: 50%; background: rgba(212, 165, 55, .8); animation: pulse 1.6s infinite;
}
@keyframes pulse { 50% { transform: scale(2.2); opacity: 0; } }
.pin-label {
  position: absolute; top: 100%; left: 50%; transform: translateX(-50%); margin-top: 2px; white-space: nowrap;
  font: 700 11px Inter, sans-serif; color: var(--ink); background: rgba(248, 242, 228, .95);
  padding: 1px 6px; border-radius: 6px; border: 1px solid rgba(212, 165, 55, .6);
}

/* ---------- Ficha (popup) ---------- */
.leaflet-popup-content-wrapper { background: var(--parch); border: 1px solid var(--gold); border-radius: 14px; box-shadow: var(--shadow); }
.leaflet-popup-tip { background: var(--parch); border: 1px solid var(--gold); }
.leaflet-popup-content { margin: 0; }
.ficha { width: 250px; }
.ficha-head { display: flex; align-items: center; gap: 10px; padding: 14px 14px 10px; border-bottom: 1px solid var(--parch-d); }
.ficha-head .avatar { width: 42px; height: 42px; }
.ficha h3 { margin: 0; font-size: 15px; }
.ficha .lugar { font-size: 12px; color: var(--muted); margin-top: 2px; }
.ficha-body { padding: 10px 14px 14px; }
.cargo { display: inline-block; padding: 3px 8px; margin: 0 4px 4px 0; border-radius: 6px; font-size: 11px; font-weight: 700; color: #fff; background: var(--c); }
.ficha .stats { display: flex; justify-content: space-between; margin-top: 8px; font-size: 12px; color: var(--muted); }
.ficha .stats b { color: var(--ink); }

/* ---------- Toast ---------- */
#toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); z-index: 3000; max-width: 90vw;
  background: var(--ink); color: var(--gold-l); padding: 12px 18px; border-radius: 12px; font-size: 14px; font-weight: 500;
  border: 1px solid var(--gold); box-shadow: var(--shadow); animation: pop .3s;
}

.leaflet-control-zoom a { background: var(--parch) !important; color: var(--ink) !important; }
.leaflet-control-attribution { font-size: 10px; }

@media (max-width: 640px) {
  #topbar { gap: 10px; padding: 7px 8px; }
  .brand span, .btn.gold span, .me-text { display: none; }
  .me { margin-left: auto; }
  #legend { display: none; }
}

/* ================= JUEGO ================= */
.res { display: flex; align-items: baseline; gap: 4px; padding: 6px 10px; border-radius: 999px; background: #fff; border: 1px solid #e3d6b8; font-size: 14px; white-space: nowrap; }
.res small { color: #2f7d32; font-size: 11px; font-weight: 600; }
.btn { position: relative; }
.badge { position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: #e53935; color: #fff; font: 700 11px/20px Inter, sans-serif; font-style: normal; border: 2px solid #fff; }
.btn.mini { padding: 7px 11px; font-size: 12px; border-radius: 8px; background: var(--parch-d); color: var(--ink); }
.btn.mini.primary { background: linear-gradient(180deg, #9b1426, var(--wine)); color: #fff; box-shadow: 0 2px 0 var(--wine-d); }
.btn.mini.gold { background: linear-gradient(180deg, var(--gold-l), var(--gold)); box-shadow: 0 2px 0 #a67d1f; }
.btn.mini.dark { background: var(--ink); color: var(--gold-l); box-shadow: 0 2px 0 #000; }
.btn.wide { width: auto; padding: 11px 16px; font-size: 14px; }

#alerta {
  position: fixed; top: 84px; left: 50%; transform: translateX(-50%); z-index: 1000; cursor: pointer;
  background: #b3121f; color: #fff; padding: 9px 16px; border-radius: 12px; font-size: 14px;
  box-shadow: 0 6px 20px rgba(179, 18, 31, .45); animation: latido 1.4s infinite; white-space: nowrap;
}
@keyframes latido { 50% { box-shadow: 0 6px 30px rgba(179, 18, 31, .8); } }

/* Ficha: acciones */
.ficha .senor { margin-top: 8px; padding-top: 8px; border-top: 1px dashed #d8c9a8; font-size: 12px; color: var(--muted); }
.ficha-acc { display: flex; gap: 6px; margin-top: 10px; }
.ficha-acc .btn { flex: 1; }

/* Panel lateral */
#panel {
  position: fixed; top: 84px; right: 12px; bottom: 24px; width: 380px; z-index: 1100;
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--parch); border: 1px solid var(--gold); border-radius: 18px; box-shadow: 0 20px 50px rgba(0,0,0,.35);
  animation: entra .25s ease-out;
}
@keyframes entra { from { opacity: 0; transform: translateX(20px); } }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 8px; }
.panel-head h2 { margin: 0; font: 800 20px Cinzel, serif; color: var(--wine); }
.panel-head .btn.icon { width: 34px; padding: 7px 0; font-size: 14px; }
.ptabs { display: flex; gap: 4px; padding: 0 10px 10px; border-bottom: 1px solid #e3d6b8; }
.ptabs button {
  position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 7px 2px; border: 0; border-radius: 10px; background: none; cursor: pointer; font: 600 11px Inter, sans-serif; color: var(--muted);
}
.ptabs button.active { background: #fff; color: var(--wine); box-shadow: 0 2px 6px rgba(0,0,0,.08); }
.ptabs .badge { top: 0; right: 6px; }
.panel-body { flex: 1; overflow-y: auto; padding: 4px 14px 16px; }
.panel-body h3 { margin: 18px 0 8px; font: 700 13px Inter, sans-serif; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); }
.panel-body h3 small { text-transform: none; letter-spacing: 0; }
.vacio { color: var(--muted); font-size: 13px; text-align: center; padding: 12px; }
.tip { font-size: 12px; color: var(--muted); background: #fff8e4; border-radius: 10px; padding: 9px 11px; margin: 12px 0 0; }
.nota { font-size: 13px; padding: 10px 12px; border-radius: 10px; margin-top: 12px; }
.nota.ok { background: #e7f3e8; color: #24572a; }
.nota.obra { background: #fff2cc; color: #6b4a00; }

.edif { display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin-bottom: 8px; background: #fff; border: 1px solid #eadfc6; border-radius: 12px; }
.edif-ico { font-size: 26px; width: 44px; height: 44px; display: grid; place-items: center; background: var(--parch); border-radius: 10px; flex: none; }
.edif-info { flex: 1; min-width: 0; }
.edif-top { display: flex; align-items: center; gap: 6px; }
.lvl { font-size: 11px; font-weight: 700; color: #fff; background: var(--wine); border-radius: 6px; padding: 1px 6px; }
.edif-desc { font-size: 12px; color: var(--muted); margin: 2px 0; line-height: 1.35; }
.edif-coste { font-size: 12px; color: var(--ink); }
.edif.compacta { background: var(--parch); border-style: dashed; margin: 8px 0; }
.pueblo-card { background: #fff; border: 1px solid #eadfc6; border-radius: 12px; padding: 12px; margin-bottom: 10px; }
.pc-head { display: flex; justify-content: space-between; align-items: baseline; }
.pc-head span { font-size: 12px; color: var(--muted); }
.pc-stats { display: flex; gap: 14px; font-size: 13px; margin-top: 4px; }
.pueblo-card > .btn { width: 100%; }

.ejercito-top { margin-top: 12px; padding: 14px; border-radius: 14px; color: #fff; background: linear-gradient(135deg, var(--wine), #3a0810); }
.ejercito-top .big { font-size: 22px; } .ejercito-top .big b { font-size: 30px; } .ejercito-top small { font-size: 13px; opacity: .8; margin-left: 4px; }
.ejercito-top .pow { font-size: 12px; color: var(--gold-l); margin-top: 4px; }
.reclutar { display: grid; grid-template-columns: 90px 1fr; gap: 8px; align-items: center; }
.reclutar input { padding: 9px; text-align: center; font-weight: 700; }
.rec-quick { display: flex; gap: 4px; }
.rec-quick .btn { flex: 1; padding: 8px 0; }
.reclutar > .btn { grid-column: 1 / -1; }
.rec-coste { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }
.mov { display: flex; justify-content: space-between; gap: 10px; align-items: center; font-size: 13px; padding: 9px 11px; margin-bottom: 6px; background: #fff; border-radius: 10px; border-left: 4px solid var(--gold); }
.mov b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.mov.peligro { border-left-color: #b3121f; background: #fdecec; }
.mov.guerra { border-left-color: #e65100; background: #fff3e0; }
.declarar { margin-top: 12px; padding: 12px; background: #fff; border: 1px dashed var(--wine); border-radius: 12px; display: grid; gap: 8px; }
.declarar p { margin: 0; font-size: 12px; color: var(--muted); }

.informe { background: #fff; border-radius: 10px; padding: 10px 12px; margin: 8px 0; border-left: 4px solid #bbb; }
.informe.victoria { border-left-color: #2f7d32; } .informe.derrota { border-left-color: #b3121f; }
.informe.obra { border-left-color: var(--gold); } .informe.guerra { border-left-color: #e65100; }
.informe.nuevo { box-shadow: 0 0 0 2px rgba(212, 165, 55, .5); }
.inf-top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.inf-top small, .noticia small { color: var(--muted); white-space: nowrap; font-size: 11px; }
.informe p { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.noticia { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; padding: 9px 2px; border-bottom: 1px solid #eadfc6; }
.ranking { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 13px; }
.ranking th { text-align: left; font-size: 11px; color: var(--muted); padding: 6px 4px; }
.ranking td { padding: 8px 4px; border-top: 1px solid #eadfc6; vertical-align: middle; }
.ranking td small { display: block; color: var(--muted); font-size: 11px; }
.ranking tr.yo td { background: #fff3cc; }
.ranking td:first-child { width: 28px; text-align: center; }

/* Ventana de ataque */
#modal { position: fixed; inset: 0; z-index: 2500; display: grid; place-items: center; padding: 16px; background: rgba(30, 8, 10, .6); backdrop-filter: blur(2px); }
.slider { background: #fff; border-radius: 12px; padding: 14px; border: 1px solid #eadfc6; }
.slider input { width: 100%; accent-color: var(--wine); padding: 0; border: 0; box-shadow: none; }
.slider-val { margin-top: 6px; font-size: 14px; } .slider-val b { font-size: 22px; color: var(--wine); }
.slider-val span { color: var(--muted); font-size: 13px; }
.viaje { font-size: 14px; color: var(--muted); }
.modal-actions { display: flex; gap: 10px; }
.modal-actions .btn { flex: 1; }

@media (max-width: 640px) {
  .res { padding: 5px 8px; font-size: 13px; } .res small { display: none; }
  #topbar .points { display: none; }
  .btn.primary span { display: none; }
  #panel { top: auto; left: 0; right: 0; bottom: 0; width: auto; height: 78vh; border-radius: 18px 18px 0 0; animation: sube .25s ease-out; }
  @keyframes sube { from { transform: translateY(30px); opacity: 0; } }
  #alerta { top: 70px; font-size: 12px; white-space: normal; width: calc(100% - 24px); text-align: center; }
}
@media (max-width: 1100px) { .me-text { display: none; } }
.ficha-acc .btn { white-space: nowrap; }

/* ===== Roles ===== */
.resumen { margin-top: 12px; background: #fff; border: 1px solid #eadfc6; border-radius: 12px; padding: 8px 12px; font-size: 13px; }
.resumen div { display: flex; justify-content: space-between; padding: 4px 0; }
.resumen .total { border-top: 1px solid #eadfc6; margin-top: 4px; padding-top: 7px; font-size: 14px; }
.resumen .neg { color: #b3121f; }
.pueblo-hero { margin-top: 12px; padding: 14px; border-radius: 14px; color: #fff; background: linear-gradient(135deg, #2f4f6b, #1b2c3d); }
.ph-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.ph-top h4 { margin: 0; font: 800 18px Cinzel, serif; } .ph-top span { font-size: 12px; opacity: .75; }
.ph-alcalde { font-size: 12px; background: rgba(255,255,255,.12); padding: 4px 9px; border-radius: 999px; white-space: nowrap; }
.ph-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 12px; }
.ph-stats div { background: rgba(255,255,255,.1); border-radius: 10px; padding: 7px 6px; text-align: center; display: flex; flex-direction: column; gap: 2px; }
.ph-stats small { font-size: 10px; opacity: .75; } .ph-stats b { font-size: 13px; white-space: nowrap; }
.ph-mov { margin-top: 10px; font-size: 12px; color: var(--gold-l); }
.acciones-vecino { display: grid; gap: 8px; }
.accion-card { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid #eadfc6; border-radius: 12px; padding: 10px 12px; }
.ac-ico { font-size: 24px; width: 40px; height: 40px; display: grid; place-items: center; background: var(--parch); border-radius: 10px; flex: none; }
.ac-info { flex: 1; min-width: 0; font-size: 13px; } .ac-info small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; line-height: 1.35; }
.accion-card > .btn { min-width: 84px; }
.inline { display: flex; gap: 6px; margin-top: 6px; }
.inline input, .inline select { padding: 7px 9px; font-size: 13px; flex: 1; min-width: 0; }
.bloque { margin-top: 12px; padding: 12px; border-radius: 12px; background: #fff; border: 1px solid #eadfc6; display: grid; gap: 8px; }
.bloque h5 { margin: 0; font-size: 14px; color: var(--wine); }
.bloque p { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.4; }
.bloque.alcalde { border: 1px solid var(--gold); background: #fffaf0; }
.bloque.censura { border-color: #e6b3b3; }
.bloque.gob { border: 2px solid var(--gold); background: #fffaf0; }
.bloque.dip { border: 2px solid #6b2fa3; background: #faf6ff; }
.bloque.dip h5 { color: #6b2fa3; }
.sub-bloque { display: grid; gap: 5px; padding-top: 8px; border-top: 1px dashed #d8c9a8; font-size: 13px; }
.fila { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.fila input[type=number] { padding: 7px 9px; font-size: 13px; }
.range-row { display: flex; align-items: center; gap: 10px; } .range-row input { flex: 1; padding: 0; border: 0; accent-color: var(--wine); box-shadow: none; } .range-row b { color: var(--ink); min-width: 34px; }
.mini-nota { font-size: 11px; color: var(--muted); margin: 4px 2px 0; }
.barra { height: 10px; background: #f1e4e4; border-radius: 6px; overflow: hidden; } .barra i { display: block; height: 100%; background: linear-gradient(90deg, #e57373, #b3121f); }
.barra-txt { font-size: 12px; color: var(--muted); }
.vecinos { display: grid; gap: 4px; }
.vecino { display: flex; justify-content: space-between; align-items: center; font-size: 13px; padding: 7px 10px; background: #fff; border-radius: 8px; }
.vecino small { color: var(--muted); font-size: 11px; } .vecino.yo { background: #fff3cc; }
.otro-pueblo { background: #fff; border: 1px solid #eadfc6; border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; }
.otro-pueblo summary { cursor: pointer; font-size: 13px; } .otro-pueblo summary small { color: var(--muted); }
.decretos { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.decreto { display: grid; gap: 3px; text-align: left; padding: 12px; border-radius: 12px; border: 1px solid var(--gold); background: linear-gradient(180deg, #fff, #fff6dc); cursor: pointer; font: 13px Inter, sans-serif; }
.decreto small { color: var(--muted); font-size: 11px; } .decreto:hover { filter: brightness(1.03); } .decreto:disabled { opacity: .5; cursor: not-allowed; }
.oferta { color: #e65100; }
.ptabs button span { font-size: 10px; }

/* =================== TEMA v2: más bonito =================== */
body { -webkit-font-smoothing: antialiased; }
/* Barra superior oscura y dorada */
#topbar {
  background: linear-gradient(180deg, rgba(74, 10, 20, .96), rgba(48, 6, 13, .96));
  border: 1px solid rgba(212, 165, 55, .65); color: #fff;
  box-shadow: 0 10px 30px rgba(30, 5, 8, .45), inset 0 1px 0 rgba(255, 255, 255, .08);
}
#topbar::after { content: ""; position: absolute; left: 16px; right: 16px; bottom: -1px; height: 2px; border-radius: 2px; background: linear-gradient(90deg, transparent, var(--gold), transparent); }
.brand { color: var(--gold-l); text-shadow: 0 1px 0 rgba(0,0,0,.4); }
.me-name { color: #fff; } .me-role { color: rgba(255, 230, 190, .75); }
.res { background: rgba(255, 255, 255, .08); border-color: rgba(212, 165, 55, .35); color: #fff; }
.res small { color: #9be59f; }
.points { background: linear-gradient(180deg, var(--gold-l), var(--gold)); color: var(--ink); font-weight: 700; }
#btn-logout.btn.icon { background: rgba(255, 255, 255, .08); color: #fff; }
#btn-reino.btn.primary { background: linear-gradient(180deg, #c81d32, #8f0f20); box-shadow: 0 3px 0 #4a0710, 0 0 0 1px rgba(255, 220, 150, .35) inset; }

/* Panel */
#panel { background: radial-gradient(circle at 0 0, #fffaf0, var(--parch) 40%), var(--parch); border: 1px solid var(--gold); }
.panel-head {
  margin: 0; padding: 16px 16px 14px; color: #fff;
  background: linear-gradient(135deg, #7a0f1c, #3d0710),
    repeating-linear-gradient(45deg, rgba(255,255,255,.04) 0 10px, transparent 10px 20px);
  background-blend-mode: overlay; border-bottom: 2px solid var(--gold);
}
.panel-head h2 { color: var(--gold-l); letter-spacing: .5px; }
.panel-head .btn.icon { background: rgba(255,255,255,.12); color: #fff; }
.ptabs { padding: 10px; gap: 4px; background: rgba(255,255,255,.4); }
.ptabs button { font-size: 18px; transition: background .15s, color .15s, transform .1s; }
.ptabs button:hover { background: rgba(122, 15, 28, .06); }
.ptabs button.active { background: linear-gradient(180deg, #9b1426, var(--wine)); color: #fff; box-shadow: 0 3px 8px rgba(122, 15, 28, .35); }
.ptabs button.active span { color: var(--gold-l); }
.panel-body h3 { display: flex; align-items: center; gap: 8px; font: 700 13px Cinzel, serif; letter-spacing: 1px; color: var(--wine); }
.panel-body h3::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, rgba(212,165,55,.7), transparent); }
.panel-body h3 small { font-family: Inter, sans-serif; color: var(--muted); }

/* Tarjetas con algo de vida */
.edif, .accion-card, .pueblo-card, .bloque, .mision, .cand, .informe, .mov { box-shadow: 0 2px 6px rgba(60, 30, 10, .06); transition: transform .12s, box-shadow .12s; }
.edif:hover, .accion-card:hover, .mision:hover, .cand:hover { transform: translateY(-1px); box-shadow: 0 6px 14px rgba(60, 30, 10, .1); }
.edif-ico, .ac-ico, .mi-ico { background: linear-gradient(180deg, #fff8e6, #f1e3c2); box-shadow: inset 0 0 0 1px rgba(212,165,55,.35); }
.btn.gold, .btn.mini.gold { position: relative; overflow: hidden; }
.btn.gold::after, .btn.mini.gold::after { content: ""; position: absolute; top: 0; left: -60%; width: 40%; height: 100%; background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent); transform: skewX(-20deg); animation: brillo 3.5s infinite; }
@keyframes brillo { 0%, 70% { left: -60%; } 100% { left: 130%; } }

/* Leyenda oscura */
#legend { background: rgba(48, 6, 13, .9); color: #f5e6c8; border-color: rgba(212,165,55,.5); }

/* Toast más vistoso */
#toast { background: linear-gradient(180deg, #3a0810, #24050a); border: 1px solid var(--gold); color: #fff3d6; padding: 12px 20px; border-radius: 14px; font-weight: 600; }

/* Ficha del mapa */
.ficha-head { background: linear-gradient(135deg, #fffaf0, #f3e6c9); border-radius: 14px 14px 0 0; }

/* Login: velo con un toque dorado */
#overlay { background: radial-gradient(ellipse at 50% 30%, rgba(122, 15, 28, .55), rgba(20, 4, 6, .88)); }
.card h1 { text-shadow: 0 1px 0 #fff; }

/* ===== Misiones ===== */
.misiones { display: grid; gap: 8px; }
.mision { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid #eadfc6; border-radius: 12px; padding: 10px 12px; }
.mi-ico { font-size: 22px; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; flex: none; }
.mi-info { flex: 1; min-width: 0; font-size: 13px; } .mi-info small { color: var(--muted); font-size: 11px; }
.barra.fina { height: 6px; margin: 5px 0 3px; background: #efe5cf; } .barra.fina i { background: linear-gradient(90deg, var(--gold-l), var(--gold)); }
.mision.lista { border-color: var(--gold); background: #fffaf0; }
.mision.hecha { opacity: .6; }

/* ===== Revuelta ===== */
.bloque.revuelta { border: 1px solid #b3121f; background: linear-gradient(180deg, #fff, #fdf0f0); }
.bloque.revuelta h5 { color: #b3121f; }

/* ===== Chat ===== */
.chat { background: #fff; border: 1px solid #eadfc6; border-radius: 12px; overflow: hidden; }
.chat-box { max-height: 240px; min-height: 90px; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 6px; background: linear-gradient(180deg, #fffdf8, #fbf5e8); }
.msg { max-width: 85%; align-self: flex-start; background: #f3ead6; border-radius: 12px 12px 12px 4px; padding: 6px 10px; font-size: 13px; display: grid; }
.msg b { font-size: 11px; color: var(--wine); } .msg small { font-size: 10px; color: var(--muted); justify-self: end; }
.msg span { word-break: break-word; }
.msg.mio { align-self: flex-end; background: linear-gradient(180deg, #9b1426, var(--wine)); color: #fff; border-radius: 12px 12px 4px 12px; }
.msg.mio b, .msg.mio small { color: var(--gold-l); }
.chat-input { display: flex; gap: 6px; padding: 8px; border-top: 1px solid #eadfc6; }
.chat-input input { flex: 1; padding: 8px 10px; font-size: 13px; }

/* ===== Elecciones ===== */
.nota.info { background: #eef3fb; color: #23415f; line-height: 1.45; }
.bloque.eleccion { border: 1px solid var(--gold); }
.el-head { display: flex; justify-content: space-between; align-items: center; }
.el-head span { font-size: 12px; background: var(--ink); color: var(--gold-l); padding: 3px 9px; border-radius: 999px; }
.cand { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--parch); border: 1px solid #eadfc6; }
.cand.lider { background: linear-gradient(90deg, #fff4d1, #fffaf0); border-color: var(--gold); }
.cand.yo { box-shadow: 0 0 0 2px rgba(122, 15, 28, .35); }
.cand-pos { width: 26px; text-align: center; font-weight: 800; color: var(--muted); }
.cand-info { flex: 1; min-width: 0; font-size: 13px; } .cand-info small { display: block; color: var(--muted); font-size: 11px; }
.cand-poder { text-align: center; line-height: 1; } .cand-poder b { font-size: 18px; color: var(--wine); } .cand-poder small { display: block; font-size: 9px; color: var(--muted); text-transform: uppercase; }
.tag { font-size: 10px; background: #e8f0fe; color: #23415f; padding: 1px 6px; border-radius: 6px; font-weight: 600; }
.wide-btn { width: 100%; }
