:root {
  /* GENERADO desde [TemaWeb] de mastermu.ini. No editar a mano. */
  --bg: #07090d;
  --panel: #0e1117;
  --panel-2: #141922;
  --line: #28303a;
  --soft-line: #1e252e;
  --text: #d8dde4;
  --muted: #87919f;
  --bright: #f5f7fa;
  --gold: #c99b3a;
  --gold-2: #e2c06b;
  --blue: #4b80d7;
  --danger: #ffb9be;
  --danger-bg: #2b1518;
  --ok: #86dfb2;
}

* { box-sizing: border-box; }

html { height: 100%; }

body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 14px;
}

a { color: var(--gold-2); text-decoration: none; }
a:hover { color: var(--bright); }

button,
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid rgba(201,155,58,.65);
  background: linear-gradient(180deg, #b8892e, #80591f);
  color: #08090b;
  font-weight: 800;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: .04em;
}

button:hover,
.button-link:hover {
  color: #050608;
  background: linear-gradient(180deg, #e2c06b, #a87525);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #0a0d12;
  color: var(--bright);
  padding: 12px;
  font: inherit;
}

textarea { font-family: Consolas, monospace; }

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 6px;
}

th {
  padding: 0 12px 7px;
  color: var(--muted);
  font-size: 11px;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: .1em;
}

td {
  padding: 10px 12px;
  background: var(--panel-2);
  border-top: 1px solid var(--soft-line);
  border-bottom: 1px solid var(--soft-line);
}

td:first-child { border-left: 1px solid var(--soft-line); }
td:last-child { border-right: 1px solid var(--soft-line); }

.num {
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.strong { color: var(--gold-2); font-weight: 800; }

.shell {
  /* Alto EXACTO del WebView del launcher. Antes era min-height, y bastaba
     que una seccion creciera un pixel para que apareciera la barra de
     scroll de la pagina entera dentro de la caja del launcher. */
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 14px;
  gap: 12px;
}

.shell-home {
  padding: 10px;
  gap: 8px;
}

.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--soft-line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(201,155,58,.6);
  background: radial-gradient(circle at 35% 25%, rgba(226,192,107,.55), rgba(105,71,23,.65));
  color: var(--bright);
  font-weight: 900;
}

.brand strong {
  display: block;
  color: var(--bright);
  font-size: 18px;
  line-height: 1.1;
}

