/* Guild War 24/7 event page */

:root {
    --gw-bg:        #1d1d1d;
    --gw-bg-2:      #111;
    --gw-border:    #2a2a2a;
    --gw-text:      #ffffff;
    --gw-muted:     #c2c2c2;
    --gw-accent:    #ffb84d;
    --gw-mine:      #4caf50;
    --gw-enemy:     #e74c3c;
    --gw-attack:    #ffb84d;
    --gw-unclaimed: #444;
}

/* ---------- Patron marquee (match site-wide gold/orange styling) ----------
 * This page only loads pages/guild-war.css, not the site-wide style.css /
 * main.css that styles the patron strip everywhere else. Re-declare the
 * gradient locally so the supporters bar matches the rest of the site. */
/* #skykings-patrons-display {
    background: linear-gradient(to right, #BF953F, #B38728, #AA771C);
    border-top: 2px solid #ffffff;
    border-bottom: 2px solid #ffffff;
}
#skykings-patrons-display .patron-track-background {
    background: linear-gradient(to right, #BF953F, #B38728, #AA771C) !important;
    border-top: 2px solid #ffffff;
    border-bottom: 2px solid #ffffff;
    font-family: "Lexend Deca", sans-serif;
    color: #1d1d1d;
}
#skykings-patrons-display .patron-username { color: #1d1d1d; font-weight: 600; } */

.patron-track-background {
    background: linear-gradient(to right, #BF953F, #B38728, #AA771C) !important;
    border-top: 2px solid #ffffff;
    border-bottom: 2px solid #ffffff;
    font-family: "Lexend Deca", sans-serif;
}
/* ---------- How-it-works info button (below header text) ---------- */
.gw-info-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 184, 77, 0.12);
    color: var(--gw-accent);
    border: 1px solid rgba(255, 184, 77, 0.38);
    border-radius: 999px;
    padding: 7px 18px;
    font-family: inherit;
    font-size: 0.85em;
    font-weight: 700;
    cursor: pointer;
    margin-top: 16px;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.gw-info-btn:hover {
    background: rgba(255, 184, 77, 0.2);
    border-color: var(--gw-accent);
    box-shadow: 0 0 0 3px rgba(255, 184, 77, 0.12);
}
.gw-info-btn:active { transform: translateY(1px); }
.gw-info-btn i { font-size: 1em; }
@media (max-width: 600px) {
    .gw-header {
        max-width: 95%;
    }
}

