/* Viz Magic — Core Styles (Mobile-First) */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
button { color: inherit; font: inherit; }

:root {
    --color-bg: #0d1117;
    --color-surface: #161b22;
    --color-surface-2: #21262d;
    --color-text: #e6edf3;
    --color-text-muted: #9da5ae;
    --color-primary: #d4a843;
    --color-primary-glow: rgba(212, 168, 67, 0.3);
    --color-accent: #58a6ff;
    --color-success: #3fb950;
    --color-error: #f85149;
    --color-warning: #d29922;
    --color-border: #30363d;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 2px 8px rgba(0,0,0,0.3);
    --transition: 0.2s ease;
    --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --touch-target: 48px;
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--font-body);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Screens */
.screen { display: none; min-height: 100vh; padding: 16px; padding-bottom: 80px; }
.screen.active { display: block; }

/* SR Only */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: var(--touch-target); min-width: var(--touch-target);
    padding: 12px 24px; border: none; border-radius: var(--radius-sm);
    font-size: 1rem; font-weight: 600; cursor: pointer;
    transition: all var(--transition); text-decoration: none;
    touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.btn:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }
.btn-primary { background: var(--color-primary); color: #000; }
.btn-primary:hover { filter: brightness(1.1); }
.btn-primary:active { transform: scale(0.97); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary { background: var(--color-surface-2); color: var(--color-text); border: 1px solid var(--color-border); }
.btn-secondary:hover { background: var(--color-border); filter: brightness(1.2); }
.btn-secondary:active { transform: scale(0.97); }
.btn-danger { background: var(--color-error); color: #fff; font-weight: 700; }
.btn-danger:hover { filter: brightness(1.15); }
.btn-danger:active { transform: scale(0.97); }
.btn-large { padding: 16px 32px; font-size: 1.125rem; min-width: 200px; }
.btn-glow { box-shadow: 0 0 20px var(--color-primary-glow), 0 0 40px var(--color-primary-glow); }

/* Input fields */
.input-label { display: block; margin-bottom: 4px; font-weight: 600; color: var(--color-text-muted); }
.input-field {
    width: 100%; padding: 12px 16px; background: var(--color-surface);
    border: 1px solid var(--color-border); border-radius: var(--radius-sm);
    color: var(--color-text); font-size: 1rem; min-height: var(--touch-target);
    transition: border-color var(--transition);
}
.input-field:focus { outline: none; border-color: var(--color-primary); }
.input-feedback { margin-top: 4px; font-size: 0.875rem; min-height: 1.5em; }
.input-feedback.success { color: var(--color-success); }
.input-feedback.error { color: var(--color-error); }

/* Landing */
.landing { text-align: center; max-width: 480px; margin: 0 auto; }
.landing-hero { padding: 60px 0 40px; }
.landing-title { margin-bottom: 24px; }
.title-glow { font-size: 2.5rem; font-weight: 700; color: var(--color-primary); text-shadow: 0 0 30px var(--color-primary-glow); }
.landing-text { margin-bottom: 32px; }
.landing-text p { margin-bottom: 8px; font-size: 1.1rem; opacity: 0.9; }
.landing-login-link { margin-top: 16px; }
.landing-login-link a { color: var(--color-accent); text-decoration: none; }
.landing-login-link a:hover { text-decoration: underline; }
.landing-cards { display: grid; grid-template-columns: 1fr; gap: 12px; margin: 32px 0; }
.feature-card {
    background: var(--color-surface); padding: 20px; border-radius: var(--radius);
    border: 1px solid var(--color-border); text-align: left;
}
.feature-icon { font-size: 1.5rem; display: block; margin-bottom: 8px; }
.feature-card h3 { margin-bottom: 4px; }
.feature-card p { color: var(--color-text-muted); font-size: 0.9rem; }
.landing-assurances { color: var(--color-text-muted); font-size: 0.9rem; }
.landing-assurances p { margin-bottom: 4px; }

/* Onboarding */
.onboarding-step { max-width: 480px; margin: 0 auto; padding-top: 40px; }
.onboarding-step h1 { font-size: 1.75rem; margin-bottom: 16px; text-align: center; }
.onboarding-text { margin-bottom: 24px; text-align: center; color: var(--color-text-muted); }
.onboarding-step .input-field { margin-bottom: 8px; }
.onboarding-step .btn { display: block; width: 100%; margin-top: 16px; }
.onboarding-buttons { display: flex; gap: 12px; margin-top: 24px; }
.onboarding-buttons .btn { flex: 1; }

/* Class cards */
.class-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.class-card {
    background: var(--color-surface); border: 2px solid var(--color-border);
    border-radius: var(--radius); padding: 16px; cursor: pointer;
    text-align: left; transition: all var(--transition); min-height: var(--touch-target);
}
.class-card:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }
.class-card.selected { border-color: var(--color-primary); background: rgba(212,168,67,0.1); }
.class-icon { font-size: 2rem; display: block; margin-bottom: 8px; }
.class-card h3 { font-size: 1rem; margin-bottom: 4px; }
.class-quote { font-style: italic; color: var(--color-text-muted); font-size: 0.85rem; margin-bottom: 4px; }
.class-detail { font-size: 0.8rem; color: var(--color-text-muted); margin-bottom: 4px; }
.class-diff { font-size: 0.75rem; color: var(--color-accent); }

/* Home dashboard */
.home-dashboard { max-width: 480px; margin: 0 auto; }
.home-summary { margin-bottom: 24px; }
.home-summary h1 { font-size: 1.5rem; margin-bottom: 8px; }
.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.action-tile {
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius); padding: 20px; cursor: pointer;
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    min-height: 80px; transition: all var(--transition);
}
.action-tile:hover { border-color: var(--color-primary); }
.action-tile:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }
.tile-icon { font-size: 2rem; }
.tile-label { font-size: 0.9rem; font-weight: 600; }

/* Progress bars */
.progress-bar-wrapper { margin-bottom: 12px; }
.progress-label { font-size: 0.8rem; color: var(--color-text-muted); margin-bottom: 2px; display: block; }
.progress-bar {
    position: relative; height: 20px; background: var(--color-surface-2);
    border-radius: 10px; overflow: hidden; border: 1px solid var(--color-border);
}
.progress-fill { height: 100%; transition: width 0.3s ease; border-radius: 10px; background: var(--color-primary); }
.progress-text {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    font-size: 0.75rem; font-weight: 600; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* Character sheet */
.character-sheet { max-width: 480px; margin: 0 auto; }
.char-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.char-icon { font-size: 3rem; }
.stats-list { margin-bottom: 16px; }
.stat-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--color-border); }
.stat-label { color: var(--color-text-muted); }
.stat-value { font-weight: 600; }
.spell-list { display: flex; flex-direction: column; gap: 8px; }
.spell-item { background: var(--color-surface); padding: 12px; border-radius: var(--radius-sm); border-left: 3px solid transparent; }