.brand small {
  display: block;
  color: var(--muted);
  margin-top: 3px;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.top-actions a {
  padding: 8px 10px;
  border: 1px solid var(--soft-line);
  background: rgba(255,255,255,.02);
  color: var(--text);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.top-actions a:hover {
  border-color: var(--gold);
  color: var(--bright);
}

main {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.login-card,
.card,
.wrap {
  width: min(100%, 460px);
  padding: 24px;
  background: var(--panel);
  border: 1px solid rgba(201,155,58,.45);
}

.wrap {
  width: min(100%, 980px);
  margin: 18px auto;
}

.login-card {
  position: relative;
  z-index: 1;
  width: min(100%, 420px);
  padding: clamp(16px, 3vh, 28px);
  background: rgba(10,12,17,.9);
  border-color: rgba(201,155,58,.45);
}

.login-card .eyebrow { display: block; }

.login-card h1 { font-size: clamp(20px, 3.4vh, 26px); }

.login-card p {
  font-size: 13px;
  margin-bottom: clamp(10px, 2vh, 18px);
}

.login-card label { margin-top: clamp(8px, 1.6vh, 14px); }

.login-card button { margin-top: clamp(12px, 2.2vh, 18px); }

.login-card h1,
.card h1,
.wrap h1 {
  margin: 0 0 10px;
  color: var(--bright);
  font-size: 24px;
}

.login-card p {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.45;
}

.login-card label { margin-top: 14px; }
.login-card button { width: 100%; margin-top: 18px; }

.alert {
  margin: 12px 0;
  padding: 11px 12px;
  background: var(--danger-bg);
  border-left: 3px solid var(--danger);
  color: var(--danger);
}

.content-grid {
  display: grid;
  gap: 14px;
}

.hero-panel,
.siege-panel,
.table-panel {
  background: var(--panel);
  border: 1px solid var(--soft-line);
  padding: 18px;
}

.hero-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-left: 3px solid var(--gold);
}

.hero-panel h1,
.winner-main h2,
.empty-state h2 {
  margin: 4px 0 6px;
  color: var(--bright);
}

.hero-panel p,
.empty-state p {
  margin: 0;
  color: var(--muted);
}

.eyebrow,
.section-title {
  color: var(--gold-2);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .12em;
}

.section-title { margin-bottom: 12px; }

.winner-card {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.winner-main { min-width: 0; flex: 1 1 auto; }

.winner-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.winner-facts span {
  display: grid;
  gap: 3px;
  padding: 10px;
  background: var(--panel-2);
  border: 1px solid var(--soft-line);
  min-width: 0;
}

.winner-facts b {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.guild-mark {
  --cell: 5px;
  display: grid;
  grid-template-columns: repeat(8, var(--cell));
  grid-template-rows: repeat(8, var(--cell));
  gap: 0;
  padding: 2px;
  background: #06070a;
  border: 1px solid var(--line);
}

.guild-mark.medium { --cell: 6px; }
.guild-mark.large { --cell: 7px; }

.guild-mark.hero {
  --cell: clamp(8px, 2.3vh, 14px);
  padding: 4px;
}

.guild-mark.empty {
  background: linear-gradient(135deg, #11151d, #090b10);
}

.guild-mark i { display: block; }

/* ══ INICIO ══════════════════════════════════════════════════════════
   La portada no scrollea nunca: .stage se queda con el alto sobrante
   del shell y recorta. Los tamanos van en vh para que el mismo layout
   entre igual de bien a 517px de alto (launcher por defecto) que a
   377px (launcher en su tamano minimo). */

.stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: grid;
  border: 1px solid rgba(201,155,58,.20);
  background:
    linear-gradient(90deg, rgba(5,7,10,.95) 0%, rgba(7,9,13,.78) 42%, rgba(5,6,8,.48) 100%),
    linear-gradient(0deg, rgba(3,4,6,.90) 0%, rgba(3,4,6,.14) 55%, rgba(3,4,6,.60) 100%),
    url("images/launcher-home-castle-siege.png") center center / cover no-repeat;
}

.stage-login {
  place-items: center;
  padding: 16px;
}

.particle-field {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.particle-field i {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--s);
  height: var(--s);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 32%, #fff0b6 0%, #e2b85e 35%, #9f5f22 70%, rgba(159,95,34,0) 100%);
  box-shadow: 0 0 12px rgba(226,184,94,.48), 0 0 22px rgba(120,54,22,.22);
  opacity: .46;
  filter: blur(.15px);
  animation: ember-drift var(--d) linear infinite;
}

@keyframes ember-drift {
  0% { transform: translate3d(0, 24px, 0) rotate(var(--r, 0deg)) scale(.55); opacity: 0; }
  18% { opacity: .54; }
  62% { opacity: .34; }
  100% { transform: translate3d(34px, -96px, 0) rotate(calc(var(--r, 0deg) + 160deg)) scale(1.25); opacity: 0; }
}

/* ── Cabecera: identidad de la cuenta, no marca del launcher ── */

.account-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.account-avatar {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(201,155,58,.55);
  background: radial-gradient(circle at 34% 24%, rgba(226,192,107,.5), rgba(96,65,21,.7));
  color: var(--bright);
  font-size: 16px;
  font-weight: 900;
}

.account-id { min-width: 0; }

.account-id strong {
  display: block;
  color: var(--bright);
  font-size: 15px;
  line-height: 1.15;
  letter-spacing: .02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-id small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .11em;
}

.top-actions a.quiet-action {
  border-color: rgba(255,255,255,.08);
  color: var(--muted);
}

.top-actions a.quiet-action:hover {
  border-color: var(--danger);
  color: var(--danger);
}

/* ── Castle Siege ── */

.siege {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(224px, 26%, 320px);
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas:
    "head  side"
    "clans side";
  gap: clamp(9px, 3vh, 18px) clamp(12px, 1.8vw, 22px);
  padding: clamp(12px, 4vh, 28px) clamp(14px, 2vw, 28px);
  width: 100%;
  min-height: 0;
}

/* Sin datos de switchs el tablero de clanes ocupa todo el ancho. */
.siege-wide {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "head"
    "clans";
}

.siege-head {
  grid-area: head;
  min-width: 0;
}

.siege-head h1 {
  margin: 5px 0 0;
  color: var(--text);
  font-size: clamp(16px, 4.6vh, 28px);
  font-weight: 600;
  line-height: 1.15;
}

.siege-head h1 b {
  color: var(--bright);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .02em;
}

.siege-sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

/* Tablero de clanes.
   Bandas horizontales apiladas, no tarjetas verticales: con 1 o 2 clanes
   las tarjetas verticales dejaban media portada vacia. Apiladas, las filas
   se reparten el alto disponible (`1fr`) y el tablero siempre queda lleno,
   sean 1 o 4 clanes.
   El dueno y los aliados usan la MISMA banda y el mismo ancho: al dueno lo
   distingue el filo dorado y su etiqueta, nunca el tamano. */
.clan-board {
  grid-area: clans;
  display: grid;
  grid-auto-rows: minmax(0, 1fr);
  gap: clamp(7px, 2vh, 13px);
  min-height: 0;
}

.clan {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(0, 1.35fr);
  align-items: center;
  gap: clamp(10px, 1.4vw, 22px);
  min-width: 0;
  min-height: 0;
  padding: clamp(8px, 2.4vh, 16px) clamp(11px, 1vw, 18px);
  background: linear-gradient(90deg, rgba(13,16,22,.9), rgba(8,10,14,.74));
  border: 1px solid rgba(255,255,255,.09);
  border-left: 3px solid rgba(255,255,255,.14);
}

.clan-owner {
  background: linear-gradient(90deg, rgba(40,31,12,.88), rgba(9,11,15,.76));
  border-color: rgba(226,192,107,.42);
  border-left-color: var(--gold);
}

.clan-crest { display: block; }

.clan-id {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.clan-name {
  display: block;
  color: var(--bright);
  font-size: clamp(16px, 4.4vh, 27px);
  line-height: 1.05;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.clan-tag {
  color: var(--muted);
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: .12em;
}

.clan-owner .clan-tag { color: var(--gold-2); }

.clan-facts {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: clamp(8px, 1vw, 18px);
  margin: 0;
  min-width: 0;
}

.clan-facts div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.clan-facts dt {
  color: var(--muted);
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: .1em;
}

.clan-facts dd {
  margin: 0;
  min-width: 0;
  color: var(--bright);
  font-size: clamp(12px, 2.7vh, 15px);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.clan-facts .dd-num {
  color: var(--gold-2);
  font-variant-numeric: tabular-nums;
}

/* El emblema crece cuando hay menos bandas: con un solo clan la fila es
   alta y un emblema chico se veria perdido. */
.clan-board[data-count="1"] .guild-mark.card { --cell: clamp(7px, 3.9vh, 19px); }

.clan-board[data-count="1"] .clan {
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas:
    "crest id"
    "crest facts";
  align-content: center;
  gap: clamp(10px, 2.4vh, 22px) clamp(16px, 2vw, 30px);
  padding: clamp(14px, 3vh, 28px) clamp(16px, 1.6vw, 28px);
}

.clan-board[data-count="1"] .clan-crest { grid-area: crest; align-self: center; }
.clan-board[data-count="1"] .clan-id { grid-area: id; align-self: end; }
.clan-board[data-count="1"] .clan-facts { grid-area: facts; align-self: start; }
.clan-board[data-count="1"] .clan-name { font-size: clamp(24px, 7vh, 46px); }
.clan-board[data-count="2"] .guild-mark.card { --cell: clamp(6px, 2.1vh, 11px); }
.clan-board[data-count="3"] .guild-mark.card { --cell: clamp(5px, 1.6vh, 8px); }
.clan-board[data-count="4"] .guild-mark.card { --cell: clamp(4px, 1.2vh, 7px); }

/* Banda contadora cuando la alianza no entra entera en el tablero. */
.clan-more {
  grid-template-columns: auto minmax(0, 1fr);
  justify-content: start;
  gap: 10px;
  background: rgba(201,155,58,.1);
  border-color: rgba(201,155,58,.3);
  border-left-color: rgba(201,155,58,.55);
}

.clan-more strong {
  color: var(--gold-2);
  font-size: clamp(15px, 2.4vh, 22px);
  line-height: 1;
}

.clan-more span {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .09em;
}

/* ── Top acumulado del Castle Siege ── */

.top-board {
  grid-area: side;
  display: flex;
  flex-direction: column;
  gap: clamp(7px, 1.2vh, 12px);
  min-width: 0;
  min-height: 0;
  padding: clamp(10px, 1.6vh, 16px) clamp(10px, .9vw, 14px);
  background: rgba(7,9,13,.84);
  border: 1px solid rgba(255,255,255,.09);
  border-top: 2px solid rgba(201,155,58,.5);
}

.board-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  white-space: nowrap;
}

.board-head small {
  color: var(--muted);
  font-size: 9.5px;
  letter-spacing: .04em;
}

.top-list {
  flex: 1 1 auto;
  display: grid;
  grid-auto-rows: minmax(0, 1fr);
  gap: clamp(5px, .9vh, 9px);
  margin: 0;
  padding: 0;
  min-height: 0;
  list-style: none;
}

.top-list li {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: clamp(5px, .9vh, 10px) 10px;
  background: rgba(14,17,23,.72);
  border: 1px solid rgba(255,255,255,.07);
}

.top-list li:first-child {
  background: rgba(30,24,10,.6);
  border-color: rgba(226,192,107,.4);
}

.top-pos {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  background: #0b0e13;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.top-list li:first-child .top-pos {
  background: var(--gold);
  border-color: var(--gold-2);
  color: #08090b;
}

.top-list .guild-mark { --cell: clamp(4px, 1.25vh, 7px); }

.top-id {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.top-id strong {
  display: block;
  color: var(--bright);
  font-size: clamp(12px, 2.4vh, 15px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-master {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: 10.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-flag {
  flex: 0 0 auto;
  width: 16px;
  height: 11px;
  border: 1px solid rgba(255,255,255,.18);
  object-fit: cover;
}

.top-score {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: end;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  margin-top: clamp(1px, .5vh, 4px);
  color: var(--gold-2);
  font-size: clamp(15px, 3.4vh, 24px);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.top-score em {
  display: block;
  min-width: 0;
  color: var(--muted);
  font-size: 9px;
  font-style: normal;
  text-transform: uppercase;
  letter-spacing: .04em;
  line-height: 1.05;
  white-space: normal;
  overflow-wrap: anywhere;
}

/* ── Castillo vacante / diagnostico ── */

.siege-empty {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  grid-template-areas: "head";
  place-items: center;
  text-align: center;
}

.siege-empty .siege-head { max-width: 760px; }

.siege-empty h1 {
  color: var(--bright);
  font-size: clamp(26px, 6vh, 46px);
  font-weight: 800;
  text-transform: uppercase;
}

.siege-note {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.siege-diag {
  margin: 14px 0 0;
  padding: 10px 14px 10px 30px;
  background: rgba(43,21,24,.72);
  border: 1px solid rgba(255,185,190,.3);
  color: var(--danger);
  font-size: 12px;
  text-align: left;
}

.siege-diag li + li { margin-top: 4px; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.stat-card {
  display: grid;
  gap: 5px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--soft-line);
  border-top: 2px solid var(--line);
}

.stat-card.accent { border-top-color: var(--blue); }
.stat-card.gold { border-top-color: var(--gold); }
.stat-card span {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.stat-card strong {
  color: var(--bright);
  font-size: 20px;
  line-height: 1.1;
}
.stat-card small { color: var(--muted); }

.rank-tabs {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.rank-tab {
  min-height: 36px;
  background: var(--panel);
  color: var(--text);
  border-color: var(--soft-line);
}

.rank-tab[aria-selected="true"] {
  background: var(--panel-2);
  color: var(--bright);
  border-color: var(--gold);
}

.rank-num {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  background: #0b0e13;
  border: 1px solid var(--line);
  color: var(--text);
  font-weight: 800;
}

.top-rank .rank-num {
  background: var(--gold);
  border-color: var(--gold-2);
  color: #050608;
}

.shell-rank main {
  position: relative;
  overflow: hidden;
}

.shell-rank .rank-panel,
.shell-rank .empty-state {
  position: relative;
  z-index: 1;
}

.rank-particles {
  inset: -20px;
  opacity: .74;
}

.rank-particles i:nth-child(3n) {
  filter: blur(.7px);
}

.rank-particles i:nth-child(4n) {
  width: calc(var(--s) * 1.7);
  opacity: .32;
}

.rank-panel {
  background:
    linear-gradient(115deg, rgba(201,155,58,.08), rgba(75,128,215,.04) 48%, rgba(8,10,15,.84)),
    rgba(14,17,23,.94);
}

.rank-panel table {
  table-layout: fixed;
}

.rank-panel th,
.rank-panel td {
  padding-left: 10px;
  padding-right: 10px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rank-flag {
  width: 24px;
  height: 16px;
  object-fit: cover;
  border: 1px solid rgba(255,255,255,.14);
  vertical-align: middle;
}

.rank-gens-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border: 0;
  box-shadow: none;
  vertical-align: middle;
}

.rank-mark {
  --cell: 3px;
  display: inline-grid;
  vertical-align: middle;
}

.empty-state {
  padding: 18px;
  background: var(--panel-2);
  border: 1px solid var(--soft-line);
}

.guide-callout {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: linear-gradient(90deg, rgba(201,155,58,.14), rgba(75,128,215,.08));
  border: 1px solid rgba(201,155,58,.35);
}

.guide-callout strong {
  display: block;
  color: var(--bright);
}

.guide-callout span {
  display: block;
  color: var(--muted);
  margin-top: 2px;
}

.guide-callout a {
  flex: 0 0 auto;
  padding: 9px 12px;
  background: rgba(201,155,58,.14);
  border: 1px solid rgba(201,155,58,.5);
  color: var(--gold-2);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
}

nav {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.ok-alert {
  background: rgba(32, 91, 58, .35);
  border-left-color: var(--ok);
  color: var(--ok);
}

.admin-layout {
  display: grid;
  gap: 14px;
}

.admin-form,
.admin-section {
  display: grid;
  gap: 14px;
}

.admin-section {
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--soft-line);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}

.admin-table,
.stack-fields {
  display: grid;
  gap: 8px;
}

.admin-row {
  display: grid;
  grid-template-columns: 82px minmax(150px, 240px) minmax(260px, 1fr);
  gap: 8px;
  align-items: stretch;
}

.admin-head {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.check-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  gap: 7px;
  padding: 0 8px;
  border: 1px solid var(--line);
  background: #0a0d12;
  color: var(--text);
  font-size: 12px;
  text-transform: none;
  letter-spacing: 0;
}

.check-cell input {
  width: auto;
  padding: 0;
}

.stack-row {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr);
  gap: 8px;
  align-items: stretch;
}

.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.quiet-link {
  background: var(--panel-2);
  color: var(--text);
  border-color: var(--line);
}

/* El launcher se puede achicar hasta 620px de ventana, y ahi el WebView
   queda en ~377px de alto. Los minimos de los clamp() dejan de entrar, asi
   que a esa altura se compacta de forma explicita en vez de recortar. */
@media (max-height: 470px) {
  .shell-home { padding: 8px; gap: 6px; }
  .account-avatar { width: 32px; height: 32px; font-size: 14px; }
  .siege { padding: 9px 12px; gap: 7px 12px; }
  .siege-sub { display: none; }
  .siege-head h1 { margin-top: 3px; font-size: 16px; }
  .clan-board { gap: 5px; }
  .clan { padding: 5px 10px; gap: 10px; }
  .clan-name { font-size: 15px; }
  .clan-board[data-count="1"] .clan-name { font-size: 24px; }
  .clan-board[data-count="1"] .guild-mark.card { --cell: 10px; }
  .clan-board[data-count="1"] .clan { padding: 12px 14px; gap: 8px 16px; }
  .top-score {
    grid-template-columns: 1fr;
    gap: 1px;
    font-size: 16px;
    margin-top: 0;
    text-align: center;
  }
  .top-score em {
    font-size: 8px;
    letter-spacing: .02em;
  }
  .top-id strong { font-size: 12.5px; }
  .clan-facts { gap: 10px; }
  .top-board { padding: 8px 10px; gap: 6px; }
  .board-head small { display: none; }
  .top-list { gap: 5px; }
  .top-list li { padding: 4px 8px; gap: 7px; }
  .guide-callout { padding: 8px 12px; }
}

@media (max-width: 640px) {
  .shell { padding: 10px; }
  .topbar,
  .hero-panel,
  .winner-card,
  .guide-callout {
    align-items: stretch;
    flex-direction: column;
  }
  .top-actions { justify-content: flex-start; }
  .admin-row,
  .stack-row {
    grid-template-columns: 1fr;
  }
  .siege {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "head"
      "clans";
    padding: 14px;
  }
  .top-board { display: none; }
  .clan-board {
    grid-auto-flow: row;
    grid-auto-columns: auto;
  }
}