/* ---------- Prize pool ---------- */
.gw-prize-wrap {
    max-width: 1100px;
    margin: 16px auto 0;
    padding: 0 16px;
}
.gw-prize-card {
    background: linear-gradient(135deg, rgba(255, 184, 77, 0.10), rgba(255, 184, 77, 0.02));
    border: 1px solid rgba(255, 184, 77, 0.35);
    border-radius: 12px;
    padding: 18px 22px;
    color: var(--gw-text);
}
.gw-prize-title {
    margin: 0 0 12px;
    font-size: 1.3em;
    color: var(--gw-accent);
    display: flex;
    align-items: center;
    gap: 8px;
}
.gw-prize-coin { color: #ffd166; }
.gw-prize-gem  { color: #6ad1ff; }
.gw-prize-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}
.gw-prize-list li {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--gw-border);
    border-radius: 8px;
}
.gw-prize-place {
    flex-shrink: 0;
    min-width: 48px;
    font-weight: 800;
    color: var(--gw-muted);
    letter-spacing: 0.03em;
}
.gw-prize-place-1 { color: #ffd166; }
.gw-prize-place-2 { color: #d8d8d8; }
.gw-prize-place-3 { color: #d59b6a; }
.gw-prize-reward {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    font-size: 1em;
}
.gw-prize-reward strong { color: var(--gw-text); font-weight: 700; }
.gw-prize-or { color: var(--gw-muted); margin: 0 4px; }
.gw-prize-footnote {
    margin: 12px 0 0;
    color: var(--gw-muted);
    font-size: 0.85em;
}
@media (min-width: 720px) {
    .gw-prize-list { grid-template-columns: 1fr 1fr; }
}

/* ---------- Beta-test notice banner ---------- */
.gw-beta-banner {
    max-width: 1100px;
    margin: 16px auto 0;
    padding: 0 16px;
}
.gw-beta-banner-inner {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 18px;
    background: linear-gradient(135deg, rgba(255, 184, 77, 0.12), rgba(255, 184, 77, 0.04));
    border: 1px solid rgba(255, 184, 77, 0.35);
    border-radius: 10px;
    color: var(--gw-text);
    line-height: 1.45;
}
.gw-beta-tag {
    flex-shrink: 0;
    background: var(--gw-accent);
    color: #1d1d1d;
    font-weight: 800;
    font-size: 0.75em;
    letter-spacing: 0.08em;
    padding: 4px 10px;
    border-radius: 999px;
    margin-top: 2px;
}
.gw-beta-text { font-size: 0.95em; }
.gw-beta-text strong { color: var(--gw-accent); }
.gw-beta-sub {
    display: block;
    margin-top: 6px;
    color: var(--gw-muted);
    font-size: 0.9em;
}
.gw-beta-sub strong { color: var(--gw-text); }
@media (max-width: 600px) {
    .gw-beta-banner-inner { flex-direction: column; align-items: stretch; }
    .gw-beta-tag { align-self: flex-start; }
}

body {
    font-family: "Lexend Deca", sans-serif;
    background: #0d0d0d;
    color: var(--gw-text);
    margin: 0;
}

.gw-header {
    text-align: center;
    padding: 40px 20px 10px;
    max-width: 55%;
    margin: 0 auto;
    margin-top: 20px;
    border-radius: 20px;
    border: 1px solid white;
}
.gw-header h1 {
    font-size: 2.4em;
    margin: 0 0 10px;
}
.gw-header p {
    color: var(--gw-muted);
    line-height: 1.5;
}

.gw-main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px 60px;
}

.hidden { display: none !important; }

/* Identity / login panel */
.gw-panel {
    background: var(--gw-bg);
    border: 1px solid var(--gw-border);
    border-radius: 10px;
    padding: 16px 20px;
    margin: 20px auto 24px;
}
.gw-identity {
    color: var(--gw-muted);
    font-size: 0.95em;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}
.gw-identity-name { color: var(--gw-text); font-weight: 600; font-size: 1.05em; }
.gw-identity-sep  { color: #555; }
.gw-identity-guild { color: var(--gw-accent); font-weight: 600; }
.gw-identity-status { color: var(--gw-muted); }
.gw-identity-refresh {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: transparent;
    color: var(--gw-accent);
    border: 1px solid rgba(255, 184, 77, 0.45);
    border-radius: 999px;
    padding: 4px 13px;
    font-family: inherit;
    font-size: 0.8em;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.gw-identity-refresh:hover:not(:disabled) {
    background: rgba(255, 184, 77, 0.12);
    border-color: var(--gw-accent);
    box-shadow: 0 0 0 2px rgba(255, 184, 77, 0.14);
}
.gw-identity-refresh:active:not(:disabled) { transform: translateY(1px); }
.gw-identity-refresh:disabled { cursor: default; opacity: 0.5; }

/* Unverify button: pill-shaped danger outline. Visually distinct from the
 * refresh button so it doesn't get clicked by accident. */
.gw-identity-unverify {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: transparent;
    color: #ff8a8a;
    border: 1px solid rgba(255, 100, 100, 0.4);
    border-radius: 999px;
    padding: 4px 13px;
    font-family: inherit;
    font-size: 0.8em;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.gw-identity-unverify:hover:not(:disabled) {
    background: rgba(180, 60, 60, 0.18);
    border-color: #e05555;
    color: #ffaaaa;
    box-shadow: 0 0 0 2px rgba(224, 85, 85, 0.13);
}
.gw-identity-unverify:active:not(:disabled) { transform: translateY(1px); }
.gw-identity-unverify:disabled { cursor: default; opacity: 0.5; }

/* Web verification form (shown when Discord-logged-in but unlinked). */
.gw-verify-form {
    flex-basis: 100%;
    display: flex;
    gap: 8px;
    margin-top: 8px;
    flex-wrap: wrap;
}
.gw-verify-form input[type="text"] {
    flex: 1 1 220px;
    min-width: 180px;
    background: var(--gw-bg-2);
    color: var(--gw-text);
    border: 1px solid var(--gw-border);
    border-radius: 6px;
    padding: 8px 12px;
    font: inherit;
    font-size: 0.95em;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.gw-verify-form input[type="text"]:focus {
    border-color: var(--gw-accent);
    box-shadow: 0 0 0 2px rgba(255, 200, 80, 0.18);
}
.gw-verify-form input[type="text"]::placeholder { color: var(--gw-muted); }
.gw-verify-form button {
    background: var(--gw-accent);
    color: #1d1d1d;
    border: 1px solid var(--gw-accent);
    border-radius: 6px;
    padding: 8px 16px;
    font: inherit;
    font-size: 0.92em;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.15s, transform 0.05s;
}
.gw-verify-form button:hover:not(:disabled) { filter: brightness(1.1); }
.gw-verify-form button:active:not(:disabled) { transform: translateY(1px); }
.gw-verify-form button:disabled { cursor: default; opacity: 0.7; }
.gw-verify-message {
    flex-basis: 100%;
    color: var(--gw-muted);
    font-size: 0.85em;
    margin-top: 4px;
    min-height: 1em;
}
.gw-verify-message.is-error { color: #ff8a8a; }
.gw-verify-message.is-ok    { color: #4ade80; }
.gw-identity-help {
    flex-basis: 100%;
    color: var(--gw-muted);
    font-size: 0.85em;
    margin-top: 4px;
}
.gw-identity-help code {
    background: var(--gw-bg-2);
    border: 1px solid var(--gw-border);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}
.gw-api-status {
    flex-basis: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--gw-border);
    color: var(--gw-muted);
    font-size: 0.82em;
    line-height: 1.35;
    flex-wrap: wrap;
}
.gw-api-status[hidden] { display: none; }
.gw-api-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4ade80;
    box-shadow: 0 0 6px rgba(74, 222, 128, 0.6);
    flex-shrink: 0;
    animation: gw-api-pulse 2s ease-in-out infinite;
}
.gw-api-status-dot.is-stale {
    background: #f59e0b;
    box-shadow: 0 0 6px rgba(245, 158, 11, 0.6);
}
.gw-api-status-dot.is-down {
    background: #ef4444;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.6);
    animation: none;
}
@keyframes gw-api-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.45; }
}
.gw-api-status-text strong { color: var(--gw-text); font-weight: 600; }
.gw-api-status-sep { color: #555; margin: 0 4px; }
.gw-login-btn {
    background: #5865F2;
    color: #fff;
    text-decoration: none;
    padding: 6px 14px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9em;
    transition: filter 0.15s;
}
.gw-login-btn:hover { filter: brightness(1.1); }

#gw-modal-attack-btn {
    background: var(--gw-accent);
    color: #1d1d1d;
    border: none;
    padding: 8px 18px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-family: inherit;
    transition: filter 0.15s;
}
#gw-modal-attack-btn:hover { filter: brightness(1.1); }
#gw-modal-attack-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Map area */
.gw-map-wrap {
    background: var(--gw-bg);
    border: 1px solid var(--gw-border);
    border-radius: 12px;
    padding: 16px;
    /* Default (medium). Overridden via data-size attribute below. */
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
}
.gw-map-wrap[data-size="small"]  { max-width: 460px; }
.gw-map-wrap[data-size="medium"] { max-width: 720px; }
.gw-map-wrap[data-size="large"]  { max-width: 900px; }

.gw-map-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.gw-map-toolbar-label {
    color: var(--gw-muted);
    font-size: 0.9em;
}
.gw-size-toggle {
    display: inline-flex;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 6px;
    overflow: hidden;
}
.gw-size-btn {
    appearance: none;
    background: transparent;
    border: 0;
    color: var(--gw-muted);
    padding: 6px 12px;
    font: inherit;
    font-size: 0.85em;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
}
.gw-size-btn + .gw-size-btn {
    border-left: 1px solid rgba(255,255,255,0.08);
}
.gw-size-btn:hover { color: #fff; background: rgba(255,255,255,0.04); }
.gw-size-btn.is-active {
    background: rgba(74, 222, 128, 0.18);
    color: #86efac;
}
.gw-map {
    position: relative;
    width: 100%;
    /* Square aspect ratio for the 10x10 grid */
    aspect-ratio: 1 / 1;
    background:
        radial-gradient(circle at 30% 30%, #2c4a6b 0%, #18283a 60%, #0d1722 100%);
    border-radius: 10px;
    overflow: hidden;
}
#gw-map-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.85;
}
.gw-grid {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    grid-template-rows: repeat(10, 1fr);
    gap: 2px;
    padding: 2px;
}
.gw-cell {
    position: relative;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.08);
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.1s, box-shadow 0.1s;
}
.gw-cell:hover {
    transform: scale(1.04);
    z-index: 2;
    box-shadow: 0 0 0 2px var(--gw-accent);
}
.gw-cell-overlay {
    position: absolute;
    inset: 0;
    background: var(--gw-unclaimed);
    opacity: 0.45;
    transition: opacity 0.2s, background 0.2s;
}
.gw-cell.owned-mine  .gw-cell-overlay { background: var(--gw-mine);  opacity: 0.55; }
.gw-cell.owned-enemy .gw-cell-overlay { background: var(--gw-enemy); opacity: 0.5; }
.gw-cell.attacking   { box-shadow: inset 0 0 0 4px var(--gw-attack); }
.gw-cell.attacking::after {
    background: transparent;
    animation: none;
}
/* The quadrant the *current viewer* is attacking gets a brighter,
   thicker cyan ring so it stands out from other people's attacks. We
   intentionally skip the colored overlay tint here -- stacking ring +
   tint on top of an owned-cell color was washing the cell out and made
   the skill icon hard to read. */
.gw-cell.attacking-mine {
    box-shadow:
        inset 0 0 0 5px #38bdf8,
        0 0 12px 1px rgba(56, 189, 248, 0.5);
    z-index: 1;
}
.gw-cell.attacking-mine::after {
    background: transparent;
    animation: none;
}
@keyframes gw-pulse {
    0%, 100% { opacity: 0.05; }
    50%      { opacity: 0.18; }
}
.gw-cell-skill {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.gw-cell-skill img {
    width: 55%;
    max-width: 28px;
    opacity: 0.9;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.6));
}
.gw-cell-contend {
    position: absolute;
    top: 2px;
    right: 3px;
    font-size: 11px;
    line-height: 1;
    color: var(--gw-attack, #ff5d5d);
    text-shadow: 0 0 3px rgba(0,0,0,0.85), 0 0 6px rgba(255, 80, 80, 0.6);
    pointer-events: none;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.2s, transform 0.2s;
    z-index: 2;
}
.gw-cell.attacking .gw-cell-contend {
    opacity: 1;
    transform: scale(1);
    animation: gw-contend-bob 1.4s ease-in-out infinite;
}
@keyframes gw-contend-bob {
    0%, 100% { transform: scale(1)   rotate(-8deg); }
    50%      { transform: scale(1.2) rotate(8deg);  }
}

/* Legend */
.gw-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 14px;
    color: var(--gw-muted);
    font-size: 0.9em;
}
.gw-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.gw-swatch {
    display: inline-block;
    width: 14px; height: 14px;
    border-radius: 3px;
    background: var(--gw-unclaimed);
}
.gw-swatch-mine    { background: var(--gw-mine); }
.gw-swatch-enemy   { background: var(--gw-enemy); }
.gw-swatch-attack  { background: var(--gw-attack); }
.gw-swatch-attack-mine { background: #38bdf8; box-shadow: 0 0 6px rgba(56, 189, 248, 0.6); }
.gw-swatch-attack-friendly { background: #4ade80; box-shadow: 0 0 5px rgba(74, 222, 128, 0.55); }
.gw-swatch-unclaimed { background: var(--gw-unclaimed); }

/* Modal */
.gw-modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
}
.gw-modal-card {
    background: var(--gw-bg);
    border: 1px solid var(--gw-border);
    border-radius: 12px;
    padding: 22px;
    width: 100%;
    max-width: 480px;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}
.gw-modal-close {
    position: absolute;
    top: 8px; right: 12px;
    background: transparent;
    border: none;
    color: var(--gw-muted);
    font-size: 1.6em;
    cursor: pointer;
    line-height: 1;
}
.gw-modal-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}
.gw-modal-head img {
    width: 42px; height: 42px;
    image-rendering: pixelated;
}
.gw-modal-head h2 { margin: 0; font-size: 1.4em; }
.gw-modal-head p  { margin: 2px 0 0; color: var(--gw-muted); font-size: 0.9em; }

.gw-modal-section { margin-top: 14px; }
.gw-modal-section h3 {
    margin: 0 0 6px;
    font-size: 0.95em;
    color: var(--gw-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
#gw-modal-owner {
    margin: 0;
    font-size: 1.1em;
}
#gw-modal-contenders {
    margin: 0;
    padding-left: 22px;
    color: var(--gw-text);
}
#gw-modal-contenders li {
    margin: 4px 0;
    color: var(--gw-muted);
}
#gw-modal-contenders li strong { color: var(--gw-text); }

.gw-help {
    margin: 8px 0 0;
    font-size: 0.85em;
    color: var(--gw-muted);
}

/* Active attackers list inside the quadrant modal */
#gw-modal-attackers {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.gw-attacker-group {
    background: var(--gw-bg-2);
    border: 1px solid var(--gw-border);
    border-radius: 6px;
    overflow: hidden;
}
.gw-attacker-group.is-mine { border-color: var(--gw-mine); }
.gw-attacker-header {
    width: 100%;
    display: grid;
    grid-template-columns: 18px 1fr auto auto;
    gap: 10px;
    align-items: center;
    background: transparent;
    border: none;
    color: var(--gw-text);
    padding: 8px 12px;
    text-align: left;
    cursor: pointer;
    font: inherit;
}
.gw-attacker-header:hover { background: rgba(255, 184, 77, 0.08); }
.gw-attacker-caret { color: var(--gw-muted); font-size: 0.9em; }
.gw-attacker-guild { font-weight: 600; }
.gw-attacker-count { color: var(--gw-muted); font-size: 0.85em; }
.gw-attacker-total { color: var(--gw-accent); font-variant-numeric: tabular-nums; }
.gw-attacker-members {
    list-style: none;
    margin: 0;
    padding: 4px 12px 10px 36px;
    border-top: 1px solid var(--gw-border);
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.gw-attacker-members li {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 10px;
    color: var(--gw-muted);
    font-size: 0.9em;
}
.gw-attacker-mc   { color: var(--gw-text); }
.gw-attacker-xp   { color: var(--gw-accent); font-variant-numeric: tabular-nums; }
.gw-attacker-time { font-variant-numeric: tabular-nums; }

/* Flat list of currently-attacking players (no per-guild grouping --
   just IGN, guild chip, and live XP gained). Used in the
   "Active attackers" section of the quadrant modal. */
.gw-attacker-active-list {
    padding: 4px 12px 10px 12px;
    border-top: none;
}
.gw-attacker-active-list li {
    grid-template-columns: 1fr auto auto;
    align-items: center;
    padding: 4px 0;
    border-bottom: 1px solid var(--gw-border);
}
.gw-attacker-active-list li:last-child { border-bottom: none; }
.gw-attacker-active-list li.is-mine .gw-attacker-mc { color: #86efac; font-weight: 600; }

/* Leaderboard */
.gw-leaderboard-wrap {
    background: var(--gw-bg);
    border: 1px solid var(--gw-border);
    border-radius: 12px;
    padding: 18px 20px;
    margin-top: 24px;
}
.gw-leaderboard-wrap h2 {
    margin: 0 0 4px;
    font-size: 1.4em;
}
.gw-leaderboard-sub {
    margin: 0 0 14px;
    color: var(--gw-muted);
    font-size: 0.9em;
}
.gw-leaderboard {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95em;
}
.gw-leaderboard th,
.gw-leaderboard td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid var(--gw-border);
}
.gw-leaderboard th {
    color: var(--gw-muted);
    text-transform: uppercase;
    font-size: 0.75em;
    letter-spacing: 0.6px;
}
.gw-leaderboard td:first-child,
.gw-leaderboard th:first-child { width: 40px; color: var(--gw-muted); }
.gw-leaderboard td:nth-child(3),
.gw-leaderboard td:nth-child(4) { text-align: right; font-variant-numeric: tabular-nums; }
.gw-leaderboard th:nth-child(3),
.gw-leaderboard th:nth-child(4) { text-align: right; }
.gw-leaderboard tr.gw-leaderboard-mine {
    background: rgba(76, 175, 80, 0.08);
}
.gw-leaderboard tr.gw-leaderboard-mine td:first-child {
    color: var(--gw-mine);
    font-weight: 700;
}
.gw-leaderboard-empty {
    text-align: center !important;
    color: var(--gw-muted);
    padding: 20px !important;
}

/* Clickable guild rows -- the top guild claims table opens a per-guild
   contributor modal when you click a row. */
.gw-leaderboard-clickable tbody tr.gw-leaderboard-row {
    cursor: pointer;
    transition: background 0.12s ease;
}
.gw-leaderboard-clickable tbody tr.gw-leaderboard-row:hover,
.gw-leaderboard-clickable tbody tr.gw-leaderboard-row:focus-visible {
    background: rgba(74, 222, 128, 0.08);
    outline: none;
}

/* Per-guild contributor modal extras */
.gw-guild-modal-table { margin-top: 6px; }
.gw-guild-modal-table td:nth-child(3),
.gw-guild-modal-table th:nth-child(3),
.gw-guild-modal-table td:nth-child(4),
.gw-guild-modal-table th:nth-child(4) {
    text-align: right;
    font-variant-numeric: tabular-nums;
}
#gw-guild-modal-quadrants {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}
.gw-guild-quad-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 999px;
    font-size: 0.85em;
    color: var(--gw-text);
}
.gw-guild-quad-skill { color: var(--gw-muted); }
.gw-guild-quad-xp {
    color: #86efac;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}


/* ---------- Player guild chip in the contributor leaderboard ---------- */
.gw-player-guild {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(255,255,255,0.06);
    color: var(--gw-muted);
    font-size: 0.85em;
}
.gw-player-guild-mine {
    background: rgba(74, 222, 128, 0.18);
    color: #86efac;
}
.gw-player-guild-none {
    background: transparent;
    color: var(--gw-muted);
}

/* Live attacker dot in the per-quadrant modal */
.gw-attacker-live {
    color: #4ade80;
    margin-left: 4px;
    font-size: 0.7em;
    vertical-align: middle;
}
.gw-attacker-empty {
    padding: 12px;
    color: var(--gw-muted);
    font-style: italic;
}

/* ---------- FAQ ---------- */
.gw-faq-wrap {
    margin: 32px auto;
    max-width: 900px;
    padding: 0 16px;
}
.gw-faq-wrap h2 {
    margin: 0 0 16px;
}
.gw-faq {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 10px;
}
.gw-faq summary {
    cursor: pointer;
    font-weight: 600;
    list-style: none;
    padding: 4px 0;
}
.gw-faq summary::-webkit-details-marker { display: none; }
.gw-faq summary::before {
    content: '\25B8';
    display: inline-block;
    width: 16px;
    color: var(--gw-muted);
    transition: transform 0.15s ease;
}
.gw-faq[open] summary::before {
    transform: rotate(90deg);
}
.gw-faq p {
    margin: 8px 0 4px 16px;
    color: var(--gw-muted);
    line-height: 1.5;
}
.gw-faq code {
    background: rgba(0,0,0,0.4);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}

/* Top contributors pagination */
.gw-pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-top: 12px;
}
.gw-pager[hidden] { display: none; }
.gw-pager-btn {
    appearance: none;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.12);
    color: var(--gw-text);
    padding: 6px 14px;
    border-radius: 6px;
    font: inherit;
    font-size: 0.88em;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.gw-pager-btn:hover:not(:disabled) {
    background: rgba(74, 222, 128, 0.18);
    border-color: rgba(74, 222, 128, 0.4);
}
.gw-pager-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}
.gw-pager-info {
    color: var(--gw-muted);
    font-size: 0.88em;
    min-width: 80px;
    text-align: center;
}