/* Hunt screen */
.hunt-screen { max-width: 480px; margin: 0 auto; }
.hunt-screen h1 { margin-bottom: 16px; }
.hunt-screen h2 { margin: 16px 0 8px; font-size: 1.1rem; }
.creature-list { display: flex; flex-direction: column; gap: 8px; }
.creature-card {
    display: flex; justify-content: space-between; align-items: center;
    background: var(--color-surface); border: 2px solid var(--color-border);
    border-radius: var(--radius-sm); padding: 12px 16px; cursor: pointer;
    min-height: var(--touch-target); transition: all var(--transition);
}
.creature-card.selected { border-color: var(--color-primary); background: rgba(212,168,67,0.1); }
.creature-card:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }
.creature-level { color: var(--color-text-muted); font-size: 0.85rem; }
.spell-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.spell-btn {
    background: var(--color-surface); border: 2px solid var(--color-border);
    border-radius: var(--radius-sm); padding: 12px; cursor: pointer;
    text-align: center; min-height: 64px; transition: all var(--transition);
}
.spell-btn.selected { border-color: var(--color-primary); background: rgba(212,168,67,0.1); }
.spell-btn:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }
.spell-cost { font-size: 0.75rem; color: var(--color-text-muted); display: block; margin-top: 4px; }
#btn-attack { display: block; width: 100%; margin-top: 20px; }

/* Combat result */
.combat-result { margin-top: 20px; padding: 20px; background: var(--color-surface); border-radius: var(--radius); text-align: center; }
.combat-result.victory { border: 2px solid var(--color-success); }
.combat-result.defeat { border: 2px solid var(--color-error); }
.combat-result h2 { margin-bottom: 12px; }
.combat-result .btn { margin-top: 12px; margin-right: 8px; }
.critical { color: var(--color-warning); font-weight: 700; }

