/* ==========================================================================
   Guild System v16 · copied from v15 (iso navy + gold) and restyled after the
   v51 service dialogs (src/service-dialogs-v51.css: corner diamonds, banner
   header, gold tabs, striped disabled buttons, v51 confirm). Adds the Guild
   War v16 states, history/ranking, War Medal shop and the v16 art atlases
   (.gw-act-* guild actions, .gw-ic-* war HUD icons).
   Markup: public/assets/guild-system-v16.js · v15 files kept for rollback.
   ========================================================================== */

/* --------------------------------------------------------------------------
   0. Modal layer integration (unchanged behaviour from v14)
   -------------------------------------------------------------------------- */
#modal-layer.guild-modal-open,
#modal-layer.open.guild-modal-open {
  position: fixed !important;
  inset: 0 !important;
  z-index: 100000 !important;
  display: grid !important;
  place-items: center !important;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  pointer-events: auto !important;
  touch-action: none !important;
  overscroll-behavior: contain !important;
  overflow: hidden !important;
}

#modal-layer.guild-modal-open::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 45%, rgba(8, 14, 26, .62), rgba(3, 6, 12, .88));
  backdrop-filter: blur(3px);
  pointer-events: auto;
}

/* The weather overlay is a later body sibling and would paint over the window. */
body.guild-modal-open > .weather-overlay,
body:has(#modal-layer.guild-modal-open) > .weather-overlay { visibility: hidden !important; }

#modal-layer.guild-modal-open > .guild-window {
  position: relative;
  z-index: 1;
  pointer-events: auto !important;
  touch-action: pan-y !important;
}

.guild-window,
.guild-window button,
.guild-window input,
.guild-window select,
.guild-window label {
  pointer-events: auto !important;
}

/* --------------------------------------------------------------------------
   1. Tokens + window shell
   -------------------------------------------------------------------------- */