/* Friendly attack -- a guildmate (not you) is attacking this quadrant.
   Green ring + gentle pulse so it stands out and you don't double-attack
   the same square. */
.gw-cell.attacking-friendly {
    box-shadow:
        inset 0 0 0 4px #4ade80,
        0 0 8px 1px rgba(74, 222, 128, 0.4);
}
.gw-cell.attacking-friendly::after {
    content: "";
    position: absolute; inset: 0;
    background: #4ade80;
    opacity: 0.1;
    animation: gw-pulse 1.6s ease-in-out infinite;
}
/* Own-attack ring should win over friendly. */
.gw-cell.attacking-mine.attacking-friendly {
    box-shadow:
        inset 0 0 0 5px #38bdf8,
        0 0 12px 1px rgba(56, 189, 248, 0.5);
}
.gw-cell.attacking-mine.attacking-friendly::after {
    background: transparent;
}

/* Owner guild abbreviation chip in the top-left of each owned cell.
   Short fixed size so it doesn't crowd the skill icon at any map size. */
.gw-cell-guild {
    position: absolute;
    top: 2px;
    left: 2px;
    padding: 1px 4px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.5px;
    line-height: 1.1;
    color: rgba(255, 255, 255, 0.95);
    background: rgba(0, 0, 0, 0.6);
    border-radius: 3px;
    pointer-events: none;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.8);
    z-index: 2;
}
.gw-cell-guild[hidden] { display: none; }
.gw-map-wrap[data-show-guilds="false"] .gw-cell-guild { display: none; }
.gw-cell.owned-mine  .gw-cell-guild { background: rgba(34, 197, 94, 0.75); }
.gw-cell.owned-enemy .gw-cell-guild { background: rgba(220, 38, 38, 0.75); }