/* Inventory */
.inventory-screen { max-width: 480px; margin: 0 auto; }
.item-list { display: flex; flex-direction: column; gap: 8px; }
.item-card {
    display: flex; align-items: center; gap: 8px;
    background: var(--color-surface); padding: 12px; border-radius: var(--radius-sm);
    border-left: 3px solid var(--color-border); min-height: var(--touch-target);
}
.rarity-common { border-left-color: #9e9e9e; }
.rarity-uncommon { border-left-color: #4caf50; }
.rarity-rare { border-left-color: #2196f3; }
.rarity-epic { border-left-color: #9c27b0; }
.rarity-legendary { border-left-color: #ffc107; }
.item-name { flex: 1; text-transform: capitalize; }
.item-badge { color: var(--color-primary); font-weight: 700; }
.item-volatile { color: var(--color-warning); }
.empty-state { text-align: center; color: var(--color-text-muted); padding: 40px 0; }

/* Chronicle */
.chronicle-screen { max-width: 480px; margin: 0 auto; }
.chronicle-tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.chronicle-tabs .btn { flex: 1; min-width: 60px; padding: 8px 12px; font-size: 0.85rem; }
.chronicle-compose { margin-bottom: 20px; }
.chronicle-compose textarea { margin-bottom: 8px; resize: vertical; }
.chronicle-compose-footer { display: flex; align-items: center; gap: 8px; }
.chronicle-compose-footer .btn { flex-shrink: 0; }
.chronicle-char-count { font-size: 0.8rem; color: var(--color-text-muted); }
.chronicle-char-count.error { color: var(--color-error); }
.chronicle-feed { display: flex; flex-direction: column; gap: 8px; }
.chronicle-entry {
    background: var(--color-surface); padding: 12px; border-radius: var(--radius-sm);
    border-left: 3px solid var(--color-border);
}
.chronicle-entry-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.chronicle-icon { font-size: 1.2rem; }
.chronicle-author { font-size: 0.9rem; }
.chronicle-time { font-size: 0.75rem; color: var(--color-text-muted); margin-left: auto; }
.chronicle-text { font-size: 0.9rem; margin-bottom: 8px; color: var(--color-text); }
.chronicle-actions { display: flex; gap: 8px; }
.bless-button {
    display: inline-flex; align-items: center; gap: 4px;
    background: none; border: 1px solid var(--color-border); border-radius: var(--radius-sm);
    color: var(--color-primary); font-size: 0.8rem; padding: 4px 12px; cursor: pointer;
    min-height: var(--touch-target); transition: all var(--transition);
}
.bless-button:hover { background: rgba(212,168,67,0.1); border-color: var(--color-primary); }
.bless-button:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }

/* Bottom navigation */
#bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0;
    display: none; background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    padding: 4px 0; z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
}
#bottom-nav.show { display: flex; }
.nav-tab {
    flex: 1; display: flex; flex-direction: column; align-items: center;
    padding: 8px 4px; background: none; border: none; cursor: pointer;
    color: var(--color-text-muted); font-size: 0.7rem;
    min-height: var(--touch-target); transition: color var(--transition);
}
.nav-tab.active { color: var(--color-primary); }
.nav-tab:focus-visible { outline: 2px solid var(--color-accent); outline-offset: -2px; }
.nav-icon { font-size: 1.25rem; margin-bottom: 2px; }

/* Toast */
#toast-container { position: fixed; top: 16px; right: 16px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; }
.toast {
    padding: 12px 20px; border-radius: var(--radius-sm); color: #fff;
    font-size: 0.9rem; opacity: 0; transform: translateX(100%);
    transition: all 0.3s ease; max-width: 300px;
}
.toast.show { opacity: 1; transform: translateX(0); }
.toast-info { background: var(--color-surface-2); border: 1px solid var(--color-border); }
.toast-success { background: #1a4d2e; border: 1px solid var(--color-success); }
.toast-error { background: #4d1a1a; border: 1px solid var(--color-error); }

/* Modal */
#modal-overlay {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.7);
    z-index: 200; align-items: center; justify-content: center;
}
#modal-overlay.show { display: flex; }
.modal {
    background: var(--color-surface); border-radius: var(--radius);
    padding: 24px; max-width: 400px; width: 90%; max-height: 80vh; overflow-y: auto;
}
.modal-title { margin-bottom: 16px; }
.modal-actions { display: flex; gap: 8px; margin-top: 20px; flex-wrap: wrap; }

/* Connection status */
#connection-status {
    position: fixed; top: 0; left: 0; right: 0; text-align: center;
    padding: 8px; background: var(--color-surface-2); color: var(--color-text-muted);
    font-size: 0.85rem; z-index: 300; transform: translateY(-100%);
    transition: transform 0.3s ease;
}
#connection-status.show { transform: translateY(0); }

/* Duel Screen */
.duel-screen { max-width: 480px; margin: 0 auto; text-align: center; }
.duel-screen h1 { margin-bottom: 16px; }

/* Matchup display */
.duel-matchup {
    display: flex; align-items: center; justify-content: center; gap: 16px;
    margin: 20px 0; padding: 16px; background: var(--color-surface); border-radius: var(--radius);
}
.duel-mage { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 1; }
.duel-mage-icon { font-size: 2.5rem; }
.duel-mage-info { font-size: 0.8rem; color: var(--color-text-muted); }
.duel-vs { font-size: 1.5rem; font-weight: 700; color: var(--color-primary); }
.duel-format { color: var(--color-text-muted); margin-bottom: 20px; }
.duel-actions { display: flex; gap: 12px; justify-content: center; margin-top: 20px; }
.duel-actions .btn { flex: 1; max-width: 200px; }

/* Spell cards (2x2 grid) */
.spell-card-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 20px 0;
}
.spell-card {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 8px; padding: 16px; min-height: 80px; min-width: 80px;
    background: var(--color-surface); border: 2px solid var(--color-border);
    border-radius: var(--radius); cursor: pointer;
    transition: all var(--transition); position: relative; overflow: hidden;
}
.spell-card:hover { border-color: var(--color-primary); transform: scale(1.02); }
.spell-card:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }
.spell-card.selected {
    border-color: var(--color-primary); background: rgba(212,168,67,0.15);
    box-shadow: 0 0 20px var(--color-primary-glow), 0 0 40px var(--color-primary-glow);
}
.spell-card.sealed {
    background: var(--color-surface-2); border-color: var(--color-primary);
    transform: rotateY(180deg);
}
.spell-card.sealed::after {
    content: '\uD83D\uDD12'; position: absolute; font-size: 2rem;
    top: 50%; left: 50%; transform: translate(-50%, -50%) rotateY(180deg);
}
.spell-card.sealed .spell-card-icon,
.spell-card.sealed .spell-card-name,
.spell-card.sealed .spell-card-hint { opacity: 0; }
.spell-card-icon { font-size: 2rem; }
.spell-card-name { font-size: 0.95rem; font-weight: 600; }
.spell-card-hint { font-size: 0.7rem; color: var(--color-text-muted); }

/* Seal animation */
@keyframes sealFlip {
    0% { transform: rotateY(0deg); }
    50% { transform: rotateY(90deg); }
    100% { transform: rotateY(180deg); }
}
.spell-card.sealed { animation: sealFlip 0.4s ease-out; }

/* Timer */
.duel-timer {
    font-size: 2rem; font-weight: 700; color: var(--color-primary);
    margin: 12px 0; min-height: 40px;
}

/* Round info */
.duel-round-info { color: var(--color-text-muted); margin-bottom: 12px; }

/* Seal status */
.duel-seal-status { margin-top: 16px; font-weight: 600; color: var(--color-success); min-height: 2em; }

/* Waiting display */
.duel-waiting-display {
    display: flex; align-items: center; justify-content: center; gap: 24px; margin: 30px 0;
}
.sealed-envelope {
    width: 80px; height: 80px; display: flex; align-items: center; justify-content: center;
    background: var(--color-surface); border: 2px solid var(--color-primary);
    border-radius: var(--radius); font-size: 2rem;
}
.sealed-envelope.pending { border-color: var(--color-border); opacity: 0.5; }
.sealed-envelope.committed { border-color: var(--color-success); }
.duel-waiting-text { color: var(--color-text-muted); margin-bottom: 16px; }
.duel-waiting-dots { display: flex; gap: 8px; justify-content: center; margin-bottom: 20px; }
.duel-waiting-dots .dot {
    width: 8px; height: 8px; border-radius: 50%; background: var(--color-text-muted);
    animation: dotPulse 1.4s ease infinite both;
}
.duel-waiting-dots .dot:nth-child(2) { animation-delay: 0.2s; }
.duel-waiting-dots .dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes dotPulse { 0%, 80%, 100% { opacity: 0.3; } 40% { opacity: 1; } }

/* Reveal display */
.duel-reveal-display {
    display: flex; align-items: center; justify-content: center; gap: 16px; margin: 20px 0;
}
.reveal-card {
    width: 100px; padding: 16px; background: var(--color-surface);
    border: 2px solid var(--color-border); border-radius: var(--radius);
    text-align: center;
}
.reveal-card.reveal-animation { animation: revealShatter 0.5s ease-out; }
@keyframes revealShatter {
    0% { transform: scale(0.8); opacity: 0; }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}
.reveal-icon { font-size: 2rem; display: block; margin-bottom: 8px; }
.reveal-name { font-size: 0.85rem; font-weight: 600; }

/* Round result */
.duel-round-result {
    padding: 16px; background: var(--color-surface); border-radius: var(--radius);
    margin: 16px 0; border: 2px solid var(--color-border);
}
.duel-round-result.round-won { border-color: var(--color-success); }
.duel-round-result.round-lost { border-color: var(--color-error); }
.duel-round-result.round-draw { border-color: var(--color-warning); }
.duel-score { font-size: 1.5rem; font-weight: 700; margin: 12px 0; color: var(--color-primary); }
.duel-hint { color: var(--color-accent); font-style: italic; margin: 12px 0; }

/* Duel result screen */
.duel-result {
    padding: 24px; background: var(--color-surface); border-radius: var(--radius);
    border: 2px solid var(--color-border);
}
.duel-result.duel-victory { border-color: var(--color-success); }
.duel-result.duel-defeat { border-color: var(--color-error); }
.duel-result.duel-draw { border-color: var(--color-warning); }
.duel-final-score { font-size: 2rem; font-weight: 700; color: var(--color-primary); margin: 12px 0; }
.round-summary-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 0; border-bottom: 1px solid var(--color-border);
}
.round-num { font-weight: 600; min-width: 80px; }
.duel-rewards { margin: 16px 0; color: var(--color-success); }
.duel-insight { color: var(--color-accent); font-style: italic; margin: 12px 0; }

/* Arena Screen */
.arena-screen { max-width: 560px; margin: 0 auto; }
.arena-screen h1 { margin-bottom: 16px; }
.arena-tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.arena-tabs .btn { flex: 1; }
.arena-filter { margin-bottom: 16px; }
.arena-filter select { max-width: 200px; }
.arena-table {
    width: 100%; border-collapse: collapse; font-size: 0.9rem;
}
.arena-table th {
    text-align: left; padding: 8px; border-bottom: 2px solid var(--color-border);
    color: var(--color-text-muted); font-size: 0.8rem; text-transform: uppercase;
}
.arena-table td {
    padding: 8px; border-bottom: 1px solid var(--color-border);
}
.arena-table tr:hover { background: var(--color-surface); }
.arena-row-me { background: rgba(212,168,67,0.1) !important; }
.arena-challenge-btn { font-size: 0.8rem; padding: 4px 8px; }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; min-height: 36px; }