.guild-window,
.guild-confirm-layer {
  --g-gold: var(--iso-gold, #e0b45c);
  --g-gold-hi: var(--iso-gold-hi, #f6dc9a);
  --g-gold-lo: var(--iso-gold-lo, #7a5826);
  --g-line: rgba(190, 144, 70, .62);
  --g-line-soft: rgba(190, 144, 70, .3);
  --g-line-faint: rgba(190, 144, 70, .16);
  --g-text: var(--iso-text, #ece3cc);
  --g-muted: var(--iso-muted, #9aa8bb);
  --g-dim: #7d8ca5;
  --g-bright: #fff3cf;
  --g-title: #ffe08a;
  --g-inset: rgba(7, 12, 22, .66);
  --g-card:
    radial-gradient(120% 80% at 50% 0%, rgba(62, 92, 136, .12), transparent 62%),
    linear-gradient(180deg, rgba(22, 36, 58, .94), rgba(10, 17, 30, .97));
  --g-btn-gold: linear-gradient(180deg, #f6d27e 0%, #d79a3b 55%, #a8661f 100%);
  --g-btn-navy: linear-gradient(180deg, #1d2b45, #0e1727);
  --g-blue: #6fb0ff;
  --g-red: #ff7a66;
  --g-green: #7fe39a;
  --g-side-blue: #4bbcff;
  --g-side-red: #ff5a4a;
  --g-font: "Chakra Petch", "Leelawadee UI", "Leelawadee", "Noto Sans Thai", Tahoma, sans-serif;
  --g-diamond: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M5 .7 9.3 5 5 9.3.7 5z' fill='%23f6dc9a' stroke='%237a5826' stroke-width='1'/%3E%3C/svg%3E");
  --role: #8fd0a6;
}

.guild-window *,
.guild-window *::before,
.guild-window *::after,
.guild-confirm-layer * { box-sizing: border-box; }

.guild-window {
  position: relative;
  width: min(1200px, calc(100vw - 32px));
  height: min(820px, calc(100vh - 32px));
  height: min(820px, calc(100dvh - 32px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  isolation: isolate;
  color: var(--g-text);
  font: 500 14px/1.45 var(--g-font);
  border: 1px solid var(--g-line);
  border-radius: 14px;
  background:
    var(--iso-corners, linear-gradient(transparent, transparent)),
    radial-gradient(120% 55% at 50% 0%, rgba(62, 92, 136, .2), transparent 60%),
    linear-gradient(180deg, rgba(17, 28, 46, .985), rgba(8, 13, 24, .99));
  box-shadow:
    0 0 0 1px rgba(3, 6, 12, .95),
    0 0 0 4px rgba(122, 88, 38, .35),
    inset 0 1px rgba(255, 226, 160, .1),
    0 24px 60px rgba(0, 0, 0, .65);
  scrollbar-color: #6e5226 #0b1422;
}
/* v51: small gold diamonds on the four corners of the frame. */
.guild-window::after {
  content: "";
  position: absolute;
  inset: 4px;
  z-index: 7;
  pointer-events: none;
  background:
    var(--g-diamond) left top / 10px 10px no-repeat,
    var(--g-diamond) right top / 10px 10px no-repeat,
    var(--g-diamond) left bottom / 10px 10px no-repeat,
    var(--g-diamond) right bottom / 10px 10px no-repeat;
}

.guild-window button,
.guild-window input,
.guild-window select,
.guild-window textarea { font-family: var(--g-font); }

.guild-window img { image-rendering: auto; -webkit-user-drag: none; user-select: none; }
.guild-window h2,
.guild-window h3,
.guild-window h4,
.guild-window p { margin: 0; }
/* style.css gives every <label> a block margin and gold 12px text. */
.guild-window label { display: block; margin: 0; text-align: inherit; color: inherit; font-size: inherit; }

.guild-eyebrow {
  margin: 0 0 2px;
  color: var(--g-gold);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .2em;
  text-transform: uppercase;
}

/* --------------------------------------------------------------------------
   2. Header (crest · name · level · stat chips · close)
   -------------------------------------------------------------------------- */
.guild-head {
  position: relative;
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 16px;
  padding: 16px 18px 16px 20px;
  border-bottom: 1px solid var(--g-line);
  border-radius: 13px 13px 0 0;
  /* v51 banner header: dark shade from the left over a warm tint, no NPC banner art for guilds. */
  background:
    linear-gradient(90deg, rgba(6, 11, 20, .9) 0%, rgba(6, 11, 20, .55) 42%, rgba(6, 11, 20, .15) 100%),
    linear-gradient(0deg, rgba(6, 11, 20, .7) 0%, transparent 50%),
    radial-gradient(70% 160% at 80% 30%, rgba(224, 180, 92, .34), transparent 70%),
    radial-gradient(40% 120% at 30% 120%, rgba(75, 188, 255, .18), transparent 70%),
    linear-gradient(180deg, #17263f, #080e1a);
  box-shadow: inset 0 -1px rgba(255, 226, 160, .12), 0 6px 14px rgba(0, 0, 0, .35);
}

/* Crest on a v51 halo medallion (the NPC-portrait slot of the service dialogs). */
.guild-crest {
  position: relative;
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border: 1px solid var(--g-line);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, transparent 0 60%, rgba(224, 180, 92, .55) 61% 63%, transparent 64%),
    radial-gradient(circle at 50% 38%, #2f4668, #0b1422 72%);
  box-shadow: 0 0 0 2px #1a1206, 0 0 18px rgba(224, 180, 92, .28), inset 0 0 14px rgba(0, 0, 0, .7);
}
.guild-crest img { width: 62px; height: 62px; object-fit: contain; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .6)); }
.guild-crest .guild-crest-icon { width: 50px; height: 50px; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .6)); }
.guild-crest-lv {
  position: absolute;
  left: 50%;
  bottom: -9px;
  transform: translateX(-50%);
  padding: 1px 8px;
  border: 1px solid #f6d790;
  border-radius: 999px;
  background: var(--g-btn-gold);
  color: #241503;
  font: 700 11px/1.35 var(--g-font);
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .55);
}

.guild-head-text { min-width: 0; }
.guild-head h2 {
  overflow: hidden;
  color: #f2cf7e;
  font: 700 26px/1.2 var(--g-font);
  letter-spacing: .01em;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 2px 0 #3a250b, 0 0 14px rgba(240, 190, 90, .25);
}
.guild-head-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 6px; }
.guild-head-since { color: var(--g-muted); font-size: 12px; }

.guild-head-stats { display: flex; gap: 8px; }
.guild-head-chip {
  min-width: 96px;
  padding: 7px 12px 8px;
  border: 1px solid var(--g-line-soft);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(24, 38, 60, .9), rgba(9, 15, 27, .92));
  box-shadow: inset 0 1px rgba(255, 226, 160, .08);
}
.guild-head-chip small { display: block; color: var(--g-muted); font-size: 11px; line-height: 1.3; white-space: nowrap; }
.guild-head-chip b { display: block; color: var(--g-bright); font-size: 18px; font-weight: 700; line-height: 1.25; white-space: nowrap; }
.guild-head-chip b em { margin-left: 1px; color: var(--g-muted); font-size: 12px; font-style: normal; font-weight: 600; }
.guild-head-chip.gold b { color: var(--g-gold-hi); }
.guild-head-chip.gem b { color: #9fd8ff; }
.guild-head-chip.buff b { color: var(--g-green); }
.guild-head-chip.war b { display: flex; align-items: center; gap: 5px; }
.guild-head-chip.war .gw-chip-ic { width: 20px; height: 20px; object-fit: contain; }
.guild-head-chip.war.live { border-color: rgba(255, 90, 74, .7); background: linear-gradient(180deg, rgba(90, 22, 18, .9), rgba(30, 9, 8, .92)); }
.guild-head-chip.war.live b { color: #ffd2c8; animation: guild-live 1.4s ease-in-out infinite; }
.guild-head-chip.war.prep { border-color: rgba(246, 215, 144, .7); }
.guild-head-chip.war.prep b { color: var(--g-gold-hi); }
.guild-head-chip .gw-chip-short { display: none; }
.guild-head-chip.war.alert { border-color: rgba(255, 170, 120, .75); box-shadow: 0 0 12px rgba(255, 150, 90, .3); }
.guild-head-chip.war.alert b { color: #ffd7b8; }

.guild-close {
  align-self: start;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--g-line);
  border-radius: 9px;
  background: linear-gradient(180deg, #2a3a58, #0d1626);
  box-shadow: inset 0 1px rgba(255, 226, 160, .15), 0 2px 6px rgba(0, 0, 0, .5);
  color: var(--g-gold-hi);
  font: 700 24px/1 var(--g-font);
  cursor: pointer;
}
.guild-close span { display: block; margin-top: -2px; }
.guild-close:hover,
.guild-close:focus-visible { border-color: var(--g-gold-hi); color: #fff; outline: none; }

/* --------------------------------------------------------------------------
   3. Tabs
   -------------------------------------------------------------------------- */
.guild-tabs {
  flex: 0 0 auto;
  display: flex;
  gap: 6px;
  padding: 10px 16px;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--g-line-soft);
  background: linear-gradient(180deg, #0e1828, #0a111e);
}
.guild-tabs::-webkit-scrollbar { display: none; }
/* v51 .svc-tab */
.guild-tabs button {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 16px 0 9px;
  border: 1px solid #3c4f6e;
  border-radius: 8px;
  background: linear-gradient(180deg, #1d2b45, #0e1727);
  color: #c6d2e4;
  font: 700 14px/1 var(--g-font);
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
  transition: border-color .12s ease, filter .12s ease;
}
.guild-tabs button img,
.guild-tabs .guild-tab-icon { width: 26px; height: 26px; object-fit: contain; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .6)); }
.guild-tabs .tab-short { display: none; }
.guild-tabs button:hover { border-color: var(--g-gold); color: #fff; }
.guild-tabs button.active {
  border-color: #ffd98a;
  background: linear-gradient(180deg, #f6d27a, #d29a3c 55%, #a8741f);
  color: #1d1405;
  text-shadow: 0 1px 0 rgba(255, 240, 200, .5);
  box-shadow: 0 0 10px rgba(255, 210, 110, .25);
}
.guild-tab-badge {
  display: grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 10px;
  background: #d8432f;
  box-shadow: 0 0 0 2px #0b1422;
  color: #fff;
  font: 700 11px/1 var(--g-font);
  font-style: normal;
}
.guild-tab-live {
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(216, 67, 47, .9);
  color: #fff;
  font: 700 9.5px/1.3 var(--g-font);
  font-style: normal;
  letter-spacing: .08em;
  animation: guild-live 1.4s ease-in-out infinite;
}
.guild-tab-live.prep { background: rgba(224, 160, 60, .95); color: #241503; animation: none; }
.guild-tab-badge.scroll { min-width: 0; height: auto; padding: 0; background: none; box-shadow: none; animation: gw-bob 1.6s ease-in-out infinite; }
.guild-tab-badge.scroll .gw-tab-scroll { width: 24px; height: 24px; object-fit: contain; filter: drop-shadow(0 0 5px rgba(255, 120, 80, .7)); }
.guild-tab-badge.wait { background: #3c4f6e; }
@keyframes guild-live { 50% { opacity: .55; } }
@keyframes gw-bob { 50% { transform: translateY(-2px) rotate(-6deg); } }

/* --------------------------------------------------------------------------
   4. Status toast + scroll body
   -------------------------------------------------------------------------- */
.guild-status {
  position: absolute;
  left: 50%;
  bottom: 18px;
  z-index: 6;
  display: none;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 32px);
  padding: 9px 16px;
  border: 1px solid var(--g-line);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(26, 42, 68, .98), rgba(11, 20, 34, .98));
  box-shadow: 0 10px 26px rgba(0, 0, 0, .6);
  color: var(--g-gold-hi);
  font-size: 13.5px;
  font-weight: 700;
  transform: translateX(-50%);
  pointer-events: none;
}
.guild-status.show { display: flex; animation: guild-toast .22s ease-out; }
.guild-status i { flex: 0 0 auto; width: 9px; height: 9px; border-radius: 50%; background: var(--g-gold); box-shadow: 0 0 8px currentColor; }
.guild-status.error { border-color: rgba(255, 122, 102, .8); color: #ffb4a6; }
.guild-status.error i { background: var(--g-red); }
.guild-status.success { border-color: rgba(127, 227, 154, .75); color: #c9f5d4; }
.guild-status.success i { background: var(--g-green); }
.guild-status.loading i { animation: guild-live 1s ease-in-out infinite; }
@keyframes guild-toast { from { opacity: 0; transform: translate(-50%, 8px); } }

.guild-window > main {
  flex: 1 1 auto;
  min-height: 0;
  padding: 18px 20px 24px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.guild-window > main::-webkit-scrollbar { width: 8px; }
.guild-window > main::-webkit-scrollbar-track { background: #0b1422; }
.guild-window > main::-webkit-scrollbar-thumb { background: #6e5226; border-radius: 4px; }

/* --------------------------------------------------------------------------
   5. Shared pieces: cards, chips, bars, buttons, fields
   -------------------------------------------------------------------------- */
.guild-card {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--g-line-soft);
  border-radius: 12px;
  background: var(--g-card);
  box-shadow: inset 0 1px rgba(255, 226, 160, .06), 0 6px 18px rgba(0, 0, 0, .28);
}
.guild-card-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.guild-card-head h3 { color: var(--g-title); font-size: 17px; font-weight: 700; line-height: 1.3; }
.guild-card-aside { color: var(--g-muted); font-size: 12px; }
.guild-card-aside b { color: var(--g-gold-hi); }
.guild-card-note { display: block; margin: 0; color: var(--g-dim); font-size: 12px; line-height: 1.5; }
.guild-card-note b { color: var(--g-gold-hi); font-weight: 700; }
.guild-window .nowrap { white-space: nowrap; }

.guild-count-pill,
.guild-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border: 1px solid var(--g-line-soft);
  border-radius: 999px;
  background: #0a1220;
  color: #c9d3e3;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}
.guild-count-pill.gold,
.guild-tag.gold { border-color: rgba(246, 215, 144, .55); color: var(--g-gold-hi); }
.guild-count-pill.alert { border-color: rgba(255, 122, 102, .6); background: rgba(90, 24, 18, .5); color: #ffc2b6; }
.guild-tag.win { border-color: rgba(127, 227, 154, .6); background: rgba(20, 70, 38, .55); color: #c9f5d4; }
.guild-tag.lose { border-color: rgba(255, 122, 102, .55); background: rgba(90, 24, 18, .5); color: #ffc2b6; }

.guild-bar {
  position: relative;
  display: block;
  height: 12px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, .85);
  border-radius: 7px;
  background: linear-gradient(180deg, #050911, #0f1726);
  box-shadow: 0 0 0 1px rgba(190, 144, 70, .3), inset 0 1px 2px #000;
}
.guild-bar i {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 6px;
  background: linear-gradient(180deg, #ffe7a0, #e0b45c 45%, #9c6a22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35);
}
.guild-bar.thin { height: 6px; border-radius: 4px; }
.guild-bar.thin i { border-radius: 3px; }
.guild-bar.blue i { background: linear-gradient(180deg, #a6d4ff, #3f8ae6 45%, #1d4a9a); }
.guild-bar.red i { background: linear-gradient(180deg, #ffb09e, #e0503c 45%, #8f1d17); }

.guild-primary,
.guild-secondary,
.guild-success,
.guild-danger,
.guild-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 9px;
  font: 700 14px/1.1 var(--g-font);
  white-space: nowrap;
  cursor: pointer;
  transition: filter .12s ease, transform .08s ease, border-color .12s ease;
}
.guild-primary { border-color: #ffd98a; background: linear-gradient(180deg, #f8d77f 0%, #e3ac4a 46%, #b67c25 100%); color: #1d1405; box-shadow: inset 0 1px rgba(255, 250, 220, .75), inset 0 -2px rgba(90, 50, 10, .45), 0 0 0 1px rgba(20, 12, 2, .85), 0 3px 8px rgba(0, 0, 0, .45); text-shadow: 0 1px rgba(255, 240, 200, .45); }
.guild-secondary { border-color: rgba(190, 144, 70, .65); background: var(--g-btn-navy); color: #ffe7a8; box-shadow: inset 0 1px rgba(255, 226, 160, .12); }
.guild-success { border-color: #9ef0b0; background: linear-gradient(180deg, #6fd892, #2f9a58 55%, #1d6b3b); color: #f2fff5; box-shadow: inset 0 1px rgba(255, 255, 255, .3), 0 3px 10px rgba(0, 0, 0, .35); text-shadow: 0 1px 1px rgba(0, 40, 15, .6); }
.guild-danger { border-color: #ff9c8a; background: linear-gradient(180deg, #ef7464, #b8382d 55%, #7f2019); color: #fff3f0; box-shadow: inset 0 1px rgba(255, 255, 255, .25), 0 3px 10px rgba(0, 0, 0, .35); text-shadow: 0 1px 1px rgba(60, 0, 0, .6); }
.guild-ghost { border-color: var(--g-line-soft); background: var(--g-btn-navy); color: #ffe7a8; }
.guild-ghost.danger { border-color: rgba(255, 122, 102, .45); color: #ffb4a6; }
.guild-primary:hover:not(:disabled),
.guild-secondary:hover:not(:disabled),
.guild-success:hover:not(:disabled),
.guild-danger:hover:not(:disabled) { filter: brightness(1.1); }
.guild-ghost:hover:not(:disabled) { border-color: var(--g-gold); background: linear-gradient(180deg, #24365a, #111c30); }
.guild-ghost.danger:hover:not(:disabled) { border-color: var(--g-red); background: linear-gradient(180deg, #4a1d1a, #24100e); }
.guild-primary:active:not(:disabled),
.guild-success:active:not(:disabled),
.guild-danger:active:not(:disabled) { transform: translateY(1px); }
.guild-window button:disabled { opacity: .5; filter: grayscale(.45); cursor: default; }
/* v51: a disabled action button reads as disabled (flat grey stripes, no gold, no glow). */
.guild-window :is(.guild-primary, .guild-success, .guild-danger, .guild-secondary):disabled,
.guild-confirm-dialog :is(.guild-primary, .guild-success, .guild-danger):disabled {
  opacity: 1;
  border-color: #3a4352 !important;
  background: repeating-linear-gradient(135deg, #262d39 0 8px, #20262f 8px 16px) !important;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .4) !important;
  color: #8a94a5 !important;
  text-shadow: none !important;
  filter: none !important;
  transform: none !important;
  cursor: not-allowed;
}
.guild-window button:disabled .gw-act,
.guild-window button:disabled .gw-ic { filter: grayscale(1) opacity(.55); }
/* In-flight request (JS adds .is-busy + disabled). */
.guild-window button.is-busy,
.guild-confirm-dialog button.is-busy { position: relative; color: transparent !important; text-shadow: none !important; pointer-events: none; }
.guild-window button.is-busy > *,
.guild-confirm-dialog button.is-busy > * { visibility: hidden; }
.guild-window button.is-busy::after,
.guild-confirm-dialog button.is-busy::after { content: ""; position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px; border: 2px solid rgba(236, 227, 204, .3); border-top-color: #f6dc9a; border-radius: 50%; animation: guild-spin .7s linear infinite; }
.guild-window button:focus-visible { outline: 2px solid var(--g-gold-hi); outline-offset: 2px; }
.guild-wide { width: 100%; min-height: 44px; font-size: 15px; }
.guild-action-icon { flex: 0 0 auto; width: 22px; height: 22px; object-fit: contain; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .5)); }

.guild-field { display: grid !important; gap: 6px; }
.guild-field > span { color: #c9d3e3; font-size: 12.5px; font-weight: 600; }
.guild-window input:not([type="radio"]),
.guild-window select {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--g-line-soft);
  border-radius: 9px;
  background: #070c16;
  box-shadow: inset 0 1px 3px #000;
  color: var(--g-bright);
  font-size: 15px;
  font-weight: 600;
  outline: none;
}
.guild-window select { padding-right: 34px; appearance: none; -webkit-appearance: none; background: #070c16 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23e0b45c' stroke-width='2'/%3E%3C/svg%3E") right 12px center / 12px 8px no-repeat; cursor: pointer; }
.guild-window select option { background: #0b1422; color: var(--g-text); }
.guild-window input::placeholder { color: #5f6e86; font-weight: 500; }
.guild-window input:focus,
.guild-window select:focus { border-color: var(--g-gold); box-shadow: inset 0 1px 3px #000, 0 0 0 3px rgba(224, 180, 92, .16); }

.guild-role-pill {
  --role: #8fd0a6;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 10px 2px 3px;
  border: 1px solid rgba(255, 255, 255, .22);
  border-color: color-mix(in srgb, var(--role) 55%, transparent);
  border-radius: 999px;
  background: #0f1828;
  background: color-mix(in srgb, var(--role) 14%, #0a1220);
  color: var(--role);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
  white-space: nowrap;
}
.guild-role-pill .guild-role-badge { width: 20px; height: 20px; object-fit: contain; }
/* Role mark: crown (HUD atlas) for the leader, a gem in the role colour for everyone else (replaces the v8 rank badges). */
.guild-role-gem { display: inline-block; flex: 0 0 auto; width: 10px; height: 10px; margin: 0 4px 0 5px; border: 1px solid rgba(0, 0, 0, .6); background: var(--role); box-shadow: 0 0 6px var(--role), inset 0 1px rgba(255, 255, 255, .45); transform: rotate(45deg); }
.role-leader { --role: #f4c862; }
.role-vice_leader { --role: #86bcff; }
.role-officer { --role: #c9a2ff; }
.role-member { --role: #8fd0a6; }

/* --------------------------------------------------------------------------
   6. Empty states, loading, error
   -------------------------------------------------------------------------- */
.guild-empty-state {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 8px;
  min-height: 100%;
  padding: 36px 20px;
  text-align: center;
}
.guild-empty-state.compact { min-height: 0; padding: 26px 16px; grid-column: 1 / -1; }
.guild-empty-state[hidden] { display: none; }
.guild-empty-art {
  display: grid;
  place-items: center;
  width: 108px;
  height: 108px;
  margin-bottom: 6px;
  border: 1px solid var(--g-line-soft);
  border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, #2a3f62, #0b1422 70%);
  box-shadow: 0 0 0 6px rgba(224, 180, 92, .06), inset 0 0 18px rgba(0, 0, 0, .7);
}
.guild-empty-state.compact .guild-empty-art { width: 76px; height: 76px; }
.guild-empty-art img { width: 64%; height: 64%; object-fit: contain; }
.guild-empty-state h3 { color: var(--g-title); font-size: 18px; }
.guild-empty-state p { max-width: 440px; color: var(--g-muted); font-size: 13px; }
.guild-empty-state button { margin-top: 8px; min-width: 160px; }

.guild-window.guild-loading-window,
.guild-window.guild-error-window { width: min(460px, calc(100vw - 32px)); height: auto; min-height: 260px; }
.guild-window.guild-error-window { min-height: 360px; }
.guild-loading { display: grid; place-items: center; gap: 6px; margin: auto; padding: 40px 24px; text-align: center; }
.guild-loading b { color: var(--g-gold-hi); font-size: 15px; }
.guild-loading small { color: var(--g-muted); font-size: 11px; letter-spacing: .2em; }
.guild-spinner { position: relative; display: grid; place-items: center; width: 76px; height: 76px; margin-bottom: 10px; }
.guild-spinner::before { content: ""; position: absolute; inset: 0; border: 3px solid rgba(255, 255, 255, .1); border-top-color: var(--g-gold-hi); border-radius: 50%; animation: guild-spin .9s linear infinite; }
.guild-spinner img { width: 46px; height: 46px; object-fit: contain; }
@keyframes guild-spin { to { transform: rotate(360deg); } }

/* --------------------------------------------------------------------------
   7. Lobby (no guild): directory + create side by side
   -------------------------------------------------------------------------- */
.guild-lobby-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(340px, 1fr);
  gap: 14px;
  align-items: start;
}
.guild-segment { display: none; }
.guild-browse .guild-card-note { margin: -6px 0 12px; }

.guild-search { position: relative; display: block; margin-bottom: 12px; }
.guild-search input { padding-left: 38px !important; }
.guild-search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  width: 14px;
  height: 14px;
  border: 2px solid var(--g-gold);
  border-radius: 50%;
  transform: translateY(-60%);
  pointer-events: none;
}
.guild-search-icon::after { content: ""; position: absolute; right: -6px; bottom: -5px; width: 7px; height: 2px; border-radius: 1px; background: var(--g-gold); transform: rotate(45deg); }

.guild-directory {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 10px;
}
.guild-directory-card {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--g-line-faint);
  border-radius: 11px;
  background: linear-gradient(180deg, rgba(27, 41, 66, .75), rgba(11, 19, 33, .85));
  transition: border-color .12s ease;
}
.guild-directory-card[hidden] { display: none; }
.guild-directory-card:hover { border-color: var(--g-line); }
.guild-directory-card.applied { border-color: rgba(134, 188, 255, .45); }
.guild-dir-emblem {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border: 1px solid var(--g-line-soft);
  border-radius: 12px;
  background: radial-gradient(circle at 50% 38%, #2b4163, #0b1422 72%);
}
.guild-dir-emblem img { width: 46px; height: 46px; object-fit: contain; }
.guild-dir-info { min-width: 0; display: grid; gap: 4px; }
.guild-dir-info > b { overflow: hidden; color: var(--g-bright); font-size: 15px; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
.guild-dir-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.guild-dir-tags .guild-tag { padding: 0 8px; font-size: 11px; }
.guild-dir-members { display: grid; grid-template-columns: minmax(40px, 1fr) auto; align-items: center; gap: 8px; }
.guild-dir-members > span { position: relative; height: 5px; overflow: hidden; border-radius: 3px; background: #050911; box-shadow: 0 0 0 1px rgba(190, 144, 70, .22); }
.guild-dir-members > span i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #6fb0ff, #9fd8ff); border-radius: 3px; }
.guild-dir-members small { color: var(--g-muted); font-size: 11px; white-space: nowrap; }
.guild-directory-card > button { min-height: 34px; padding: 0 12px; font-size: 13px; }
.guild-directory-card.applied > button:disabled { opacity: 1; filter: none; border-color: rgba(134, 188, 255, .55); background: rgba(30, 60, 110, .35); color: #b9dcff; }
.guild-directory-card > button .guild-action-icon { width: 18px; height: 18px; }

.guild-create-card { position: sticky; top: 0; display: grid; gap: 12px; }
.guild-create-card > .guild-card-head { margin-bottom: 0; }
.guild-create-preview {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  padding: 12px 14px 16px;
  border: 1px dashed rgba(224, 180, 92, .35);
  border-radius: 11px;
  background: radial-gradient(80% 120% at 0% 50%, rgba(224, 180, 92, .1), transparent 60%), rgba(7, 12, 22, .5);
}
.guild-crest.preview { width: 60px; height: 60px; }
.guild-crest.preview img { width: 50px; height: 50px; }
.guild-create-preview > div:last-child { min-width: 0; display: grid; }
.guild-create-preview > div:last-child small { color: var(--g-dim); font-size: 11px; letter-spacing: .08em; }
.guild-create-preview > div:last-child b { overflow: hidden; color: #f2cf7e; font-size: 19px; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
.guild-create-preview > div:last-child span { overflow: hidden; color: var(--g-muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }

.guild-cost { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.guild-cost > span {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 7px 10px;
  border: 1px solid var(--g-line-faint);
  border-radius: 9px;
  background: var(--g-inset);
}
.guild-cost > span > div { min-width: 0; display: grid; }
.guild-cost b { overflow: hidden; color: var(--g-bright); font-size: 13.5px; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
.guild-cost small { overflow: hidden; color: var(--g-muted); font-size: 11.5px; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
.guild-cost > span.ok { border-color: rgba(127, 227, 154, .4); }
.guild-cost > span.ok small { color: #a6ebb8; }
.guild-cost > span.short { border-color: rgba(255, 122, 102, .5); }
.guild-cost > span.short small { color: #ffb4a6; }
.guild-cost i { flex: 0 0 auto; width: 18px; height: 18px; }
.guild-cost i.coin { border-radius: 50%; background: radial-gradient(circle at 38% 32%, #fff2b0 0 14%, #f2c24c 30%, #b57a1c 68%, #6b430c 100%); box-shadow: 0 0 6px rgba(240, 190, 80, .45); }
.guild-cost i.gem { width: 12px; height: 12px; margin: 0 2px; border-radius: 2px; background: linear-gradient(135deg, #d6f4ff 0%, #57b8ff 38%, #2257d6 72%, #12307a 100%); box-shadow: 0 0 7px rgba(90, 180, 255, .7); transform: rotate(45deg); }

.guild-emblem-picker { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 6px; }
.guild-emblem-picker label { position: relative; cursor: pointer; }
.guild-emblem-picker input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.guild-emblem-picker label > span {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border: 1px solid var(--g-line-faint);
  border-radius: 9px;
  background: radial-gradient(circle at 50% 40%, #1d2e4a, #0a1220 75%);
  transition: border-color .12s ease, box-shadow .12s ease;
}
.guild-emblem-picker label > span img { width: 80%; height: 80%; object-fit: contain; opacity: .78; transition: opacity .12s ease, transform .12s ease; }
.guild-emblem-picker label:hover > span { border-color: var(--g-line); }
.guild-emblem-picker label:hover > span img { opacity: 1; }
.guild-emblem-picker input:checked + span { border-color: var(--g-gold-hi); box-shadow: 0 0 0 2px rgba(246, 220, 154, .25), 0 0 12px rgba(224, 180, 92, .35); background: radial-gradient(circle at 50% 40%, #3a4f73, #111c30 75%); }
.guild-emblem-picker input:checked + span img { opacity: 1; transform: scale(1.06); }
.guild-emblem-picker input:focus-visible + span { outline: 2px solid var(--g-gold-hi); outline-offset: 1px; }

/* --------------------------------------------------------------------------
   8. Overview
   -------------------------------------------------------------------------- */
.guild-overview {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, 1fr);
  gap: 14px;
  align-items: start;
}
.guild-ov-main,
.guild-ov-side { display: grid; gap: 14px; min-width: 0; }

.guild-level-row { display: grid; grid-template-columns: 88px minmax(0, 1fr); align-items: center; gap: 16px; margin-bottom: 14px; }
.guild-level-badge {
  display: grid;
  place-items: center;
  align-content: center;
  width: 88px;
  height: 88px;
  border: 2px solid var(--g-gold);
  border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, #2c4064, #0e1829 66%, #070c16);
  box-shadow: 0 0 0 3px #1a1206, 0 0 18px rgba(224, 180, 92, .25), inset 0 0 14px rgba(0, 0, 0, .7);
}
.guild-level-badge small { color: var(--g-muted); font-size: 10px; letter-spacing: .2em; line-height: 1; }
.guild-level-badge b { color: var(--g-gold-hi); font-size: 38px; line-height: 1; text-shadow: 0 2px 0 #3a250b, 0 0 12px rgba(240, 190, 90, .35); }
.guild-level-progress { min-width: 0; display: grid; gap: 8px; }
.guild-level-progress .guild-bar { height: 16px; border-radius: 9px; }
.guild-level-caption { display: flex; justify-content: space-between; gap: 10px; color: #c9d3e3; font-size: 13px; }
.guild-level-caption b { color: var(--g-gold-hi); }
.guild-level-caption small { color: var(--g-gold); font-size: 12px; font-weight: 700; }

.guild-stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.guild-stat {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 9px 12px;
  border: 1px solid var(--g-line-faint);
  border-radius: 10px;
  background: var(--g-inset);
}
.guild-stat-icon { flex: 0 0 auto; width: 34px; height: 34px; object-fit: contain; }
.guild-stat > div { min-width: 0; }
.guild-stat small { display: block; color: var(--g-muted); font-size: 11.5px; line-height: 1.3; }
.guild-stat b { display: block; overflow: hidden; color: var(--g-bright); font-size: 15.5px; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }

.guild-buffs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.guild-ov-side .guild-buffs { grid-template-columns: minmax(0, 1fr); }
.guild-buff {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(127, 227, 154, .22);
  border-radius: 10px;
  background: radial-gradient(90% 120% at 100% 50%, rgba(127, 227, 154, .08), transparent 60%), var(--g-inset);
}
.guild-buff .guild-stat-icon { width: 38px; height: 38px; }
.guild-buff b { display: block; color: var(--g-text); font-size: 12.5px; line-height: 1.3; }
.guild-buff small { display: block; color: var(--g-dim); font-size: 11.5px; line-height: 1.3; }
.guild-buff strong { color: var(--g-green); font-size: 24px; line-height: 1; text-shadow: 0 0 10px rgba(127, 227, 154, .35); }

.guild-donate-card { display: grid; gap: 10px; }
.guild-donate-card > .guild-card-head { margin-bottom: 2px; }
.guild-presets { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.guild-presets button {
  min-height: 32px;
  padding: 0 6px;
  border: 1px solid var(--g-line-soft);
  border-radius: 8px;
  background: var(--g-btn-navy);
  color: var(--g-gold-hi);
  font: 700 13px/1 var(--g-font);
  cursor: pointer;
}
.guild-presets button:hover,
.guild-presets button.active { border-color: var(--g-gold-hi); background: linear-gradient(180deg, #3b2b13, #1d150a); }

.guild-donors { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.guild-donors li { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 7px 6px; border-radius: 8px; }
.guild-donors li + li { border-top: 1px solid rgba(190, 144, 70, .1); }
.guild-donors li.self { background: rgba(224, 180, 92, .07); }
.guild-donors li > div { min-width: 0; display: grid; gap: 4px; }
.guild-donors b { overflow: hidden; color: var(--g-bright); font-size: 13.5px; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.guild-donors small { color: var(--g-gold-hi); font-size: 13px; font-weight: 700; }
.guild-donor-rank { display: grid; place-items: center; width: 26px; height: 26px; border: 1px solid var(--g-line-soft); border-radius: 50%; background: #0a1220; color: var(--g-muted); font-size: 12px; font-weight: 700; }
.guild-donor-rank.r1 { border-color: #f6d790; background: var(--g-btn-gold); color: #241503; }
.guild-donor-rank.r2 { border-color: #dfe7f2; background: linear-gradient(180deg, #f1f5fb, #9aa8bb); color: #182030; }
.guild-donor-rank.r3 { border-color: #e9a66a; background: linear-gradient(180deg, #f2b77f, #9a5a26); color: #2a1404; }

.guild-leave-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-color: rgba(255, 122, 102, .3);
  background: radial-gradient(90% 140% at 0% 50%, rgba(160, 40, 30, .14), transparent 65%), var(--g-card);
}
.guild-leave-card > div { min-width: 0; display: grid; gap: 2px; }
.guild-leave-card b { color: #ffc2b6; font-size: 14px; }
.guild-leave-card small { color: var(--g-dim); font-size: 12px; }
.guild-leave-card button { flex: 0 0 auto; }

/* --------------------------------------------------------------------------
   9. Members
   -------------------------------------------------------------------------- */
.guild-members-view { display: grid; gap: 14px; }
.guild-applications.has-items { border-color: rgba(255, 170, 120, .45); }
.guild-app-list { display: grid; gap: 8px; }
.guild-app {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--g-line-faint);
  border-radius: 10px;
  background: var(--g-inset);
}
.guild-app .guild-avatar { width: 44px; height: 44px; font-size: 17px; }
.guild-app-id { min-width: 0; display: grid; }
.guild-app-id b { overflow: hidden; color: var(--g-bright); font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.guild-app-id small { overflow: hidden; color: var(--g-muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.guild-app-actions { display: flex; gap: 8px; }
.guild-no-applications { padding: 6px 2px 2px; color: var(--g-dim); font-size: 13px; }

.guild-roster { display: grid; gap: 10px; }
.guild-roster-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 8px 16px; }
.guild-roster-head h3 { color: var(--g-title); font-size: 18px; line-height: 1.3; }
.guild-roster-head h3 span { margin-left: 6px; color: var(--g-muted); font-size: 14px; font-weight: 600; }
.guild-role-legend { display: flex; flex-wrap: wrap; gap: 6px; }
.guild-role-legend span { padding: 2px 10px; border: 1px solid rgba(255, 255, 255, .18); border-color: color-mix(in srgb, var(--role) 40%, transparent); border-radius: 999px; background: #0d1626; background: color-mix(in srgb, var(--role) 10%, #0a1220); color: var(--role); font-size: 12px; font-weight: 600; white-space: nowrap; }
.guild-role-legend b { color: var(--g-bright); }
.guild-roster > .guild-card-note { margin-top: -4px; }

.guild-member-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 10px; }
.guild-member {
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--g-line-faint);
  border-radius: 12px;
  background: var(--g-card);
  box-shadow: inset 3px 0 0 var(--role), 0 4px 14px rgba(0, 0, 0, .25);
}
.guild-member.self { border-color: rgba(246, 220, 154, .5); background: radial-gradient(90% 120% at 100% 0%, rgba(224, 180, 92, .1), transparent 60%), var(--g-card); }
.guild-member-top { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; align-items: center; gap: 12px; }
.guild-avatar {
  position: relative;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 2px solid var(--role);
  border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, #33507a, #13203a 55%, #070c16);
  box-shadow: 0 0 0 2px #070c16, 0 0 10px color-mix(in srgb, var(--role) 30%, transparent);
  color: var(--g-bright);
  font-size: 20px;
  font-weight: 700;
}
.guild-avatar > span { line-height: 1; }
.guild-avatar .guild-role-badge { position: absolute; right: -6px; bottom: -6px; width: 24px; height: 24px; object-fit: contain; filter: drop-shadow(0 1px 2px #000); }
.guild-member-id { min-width: 0; display: grid; gap: 2px; }
.guild-member-name { display: flex; align-items: center; gap: 6px; min-width: 0; }
.guild-member-name b { overflow: hidden; color: var(--g-bright); font-size: 15.5px; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
.guild-member-id small { overflow: hidden; color: var(--g-muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.guild-you-badge { flex: 0 0 auto; padding: 0 7px; border: 1px solid rgba(246, 220, 154, .5); border-radius: 6px; background: rgba(224, 180, 92, .16); color: var(--g-gold-hi); font-size: 11px; font-weight: 700; line-height: 1.6; }

.guild-member-contrib { display: grid; gap: 5px; margin-top: 10px; }
.guild-member-contrib > div { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.guild-member-contrib small { color: var(--g-dim); font-size: 11.5px; }
.guild-member-contrib b { color: var(--g-gold-hi); font-size: 14px; }

.guild-member-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed rgba(190, 144, 70, .22);
}
.guild-role-editor { display: flex; align-items: center; gap: 6px; min-width: 0; }
.guild-role-editor select { width: 136px !important; height: 34px !important; font-size: 13.5px !important; }
.guild-member-buttons { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.guild-member-actions.note { min-height: 45px; }
.guild-member-actions.note small { color: var(--g-dim); font-size: 12px; }
.guild-member-actions button { min-height: 34px; padding: 0 11px; font-size: 13px; }
.guild-member-actions .guild-action-icon { width: 17px; height: 17px; }

/* --------------------------------------------------------------------------
   10. Guild War
   -------------------------------------------------------------------------- */
/* 10a. v16 art atlases (128 px cells; percent positions so any display size works). */
.gw-act,
.gw-ic { display: inline-block; flex: 0 0 auto; width: 20px; height: 20px; vertical-align: middle; background-repeat: no-repeat; font-style: normal; }
.gw-act { background-image: url('/assets/guild_v16/ui/guild-actions-v16.png'); background-size: 400% 400%; }
.gw-ic { background-image: url('/assets/guild_v16/hud/hud-icons-v16.png'); background-size: 500% 500%; }
.gw-act-join { background-position: 0 0; } .gw-act-create { background-position: 33.333% 0; } .gw-act-leave { background-position: 66.667% 0; } .gw-act-accept { background-position: 100% 0; }
.gw-act-reject { background-position: 0 33.333%; } .gw-act-kick { background-position: 33.333% 33.333%; } .gw-act-promote { background-position: 66.667% 33.333%; } .gw-act-transfer { background-position: 100% 33.333%; }
.gw-act-donate { background-position: 0 66.667%; } .gw-act-members { background-position: 33.333% 66.667%; } .gw-act-invite { background-position: 66.667% 66.667%; } .gw-act-declare { background-position: 100% 66.667%; }
.gw-act-accept_challenge { background-position: 0 100%; } .gw-act-surrender { background-position: 33.333% 100%; } .gw-act-medal_shop { background-position: 66.667% 100%; } .gw-act-ranking { background-position: 100% 100%; }
.gw-ic-gate { background-position: 0 0; } .gw-ic-gate_broken { background-position: 25% 0; } .gw-ic-core_sealed { background-position: 50% 0; } .gw-ic-core_open { background-position: 75% 0; } .gw-ic-tower { background-position: 100% 0; }
.gw-ic-tower_ruined { background-position: 0 25%; } .gw-ic-kill { background-position: 25% 25%; } .gw-ic-death { background-position: 50% 25%; } .gw-ic-assist { background-position: 75% 25%; } .gw-ic-mvp { background-position: 100% 25%; }
.gw-ic-bounty { background-position: 0 50%; } .gw-ic-shutdown { background-position: 25% 50%; } .gw-ic-tonic_hp { background-position: 50% 50%; } .gw-ic-tonic_mp { background-position: 75% 50%; } .gw-ic-rally { background-position: 100% 50%; }
.gw-ic-underdog { background-position: 0 75%; } .gw-ic-timer { background-position: 25% 75%; } .gw-ic-war_score { background-position: 50% 75%; } .gw-ic-drake { background-position: 75% 75%; } .gw-ic-sim { background-position: 100% 75%; }
.gw-ic-respawn { background-position: 0 100%; } .gw-ic-lane { background-position: 25% 100%; } .gw-ic-structure_dmg { background-position: 50% 100%; } .gw-ic-merit { background-position: 75% 100%; } .gw-ic-live { background-position: 100% 100%; }
.guild-window .gw-reward,
.guild-confirm-dialog .gw-reward { width: 22px; height: 22px; object-fit: contain; vertical-align: middle; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .6)); }
.guild-window img.gw-img-missing { visibility: hidden; }
.guild-avatar .guild-role-gem { position: absolute; right: -3px; bottom: -3px; width: 13px; height: 13px; margin: 0; }
.guild-spinner .guild-spinner-icon { width: 46px; height: 46px; }
.guild-empty-art :is(.gw-act, .gw-ic) { width: 64%; height: 64%; }
.guild-empty-art .gw-reward { width: 64% !important; height: 64% !important; }
.guild-war-disabled .guild-empty-art .gw-ic { filter: grayscale(.8) brightness(.75); }
.guild-stat i.guild-stat-icon { width: 34px; height: 34px; }
.guild-buff i.guild-stat-icon { width: 38px; height: 38px; }

/* 10b. Shared war pieces: chips, notes, segmented buttons. */
.gw-war { display: grid; gap: 14px; }
.gw-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border: 1px solid var(--g-line-soft);
  border-radius: 999px;
  background: #0a1220;
  color: #c9d3e3;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
}
.gw-chip .gw-ic, .gw-chip .gw-reward { width: 18px !important; height: 18px !important; }
.gw-chip.ready { border-color: rgba(127, 227, 154, .6); background: rgba(20, 70, 38, .55); color: #c9f5d4; }
.gw-chip.busy { border-color: rgba(255, 122, 102, .55); background: rgba(90, 24, 18, .55); color: #ffc2b6; }
.gw-chip.cool { border-color: rgba(134, 188, 255, .5); background: rgba(24, 48, 90, .55); color: #c6defc; }
.gw-chip.live { border-color: rgba(255, 90, 74, .75); background: rgba(110, 22, 16, .7); color: #ffe0d8; }
.gw-chip.gold { border-color: rgba(246, 215, 144, .6); background: rgba(80, 56, 16, .45); color: var(--g-gold-hi); }
.gw-count { font-variant-numeric: tabular-nums; }
.gw-why { display: flex; align-items: center; gap: 6px; color: #ff9c86; font-size: 12px; font-weight: 600; line-height: 1.35; }
.gw-why::before { content: "!"; display: grid; place-items: center; flex: none; width: 16px; height: 16px; border-radius: 50%; background: #c0473a; color: #fff; font: 900 11px/1 var(--g-font); }
.gw-notice { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border: 1px solid rgba(134, 188, 255, .4); border-radius: 10px; background: rgba(24, 48, 90, .35); color: #c6defc; font-size: 13px; }
.gw-wait-note { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 12px; border: 1px dashed var(--g-line-soft); border-radius: 9px; color: var(--g-muted); font-size: 13px; text-align: center; }
.gw-wait-note .gw-act { width: 24px; height: 24px; }
.gw-big { min-height: 46px; padding: 0 22px; font-size: 15px; }
.gw-seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 3px; border: 1px solid var(--g-line-soft); border-radius: 10px; background: rgba(6, 11, 20, .6); }
.gw-seg button { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 14px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: #b9c6da; font: 700 13px/1 var(--g-font); cursor: pointer; }
.gw-seg button:hover { color: #fff; border-color: var(--g-line-soft); }
.gw-seg button.active { border-color: #ffd98a; background: linear-gradient(180deg, #f6d27a, #d29a3c 55%, #a8741f); color: #1d1405; }
.gw-seg button.blue.active { border-color: #9fd0ff; background: linear-gradient(180deg, #6fb6ff, #2c6fc2 60%, #1b4a8a); color: #fff; }
.gw-seg button.red.active { border-color: #ffb09e; background: linear-gradient(180deg, #ff8a74, #c2392a 60%, #8a1f17); color: #fff; }
.gw-seg.small button { min-height: 30px; padding: 0 12px; font-size: 12.5px; }
.gw-el-dot { display: inline-block; flex: 0 0 auto; width: 10px; height: 10px; border: 1px solid rgba(0, 0, 0, .7); border-radius: 50%; background: var(--el, #8d9bb0); box-shadow: 0 0 6px var(--el, transparent); }
.gw-online-dot { display: inline-block; flex: 0 0 auto; width: 8px; height: 8px; margin-right: 4px; border-radius: 50%; background: #4d5a6e; vertical-align: middle; }
.gw-online-dot.on { background: #6fe39a; box-shadow: 0 0 6px rgba(111, 227, 154, .8); }
.gw-tag { display: inline-flex; align-items: center; gap: 3px; padding: 0 6px; border: 1px solid var(--g-line-soft); border-radius: 6px; background: #0a1220; color: #c9d3e3; font-size: 10.5px; font-style: normal; font-weight: 700; line-height: 1.6; white-space: nowrap; }
.gw-tag.field { border-color: rgba(127, 227, 154, .55); color: #c9f5d4; }
.gw-tag.gold { border-color: rgba(246, 215, 144, .55); color: var(--g-gold-hi); }
.gw-tag .gw-ic { width: 14px; height: 14px; }

/* 10c. State "none": painted battlefield banner, rules, rival cards, live wars. */
.gw-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 1fr);
  align-items: stretch;
  min-height: 200px;
  overflow: hidden;
  border: 1px solid var(--g-line);
  border-radius: 12px;
  background:
    linear-gradient(90deg, rgba(6, 11, 20, .96) 0%, rgba(6, 11, 20, .82) 38%, rgba(6, 11, 20, .25) 62%, rgba(6, 11, 20, .1) 100%),
    linear-gradient(0deg, rgba(6, 11, 20, .55), transparent 40%),
    linear-gradient(180deg, transparent 54%, rgba(120, 86, 46, .55) 54% 74%, transparent 74%),
    url('/assets/guild_v16/tiles/grass.png') 0 0 / 128px 128px repeat,
    #1b3a1c;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, .55), 0 8px 24px rgba(0, 0, 0, .4);
}
.gw-hero-text { position: relative; z-index: 2; grid-column: 1; grid-row: 1; display: grid; align-content: center; gap: 6px; padding: 22px 24px; }
.gw-hero-text h3 { color: #f6d27a; font-size: 25px; line-height: 1.2; text-shadow: 0 2px 0 #3a250b, 0 0 14px rgba(240, 190, 90, .3); }
.gw-hero-text > p:not(.guild-eyebrow) { max-width: 52ch; color: #d7deea; font-size: 13.5px; text-shadow: 0 1px 2px #000; }
.gw-hero-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.gw-hero-field { position: relative; z-index: 1; grid-column: 2; grid-row: 1; min-height: 190px; }
.gw-hero-field img { position: absolute; bottom: 8%; object-fit: contain; filter: drop-shadow(0 8px 10px rgba(0, 0, 0, .6)); }
.gw-hero-gate { width: 34%; max-width: 150px; }
.gw-hero-gate.blue { left: 6%; }
.gw-hero-gate.red { right: 6%; }
.gw-hero-core { width: 16%; max-width: 70px; bottom: 34% !important; opacity: .95; }
.gw-hero-core.blue { left: 0; }
.gw-hero-core.red { right: 0; }
.gw-hero-vs { position: absolute; left: 50%; top: 46%; display: grid; place-items: center; width: 64px; height: 64px; border: 2px solid var(--g-gold); border-radius: 50%; background: radial-gradient(circle, #3b1410, #120707 70%); box-shadow: 0 0 0 3px #1a1206, 0 0 22px rgba(255, 90, 60, .5); transform: translate(-50%, -50%); }
.gw-hero-vs .gw-ic { width: 46px; height: 46px; animation: gw-pulse 1.8s ease-in-out infinite; }
@keyframes gw-pulse { 50% { transform: scale(1.08); filter: brightness(1.25); } }

.gw-rules { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.gw-rules article { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 12px 14px; border: 1px solid var(--g-line-faint); border-radius: 11px; background: var(--g-card); }
.gw-rule-art { flex: 0 0 auto; display: flex; align-items: center; justify-content: center; min-width: 46px; height: 46px; padding: 0 6px; border: 1px solid var(--g-line-soft); border-radius: 10px; background: radial-gradient(circle at 50% 40%, #24385a, #0b1422 72%); }
.gw-rule-art :is(.gw-ic, .gw-act) { width: 26px; height: 26px; margin: 0 -3px; }
.gw-rule-art .gw-reward { width: 32px !important; height: 32px !important; }
.gw-rules span:not(.gw-rule-art) { min-width: 0; display: grid; gap: 2px; }
.gw-rules strong { color: var(--g-bright); font-size: 13.5px; line-height: 1.35; }
.gw-rules small { color: var(--g-muted); font-size: 12px; line-height: 1.4; }

.gw-declare-card { display: grid; gap: 12px; }
.gw-declare-card > .guild-card-head { margin-bottom: 0; }
.gw-rival-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 10px; }
.guild-window .gw-rival {
  position: relative;
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--g-line-faint);
  border-radius: 11px;
  background: linear-gradient(180deg, rgba(27, 41, 66, .75), rgba(11, 19, 33, .85));
  transition: border-color .12s ease, box-shadow .12s ease, transform .12s ease;
}
.guild-window .gw-rival.selectable { cursor: pointer; }
.guild-window .gw-rival.selectable:hover:not(.busy) { border-color: var(--g-line); transform: translateY(-1px); }
.guild-window .gw-rival.selected { border-color: var(--g-gold-hi); box-shadow: 0 0 0 1px #000, 0 0 16px rgba(246, 220, 154, .35); background: radial-gradient(120% 100% at 0% 0%, rgba(224, 180, 92, .16), transparent 62%), linear-gradient(180deg, #1d2d48, #0d1729); }
.guild-window .gw-rival.busy { opacity: .62; filter: grayscale(.4); cursor: not-allowed; }
.gw-rival input[type="radio"] { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: inherit; }
.gw-rival input[type="radio"]:focus-visible ~ .gw-rival-emblem { outline: 2px solid var(--g-gold-hi); outline-offset: 2px; }
.gw-rival-emblem { position: relative; display: grid; place-items: center; width: 60px; height: 60px; border: 1px solid var(--g-line-soft); border-radius: 12px; background: radial-gradient(circle at 50% 38%, #2b4163, #0b1422 72%); }
.gw-rival-emblem img { width: 50px; height: 50px; object-fit: contain; }
.gw-rival-emblem em { position: absolute; left: 50%; bottom: -8px; padding: 0 6px; border: 1px solid #f6d790; border-radius: 999px; background: var(--g-btn-gold); color: #241503; font: 700 10px/1.4 var(--g-font); font-style: normal; white-space: nowrap; transform: translateX(-50%); }
.gw-rival-info { min-width: 0; display: grid; gap: 3px; }
.gw-rival-info b { overflow: hidden; color: var(--g-bright); font-size: 15px; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
.gw-rival-info small { display: flex; align-items: center; flex-wrap: wrap; gap: 0 4px; color: var(--g-muted); font-size: 11.5px; line-height: 1.45; }
.gw-rival-info small strong { color: var(--g-gold-hi); }
.gw-rival-info :is(.gw-ic, .gw-act) { width: 16px; height: 16px; }
.gw-declare-row { display: grid; grid-template-columns: 160px minmax(0, 1fr) auto; align-items: end; gap: 12px; padding-top: 12px; border-top: 1px dashed rgba(190, 144, 70, .25); }
.gw-fee { display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 42px; padding: 6px 12px; border: 1px solid rgba(127, 227, 154, .35); border-radius: 9px; background: var(--g-inset); color: #d7deea; font-size: 13px; }
.gw-fee .gw-reward { width: 30px !important; height: 30px !important; }
.gw-fee > span { min-width: 0; display: block; line-height: 1.4; }
.gw-fee b { color: var(--g-gold-hi); }
.gw-fee small { display: block; color: var(--g-dim); font-size: 11.5px; }
.gw-fee.short { border-color: rgba(255, 122, 102, .55); }
.gw-fee.short b { color: #ff9c86; }
.gw-declare-go { display: grid; justify-items: end; gap: 4px; }

.gw-live-card > .guild-card-head { margin-bottom: 10px; }
.gw-spec-list { display: grid; gap: 8px; }
.gw-spec { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--g-line-faint); border-radius: 10px; background: var(--g-inset); }
.gw-spec-side { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 8px; min-width: 0; }
.gw-spec-side.red { grid-template-columns: auto minmax(0, 1fr) 40px; text-align: right; }
.gw-spec-side.red .gw-spec-emblem { order: 3; }
.gw-spec-side.red strong { order: 1; }
.gw-spec-side.red > div { order: 2; }
.gw-spec-emblem img { width: 40px; height: 40px; object-fit: contain; }
.gw-spec-side > div { min-width: 0; display: grid; gap: 4px; }
.gw-spec-side b { overflow: hidden; color: var(--g-bright); font-size: 13.5px; text-overflow: ellipsis; white-space: nowrap; }
.gw-spec-side.blue b { color: #a9d4ff; }
.gw-spec-side.red b { color: #ffb4a6; }
.gw-spec-side strong { color: var(--g-gold-hi); font-size: 20px; font-variant-numeric: tabular-nums; }
.gw-spec-mid { display: grid; justify-items: center; gap: 2px; }
.gw-spec-mid small { color: var(--g-gold); font-size: 10.5px; font-weight: 700; letter-spacing: .14em; }

/* 10d. Challenge (out / in): scroll card. */
.gw-challenge { display: grid; gap: 12px; }
.gw-scroll-card {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  align-items: center;
  gap: 20px;
  padding: 20px 22px;
  border: 1px solid var(--g-line);
  border-radius: 14px;
  background:
    radial-gradient(70% 120% at 0% 50%, rgba(224, 180, 92, .18), transparent 65%),
    radial-gradient(60% 100% at 100% 0%, rgba(255, 90, 74, .12), transparent 70%),
    var(--g-card);
  box-shadow: inset 0 1px rgba(255, 226, 160, .08), 0 8px 22px rgba(0, 0, 0, .35);
}
.gw-scroll-card.big { grid-template-columns: 230px minmax(0, 1fr); border-color: rgba(255, 170, 120, .7); box-shadow: 0 0 0 1px #2a0805, 0 0 26px rgba(255, 120, 80, .2), 0 8px 22px rgba(0, 0, 0, .35); }
.gw-scroll-art { position: relative; display: grid; place-items: center; }
.gw-scroll-art .gw-reward { width: 140px !important; height: 140px !important; filter: drop-shadow(0 10px 14px rgba(0, 0, 0, .65)) !important; }
.gw-scroll-card.big .gw-scroll-art .gw-reward { width: 220px !important; height: 220px !important; animation: gw-float 3.2s ease-in-out infinite; }
.gw-scroll-emblem { position: absolute; right: 4px; bottom: 6px; display: grid; place-items: center; width: 70px; height: 70px; border: 2px solid var(--g-gold); border-radius: 50%; background: radial-gradient(circle at 50% 38%, #3a2a2a, #120a0a 72%); box-shadow: 0 0 0 3px #1a1206, 0 6px 14px rgba(0, 0, 0, .6); }
.gw-scroll-emblem img { width: 56px; height: 56px; object-fit: contain; }
@keyframes gw-float { 50% { transform: translateY(-5px) rotate(-1.5deg); } }
.gw-scroll-text { min-width: 0; display: grid; gap: 6px; }
.gw-scroll-text h3 { color: #f6d27a; font-size: 24px; line-height: 1.25; text-shadow: 0 2px 0 #3a250b; overflow-wrap: anywhere; }
.gw-scroll-card.big .gw-scroll-text h3 { font-size: 30px; color: #ffd2a8; }
.gw-scroll-sub { color: var(--g-muted); font-size: 13px; }
.gw-scroll-timer { display: flex; align-items: center; gap: 8px; color: #d7deea; font-size: 15px; }
.gw-scroll-timer .gw-ic { width: 24px; height: 24px; }
.gw-scroll-timer .gw-count { color: var(--g-gold-hi); font-size: 22px; }
.gw-facts { display: grid; gap: 4px; margin: 4px 0 0; padding: 0; list-style: none; }
.gw-facts li { display: flex; align-items: center; gap: 8px; color: #c9d3e3; font-size: 13px; line-height: 1.45; }
.gw-facts li.short { color: #ff9c86; }
.gw-facts :is(.gw-ic, .gw-act, .gw-reward) { flex: 0 0 auto; width: 20px !important; height: 20px !important; }
.gw-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.gw-refresh { justify-self: center; min-height: 34px; font-size: 13px; }
.gw-mini-vs { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid var(--g-line-faint); border-radius: 12px; background: var(--g-inset); }
.gw-mini-vs > span { color: var(--g-gold); font-size: 13px; font-weight: 700; letter-spacing: .16em; }
.gw-mini-side { display: grid; grid-template-columns: 44px minmax(0, 1fr); grid-template-rows: auto auto; align-items: center; column-gap: 10px; min-width: 0; }
.gw-mini-side img { grid-row: 1 / 3; width: 44px; height: 44px; object-fit: contain; }
.gw-mini-side b { overflow: hidden; color: var(--g-bright); font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.gw-mini-side small { color: var(--g-muted); font-size: 11.5px; }
.gw-mini-side.blue b { color: #a9d4ff; }
.gw-mini-side.red { grid-template-columns: minmax(0, 1fr) 44px; text-align: right; }
.gw-mini-side.red img { grid-column: 2; }
.gw-mini-side.red :is(b, small) { grid-column: 1; }
.gw-mini-side.red b { color: #ffb4a6; }
.gw-mini-side.mine b::after { content: " ★"; color: var(--g-gold); }

/* 10e. Prep / active: phase banner, versus bar, lanes, rosters, battle log. */
.gw-battle { display: grid; gap: 12px; }
.gw-battle [data-gw-live] { display: grid; gap: 12px; }
.gw-phase { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid var(--g-line); border-radius: 12px; background: radial-gradient(60% 160% at 0% 50%, rgba(224, 180, 92, .2), transparent 70%), linear-gradient(180deg, #17263f, #0b1422); }
.gw-phase.active { border-color: rgba(255, 90, 74, .7); background: radial-gradient(60% 160% at 0% 50%, rgba(255, 90, 74, .22), transparent 70%), linear-gradient(180deg, #2a1414, #120909); }
.gw-phase-ic { width: 42px !important; height: 42px !important; }
.gw-phase.active .gw-phase-ic { animation: gw-pulse 1.6s ease-in-out infinite; }
.gw-phase > div { min-width: 0; display: grid; }
.gw-phase b { color: #f6d27a; font-size: 18px; line-height: 1.3; }
.gw-phase.active b { color: #ffd2c8; }
.gw-phase span { color: #c9d3e3; font-size: 13px; }
.gw-phase .gw-count { color: var(--g-gold-hi); font-size: 16px; }

.gw-versus { display: grid; grid-template-columns: minmax(0, 1fr) 150px minmax(0, 1fr); gap: 10px; align-items: stretch; }
.gw-vs-side { min-width: 0; display: grid; align-content: start; gap: 8px; padding: 12px; border: 1px solid; border-radius: 12px; }
.gw-vs-side.blue { border-color: rgba(75, 188, 255, .55); background: linear-gradient(90deg, rgba(30, 90, 160, .38), rgba(10, 17, 30, .96) 75%); }
.gw-vs-side.red { border-color: rgba(255, 90, 74, .55); background: linear-gradient(270deg, rgba(160, 40, 30, .38), rgba(10, 17, 30, .96) 75%); }
.gw-vs-side.mine { box-shadow: 0 0 0 1px var(--g-gold), 0 0 18px rgba(224, 180, 92, .25); }
.gw-vs-head { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-width: 0; }
.gw-vs-side.red .gw-vs-head { grid-template-columns: auto minmax(0, 1fr) 56px; text-align: right; }
.gw-vs-side.red .gw-vs-crest { order: 3; }
.gw-vs-side.red .gw-vs-id { order: 2; }
.gw-vs-side.red .gw-vs-score { order: 1; }
.gw-vs-crest { display: grid; place-items: center; width: 56px; height: 56px; border: 1px solid var(--g-line-soft); border-radius: 50%; background: radial-gradient(circle at 50% 38%, #2f4668, #0b1422 72%); }
.gw-vs-crest img { width: 48px; height: 48px; object-fit: contain; }
.gw-vs-id { min-width: 0; display: grid; gap: 1px; }
.gw-vs-id small { color: var(--g-muted); font-size: 11px; font-weight: 700; letter-spacing: .06em; }
.gw-vs-side.blue .gw-vs-id small { color: #9fd0ff; }
.gw-vs-side.red .gw-vs-id small { color: #ffb4a6; }
.gw-vs-id b { overflow: hidden; color: var(--g-bright); font-size: 17px; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.gw-vs-id em { display: flex; align-items: center; gap: 4px; color: var(--g-muted); font-size: 11.5px; font-style: normal; }
.gw-vs-side.red .gw-vs-id em { justify-content: flex-end; }
.gw-vs-id em .gw-ic { width: 16px; height: 16px; }
.gw-vs-score { color: #fff3cf; font-size: 34px; line-height: 1; font-variant-numeric: tabular-nums; text-shadow: 0 2px 0 rgba(0, 0, 0, .6), 0 0 14px rgba(255, 210, 120, .35); }
.gw-vs-side.blue .gw-vs-score { color: #cfe9ff; text-shadow: 0 2px 0 rgba(0, 0, 0, .6), 0 0 14px rgba(75, 188, 255, .5); }
.gw-vs-side.red .gw-vs-score { color: #ffd9d2; text-shadow: 0 2px 0 rgba(0, 0, 0, .6), 0 0 14px rgba(255, 90, 74, .5); }
.gw-vs-mid { display: grid; justify-items: center; align-content: center; gap: 2px; padding: 8px 10px; border: 1px solid var(--g-line); border-radius: 50% / 22%; background: radial-gradient(circle at 50% 30%, rgba(224, 180, 92, .18), transparent 70%), linear-gradient(180deg, #16243a, #0b1422); text-align: center; }
.gw-vs-ic { width: 34px !important; height: 34px !important; }
.gw-vs-mid small { color: var(--g-gold); font-size: 11px; font-weight: 700; letter-spacing: .08em; }
.gw-vs-mid .gw-count { color: var(--g-gold-hi); font-size: 30px; line-height: 1.1; text-shadow: 0 0 12px rgba(255, 190, 70, .45); }
.gw-vs-mid em { color: var(--g-muted); font-size: 11.5px; font-style: normal; }
.gw-vs-mid.last { border-color: rgba(255, 90, 74, .8); animation: gw-last 1s ease-in-out infinite; }
.gw-vs-mid.last .gw-count, .gw-vs-mid.last small { color: #ff8a73; }
@keyframes gw-last { 50% { box-shadow: 0 0 18px rgba(255, 90, 74, .55); } }

.gw-core { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--g-line-faint); border-radius: 9px; background: rgba(6, 11, 20, .55); }
.gw-core .gw-ic { width: 30px; height: 30px; }
.gw-core > div { min-width: 0; display: grid; gap: 3px; }
.gw-core b { color: #d7deea; font-size: 11px; letter-spacing: .04em; }
.gw-core.open b { color: #ffcf8a; }
.gw-core.down b { color: #ff9c86; }
.gw-core strong { color: var(--g-bright); font-size: 14px; font-variant-numeric: tabular-nums; }
.gw-core.sealed .gw-ic { filter: drop-shadow(0 0 5px rgba(150, 210, 255, .7)); }
.gw-lanes { display: grid; gap: 4px; }
.gw-lane { display: grid; grid-template-columns: 34px minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: 8px; }
.gw-lane small { color: var(--g-muted); font-size: 11px; }
.gw-lane.open small { color: #ffcf8a; }
.gw-pip { display: grid; grid-template-columns: 22px minmax(0, 1fr); align-items: center; gap: 5px; min-width: 0; }
.gw-pip .gw-ic { width: 22px; height: 22px; }
.gw-pip .guild-bar { height: 6px; }
.gw-pip.down .gw-ic { filter: grayscale(.8) brightness(.7); }
.gw-pip.down .guild-bar { opacity: .4; }
.guild-bar.blue i { background: linear-gradient(180deg, #a6d4ff, #3f8ae6 45%, #1d4a9a); }
.gw-hint { padding: 7px 12px; border: 1px solid rgba(246, 215, 144, .35); border-radius: 9px; background: rgba(80, 56, 16, .3); color: #ffe7a8; font-size: 13px; font-weight: 600; text-align: center; }

.gw-rosters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.gw-roster { min-width: 0; padding: 10px 12px; border: 1px solid; border-radius: 12px; background: var(--g-card); }
.gw-roster.blue { border-color: rgba(75, 188, 255, .4); }
.gw-roster.red { border-color: rgba(255, 90, 74, .4); }
.gw-roster > header { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.gw-roster > header b { overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.gw-roster.blue > header b { color: #a9d4ff; }
.gw-roster.red > header b { color: #ffb4a6; }
.gw-roster > header small { flex: 0 0 auto; color: var(--g-muted); font-size: 11.5px; }
.gw-roster ol { display: grid; gap: 2px; max-height: 300px; margin: 0; padding: 0; overflow-y: auto; list-style: none; scrollbar-width: thin; }
.gw-roster li { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto auto auto; align-items: center; gap: 8px; min-height: 30px; padding: 3px 6px; border-radius: 7px; }
.gw-roster li + li { border-top: 1px solid rgba(190, 144, 70, .08); }
.gw-roster li.me { background: rgba(224, 180, 92, .1); box-shadow: inset 2px 0 0 var(--g-gold); }
.gw-roster li.in-field .gw-r-name b { color: #fff3cf; }
.gw-r-name { display: flex; align-items: center; gap: 6px; min-width: 0; }
.gw-r-name b { overflow: hidden; color: #c9d3e3; font-size: 13px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.gw-r-name .guild-you-badge { font-style: normal; }
.gw-roster li > small { color: var(--g-muted); font-size: 11.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.gw-roster li > small.gw-kda { color: #d7deea; }

.gw-events > .guild-card-head { margin-bottom: 8px; }
.gw-events ol { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.gw-events li { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; align-items: center; gap: 8px; min-height: 32px; padding: 3px 6px; border-radius: 7px; color: #d7deea; font-size: 13px; }
.gw-events li + li { border-top: 1px solid rgba(190, 144, 70, .08); }
.gw-events li .gw-ic { width: 24px; height: 24px; }
.gw-events li > span { min-width: 0; overflow-wrap: anywhere; }
.gw-events li > small { color: var(--g-dim); font-size: 11px; font-variant-numeric: tabular-nums; }
.gw-events li:first-child { background: rgba(224, 180, 92, .08); }
.gw-events :is(li, li > span) .blue { color: #8fcaff; font-weight: 700; }
.gw-events :is(li, li > span) .red { color: #ff9c8a; font-weight: 700; }
.gw-events li:is(.ev-gate-destroyed, .ev-core-destroyed, .ev-core-unsealed, .ev-end) { font-weight: 700; }

.gw-enter-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 16px; padding: 12px 14px; border: 1px solid var(--g-line-soft); border-radius: 12px; background: radial-gradient(60% 140% at 50% 50%, rgba(224, 180, 92, .16), transparent 70%), rgba(7, 12, 22, .55); }
.gw-enter { min-width: 280px; min-height: 52px; font-size: 17px; }
.gw-enter .guild-action-icon { width: 28px; height: 28px; }
.gw-surrender-wait { display: inline-flex; align-items: center; gap: 6px; color: var(--g-dim); font-size: 12px; }
.gw-surrender-wait .gw-act { width: 18px; height: 18px; opacity: .6; }

/* 10f. Ended: result banner (art + CSS title), final score, MVP/Valiant, rewards, scoreboard. */
.gw-ended { display: grid; gap: 12px; }
.gw-result-banner { --py: 62%; position: relative; justify-self: center; width: min(720px, 100%); }
.gw-result-banner.defeat { --py: 52%; }
.gw-result-banner.draw { --py: 50%; }
.gw-result-art { display: block; width: 100%; height: auto; filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .6)); animation: gw-banner-in .55s cubic-bezier(.18, 1.3, .4, 1) both; }
@keyframes gw-banner-in { from { opacity: 0; transform: scale(.7); } }
.gw-result-title { position: absolute; left: 50%; top: var(--py); display: grid; justify-items: center; width: 46%; transform: translate(-50%, -50%); text-align: center; pointer-events: none; }
.gw-result-title b { overflow: hidden; max-width: 100%; color: #ffe39a; font: 800 clamp(20px, 4.6vw, 36px)/1.05 var(--g-font); text-overflow: ellipsis; white-space: nowrap; text-shadow: 0 2px 0 #3a250b, 0 0 16px rgba(255, 200, 80, .55); }
.gw-result-title small { color: #f6dc9a; font: 700 clamp(9px, 1.4vw, 12px)/1.2 var(--g-font); letter-spacing: .32em; }
.gw-result-banner.defeat .gw-result-title b { color: #ffc0b0; text-shadow: 0 2px 0 #2a0805, 0 0 14px rgba(255, 80, 60, .5); }
.gw-result-banner.draw .gw-result-title b { color: #e6edf7; text-shadow: 0 2px 0 #10161f, 0 0 14px rgba(180, 200, 230, .45); }
.gw-result-reason { color: #d7deea; font-size: 14px; font-weight: 600; text-align: center; }
.gw-final { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: stretch; gap: 10px; }
.gw-final-vs { align-self: center; color: var(--g-gold); font-weight: 700; letter-spacing: .16em; }
.gw-final-side { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-width: 0; padding: 10px 12px; border: 1px solid; border-radius: 12px; }
.gw-final-side.blue { border-color: rgba(75, 188, 255, .5); background: linear-gradient(90deg, rgba(30, 90, 160, .32), rgba(10, 17, 30, .96) 75%); }
.gw-final-side.red { grid-template-columns: auto minmax(0, 1fr) 56px; border-color: rgba(255, 90, 74, .5); background: linear-gradient(270deg, rgba(160, 40, 30, .32), rgba(10, 17, 30, .96) 75%); text-align: right; }
.gw-final-side.red .gw-vs-crest { order: 3; }
.gw-final-side.red > div { order: 2; }
.gw-final-side.red > strong { order: 1; }
.gw-final-side.won { box-shadow: 0 0 0 1px var(--g-gold-hi), 0 0 20px rgba(255, 210, 120, .3); }
.gw-final-side > div { min-width: 0; display: grid; gap: 2px; }
.gw-final-side small { color: var(--g-muted); font-size: 11px; font-weight: 700; }
.gw-final-side b { overflow: hidden; color: var(--g-bright); font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }
.gw-final-side.won b::before { content: "♛ "; color: var(--g-gold); }
.gw-final-side em { color: var(--g-muted); font-size: 11.5px; font-style: normal; }
.gw-final-side > strong { color: #fff3cf; font-size: 30px; font-variant-numeric: tabular-nums; }
.gw-stars { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 10px; }
.gw-stars:empty { display: none; }
.gw-star { display: grid; grid-template-columns: 64px minmax(0, 1fr); align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid var(--g-line); border-radius: 12px; background: radial-gradient(90% 120% at 0% 50%, rgba(255, 200, 80, .2), transparent 65%), var(--g-card); }
.gw-star.valiant { border-color: rgba(200, 160, 255, .55); background: radial-gradient(90% 120% at 0% 50%, rgba(176, 97, 255, .2), transparent 65%), var(--g-card); }
.gw-star-art { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 220, 140, .25), rgba(6, 11, 20, .85) 70%); }
.gw-star-art :is(.gw-reward, .gw-ic) { width: 50px !important; height: 50px !important; }
.gw-star > div { min-width: 0; display: grid; gap: 2px; }
.gw-star small { color: var(--g-gold); font-size: 11px; font-weight: 700; letter-spacing: .06em; }
.gw-star.valiant small { color: #cf9bff; }
.gw-star b { display: flex; align-items: center; gap: 6px; overflow: hidden; color: #fff3cf; font-size: 18px; text-overflow: ellipsis; white-space: nowrap; }
.gw-star span { color: var(--g-muted); font-size: 12.5px; }
.gw-star span strong { color: var(--g-gold-hi); }
.gw-my-reward { display: grid; gap: 10px; }
.gw-my-reward > .guild-card-head { margin-bottom: 0; }
.gw-reward-row,
.gw-reward-guild { display: flex; flex-wrap: wrap; gap: 8px; }
.gw-reward-row > span,
.gw-reward-guild > span { display: grid; grid-template-columns: 40px auto; grid-template-rows: auto auto; align-items: center; column-gap: 8px; min-width: 120px; padding: 8px 12px; border: 1px solid var(--g-line-soft); border-radius: 10px; background: var(--g-inset); }
.gw-reward-row > span > :first-child,
.gw-reward-guild > span > :first-child { grid-row: 1 / 3; }
.gw-reward-row .gw-reward,
.gw-reward-guild .gw-reward { width: 40px !important; height: 40px !important; }
.gw-reward-row b,
.gw-reward-guild b { color: #fff3cf; font-size: 17px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.gw-reward-row small,
.gw-reward-guild small { color: var(--g-muted); font-size: 11.5px; }
.gw-reward-row > span.medal { border-color: rgba(47, 212, 192, .55); background: radial-gradient(90% 120% at 0% 50%, rgba(47, 212, 192, .18), transparent 65%), var(--g-inset); }
.gw-reward-guild > span { border-style: dashed; }
.gw-reward-item { position: relative; display: block; width: 40px; height: 40px; overflow: hidden; }
/* The 64 px atlas cell would overflow a 40 px grid track and sit off-centre: pin it to the middle, then scale. */
.gw-reward-item .gw-item-art { position: absolute; left: 50%; top: 50%; margin: -32px 0 0 -32px; transform: scale(.62); }
.gw-gem, .gw-coin { display: block; justify-self: center; }
.gw-coin { width: 26px; height: 26px; border-radius: 50%; background: radial-gradient(circle at 38% 32%, #fff2b0 0 14%, #f2c24c 30%, #b57a1c 68%, #6b430c 100%); box-shadow: 0 0 8px rgba(240, 190, 80, .45); }
.gw-gem { width: 20px; height: 20px; border-radius: 3px; background: linear-gradient(135deg, #d6f4ff 0%, #57b8ff 38%, #2257d6 72%, #12307a 100%); box-shadow: 0 0 8px rgba(90, 180, 255, .7); transform: rotate(45deg); }
.gw-reward-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.gw-reward-none { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px dashed var(--g-line-soft); border-radius: 10px; color: #c9d3e3; font-size: 13px; }
.gw-reward-none :is(.gw-ic, .gw-act) { width: 26px; height: 26px; }
.gw-reward-none.capped { border-color: rgba(255, 170, 120, .55); color: #ffd7b8; }
.gw-scoreboard > .guild-card-head { margin-bottom: 8px; }
.gw-table-wrap { overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; }
.gw-table { width: 100%; min-width: 560px; border-collapse: separate; border-spacing: 0; font-size: 13px; font-variant-numeric: tabular-nums; }
.gw-table th { padding: 6px 8px; border-bottom: 1px solid var(--g-line-soft); color: var(--g-gold); font-size: 11.5px; font-weight: 700; text-align: right; white-space: nowrap; }
.gw-table th:first-child,
.gw-table td:first-child { text-align: left; }
.gw-table td { padding: 6px 8px; border-bottom: 1px solid rgba(190, 144, 70, .08); color: #d7deea; text-align: right; white-space: nowrap; }
.gw-table td strong { color: var(--g-gold-hi); }
.gw-table tr.me td { background: rgba(224, 180, 92, .1); }
.gw-table tr.me td:first-child { box-shadow: inset 2px 0 0 var(--g-gold); }
.gw-t-name { display: inline-flex; align-items: center; gap: 6px; max-width: 220px; }
.gw-t-name b { overflow: hidden; color: #fff3cf; text-overflow: ellipsis; }
.gw-t-crown { width: 20px !important; height: 20px !important; }
.gw-ended-note { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 10px; text-align: center; }
.gw-inline { min-height: 30px; padding: 0 10px; font-size: 12.5px; }


/* --------------------------------------------------------------------------
   11. History
   -------------------------------------------------------------------------- */
.guild-war-history { display: grid; gap: 8px; }
.guild-war-history > .guild-card-head { margin-bottom: 4px; }
.guild-history-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--g-line-faint);
  border-radius: 11px;
  background: var(--g-card);
}
.guild-history-row.decided { border-color: var(--g-line-soft); }
.guild-history-row.win { box-shadow: inset 3px 0 0 var(--g-green); }
.guild-history-row.lose { box-shadow: inset 3px 0 0 var(--g-red); }
.guild-history-icon { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--g-line-faint); border-radius: 10px; background: var(--g-inset); }
.guild-history-icon img { width: 32px; height: 32px; object-fit: contain; }
.guild-history-row.draw .guild-history-icon img { filter: grayscale(.8) brightness(.8); }
.guild-history-main { min-width: 0; display: grid; gap: 2px; }
.guild-history-main b { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 15px; line-height: 1.35; }
.guild-history-main b span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.guild-history-main b span.blue { color: #a9d4ff; }
.guild-history-main b span.red { color: #ffb4a6; }
.guild-history-main b span.won { color: var(--g-gold-hi); text-shadow: 0 0 10px rgba(240, 190, 90, .35); }
.guild-history-main b span.won::before { content: "♛ "; color: var(--g-gold); }
.guild-history-main b i { flex: 0 0 auto; color: var(--g-gold); font-size: 11px; font-style: normal; font-weight: 700; letter-spacing: .1em; }
.guild-history-main > span { color: var(--g-muted); font-size: 12px; }
.guild-history-tags { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.guild-history-tags .guild-tag { font-size: 11px; }
/* v16 rows: emblems, score, MVP line, legacy rows, draw tag; sub-tabs + filter; ranking. */
.guild-history-icon .gw-reward { width: 32px !important; height: 32px !important; }
.guild-history-row.tie { box-shadow: inset 3px 0 0 #9aa8bb; }
.guild-history-row.legacy { opacity: .82; }
.guild-tag.draw { border-color: rgba(200, 210, 225, .5); color: #e6edf7; }
.gw-h-side { display: inline-flex; align-items: center; gap: 5px; min-width: 0; }
.gw-h-side b { min-width: 0; overflow: hidden; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.gw-h-side.blue b { color: #a9d4ff; }
.gw-h-side.red b { color: #ffb4a6; }
.gw-h-side.won b { color: var(--g-gold-hi); text-shadow: 0 0 10px rgba(240, 190, 90, .35); }
.gw-h-side.won b::before { content: "♛ "; color: var(--g-gold); }
.guild-history-main b span.gw-h-side::before { content: none; } /* v15 put the crown on the span; v16 puts it on the name */
.gw-h-emblem { flex: 0 0 auto; width: 26px; height: 26px; object-fit: contain; }
.guild-history-main b i.gw-h-score { padding: 0 8px; border: 1px solid var(--g-line-soft); border-radius: 6px; background: #070c16; color: #fff3cf; font-size: 13px; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.gw-h-mvp { display: inline-flex; align-items: center; gap: 5px; color: var(--g-muted); font-size: 12px; }
.gw-h-mvp b { color: var(--g-gold-hi); }
.gw-h-mvp b.blue { color: #a9d4ff; }
.gw-h-mvp b.red { color: #ffb4a6; }
.gw-h-mvp .gw-reward { width: 18px !important; height: 18px !important; }
.gw-history-sub { justify-self: start; margin-bottom: 4px; }
.gw-history-sub .gw-reward { width: 20px !important; height: 20px !important; }
.gw-history-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 8px; }
.gw-history-head .guild-card-head { flex: 1 1 auto; margin-bottom: 0; }
.gw-ranking { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.gw-ranking li { display: grid; grid-template-columns: 26px 44px minmax(0, 1fr) auto auto auto; align-items: center; gap: 12px; padding: 8px 12px; border: 1px solid var(--g-line-faint); border-radius: 10px; background: var(--g-inset); }
.gw-ranking li.mine { border-color: rgba(246, 220, 154, .55); background: radial-gradient(90% 120% at 100% 0%, rgba(224, 180, 92, .12), transparent 60%), var(--g-inset); }
.gw-rank-emblem img { width: 44px; height: 44px; object-fit: contain; }
.gw-rank-id { min-width: 0; display: grid; }
.gw-rank-id b { overflow: hidden; color: var(--g-bright); font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.gw-rank-id small, .gw-rank-rec small, .gw-rank-rate small { color: var(--g-muted); font-size: 11px; }
.gw-rank-rec, .gw-rank-rate { display: grid; justify-items: end; }
.gw-rank-rec b, .gw-rank-rate b { color: #d7deea; font-size: 14px; font-variant-numeric: tabular-nums; }
.gw-rank-rating { display: inline-flex; align-items: center; gap: 6px; min-width: 96px; justify-content: flex-end; }
.gw-rank-rating .gw-reward { width: 28px !important; height: 28px !important; }
.gw-rank-rating b { color: var(--g-gold-hi); font-size: 19px; font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------------------
   11b. War Medal shop (v51 card look; item art from the game's atlases)
   -------------------------------------------------------------------------- */
.gw-shop { display: grid; gap: 14px; }
.gw-back { justify-self: start; min-height: 34px; font-size: 13px; }
.gw-shop-head { display: grid; grid-template-columns: minmax(260px, auto) minmax(0, 1fr); gap: 14px; align-items: stretch; }
.gw-shop-balance { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border: 1px solid rgba(47, 212, 192, .55); border-radius: 12px; background: radial-gradient(90% 140% at 0% 50%, rgba(47, 212, 192, .2), transparent 65%), var(--g-card); }
.gw-shop-balance .gw-shop-stack { width: 72px !important; height: 72px !important; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .6)) !important; }
.gw-shop-balance > div { display: grid; }
.gw-shop-balance small { color: var(--g-muted); font-size: 12px; }
.gw-shop-balance b { color: #6ff0de; font-size: 34px; line-height: 1.1; font-variant-numeric: tabular-nums; text-shadow: 0 0 14px rgba(47, 212, 192, .45); }
.gw-shop-balance em { color: var(--g-dim); font-size: 11.5px; font-style: normal; }
.gw-shop-earn { padding: 12px 16px; border: 1px solid var(--g-line-faint); border-radius: 12px; background: var(--g-card); }
.gw-shop-earn ul { display: grid; gap: 4px; margin: 4px 0 0; padding: 0; list-style: none; }
.gw-shop-earn li { display: flex; align-items: center; gap: 8px; color: #c9d3e3; font-size: 13px; }
.gw-shop-earn li b { color: var(--g-gold-hi); }
.gw-shop-earn :is(.gw-reward, .gw-ic) { width: 20px !important; height: 20px !important; }
.gw-shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 12px 10px; }
.gw-shop-card {
  --r: #3c4f6e;
  --r-soft: rgba(63, 82, 110, .18);
  --r-text: #c9d3e3;
  position: relative;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  grid-template-areas: "art text" "foot foot";
  align-items: center;
  gap: 8px 12px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--r);
  border-radius: 10px;
  background: radial-gradient(120% 100% at 0% 0%, var(--r-soft), transparent 62%), linear-gradient(180deg, #16243a, #0b1422);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .55), 0 0 10px var(--r-soft);
}
.gw-shop-card.svc-r-Uncommon { --r: #4fbf6a; --r-soft: rgba(79, 191, 106, .2); --r-text: #7ee495; }
.gw-shop-card.svc-r-Rare { --r: #3f8dff; --r-soft: rgba(63, 141, 255, .22); --r-text: #7fb2ff; }
.gw-shop-card.svc-r-Epic { --r: #b061ff; --r-soft: rgba(176, 97, 255, .24); --r-text: #cf9bff; }
.gw-shop-card.svc-r-Legendary { --r: #ffb02e; --r-soft: rgba(255, 176, 46, .24); --r-text: #ffc75a; }
.gw-shop-art { grid-area: art; display: grid; place-items: center; width: 72px; height: 72px; overflow: hidden; border: 1px solid var(--r); border-radius: 10px; background: radial-gradient(circle at 50% 40%, #24385a, #0b1422 72%); box-shadow: inset 0 0 12px rgba(0, 0, 0, .6), inset 0 0 14px var(--r-soft); }
.gw-item-art { display: block; flex: none; width: 64px; height: 64px; background-repeat: no-repeat; background-position: calc(var(--x, 0) * -64px) calc(var(--y, 0) * -64px); image-rendering: pixelated; filter: drop-shadow(0 4px 3px #000); }
.gw-item-art.item { background-image: url('/assets/generated/item-atlas-v4.png'); background-size: 384px 256px; }
.gw-item-art.acc { background-image: url('/assets/generated/accessory-atlas-v5.png'); background-size: 384px 192px; }
.gw-shop-text { grid-area: text; min-width: 0; display: grid; gap: 2px; }
.gw-shop-text b { color: #fff3cf; font-size: 15px; line-height: 1.3; }
.gw-rarity { color: var(--r-text); font-size: 12px; font-weight: 700; }
.gw-shop-text p { color: #b9c6da; font-size: 12.5px; line-height: 1.4; }
.gw-shop-foot { grid-area: foot; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding-top: 10px; border-top: 1px solid rgba(52, 68, 95, .6); }
.gw-price { display: inline-flex; align-items: center; gap: 5px; margin-right: auto; }
.gw-price .gw-reward { width: 24px !important; height: 24px !important; }
.gw-price b { color: #6ff0de; font-size: 17px; font-variant-numeric: tabular-nums; }
.gw-price small { color: var(--g-dim); font-size: 11px; }
.gw-qty { display: inline-flex; align-items: center; gap: 4px; }
.gw-qty button { min-width: 34px; height: 34px; padding: 0; border: 1px solid #4a5d7e; border-radius: 7px; background: linear-gradient(180deg, #22324f, #0e1727); color: #f0e6cc; font: 800 17px/1 var(--g-font); cursor: pointer; touch-action: manipulation; }
.gw-qty button:hover:not(:disabled) { border-color: var(--g-gold); color: #fff; }
.gw-qty b { min-width: 34px; color: #fff3cf; font-size: 16px; text-align: center; font-variant-numeric: tabular-nums; }
.gw-buy { min-height: 38px; }
.gw-shop-foot .gw-why { flex-basis: 100%; }
.gw-lobby-medals { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; padding: 8px 12px; border: 1px solid rgba(47, 212, 192, .45); border-radius: 11px; background: radial-gradient(90% 140% at 0% 50%, rgba(47, 212, 192, .14), transparent 65%), var(--g-card); }
.gw-lobby-medals .gw-lobby-medal { width: 34px !important; height: 34px !important; }
.gw-lobby-medals span { flex: 1 1 auto; color: #c9d3e3; font-size: 13px; }
.gw-lobby-medals b { color: #6ff0de; }
.gw-lobby-medals button { min-height: 34px; font-size: 13px; }

/* --------------------------------------------------------------------------
   12. Confirm dialog
   -------------------------------------------------------------------------- */
.guild-confirm-layer {
  position: fixed;
  inset: 0;
  z-index: 100010;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(3, 6, 12, .7);
  pointer-events: auto;
}
/* v51 .svc-confirm look (radial top glow, gold rim, pop-in), danger / green tones. */
.guild-confirm-dialog {
  position: relative;
  display: grid;
  gap: 12px;
  width: min(440px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  padding: 22px 22px 18px;
  border: 1px solid rgba(190, 144, 70, .82);
  border-radius: 14px;
  background:
    var(--iso-corners, linear-gradient(transparent, transparent)),
    radial-gradient(120% 70% at 50% 0%, rgba(62, 92, 136, .28), transparent 62%),
    linear-gradient(180deg, #16243a, #0a1220);
  box-shadow: 0 0 0 1px #03060c, 0 0 0 4px rgba(122, 88, 38, .35), 0 24px 50px rgba(0, 0, 0, .65);
  color: var(--g-text);
  font: 500 14px/1.5 var(--g-font);
  text-align: center;
  animation: guild-pop .22s cubic-bezier(.2, 1.2, .4, 1) both;
}
.guild-confirm-dialog::after { content: ""; position: absolute; inset: 4px; pointer-events: none; background: var(--g-diamond) left top / 9px 9px no-repeat, var(--g-diamond) right top / 9px 9px no-repeat, var(--g-diamond) left bottom / 9px 9px no-repeat, var(--g-diamond) right bottom / 9px 9px no-repeat; }
.guild-confirm-dialog.tone-danger { border-color: #ff8a73; box-shadow: 0 0 0 1px #2a0805, 0 0 0 4px rgba(160, 50, 40, .35), 0 0 30px rgba(255, 100, 80, .2), 0 24px 50px rgba(0, 0, 0, .65); }
.guild-confirm-dialog.tone-green { border-color: #9ef0b0; box-shadow: 0 0 0 1px #03100a, 0 0 0 4px rgba(40, 120, 70, .3), 0 0 26px rgba(120, 230, 150, .16), 0 24px 50px rgba(0, 0, 0, .65); }
@keyframes guild-pop { from { opacity: 0; transform: translateY(8px) scale(.96); } }
.guild-confirm-head { display: grid; justify-items: center; gap: 4px; }
.guild-confirm-head img { width: 52px; height: 52px; object-fit: contain; }
.guild-confirm-head .gw-confirm-icon { width: 52px; height: 52px; }
.guild-confirm-head .gw-confirm-art { width: 96px !important; height: 96px !important; filter: drop-shadow(0 8px 12px rgba(0, 0, 0, .6)) !important; }
.guild-confirm-head .gw-confirm-item { display: grid; place-items: center; width: 80px; height: 80px; border: 1px solid var(--g-line-soft); border-radius: 12px; background: radial-gradient(circle at 50% 40%, #24385a, #0b1422 72%); }
.guild-confirm-dialog.tone-danger .guild-eyebrow { color: #ff9c86; }
.guild-confirm-dialog h3 { margin: 0; color: #f6d27a; font-size: 20px; line-height: 1.3; }
.guild-confirm-dialog p { margin: 0; color: #d7deea; font-size: 14px; line-height: 1.55; overflow-wrap: anywhere; }
.guild-confirm-cost { justify-self: center; display: inline-flex; align-items: center; gap: 8px; padding: 6px 18px; border: 1px solid #6e5226; border-radius: 999px; background: #070c16; color: var(--g-muted); font-size: 13px; }
.guild-confirm-cost .gw-cost-medal { width: 26px !important; height: 26px !important; }
.guild-confirm-cost b { color: #6ff0de; font-size: 22px; font-variant-numeric: tabular-nums; }
.guild-confirm-note { display: block; color: var(--g-muted); font-size: 12px; line-height: 1.45; }
.guild-confirm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px; }
.guild-confirm-actions button { min-height: 46px; font-family: var(--g-font); font-size: 15px; white-space: normal; }

/* --------------------------------------------------------------------------
   13. Responsive: tablet
   -------------------------------------------------------------------------- */
@media (max-width: 1100px) {
  .guild-window { width: calc(100vw - 24px); height: calc(100vh - 24px); height: calc(100dvh - 24px); }
  #modal-layer.guild-modal-open,
  #modal-layer.open.guild-modal-open { padding: 12px !important; }
  .guild-overview { grid-template-columns: minmax(0, 1.3fr) minmax(290px, 1fr); }
  .guild-lobby-grid { grid-template-columns: minmax(0, 1.3fr) minmax(320px, 1fr); }
  .guild-directory { grid-template-columns: 1fr; }
  .guild-member-grid { grid-template-columns: repeat(auto-fill, minmax(400px, 1fr)); }
  .gw-rules { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gw-versus { grid-template-columns: minmax(0, 1fr) 128px minmax(0, 1fr); }
  .gw-vs-score { font-size: 28px; }
  .gw-vs-mid .gw-count { font-size: 26px; }
  .gw-declare-row { grid-template-columns: 140px minmax(0, 1fr); }
  .gw-declare-go { grid-column: 1 / -1; justify-items: stretch; }
  .gw-shop-head { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 900px) {
  .guild-overview,
  .guild-lobby-grid { grid-template-columns: minmax(0, 1fr); }
  /* One column: actions (donate) right after the progress card. */
  .guild-ov-main,
  .guild-ov-side { display: contents; }
  .guild-level-card { order: 1; }
  .guild-donate-card { order: 2; }
  .guild-buff-card { order: 3; }
  .guild-donors-card { order: 4; }
  .guild-leave-card { order: 5; }
  .guild-ov-side .guild-buffs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .guild-member-grid { grid-template-columns: minmax(0, 1fr); }
  .guild-segment {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-bottom: 12px;
    padding: 4px;
    border: 1px solid var(--g-line-soft);
    border-radius: 12px;
    background: rgba(6, 11, 20, .6);
  }
  .guild-segment button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 38px;
    border: 1px solid transparent;
    border-radius: 9px;
    background: transparent;
    color: #b9c6da;
    font: 700 14px/1 var(--g-font);
    cursor: pointer;
  }
  .guild-segment button.active { border-color: #f6d790; background: var(--g-btn-gold); color: #241503; }
  .guild-lobby.show-browse .guild-create-card,
  .guild-lobby.show-create .guild-browse { display: none; }
  .guild-create-card { position: static; }
  .guild-directory { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
  /* War: the timer medallion takes its own row above the two sides. */
  .gw-versus { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .gw-vs-mid { grid-column: 1 / -1; grid-row: 1; grid-template-columns: auto auto auto auto; justify-content: center; align-items: center; gap: 0 10px; padding: 6px 12px; border-radius: 12px; }
  .gw-vs-ic { width: 26px !important; height: 26px !important; }
  .gw-hero { grid-template-columns: minmax(0, 1fr); }
  .gw-hero-field { grid-column: 1; grid-row: 1; min-height: 150px; }
  .gw-hero-text { grid-row: 2; padding: 4px 18px 18px; }
  .gw-hero { background:
    linear-gradient(0deg, rgba(6, 11, 20, .97) 0%, rgba(6, 11, 20, .9) 45%, rgba(6, 11, 20, .15) 70%),
    linear-gradient(180deg, transparent 24%, rgba(120, 86, 46, .55) 24% 36%, transparent 36%),
    url('/assets/guild_v16/tiles/grass.png') 0 0 / 128px 128px repeat, #1b3a1c; }
  .gw-hero-gate { width: 26%; }
  .gw-hero-core { width: 11%; }
  .gw-hero-core.blue { left: 2%; }
  .gw-hero-core.red { right: 2%; }
  .gw-scroll-card.big { grid-template-columns: 170px minmax(0, 1fr); }
  .gw-scroll-card.big .gw-scroll-art .gw-reward { width: 160px !important; height: 160px !important; }
  .gw-final { grid-template-columns: minmax(0, 1fr); }
  .gw-final-vs { justify-self: center; }
}

/* --------------------------------------------------------------------------
   14. Responsive: phone portrait (≈390px) — full-screen window
   -------------------------------------------------------------------------- */
@media (max-width: 720px) {
  #modal-layer.guild-modal-open,
  #modal-layer.open.guild-modal-open { padding: 0 !important; }
  #modal-layer.guild-modal-open > .guild-window:not(.guild-loading-window):not(.guild-error-window) {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    border-width: 0;
    border-radius: 0;
    box-shadow: none;
  }
  #modal-layer.guild-modal-open > .guild-loading-window,
  #modal-layer.guild-modal-open > .guild-error-window { place-self: center; }

  .guild-head {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 10px 12px;
    padding: max(12px, env(safe-area-inset-top)) 12px 12px;
  }
  .guild-crest { width: 56px; height: 56px; }
  .guild-crest img { width: 48px; height: 48px; }
  .guild-crest .guild-crest-icon { width: 40px; height: 40px; }
  .guild-crest-lv { bottom: -8px; padding: 0 6px; font-size: 10px; }
  .guild-head h2 { font-size: 19px; }
  .guild-head .guild-eyebrow { font-size: 9.5px; letter-spacing: .16em; }
  .guild-head-meta { margin-top: 4px; }
  .guild-head-since { font-size: 11px; }
  .guild-close { grid-column: 3; grid-row: 1; width: 34px; height: 34px; }
  .guild-head-stats { grid-column: 1 / -1; grid-row: 2; display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 6px; margin-top: 2px; }
  .guild-head-chip { min-width: 0; padding: 6px 9px; }
  .guild-head-chip small { font-size: 10.5px; }
  .guild-head-chip b { font-size: 15.5px; }
  .guild-head-chip .gw-chip-long { display: none; }
  .guild-head-chip .gw-chip-short { display: inline; }
  .guild-head-chip.war { padding-inline: 6px; } /* icon + PREP / LIVE / มีคำท้า fit a quarter of 360 px too */

  .guild-tabs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; padding: 8px 8px; }
  .guild-tabs button { flex-direction: column; justify-content: center; gap: 3px; min-height: 56px; padding: 5px 2px; border-radius: 10px; font-size: 11px; white-space: normal; text-align: center; line-height: 1.15; }
  .guild-tabs button img,
  .guild-tabs .guild-tab-icon { width: 26px; height: 26px; }
  .guild-tabs .tab-full { display: none; }
  .guild-tabs .tab-short { display: inline; }
  .guild-tab-badge { position: absolute; top: 3px; right: 6px; min-width: 18px; height: 18px; font-size: 10px; }
  .guild-tab-live { position: absolute; top: 3px; right: 4px; font-size: 8.5px; padding: 1px 4px; }

  .guild-window > main { padding: 12px 10px calc(20px + env(safe-area-inset-bottom)); }
  .guild-status { bottom: calc(12px + env(safe-area-inset-bottom)); font-size: 12.5px; }
  .guild-card { padding: 13px 12px; }
  .guild-card-head h3 { font-size: 16px; }

  .guild-directory { grid-template-columns: minmax(0, 1fr); }
  .guild-directory-card { grid-template-columns: 48px minmax(0, 1fr) auto; gap: 10px; padding: 9px 10px; }
  .guild-dir-emblem { width: 48px; height: 48px; }
  .guild-dir-emblem img { width: 40px; height: 40px; }
  .guild-emblem-picker { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 5px; }
  .guild-emblem-picker label > span { border-radius: 8px; }
  .guild-emblem-picker label > span img { width: 86%; height: 86%; }
  .guild-cost { grid-template-columns: minmax(0, 1fr); }

  .guild-level-row { grid-template-columns: 72px minmax(0, 1fr); gap: 12px; }
  .guild-level-badge { width: 72px; height: 72px; }
  .guild-level-badge b { font-size: 30px; }
  .guild-level-caption { font-size: 12px; }
  .guild-buffs,
  .guild-ov-side .guild-buffs { grid-template-columns: minmax(0, 1fr); }
  .guild-stat-grid { gap: 6px; }
  .guild-stat { gap: 8px; padding: 8px; }
  .guild-stat-icon { width: 26px; height: 26px; }
  .guild-stat small { font-size: 11px; }
  .guild-stat b { font-size: 13.5px; }
  .guild-leave-card { flex-wrap: wrap; }
  .guild-leave-card button { width: 100%; }

  .guild-app { grid-template-columns: 40px minmax(0, 1fr); }
  .guild-app .guild-avatar { width: 40px; height: 40px; }
  .guild-app-actions { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; }
  .guild-member { padding: 11px 12px; }
  .guild-member-top { grid-template-columns: 46px minmax(0, 1fr); gap: 10px; }
  .guild-member-top .guild-role-pill { grid-column: 2; justify-self: start; margin-top: -2px; }
  .guild-avatar { width: 46px; height: 46px; font-size: 18px; }
  .guild-member-actions { display: grid; grid-template-columns: minmax(0, 1fr); }
  .guild-role-editor { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
  .guild-role-editor select { width: 100% !important; }
  .guild-member-buttons { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); margin-left: 0; }

  /* War on a phone: one column everywhere, compact versus bar, thumb-size buttons. */
  .gw-hero-text h3 { font-size: 20px; }
  .gw-hero-text { padding: 2px 14px 14px; }
  .gw-hero-field { min-height: 128px; }
  .gw-rules { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .gw-rules article { padding: 10px 12px; }
  .gw-rival-grid { grid-template-columns: minmax(0, 1fr); }
  .guild-window .gw-rival { grid-template-columns: 52px minmax(0, 1fr); padding: 10px; }
  .guild-window .gw-rival > .gw-chip { grid-column: 2; justify-self: start; }
  .gw-rival-emblem { width: 52px; height: 52px; }
  .gw-rival-emblem img { width: 44px; height: 44px; }
  .gw-declare-row { grid-template-columns: minmax(0, 1fr); }
  .gw-declare-go { grid-column: auto; }
  .gw-declare-go .guild-primary,
  .gw-enter,
  .gw-actions > button { width: 100%; min-width: 0; min-height: 48px; }
  .gw-actions { display: grid; grid-template-columns: minmax(0, 1fr); }
  .gw-spec { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .gw-spec-mid { order: -1; grid-auto-flow: column; gap: 8px; }
  .gw-scroll-card,
  .gw-scroll-card.big { grid-template-columns: minmax(0, 1fr); justify-items: center; gap: 10px; padding: 16px 14px; text-align: center; }
  .gw-scroll-art .gw-reward { width: 110px !important; height: 110px !important; }
  .gw-scroll-card.big .gw-scroll-art .gw-reward { width: 150px !important; height: 150px !important; }
  .gw-scroll-emblem { width: 54px; height: 54px; }
  .gw-scroll-emblem img { width: 42px; height: 42px; }
  .gw-scroll-text { justify-items: center; }
  .gw-scroll-text h3,
  .gw-scroll-card.big .gw-scroll-text h3 { font-size: 21px; }
  .gw-facts { justify-items: start; text-align: left; }
  .gw-scroll-text .gw-wait-note { width: 100%; }
  .gw-mini-vs { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 6px; padding: 8px 10px; }
  .gw-mini-side { grid-template-columns: 32px minmax(0, 1fr); column-gap: 6px; }
  .gw-mini-side.red { grid-template-columns: minmax(0, 1fr) 32px; }
  .gw-mini-side img { width: 32px; height: 32px; }
  .gw-mini-side small { display: none; }
  .gw-vs-side { padding: 9px; gap: 6px; }
  .gw-vs-head,
  .gw-vs-side.red .gw-vs-head { grid-template-columns: 38px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 8px; text-align: left; }
  .gw-vs-side.red .gw-vs-head { grid-template-columns: minmax(0, 1fr) 38px; text-align: right; }
  .gw-vs-crest { width: 38px; height: 38px; grid-row: 1; }
  .gw-vs-crest img { width: 32px; height: 32px; }
  .gw-vs-side.red .gw-vs-crest { order: 0; grid-column: 2; }
  .gw-vs-side.red .gw-vs-id { order: 0; grid-column: 1; grid-row: 1; }
  .gw-vs-side .gw-vs-score,
  .gw-vs-side.red .gw-vs-score { order: 0; grid-column: 1 / -1; grid-row: 2; font-size: 26px; }
  .gw-vs-id b { font-size: 14px; }
  .gw-vs-id small { font-size: 10px; }
  .gw-vs-id em { font-size: 10.5px; flex-wrap: wrap; }
  .gw-vs-mid em { display: none; }
  .gw-lane { grid-template-columns: 28px minmax(0, 1fr) minmax(0, 1fr); gap: 5px; }
  .gw-pip { grid-template-columns: 18px minmax(0, 1fr); gap: 3px; }
  .gw-pip .gw-ic { width: 18px; height: 18px; }
  .gw-core { grid-template-columns: 24px minmax(0, 1fr) auto; gap: 6px; padding: 5px 6px; }
  .gw-core .gw-ic { width: 24px; height: 24px; }
  .gw-core b { font-size: 10px; }
  .gw-rosters { grid-template-columns: minmax(0, 1fr); }
  .gw-roster ol { max-height: 240px; }
  .gw-phase { padding: 8px 10px; }
  .gw-phase b { font-size: 16px; }
  .gw-result-title { width: 52%; }
  .gw-final-side { grid-template-columns: 44px minmax(0, 1fr) auto; padding: 9px 10px; }
  .gw-final-side.red { grid-template-columns: auto minmax(0, 1fr) 44px; }
  .gw-final-side .gw-vs-crest { width: 44px; height: 44px; }
  .gw-final-side .gw-vs-crest img { width: 36px; height: 36px; }
  .gw-final-side > strong { font-size: 24px; }
  .gw-reward-row > span,
  .gw-reward-guild > span { flex: 1 1 calc(50% - 8px); min-width: 0; }
  .gw-history-head { display: grid; }
  .gw-history-sub { justify-self: stretch; display: grid; grid-template-columns: 1fr 1fr; }
  .gw-history-sub button { justify-content: center; }
  .gw-ranking li { grid-template-columns: 24px 36px minmax(0, 1fr) auto; gap: 8px; padding: 8px 10px; }
  .gw-rank-emblem img { width: 36px; height: 36px; }
  .gw-rank-rec, .gw-rank-rate { display: none; }
  .gw-rank-rating { min-width: 0; }
  .gw-shop-balance b { font-size: 28px; }
  .gw-shop-grid { grid-template-columns: minmax(0, 1fr); }
  .gw-shop-foot { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
  .gw-shop-foot .gw-buy { grid-column: 1 / -1; min-height: 46px; }
  .gw-qty button { min-width: 44px; height: 44px; }
  .gw-lobby-medals button { width: 100%; }

  .guild-history-row { grid-template-columns: 38px minmax(0, 1fr); gap: 10px; padding: 10px 12px; }
  .guild-history-icon { width: 38px; height: 38px; }
  .guild-history-icon img,
  .guild-history-icon .gw-reward { width: 28px !important; height: 28px !important; }
  .guild-history-main b { flex-wrap: wrap; gap: 2px 6px; font-size: 14px; }
  .guild-history-tags { grid-column: 2; justify-content: flex-start; }
}

/* --------------------------------------------------------------------------
   15. Responsive: short landscape (≈844×390) — compact chrome, content scrolls
   -------------------------------------------------------------------------- */
@media (max-height: 520px) {
  #modal-layer.guild-modal-open,
  #modal-layer.open.guild-modal-open { padding: 0 !important; }
  #modal-layer.guild-modal-open > .guild-window:not(.guild-loading-window):not(.guild-error-window) {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    border-width: 0;
    border-radius: 0;
    box-shadow: none;
  }
  #modal-layer.guild-modal-open > .guild-loading-window,
  #modal-layer.guild-modal-open > .guild-error-window { place-self: center; min-height: 0; max-height: calc(100dvh - 16px); }
  .guild-head {
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    gap: 10px;
    padding: 6px max(12px, env(safe-area-inset-right)) 6px max(12px, env(safe-area-inset-left));
  }
  .guild-crest { width: 42px; height: 42px; box-shadow: 0 0 0 1px #1a1206; }
  .guild-crest img,
  .guild-crest .guild-crest-icon { width: 36px; height: 36px; }
  .guild-crest-lv { bottom: -6px; padding: 0 5px; font-size: 9px; line-height: 1.3; }
  .guild-head .guild-eyebrow { display: none; }
  .guild-head h2 { font-size: 17px; }
  .guild-head-meta { margin-top: 2px; }
  .guild-head-meta .guild-role-pill { padding: 0 8px 0 2px; font-size: 11px; }
  .guild-head-meta .guild-role-badge { width: 16px; height: 16px; }
  .guild-head-since { display: none; }
  .guild-head-stats { grid-column: auto; grid-row: auto; display: flex; gap: 6px; margin: 0; }
  .guild-head-chip { min-width: 0; padding: 3px 9px 4px; border-radius: 8px; }
  .guild-head-chip small { font-size: 9.5px; }
  .guild-head-chip b { font-size: 13.5px; }
  .guild-close { grid-column: auto; grid-row: auto; align-self: center; width: 32px; height: 32px; font-size: 20px; }

  .guild-tabs { display: flex; gap: 6px; padding: 5px max(12px, env(safe-area-inset-left)); overflow-x: auto; scrollbar-width: none; }
  .guild-tabs::-webkit-scrollbar { display: none; }
  .guild-tabs button { flex: 1 0 auto; flex-direction: row; justify-content: center; min-height: 32px; padding: 0 12px 0 6px; border-radius: 8px; font-size: 12.5px; white-space: nowrap; }
  .guild-tabs button img,
  .guild-tabs .guild-tab-icon { width: 20px; height: 20px; }
  .guild-tab-badge { position: static; min-width: 17px; height: 17px; font-size: 10px; }
  .guild-tab-live { position: static; }

  .guild-window > main { padding: 10px max(12px, env(safe-area-inset-right)) 16px max(12px, env(safe-area-inset-left)); }
  .guild-status { bottom: 10px; }
  .guild-card { padding: 12px; }
  .guild-empty-state { padding: 18px 14px; }
  .guild-empty-art { width: 72px; height: 72px; }
  /* Short landscape (812×375): the banner art shrinks, the scroll and result art stay small. */
  .gw-hero { min-height: 0; }
  .gw-hero-field { min-height: 120px; }
  .gw-hero-text { padding: 12px 16px; }
  .gw-hero-text h3 { font-size: 19px; }
  .gw-scroll-card.big .gw-scroll-art .gw-reward { width: 130px !important; height: 130px !important; }
  .gw-scroll-card.big { grid-template-columns: 140px minmax(0, 1fr); }
  .gw-result-banner { width: min(520px, 100%); }
  .gw-enter { min-height: 44px; }
}

@media (max-height: 520px) and (max-width: 720px) {
  .guild-head-stats { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .guild-window *,
  .guild-confirm-dialog { animation: none !important; transition: none !important; }
}

/* --------------------------------------------------------------------------
   16. HUD launch button + menu icon (kept verbatim from v14 so the HUD is
       unchanged)
   -------------------------------------------------------------------------- */
.guild-launch-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.guild-launch-icon { image-rendering: pixelated; object-fit: contain; filter: drop-shadow(0 3px 4px rgba(0,0,0,.55)); }
#menu-panel .guild-launch-button {
  width: 78px !important;
  min-width: 78px !important;
  max-width: 78px !important;
  padding: 0 !important;
  gap: 0 !important;
  overflow: hidden !important;
  align-self: stretch !important;
}
#menu-panel .guild-launch-button .guild-launch-icon {
  display: block !important;
  width: 38px !important;
  height: 38px !important;
  min-width: 38px !important;
  min-height: 38px !important;
  max-width: 38px !important;
  max-height: 38px !important;
  margin: 2px auto 3px !important;
  object-fit: contain !important;
  flex: 0 0 38px !important;
}
#menu-panel .guild-launch-button small {
  display: block !important;
  margin: 0 !important;
  font-size: 10px !important;
  line-height: 13px !important;
}
#menu-panel button[data-window="guild"] .menu-icon.icon-guild {
  width: 38px !important;
  height: 38px !important;
  background-image: url('/assets/guild_v8/ui_icons/ui_guild.png') !important;
  background-size: 36px 36px !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  transform: none !important;
}
@media (max-width: 1100px) {
  #menu-panel .guild-launch-button {
    width: 70px !important;
    min-width: 70px !important;
    max-width: 70px !important;
  }
}
@media (max-width: 720px) {
  #menu-panel .guild-launch-button .guild-launch-icon {
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    min-height: 34px !important;
    max-width: 34px !important;
    max-height: 34px !important;
    flex-basis: 34px !important;
  }
  #menu-panel button[data-window="guild"] .menu-icon.icon-guild {
    width: 34px !important;
    height: 34px !important;
    background-size: 23px 23px !important;
  }
}