/* Bigger map sizes -> slightly bigger badge. */
.gw-map-wrap[data-size="medium"] .gw-cell-guild { font-size: 10px; padding: 2px 5px; }
.gw-map-wrap[data-size="large"]  .gw-cell-guild { font-size: 11px; padding: 2px 6px; }

/* Leader's XP shown centered along the bottom edge of each cell.
   Tells other guilds the score they need to beat. */
.gw-cell-xp {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 1px;
    text-align: center;
    font-size: 9px;
    line-height: 1;
    font-weight: 700;
    color: #f8fafc;
    text-shadow:
        0 1px 2px rgba(0, 0, 0, 0.85),
        0 0 3px rgba(0, 0, 0, 0.7);
    pointer-events: none;
    letter-spacing: 0.2px;
}
.gw-cell-xp[hidden] { display: none; }
.gw-map-wrap[data-show-xp="false"] .gw-cell-xp { display: none; }
.gw-map-wrap[data-size="medium"] .gw-cell-xp { font-size: 10px; bottom: 2px; }
.gw-map-wrap[data-size="large"]  .gw-cell-xp { font-size: 12px; bottom: 3px; }

/* ---------------------------------------------------------------------- */
/* Quadrant numbers (1-100) overlay -- toggled via "Show numbers" button. */
/* ---------------------------------------------------------------------- */
.gw-cell-number {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
    color: #fff;
    text-shadow:
        0 0 3px rgba(0, 0, 0, 0.95),
        0 1px 2px rgba(0, 0, 0, 0.8);
    pointer-events: none;
    z-index: 3;
    display: none;
}
.gw-map-wrap[data-show-numbers="true"] .gw-cell-number { display: block; }
.gw-map-wrap[data-size="medium"][data-show-numbers="true"] .gw-cell-number { font-size: 12px; }
.gw-map-wrap[data-size="large"][data-show-numbers="true"]  .gw-cell-number { font-size: 14px; }