.arena-history-entry {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 12px; background: var(--color-surface); border-radius: var(--radius-sm);
    margin-bottom: 8px; border-left: 3px solid var(--color-border);
}
.arena-history-entry.arena-active { border-left-color: var(--color-accent); }
.arena-history-entry.arena-pending { border-left-color: var(--color-warning); }
.arena-history-entry.arena-won { border-left-color: var(--color-success); }
.arena-history-entry.arena-lost { border-left-color: var(--color-error); }
.arena-history-entry.arena-drew { border-left-color: var(--color-text-muted); }

/* ==========================================
   Guild Hall Screen
   ========================================== */
.guild-hall { max-width: 480px; margin: 0 auto; }
.guild-banner {
    text-align: center; padding: 20px; margin-bottom: 16px;
    background: var(--color-surface); border-radius: var(--radius);
    border: 1px solid var(--color-border);
}
.guild-name { font-size: 1.75rem; color: var(--color-primary); margin-bottom: 4px; }
.guild-tag { font-size: 1.1rem; color: var(--color-text-muted); margin-bottom: 8px; }
.guild-motto { font-style: italic; color: var(--color-text-muted); margin-bottom: 12px; }
.guild-meta { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; font-size: 0.85rem; color: var(--color-text-muted); }
.guild-my-rank {
    text-align: center; font-size: 1.1rem; font-weight: 600;
    padding: 8px; margin-bottom: 16px;
    background: rgba(212,168,67,0.1); border-radius: var(--radius-sm);
}

/* Guild sections */
.guild-quests, .guild-territories, .guild-wars, .guild-member-list, .guild-board {
    margin-bottom: 20px;
}
.guild-quests h2, .guild-territories h2, .guild-wars h2, .guild-member-list h2, .guild-board h2 {
    font-size: 1.1rem; margin-bottom: 8px; padding-bottom: 4px;
    border-bottom: 1px solid var(--color-border);
}

/* Quest list */
.guild-quest-list { list-style: none; }
.guild-quest-item {
    padding: 8px; margin-bottom: 8px;
    background: var(--color-surface); border-radius: var(--radius-sm);
}
.quest-name { font-weight: 600; margin-bottom: 4px; }

/* Territory list */
.territory-list { list-style: none; }
.territory-item {
    padding: 8px 12px; margin-bottom: 4px;
    background: var(--color-surface); border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: space-between;
}
.territory-item.under-siege { border-left: 3px solid var(--color-error); }
.siege-indicator { color: var(--color-error); font-size: 0.85rem; font-weight: 600; }

/* War list */
.war-list { list-style: none; }
.war-item {
    padding: 8px; margin-bottom: 4px;
    background: var(--color-surface); border-radius: var(--radius-sm);
}

/* Member list */
.member-list { list-style: none; }
.member-item {
    display: flex; align-items: center; gap: 8px;
    padding: 8px; margin-bottom: 4px;
    background: var(--color-surface); border-radius: var(--radius-sm);
    min-height: var(--touch-target);
}
.member-icon { font-size: 1.3rem; min-width: 28px; text-align: center; }
.member-name { flex: 1; font-weight: 600; }
.member-rank { color: var(--color-text-muted); font-size: 0.85rem; }
.member-delegation { color: var(--color-accent); font-size: 0.8rem; margin-left: 4px; }

/* Announcement list */
.announcement-list { list-style: none; }
.announcement-item {
    padding: 8px; margin-bottom: 4px;
    background: var(--color-surface); border-radius: var(--radius-sm);
    font-size: 0.9rem;
}

/* Guild action buttons */
.guild-actions {
    display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px;
}
.guild-btn { flex: 1; min-width: 120px; }
.guild-leave-btn { color: var(--color-error); border-color: var(--color-error); }

/* No-guild recommended list */
.guild-no-guild-text { text-align: center; color: var(--color-text-muted); margin-bottom: 20px; }
.recommended-guilds { margin-top: 24px; }
.recommended-guilds h2 { margin-bottom: 12px; }
.guild-list { list-style: none; }
.guild-card {
    padding: 16px; margin-bottom: 8px;
    background: var(--color-surface); border-radius: var(--radius);
    border: 1px solid var(--color-border);
}
.guild-card-header { margin-bottom: 4px; }
.guild-card-motto { font-style: italic; color: var(--color-text-muted); font-size: 0.85rem; margin-bottom: 8px; }
.guild-card-meta { display: flex; gap: 12px; font-size: 0.8rem; color: var(--color-text-muted); margin-bottom: 8px; }
.guild-join-btn { margin-top: 4px; }

/* ==========================================
   World Map Screen
   ========================================== */
.map-screen { max-width: 560px; margin: 0 auto; }
.map-screen h1 { margin-bottom: 12px; }
.map-current-location {
    margin-bottom: 12px; padding: 8px 12px;
    background: var(--color-surface); border-radius: var(--radius-sm);
    border-left: 3px solid var(--color-primary);
}
.map-siege-alert {
    padding: 8px 12px; margin-bottom: 12px;
    background: rgba(248,81,73,0.1); border: 1px solid var(--color-error);
    border-radius: var(--radius-sm); color: var(--color-error);
    font-weight: 600; text-align: center;
}

/* Region cards */
.region-list { display: flex; flex-direction: column; gap: 12px; }
.region-card {
    padding: 16px; background: var(--color-surface);
    border-radius: var(--radius); border: 1px solid var(--color-border);
    border-left: 4px solid var(--color-border);
    transition: all var(--transition);
}
.region-card.region-current {
    border-color: var(--color-primary);
    background: rgba(212,168,67,0.05);
}
.region-header {
    display: flex; align-items: flex-start; gap: 12px; margin-bottom: 8px;
}
.region-icon { font-size: 2rem; min-width: 36px; text-align: center; }
.region-info { flex: 1; }
.region-name { font-size: 1.1rem; margin-bottom: 2px; }
.region-level { font-size: 0.8rem; color: var(--color-text-muted); }
.region-school {
    font-size: 0.75rem; padding: 2px 6px;
    background: var(--color-surface-2); border-radius: 4px;
    color: var(--color-accent);
}
.region-pvp {
    font-size: 0.75rem; padding: 2px 6px;
    background: rgba(248,81,73,0.15); border-radius: 4px;
    color: var(--color-error); font-weight: 600;
}
.region-here { font-size: 1.5rem; }
.region-desc { font-size: 0.85rem; color: var(--color-text-muted); margin-bottom: 8px; }
.region-controller {
    font-size: 0.85rem; padding: 4px 8px; margin-bottom: 6px;
    background: rgba(88,166,255,0.1); border-radius: var(--radius-sm);
}
.region-siege-indicator {
    font-size: 0.85rem; padding: 4px 8px; margin-bottom: 6px;
    color: var(--color-error); font-weight: 600;
    background: rgba(248,81,73,0.1); border-radius: var(--radius-sm);
}
.region-benefits {
    font-size: 0.8rem; color: var(--color-success); margin-bottom: 6px;
}
.region-tax {
    font-size: 0.8rem; color: var(--color-warning); margin-bottom: 6px;
}
.region-travel-btn { margin-top: 8px; }