/* ---------------------------------------------------------------------- */
/* Event status banner -- driven by /api/guild-war/state .event           */
/* ---------------------------------------------------------------------- */
/* ---------------------------------------------------------------------- */
/* Event status banner -- shown above the map. Adapts to event lifecycle: */
/*   none      = grey/muted  ("no event scheduled")                        */
/*   scheduled = amber       (countdown to linking / start)                */
/*   linking   = green       ("link now"; countdown to start)              */
/*   active    = cyan        (live; countdown to end)                      */
/*   ended     = red         ("ended X ago")                               */
/* ---------------------------------------------------------------------- */
.gw-event-status {
    --gw-evt-tint:   #ffb84d;
    --gw-evt-tint-2: rgba(255, 184, 77, 0.55);
    --gw-evt-glow:   rgba(255, 184, 77, 0.18);

    position: relative;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 18px;
    padding: 16px 20px;
    margin: 0 0 16px;
    border-radius: 12px;
    background:
        radial-gradient(circle at 0% 0%, var(--gw-evt-glow), transparent 60%),
        linear-gradient(135deg, rgba(255,255,255,0.04), rgba(0,0,0,0.25));
    border: 1px solid var(--gw-evt-tint-2);
    box-shadow:
        0 0 0 1px rgba(0,0,0,0.4) inset,
        0 8px 24px -12px rgba(0,0,0,0.6),
        0 0 24px -8px var(--gw-evt-glow);
    color: var(--gw-text);
    overflow: hidden;
}
.gw-event-status::before {
    /* Left accent bar */
    content: "";
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    background: var(--gw-evt-tint);
    box-shadow: 0 0 12px var(--gw-evt-tint);
}
.gw-event-status[hidden] { display: none; }

.gw-event-status-main {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}
.gw-event-status-icon {
    font-size: 1.9em;
    line-height: 1;
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    color: var(--gw-evt-tint);
    flex-shrink: 0;
    /* Filter adds a soft glow that matches the tint without a hard border */
    filter: drop-shadow(0 0 6px var(--gw-evt-glow));
}
.gw-event-status-text { min-width: 0; }
.gw-event-status-title {
    font-weight: 700;
    color: var(--gw-evt-tint);
    margin-bottom: 4px;
    font-size: 1.05em;
    letter-spacing: 0.01em;
}
.gw-event-status-body {
    color: var(--gw-muted);
    font-size: 0.9em;
    line-height: 1.45;
}
.gw-event-status-body strong { color: var(--gw-text); }
.gw-event-status-body code {
    background: rgba(0,0,0,0.45);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.92em;
    color: var(--gw-text);
}

.gw-event-countdown {
    flex-shrink: 0;
}
.gw-event-countdown-inner {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    padding: 8px 14px;
    border-left: 1px solid rgba(255,255,255,0.08);
    min-width: 140px;
}
.gw-event-countdown-label {
    font-size: 0.7em;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--gw-muted);
    font-weight: 600;
}
.gw-event-countdown-value {
    font-family: ui-monospace, "SF Mono", "JetBrains Mono", Consolas, monospace;
    font-size: 1.5em;
    font-weight: 700;
    color: var(--gw-evt-tint);
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
    text-shadow: 0 0 16px var(--gw-evt-glow);
}