/* Siege progress bar */
.siege-progress {
    margin: 8px 0;
}
.siege-progress-bar {
    height: 12px; background: var(--color-surface-2);
    border-radius: 6px; overflow: hidden; position: relative;
    border: 1px solid var(--color-border);
}
.siege-attack-fill {
    height: 100%; background: var(--color-error);
    border-radius: 6px 0 0 6px; position: absolute; left: 0; top: 0;
}
.siege-defense-fill {
    height: 100%; background: var(--color-success);
    border-radius: 0 6px 6px 0; position: absolute; right: 0; top: 0;
}
.siege-labels {
    display: flex; justify-content: space-between; font-size: 0.75rem;
    color: var(--color-text-muted); margin-top: 2px;
}

/* ==========================================
   Marketplace (Bazaar) Screen
   ========================================== */
.marketplace-screen { max-width: 560px; margin: 0 auto; }
.marketplace-screen h1 { margin-bottom: 16px; }

/* Market tabs */
.market-tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.market-tabs .btn { flex: 1; }
.market-tabs .btn.active { background: var(--color-primary); color: #000; }

/* Search */
.market-search { margin-bottom: 12px; }

/* Category filters */
.market-categories { display: flex; gap: 4px; margin-bottom: 16px; flex-wrap: wrap; }
.market-cat-btn { font-size: 0.8rem; padding: 6px 10px; background: var(--color-surface-2); border: 1px solid var(--color-border); color: var(--color-text); }
.market-cat-btn:hover { border-color: var(--color-primary); }
.market-cat-btn:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }
.market-cat-btn.active { background: var(--color-primary); color: #000; border-color: var(--color-primary); }

/* Hot items */
.market-hot { margin-bottom: 16px; }
.market-hot h2 { font-size: 1rem; margin-bottom: 8px; color: var(--color-warning); }
.market-hot-list { display: flex; gap: 8px; flex-wrap: wrap; }
.market-hot-tag {
    padding: 4px 10px; background: rgba(210,153,34,0.15); border: 1px solid var(--color-warning);
    border-radius: var(--radius-sm); font-size: 0.8rem; color: var(--color-warning);
}

/* Listings */
.market-listings { display: flex; flex-direction: column; gap: 12px; }
.market-listing-card {
    background: var(--color-surface); border-radius: var(--radius);
    border: 1px solid var(--color-border); padding: 16px;
    border-left: 4px solid var(--color-border); transition: all var(--transition);
}
.market-listing-card.rarity-common { border-left-color: #9e9e9e; }
.market-listing-card.rarity-uncommon { border-left-color: #4caf50; }
.market-listing-card.rarity-rare { border-left-color: #2196f3; }
.market-listing-card.rarity-epic { border-left-color: #9c27b0; }
.market-listing-card.rarity-legendary {
    border-left-color: #ffc107;
    box-shadow: 0 0 8px rgba(255,193,7,0.2);
}

.listing-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.listing-name { font-weight: 600; font-size: 1rem; text-transform: capitalize; }
.listing-rarity { font-size: 0.85rem; font-weight: 600; }

.listing-stats { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.listing-stat {
    font-size: 0.75rem; padding: 2px 6px; background: var(--color-surface-2);
    border-radius: 4px; color: var(--color-accent);
}

.listing-footer { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.listing-seller { font-size: 0.85rem; color: var(--color-text-muted); }
.listing-price { font-weight: 700; color: var(--color-primary); }

.market-buy-btn { width: 100%; margin-top: 4px; }

/* Sell section */
.market-my-listings { margin-bottom: 20px; }
.market-my-listings h3 { font-size: 1rem; margin-bottom: 8px; }
.market-my-listing {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 8px 12px; margin-bottom: 4px;
    background: var(--color-surface); border-radius: var(--radius-sm);
}

.market-sell-list { display: flex; flex-direction: column; gap: 8px; }
.market-sell-item {
    padding: 12px; background: var(--color-surface); border-radius: var(--radius-sm);
    border-left: 3px solid var(--color-border);
}
.sell-item-name { display: block; font-weight: 600; margin-bottom: 8px; text-transform: capitalize; }
.sell-item-controls { display: flex; gap: 8px; align-items: center; }
.sell-price-input { max-width: 120px; }

/* Trade section */
.market-trade-desc { color: var(--color-text-muted); margin-bottom: 16px; }
.market-trade-form { display: flex; flex-direction: column; gap: 12px; }
.market-trade-form select { max-width: 100%; }

/* ==========================================
   Crafting & Enchanting Screen
   ========================================== */
.crafting-screen { max-width: 480px; margin: 0 auto; }
.crafting-screen h1 { margin-bottom: 16px; }

/* Craft tabs */
.craft-tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.craft-tabs .btn { flex: 1; }
.craft-tabs .btn.active { background: var(--color-primary); color: #000; }

/* Recipe list */
.recipe-list { display: flex; flex-direction: column; gap: 8px; }
.recipe-card {
    display: flex; align-items: center; gap: 12px;
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius-sm); padding: 12px 16px;
    cursor: pointer; transition: all var(--transition); min-height: var(--touch-target);
}
.recipe-card:hover { border-color: var(--color-primary); }
.recipe-card:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }
.recipe-card.craftable { border-left: 3px solid var(--color-success); }
.recipe-card.locked { border-left: 3px solid var(--color-text-muted); opacity: 0.7; }
.recipe-icon { font-size: 1.5rem; min-width: 32px; text-align: center; }
.recipe-info { flex: 1; }
.recipe-name { font-weight: 600; display: block; text-transform: capitalize; }
.recipe-level { font-size: 0.8rem; color: var(--color-text-muted); }
.recipe-status { text-align: right; }
.recipe-ready { color: var(--color-success); font-size: 0.85rem; font-weight: 600; }
.recipe-locked-text { color: var(--color-text-muted); font-size: 0.8rem; }

/* Recipe detail */
.recipe-detail { padding: 16px 0; }
.recipe-detail h2 { font-size: 1.3rem; margin: 12px 0; text-transform: capitalize; }
.recipe-materials { margin-bottom: 16px; }
.recipe-materials h3, .recipe-outcomes h3 { font-size: 1rem; margin-bottom: 8px; }
.recipe-material {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 0; font-size: 0.9rem;
}
.material-check { font-size: 1.1rem; min-width: 20px; text-align: center; }
.has-material .material-check { color: var(--color-success); }
.missing-material .material-check { color: var(--color-error); }
.material-name { flex: 1; text-transform: capitalize; }
.material-count { color: var(--color-text-muted); }

.recipe-cost { margin-bottom: 16px; color: var(--color-accent); }
.recipe-outcomes { margin-bottom: 20px; }
.outcome-rarity { font-size: 0.85rem; margin-right: 4px; }

/* Crafting animation */
.craft-animation { text-align: center; padding: 40px 0; }
.craft-cauldron { margin-bottom: 20px; }
.craft-icon-anim { font-size: 4rem; display: inline-block; animation: craftSpin 1.5s ease-in-out infinite; }
@keyframes craftSpin {
    0% { transform: scale(1) rotate(0deg); opacity: 1; }
    50% { transform: scale(1.3) rotate(180deg); opacity: 0.7; }
    100% { transform: scale(1) rotate(360deg); opacity: 1; }
}
.craft-progress-text { font-size: 1.1rem; color: var(--color-text-muted); margin-bottom: 16px; }
.craft-progress-bar {
    height: 6px; background: var(--color-surface-2); border-radius: 3px;
    overflow: hidden; max-width: 200px; margin: 0 auto;
}
.craft-progress-fill {
    height: 100%; background: var(--color-primary); border-radius: 3px;
    animation: craftProgress 2.5s ease forwards;
}
@keyframes craftProgress { from { width: 0; } to { width: 100%; } }

/* Craft result */
.craft-result { text-align: center; padding: 24px; }
.craft-result h2 { font-size: 1.5rem; margin-bottom: 16px; color: var(--color-success); }
.craft-result-item {
    padding: 20px; margin-bottom: 20px;
    background: var(--color-surface); border-radius: var(--radius);
    border: 2px solid var(--color-border);
}
.craft-result-item.rarity-common { border-color: #9e9e9e; }
.craft-result-item.rarity-uncommon { border-color: #4caf50; }
.craft-result-item.rarity-rare { border-color: #2196f3; }
.craft-result-item.rarity-epic { border-color: #9c27b0; box-shadow: 0 0 15px rgba(156,39,176,0.3); }
.craft-result-item.rarity-legendary { border-color: #ffc107; box-shadow: 0 0 20px rgba(255,193,7,0.4); }
.result-rarity { font-size: 1.2rem; font-weight: 700; margin-bottom: 8px; }
.result-name { font-size: 1.3rem; font-weight: 600; margin-bottom: 12px; text-transform: capitalize; }
.result-stats { display: flex; flex-direction: column; gap: 4px; }
.result-stat { font-size: 0.9rem; color: var(--color-accent); }

/* Reveal animation */
.craft-reveal-anim { animation: craftReveal 0.6s ease-out; }
@keyframes craftReveal {
    0% { transform: scale(0.5); opacity: 0; }
    60% { transform: scale(1.05); }
    100% { transform: scale(1); opacity: 1; }
}

/* Enchanting sections */
.enchant-section { margin-bottom: 24px; padding: 16px; background: var(--color-surface); border-radius: var(--radius); }
.enchant-section h3 { margin-bottom: 8px; }
.enchant-desc { color: var(--color-text-muted); font-size: 0.9rem; margin-bottom: 12px; }
.enchant-section select { margin-bottom: 12px; }

/* Consumable list */
.consumable-list { display: flex; flex-direction: column; gap: 8px; }
.consumable-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px; background: var(--color-surface-2); border-radius: var(--radius-sm);
}

/* ==========================================
   Rarity border utilities (full border variant)
   ========================================== */
.rarity-border-common { border-color: #9e9e9e; }
.rarity-border-uncommon { border-color: #4caf50; }
.rarity-border-rare { border-color: #2196f3; }
.rarity-border-epic { border-color: #9c27b0; }
.rarity-border-legendary { border-color: #ffc107; }

/* Rarity text color utilities */
.rarity-color-common { color: #9e9e9e; }
.rarity-color-uncommon { color: #4caf50; }
.rarity-color-rare { color: #2196f3; }
.rarity-color-epic { color: #9c27b0; }
.rarity-color-legendary { color: #ffc107; }

/* School border color utilities */
.school-ignis { border-color: #e53935; }
.school-aqua { border-color: #039be5; }
.school-terra { border-color: #43a047; }
.school-ventus { border-color: #b0bec5; }
.school-umbra { border-color: #7b1fa2; }

/* Armageddon section */
.armageddon-section { margin-top: 24px; border: 2px solid var(--color-error); border-radius: var(--radius); padding: 16px; }
.armageddon-section h2 { color: var(--color-error); }
.armageddon-note { color: var(--color-text-muted); }
.armageddon-label { display: block; margin: 12px 0; }

/* ==========================================
   Phase 5: World Events, Boss, Quests, Loci, Settings
   ========================================== */

/* World Event Banners */
.world-event-banner {
    display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px;
}
.event-banner-item {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px; background: rgba(212,168,67,0.1);
    border: 1px solid var(--color-primary); border-radius: var(--radius-sm);
    font-size: 0.9rem; animation: eventPulse 2s ease-in-out infinite;
}
@keyframes eventPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}
.event-icon { font-size: 1.2rem; }
.event-name { flex: 1; font-weight: 600; }
.event-timer { color: var(--color-primary); font-weight: 600; font-size: 0.85rem; }

/* Season Indicator */
.season-indicator {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px; margin-bottom: 12px;
    background: var(--color-surface); border-radius: var(--radius-sm);
    border-left: 3px solid var(--color-primary);
}
.season-icon { font-size: 1.3rem; }
.season-name { font-weight: 600; }
.season-bonus { font-size: 0.8rem; color: var(--color-text-muted); margin-left: auto; }

/* Boss Alert */
.boss-alert {
    display: flex; align-items: center; gap: 8px; width: 100%;
    padding: 12px; margin-bottom: 16px;
    background: rgba(248,81,73,0.1); border: 2px solid var(--color-error);
    border-radius: var(--radius); cursor: pointer;
    animation: bossAlertPulse 1.5s ease-in-out infinite;
    color: var(--color-text); font-size: 0.95rem;
}
@keyframes bossAlertPulse {
    0%, 100% { box-shadow: 0 0 5px rgba(248,81,73,0.3); }
    50% { box-shadow: 0 0 20px rgba(248,81,73,0.5); }
}
.boss-alert-icon { font-size: 1.5rem; }
.boss-alert-text { flex: 1; font-weight: 600; }
.boss-alert-hp { color: var(--color-error); font-weight: 700; }

/* Daily Prophecy */
.home-prophecy { margin-bottom: 16px; }
.prophecy-mini {
    display: flex; align-items: center; gap: 12px;
    padding: 12px; background: var(--color-surface);
    border: 1px solid var(--color-border); border-radius: var(--radius);
    border-left: 3px solid #9c27b0;
}
.prophecy-icon { font-size: 2rem; }
.prophecy-info { flex: 1; }
.prophecy-info h3 { font-size: 0.9rem; color: #9c27b0; margin-bottom: 2px; }
.prophecy-info p { font-size: 0.85rem; color: var(--color-text-muted); }
.prophecy-reward { font-size: 0.8rem; color: var(--color-primary); }

/* Quest Screen */
.quests-screen { max-width: 480px; margin: 0 auto; }
.quests-screen h1 { margin-bottom: 16px; }
.quest-tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.quest-tabs .btn { flex: 1; min-width: 70px; }
.quest-tabs .btn.active { background: var(--color-primary); color: #000; }

.quest-list { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.quest-card {
    padding: 16px; background: var(--color-surface);
    border: 1px solid var(--color-border); border-radius: var(--radius);
    border-left: 4px solid var(--color-border);
}
.quest-card.quest-ready { border-left-color: var(--color-success); }
.quest-card.quest-available { border-left-color: var(--color-accent); }
.quest-card.quest-completed-card { border-left-color: var(--color-text-muted); opacity: 0.8; }
.quest-card-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.quest-type-badge {
    font-size: 0.7rem; padding: 2px 6px;
    background: var(--color-surface-2); border-radius: 4px;
    color: var(--color-accent); text-transform: uppercase; font-weight: 600;
}
.quest-name { font-size: 1rem; font-weight: 600; }
.quest-desc { font-size: 0.85rem; color: var(--color-text-muted); margin-bottom: 8px; }
.quest-req { font-size: 0.8rem; color: var(--color-text-muted); margin-bottom: 8px; }
.quest-giver { font-size: 0.85rem; color: var(--color-text-muted); margin-bottom: 8px; }

.quest-objectives { margin-bottom: 12px; }
.quest-objective { margin-bottom: 8px; }
.quest-objective .obj-label { font-size: 0.85rem; color: var(--color-text-muted); display: block; margin-bottom: 2px; }
.quest-objective .progress-bar { height: 16px; }

.quest-rewards {
    display: flex; gap: 12px; font-size: 0.85rem; margin-bottom: 8px;
}
.reward-xp { color: var(--color-primary); }
.reward-energy { color: var(--color-accent); }

.quest-actions { display: flex; gap: 8px; margin-top: 8px; }
.quest-accepted-label { color: var(--color-success); font-weight: 600; }

/* Daily Prophecy Card (quest tab) */
.daily-prophecy-card {
    padding: 20px; background: var(--color-surface);
    border: 2px solid #9c27b0; border-radius: var(--radius);
    text-align: center;
}
.prophecy-header {
    display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 12px;
}
.prophecy-header h2 { color: #9c27b0; }
.prophecy-desc { color: var(--color-text-muted); margin-bottom: 12px; }
.prophecy-objectives { margin-bottom: 12px; }

/* World Boss Screen */
.boss-screen { max-width: 480px; margin: 0 auto; }
.boss-screen h1 { margin-bottom: 16px; }

.boss-portrait { text-align: center; margin-bottom: 16px; }
.boss-icon-large { font-size: 4rem; }
.boss-icon-large.defeated { opacity: 0.5; filter: grayscale(1); }
.boss-timer { color: var(--color-warning); font-weight: 600; margin-top: 4px; }

.boss-dormant { text-align: center; padding: 40px 0; }
.boss-dormant h2 { margin: 12px 0; }
.boss-dormant p { color: var(--color-text-muted); }
.boss-next { color: var(--color-accent); margin-top: 12px; }

.boss-defeated { text-align: center; padding: 20px 0; }
.boss-defeated h2 { color: var(--color-success); margin: 12px 0; }

/* Boss HP bar */
.boss-hp-section { margin-bottom: 20px; }
.boss-hp-bar {
    position: relative; height: 28px; background: var(--color-surface-2);
    border-radius: 14px; overflow: hidden; border: 2px solid var(--color-border);
}
.boss-hp-fill {
    height: 100%; border-radius: 14px; transition: width 0.5s ease;
}
.boss-hp-text {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    font-size: 0.85rem; font-weight: 700; color: #fff;
    text-shadow: 0 1px 3px rgba(0,0,0,0.7);
}
.boss-hp-meta {
    display: flex; justify-content: space-between; font-size: 0.8rem;
    color: var(--color-text-muted); margin-top: 4px;
}

.boss-my-contribution {
    padding: 12px; background: var(--color-surface);
    border-radius: var(--radius-sm); margin-bottom: 16px;
}
.boss-my-contribution h3 { font-size: 0.95rem; margin-bottom: 8px; }
.boss-my-stats {
    display: flex; gap: 12px; font-size: 0.85rem; color: var(--color-text-muted);
    flex-wrap: wrap;
}

.boss-attack-section { text-align: center; margin-bottom: 20px; }
.boss-attack-cost { font-size: 0.8rem; color: var(--color-text-muted); margin-top: 4px; }

/* Boss Leaderboard */
.boss-leaderboard { margin-bottom: 16px; }
.boss-leaderboard h3 { margin-bottom: 8px; }
.boss-lb-list { list-style: none; counter-reset: lb; }
.boss-lb-entry {
    display: flex; justify-content: space-between; align-items: center;
    padding: 6px 8px; font-size: 0.9rem;
    border-bottom: 1px solid var(--color-border); counter-increment: lb;
}
.boss-lb-entry::before {
    content: counter(lb) '.'; min-width: 24px; color: var(--color-text-muted);
    font-weight: 600;
}
.boss-lb-me { background: rgba(212,168,67,0.1); }
.lb-name { flex: 1; }
.lb-damage { font-weight: 600; color: var(--color-error); }

/* Boss Counter Log */
.boss-counter-log { margin-bottom: 16px; }
.boss-counter-log h3 { margin-bottom: 8px; }
.boss-counter-list { list-style: none; }
.counter-entry {
    padding: 4px 0; font-size: 0.85rem; color: var(--color-error);
    border-bottom: 1px solid var(--color-border);
}

/* Boss Loot */
.boss-loot-section { margin-top: 16px; }
.boss-loot-section h3 { margin-bottom: 12px; }
.boss-loot-list { list-style: none; }
.boss-loot-entry {
    display: flex; align-items: center; gap: 8px;
    padding: 8px; margin-bottom: 4px;
    background: var(--color-surface); border-radius: var(--radius-sm);
    font-size: 0.85rem;
}
.boss-loot-me { background: rgba(212,168,67,0.15); border-left: 3px solid var(--color-primary); }
.loot-rank { font-weight: 700; min-width: 28px; color: var(--color-primary); }
.loot-name { flex: 1; }
.loot-damage { color: var(--color-text-muted); }
.loot-share { color: var(--color-accent); min-width: 40px; text-align: right; }
.loot-xp { color: var(--color-success); min-width: 60px; text-align: right; }

/* Settings Screen */
.settings-screen { max-width: 480px; margin: 0 auto; }
.settings-screen h1 { margin-bottom: 20px; }
.settings-section {
    margin-bottom: 24px; padding: 16px;
    background: var(--color-surface); border-radius: var(--radius);
    border: 1px solid var(--color-border);
}
.settings-section h2 { font-size: 1.1rem; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--color-border); }
.settings-field { margin-bottom: 12px; }
.settings-toggle-group { display: flex; gap: 8px; }

/* Toggle switch */
.settings-toggle {
    display: flex; align-items: center; justify-content: space-between;
}
.settings-toggle-label { flex: 1; }
.settings-toggle-btn {
    width: 48px; height: 28px; border-radius: 14px;
    background: var(--color-surface-2); border: 2px solid var(--color-border);
    position: relative; cursor: pointer; transition: all var(--transition);
    padding: 0;
}
.settings-toggle-btn.active {
    background: var(--color-primary); border-color: var(--color-primary);
}
.toggle-knob {
    display: block; width: 20px; height: 20px; border-radius: 50%;
    background: #fff; position: absolute; top: 2px; left: 2px;
    transition: transform var(--transition);
}
.settings-toggle-btn.active .toggle-knob { transform: translateX(20px); }

/* Slider */
.settings-slider {
    width: 100%; height: 4px; border-radius: 2px;
    background: var(--color-surface-2); outline: none;
    -webkit-appearance: none; appearance: none;
}
.settings-slider::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 20px; height: 20px; border-radius: 50%;
    background: var(--color-primary); cursor: pointer;
}

/* Account info */
.settings-account-info { font-size: 0.9rem; }
.account-row {
    display: flex; justify-content: space-between; padding: 8px 0;
    border-bottom: 1px solid var(--color-border);
}
.account-label { color: var(--color-text-muted); }
.account-value { font-weight: 600; }
.settings-not-logged { color: var(--color-text-muted); text-align: center; }

/* About */
.settings-about { font-size: 0.9rem; }
.settings-about p { margin-bottom: 8px; }
.settings-about .btn { margin-right: 8px; margin-bottom: 8px; }

/* Logout */
.settings-logout { text-align: center; }
.settings-logout-btn { color: var(--color-error); border-color: var(--color-error); width: 100%; }

/* Loci Cards */
.loci-card {
    padding: 12px; background: var(--color-surface);
    border: 1px solid var(--color-border); border-radius: var(--radius-sm);
    margin-bottom: 8px;
}
.loci-card-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.loci-tier-icon { font-size: 1.5rem; }
.loci-name { font-weight: 600; flex: 1; }
.loci-tier-badge {
    font-size: 0.7rem; padding: 2px 6px;
    background: var(--color-surface-2); border-radius: 4px;
    color: var(--color-accent);
}
.loci-meta { font-size: 0.8rem; color: var(--color-text-muted); }
.loci-creator { font-size: 0.8rem; color: var(--color-text-muted); }
.loci-progress { margin-top: 4px; }

/* Responsive */
@media (min-width: 600px) {
    .landing-cards { grid-template-columns: 1fr 1fr 1fr; }
    .action-grid { grid-template-columns: repeat(4, 1fr); }
    .spell-card-grid { gap: 16px; }
    .duel-matchup { gap: 24px; padding: 24px; }
    .arena-table { font-size: 1rem; }
    .guild-hall { max-width: 560px; }
    .map-screen { max-width: 640px; }
    .guild-actions { gap: 12px; }
    .region-card { padding: 20px; }
    .marketplace-screen { max-width: 640px; }
    .crafting-screen { max-width: 560px; }
    .market-listings { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
    .quests-screen { max-width: 560px; }
    .boss-screen { max-width: 560px; }
    .settings-screen { max-width: 560px; }
    .help-screen { max-width: 640px; }
}

/* ===== Help Screen ===== */
.help-screen {
    padding: 16px;
    max-width: 640px;
    margin: 0 auto;
}
.help-screen h1 {
    margin-bottom: 8px;
}
.help-intro {
    color: var(--color-text-muted, #8b949e);
    margin-bottom: 24px;
    font-size: 0.95em;
}
.help-section {
    margin-bottom: 20px;
    padding: 14px 16px;
    background: var(--color-surface, #161b22);
    border-radius: 8px;
    border-left: 3px solid var(--color-accent, #f0c040);
}
.help-section h2 {
    font-size: 1em;
    margin: 0 0 6px 0;
    color: var(--color-accent, #f0c040);
}
.help-section p {
    margin: 0;
    font-size: 0.9em;
    line-height: 1.5;
    color: var(--color-text, #e6edf3);
}

/* Tooltip / hint button */
.help-tip-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.85em;
    padding: 0 4px;
    vertical-align: middle;
    opacity: 0.7;
    line-height: 1;
}
.help-tip-btn:hover,
.help-tip-btn:focus {
    opacity: 1;
    outline: 2px solid var(--color-accent, #f0c040);
    border-radius: 50%;
}

/* =============================================
   Leaderboard Screen
   ============================================= */
.leaderboard-your-rank {
    text-align: center;
    font-size: 0.95rem;
    color: var(--color-accent, #f0c040);
    margin: 0.5rem 1rem 0.25rem;
    font-weight: 600;
}

.leaderboard-not-ranked {
    color: var(--color-text-secondary, #aaa);
    font-weight: 400;
}

.leaderboard-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--color-text-secondary, #aaa);
    font-size: 0.95rem;
}

.leaderboard-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0.5rem 0.5rem 1rem;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.leaderboard-table thead th {
    background: var(--color-surface, #1a1a2e);
    color: var(--color-text-secondary, #aaa);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    padding: 0.5rem 0.4rem;
    text-align: left;
    border-bottom: 1px solid var(--color-border, #333);
    white-space: nowrap;
}

.leaderboard-table thead th.leaderboard-cell-rank,
.leaderboard-table tbody .leaderboard-cell-rank {
    text-align: center;
    width: 2.5rem;
}

.leaderboard-table thead th.leaderboard-cell-level,
.leaderboard-table thead th.leaderboard-cell-xp,
.leaderboard-table thead th.leaderboard-cell-hunts,
.leaderboard-table tbody .leaderboard-cell-level,
.leaderboard-table tbody .leaderboard-cell-xp,
.leaderboard-table tbody .leaderboard-cell-hunts {
    text-align: right;
    width: 3.5rem;
}

.leaderboard-row td {
    padding: 0.55rem 0.4rem;
    border-bottom: 1px solid var(--color-border, #333);
    vertical-align: middle;
}

.leaderboard-row:last-child td {
    border-bottom: none;
}

.leaderboard-row--me td {
    background: rgba(240, 192, 64, 0.08);
}

.leaderboard-name {
    font-weight: 500;
    word-break: break-word;
}

.leaderboard-you-badge {
    display: inline-block;
    margin-left: 0.35rem;
    padding: 0.1em 0.4em;
    border-radius: 4px;
    background: var(--color-accent, #f0c040);
    color: #000;
    font-size: 0.7rem;
    font-weight: 700;
    vertical-align: middle;
    line-height: 1.4;
}