/* LIVE pill badge (active state) */
.gw-event-live-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(34, 197, 94, 0.14);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.38);
    border-radius: 999px;
    padding: 1px 8px 1px 6px;
    font-size: 0.68em;
    font-weight: 800;
    letter-spacing: 0.1em;
    vertical-align: middle;
    margin-left: 8px;
    text-transform: uppercase;
    font-family: ui-monospace, 'SF Mono', Consolas, monospace;
}
.gw-event-live-badge::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background: #4ade80;
    border-radius: 50%;
    animation: gw-live-dot 1.4s ease-in-out infinite;
    flex-shrink: 0;
}
@keyframes gw-live-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.35; transform: scale(0.75); }
}

/* ENDED pill badge (ended state) */
.gw-event-ended-badge {
    display: inline-flex;
    align-items: center;
    background: rgba(251, 191, 36, 0.13);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.32);
    border-radius: 999px;
    padding: 1px 9px;
    font-size: 0.68em;
    font-weight: 800;
    letter-spacing: 0.1em;
    vertical-align: middle;
    margin-left: 8px;
    text-transform: uppercase;
    font-family: ui-monospace, 'SF Mono', Consolas, monospace;
}

/* Per-status tint overrides (one var swap drives the whole banner) */
.gw-event-status.is-none {
    --gw-evt-tint:   #9ca3af;
    --gw-evt-tint-2: rgba(156, 163, 175, 0.40);
    --gw-evt-glow:   rgba(156, 163, 175, 0.12);
}
.gw-event-status.is-scheduled {
    --gw-evt-tint:   #ffb84d;
    --gw-evt-tint-2: rgba(255, 184, 77, 0.55);
    --gw-evt-glow:   rgba(255, 184, 77, 0.20);
}
.gw-event-status.is-linking {
    --gw-evt-tint:   #86efac;
    --gw-evt-tint-2: rgba(134, 239, 172, 0.55);
    --gw-evt-glow:   rgba(74, 222, 128, 0.22);
}
/* is-active: vibrant green = "go / live now" */
.gw-event-status.is-active {
    --gw-evt-tint:   #4ade80;
    --gw-evt-tint-2: rgba(74, 222, 128, 0.42);
    --gw-evt-glow:   rgba(74, 222, 128, 0.2);
}
/* is-ended: gold/trophy = "event concluded, check standings" (not alarming red) */
.gw-event-status.is-ended {
    --gw-evt-tint:   #fbbf24;
    --gw-evt-tint-2: rgba(251, 191, 36, 0.38);
    --gw-evt-glow:   rgba(251, 191, 36, 0.15);
}

@media (max-width: 720px) {
    .gw-event-status {
        grid-template-columns: 1fr;
        padding: 14px 16px;
    }
    .gw-event-countdown-inner {
        align-items: flex-start;
        border-left: none;
        border-top: 1px dashed rgba(255,255,255,0.10);
        padding: 10px 0 0;
        min-width: 0;
    }
    .gw-event-countdown-value { font-size: 1.35em; }
}

/* ---------------------------------------------------------------------- */
/* Mobile-first responsive tweaks                                         */
/*  - tighter padding everywhere                                          */
/*  - leaderboards no longer overflow horizontally (scroll if needed)     */
/*  - low-priority columns collapse on tiny screens                       */
/*  - map toolbar wraps; map fills width of viewport                      */
/* ---------------------------------------------------------------------- */
@media (max-width: 720px) {
    .gw-header { padding: 24px 14px 6px; }
    .gw-header h1 { font-size: 1.7em; }
    .gw-header p  { font-size: 0.95em; }

    .gw-main { padding: 0 10px 40px; }

    .gw-map-wrap,
    .gw-map-wrap[data-size="small"],
    .gw-map-wrap[data-size="medium"],
    .gw-map-wrap[data-size="large"] {
        max-width: 100%;
        padding: 10px;
    }

    .gw-map-toolbar {
        gap: 8px;
        margin-bottom: 8px;
    }
    .gw-map-toolbar-label { display: none; }
    .gw-size-btn { padding: 5px 9px; font-size: 0.8em; }

    .gw-legend { gap: 8px; font-size: 0.8em; }
    .gw-legend-item .gw-swatch { width: 11px; height: 11px; }

    /* Leaderboard tables are wide; scroll horizontally rather than
       overflowing the page. Wrap is provided by the table itself, no
       extra HTML needed (tables get block-level overflow via display). */
    .gw-leaderboard-wrap {
        padding: 14px 12px;
        margin-top: 18px;
        /* Allow inner table to scroll without breaking page layout. */
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .gw-leaderboard-wrap h2 { font-size: 1.15em; }
    .gw-leaderboard-sub { font-size: 0.82em; margin-bottom: 10px; }

    .gw-leaderboard {
        font-size: 0.82em;
        min-width: 100%;
    }
    .gw-leaderboard th,
    .gw-leaderboard td {
        padding: 6px 6px;
    }
    /* Drop the rank column on phones to claw back horizontal space.
       The table is already short enough that ranks aren't critical. */
    .gw-leaderboard th:first-child,
    .gw-leaderboard td:first-child { width: 24px; padding-left: 4px; }

    /* Truncate long guild / player names so a single mega-name doesn't
       blow out the column. Tooltip is preserved via title attr where
       provided. */
    .gw-leaderboard td { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

    .gw-pager-btn { padding: 5px 10px; font-size: 0.82em; }
    .gw-pager-info { min-width: 60px; font-size: 0.82em; }

    /* Modals: take up most of the screen, smaller padding. */
    .gw-modal-card { padding: 16px; max-width: 96vw; max-height: 92vh; }
    .gw-modal-head h2 { font-size: 1.15em; }
}

@media (max-width: 480px) {
    /* On the smallest screens, hide the lowest-priority column
       (`Total XP (active)` for guilds, `Guild` for players) so the
       remaining columns fit without horizontal scrolling. */
    .gw-leaderboard-clickable th:nth-child(4),
    .gw-leaderboard-clickable td:nth-child(4) { display: none; }

    /* Top contributors table: hide the guild chip column. */
    #gw-players-body td:nth-child(3),
    .gw-leaderboard th:nth-child(3) {
        /* Only hide on the players table; the guilds table's third
           column is "Quadrants" which is the whole point of the table. */
    }
    /* Players-specific (the table immediately following the
       "Top contributors" header). Use a more targeted hide that doesn't
       affect the guild claims table. */
    .gw-leaderboard-wrap:has(#gw-players-body) th:nth-child(3),
    .gw-leaderboard-wrap:has(#gw-players-body) td:nth-child(3) {
        display: none;
    }

    .gw-cell-skill img { width: 60%; height: 60%; }
    .gw-cell-guild { font-size: 8px; padding: 1px 3px; }
}

/* ============================================================
   Live XP Log Panel
   ============================================================ */

.gw-log-wrap {
    max-width: 900px;
    margin: 22px auto 0;
    padding: 0 12px 12px;
}

.gw-log-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.gw-log-header h2 {
    margin: 0;
    font-size: 1.2em;
    color: var(--gw-text);
}

/* Pulsing "live" dot */
.gw-log-live-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #4caf50;
    border-radius: 50%;
    animation: gw-log-live-pulse 1.6s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes gw-log-live-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.4; transform: scale(0.75); }
}

.gw-log-live-label {
    font-size: 0.78em;
    color: #4caf50;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.gw-log-feed {
    background: var(--gw-bg-2);
    border: 1px solid var(--gw-border);
    border-radius: 8px;
    height: 280px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.gw-log-empty {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gw-muted);
    font-size: 0.88em;
}

.gw-log-entry {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 4px;
    padding: 5px 12px;
    border-bottom: 1px solid var(--gw-border);
    font-size: 0.86em;
    line-height: 1.4;
}

.gw-log-entry:last-child {
    border-bottom: none;
}

.gw-log-entry-player {
    color: var(--gw-text);
    font-weight: 600;
}

.gw-log-entry-xp {
    color: #4caf50;
    font-weight: 600;
}

.gw-log-entry-skill {
    color: var(--gw-accent);
}

.gw-log-entry-quad {
    color: var(--gw-muted);
    font-size: 0.9em;
}

.gw-log-entry-guild {
    color: var(--gw-muted);
    font-size: 0.9em;
    margin-left: auto;
}

.gw-log-entry-time {
    color: var(--gw-muted);
    font-size: 0.82em;
    white-space: nowrap;
}
