@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-color: #050508;
    --sidebar-bg: rgba(15, 15, 20, 0.6);
    --card-bg: rgba(25, 25, 35, 0.4);
    --card-border: rgba(255, 255, 255, 0.08);
    --card-border-hover: rgba(255, 255, 255, 0.15);
    --accent-color: #8b5cf6;
    --accent-gradient: linear-gradient(135deg, #8b5cf6 0%, #3b82f6 100%);
    --accent-hover: linear-gradient(135deg, #7c3aed 0%, #2563eb 100%);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --font-main: 'Outfit', sans-serif;
    --gold: #fbbf24;
    --silver: #cbd5e1;
    --copper: #b45309;
    --success: #10b981;
    --danger: #ef4444;
    --sidebar-width: 280px;
}

/* ===================== RESET ===================== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; scroll-behavior: smooth; }
body { 
    font-family: var(--font-main); 
    background-color: var(--bg-color); 
    color: var(--text-primary); 
    overflow-x: hidden; 
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(139, 92, 246, 0.15), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(59, 130, 246, 0.15), transparent 25%);
    background-attachment: fixed;
}
ul, li { list-style: none; }
a { text-decoration: none; }
img { max-width: 100%; display: block; }

/* ===================== AUTH ===================== */
.auth-container {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1.5rem;
    background: radial-gradient(circle at center, #0a0a0f 0%, #030305 100%);
}
.auth-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 3rem 2.5rem;
    border-radius: 24px;
    border: 1px solid var(--card-border);
    width: 100%;
    max-width: 440px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: scaleUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes scaleUp { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
.auth-card h1 { margin-bottom: 2.5rem; text-align: center; font-size: clamp(1.8rem, 4vw, 2.2rem); font-weight: 800; background: var(--accent-gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
#auth-toggle { margin-top: 2rem; text-align: center; color: var(--text-secondary); font-size: 0.95rem; }
#auth-toggle a { color: var(--accent-color); font-weight: 600; transition: color 0.2s; }
#auth-toggle a:hover { color: #a78bfa; }

/* ===================== DASHBOARD LAYOUT ===================== */
#dashboard { display: flex; height: 100vh; width: 100%; overflow: hidden; }

/* --- Sidebar --- */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--sidebar-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
    padding: 2rem 1.25rem;
    overflow-y: auto;
    flex-shrink: 0;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 200;
}
.logo {
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 2.5rem;
    padding-left: 0.5rem;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.nav-links { display: flex; flex-direction: column; gap: 0.35rem; flex-grow: 1; }
.nav-link {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem 1.15rem;
    color: var(--text-secondary);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.25s ease;
    font-size: 0.95rem;
    font-weight: 500;
    white-space: nowrap;
    border: 1px solid transparent;
}
.nav-link svg { flex-shrink: 0; width: 20px; height: 20px; transition: stroke 0.25s ease; }
.nav-link:hover { background: rgba(139, 92, 246, 0.08); color: white; border-color: rgba(139, 92, 246, 0.1); }
.nav-link.active { background: var(--accent-gradient); color: white; box-shadow: 0 8px 16px -4px rgba(139, 92, 246, 0.3); border-color: transparent; }
.nav-link.active svg { stroke: white; }

.sidebar-footer { margin-top: auto; padding-top: 1.5rem; border-top: 1px solid var(--card-border); }
.sidebar-footer p { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 1rem; word-break: break-all; font-weight: 500; }

/* Hamburger button (mobile only) */
#sidebar-toggle {
    display: none;
    position: fixed;
    top: 1.25rem;
    left: 1.25rem;
    z-index: 300;
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 0.6rem;
    cursor: pointer;
    color: white;
    transition: all 0.2s;
}
#sidebar-toggle:active { transform: scale(0.95); }
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    z-index: 150;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* --- Main Content --- */
.main-content {
    flex-grow: 1;
    padding: 2.5rem 3rem;
    overflow-y: auto;
    height: 100vh;
    min-width: 0;
}

/* ===================== COMMON COMPONENTS ===================== */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1.25rem;
}
.header h1 { font-size: clamp(1.4rem, 3vw, 2rem); font-weight: 700; letter-spacing: -0.02em; }

.card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 1.75rem;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.card:hover { border-color: var(--card-border-hover); box-shadow: 0 10px 30px -10px rgba(0,0,0,0.3); }

.form-card { background: var(--card-bg); backdrop-filter: blur(12px); border: 1px solid var(--card-border); padding: 2.5rem; border-radius: 24px; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
.form-group { display: flex; flex-direction: column; gap: 0.6rem; }
.full-width { grid-column: span 2; }
.form-actions { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 2rem; }

label { font-size: 0.9rem; color: var(--text-secondary); font-weight: 500; }
input, textarea, select {
    width: 100%;
    padding: 0.9rem 1.15rem;
    background: rgba(15, 15, 20, 0.5);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    color: white;
    outline: none;
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.25s ease;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent-color); box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15); background: rgba(15, 15, 20, 0.8); }
input:disabled, textarea:disabled, select:disabled { opacity: 0.5; cursor: not-allowed; }
textarea { resize: vertical; min-height: 100px; line-height: 1.5; }

.custom-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 1rem center; background-size: 1em; padding-right: 2.5rem; }
.custom-select option { background: #0f0f14; color: white; }

.btn {
    padding: 0.9rem 1.5rem;
    border-radius: 12px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    font-size: 0.95rem;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}
.btn-primary { background: var(--accent-gradient); color: white; box-shadow: 0 4px 12px rgba(139, 92, 246, 0.25); }
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-2px); box-shadow: 0 6px 16px rgba(139, 92, 246, 0.35); }
.btn-primary:active { transform: translateY(0); }
.btn-ghost { background: rgba(255,255,255,0.03); color: var(--text-primary); border: 1px solid var(--card-border); }
.btn-ghost:hover { background: rgba(255,255,255,0.08); border-color: var(--card-border-hover); transform: translateY(-2px); }

.grid-container { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.5rem; }

.fade-in { animation: fadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards; opacity: 0; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* ===================== TABLES ===================== */
.data-table-container {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    overflow: hidden;
    overflow-x: auto;
    box-shadow: 0 10px 30px -10px rgba(0,0,0,0.2);
}
table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 600px; }
th { text-align: left; padding: 1.25rem 1.5rem; color: var(--text-secondary); font-size: 0.85rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1px solid var(--card-border); white-space: nowrap; background: rgba(0,0,0,0.2); }
td { padding: 1rem 1.5rem; border-bottom: 1px solid rgba(255,255,255,0.03); font-size: 0.95rem; vertical-align: middle; transition: background 0.2s; }
tr:hover td { background: rgba(255,255,255,0.02); }
tr:last-child td { border-bottom: none; }
tr.in-game-row td { background: rgba(16, 185, 129, 0.04); }
tr.in-game-row:hover td { background: rgba(16, 185, 129, 0.06); }
tr.in-game-row td:first-child { box-shadow: inset 3px 0 0 var(--success); }

/* ===================== HOME ===================== */
#view-home .news-section { display: flex; flex-direction: column; gap: 1.25rem; }

/* ===================== TAVERN ===================== */
.tavern-grid {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 1.5rem;
    height: calc(100vh - 180px);
}
.chat-area { display: flex; flex-direction: column; background: var(--card-bg); backdrop-filter: blur(12px); border-radius: 24px; border: 1px solid var(--card-border); overflow: hidden; min-height: 0; box-shadow: 0 10px 30px -10px rgba(0,0,0,0.2); }
.chat-window { flex: 1; padding: 1.5rem; overflow-y: auto; display: flex; flex-direction: column; gap: 1rem; scroll-behavior: smooth; min-height: 0; }
.chat-input-area { padding: 1.25rem; background: rgba(0,0,0,0.2); border-top: 1px solid var(--card-border); display: flex; gap: 0.75rem; flex-shrink: 0; align-items: center; }
.chat-input-area input { flex-grow: 1; background: rgba(255,255,255,0.03); }

.message-bubble { max-width: 80%; padding: 0.85rem 1.2rem; border-radius: 16px; background: rgba(255,255,255,0.06); align-self: flex-start; word-break: break-word; line-height: 1.5; position: relative; border: 1px solid transparent; }
.message-bubble.own { align-self: flex-end; background: var(--accent-gradient); box-shadow: 0 4px 12px rgba(139, 92, 246, 0.15); }
.message-bubble .sender { font-size: 0.75rem; font-weight: 700; color: #a78bfa; display: block; margin-bottom: 0.25rem; letter-spacing: 0.02em; }
.message-bubble.own .sender { color: rgba(255,255,255,0.8); }
.message-bubble.roll { border-color: rgba(251, 191, 36, 0.3); background: rgba(251, 191, 36, 0.05); }
.message-bubble.roll .text { font-style: italic; color: #fbbf24; font-weight: 500; }

.active-players { background: var(--sidebar-bg); backdrop-filter: blur(12px); border-radius: 24px; padding: 1.5rem; border: 1px solid var(--card-border); overflow-y: auto; box-shadow: 0 10px 30px -10px rgba(0,0,0,0.2); }
.active-players h3 { margin-bottom: 1.25rem; font-size: 1.1rem; }
.active-p-card { padding: 0.85rem; background: rgba(255,255,255,0.04); border-radius: 12px; margin-bottom: 0.75rem; border: 1px solid var(--card-border); font-size: 0.9rem; transition: transform 0.2s; }
.active-p-card:hover { transform: translateX(4px); background: rgba(255,255,255,0.06); }

/* ===================== CURRENCY ===================== */
.currency-box { display: flex; gap: 0.75rem; align-items: center; font-weight: 600; flex-wrap: wrap; background: rgba(0,0,0,0.2); padding: 0.5rem 0.75rem; border-radius: 10px; border: 1px solid var(--card-border); display: inline-flex; }
.coin { display: flex; align-items: center; gap: 6px; font-size: 0.9rem; }
.coin i { width: 14px; height: 14px; }
.coin-gold { color: var(--gold); }
.coin-silver { color: var(--silver); }
.coin-copper { color: var(--copper); }

/* ===================== RPG CARDS ===================== */
.inventory-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; margin-top: 15px; }
.rpg-card {
    background: rgba(255,255,255,0.03); border: 1px solid var(--card-border);
    border-radius: 14px; padding: 12px; text-align: center; cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1); position: relative;
    display: flex; align-items: center; justify-content: center; min-height: 70px;
}
.rpg-card:hover { transform: translateY(-4px) scale(1.02); border-color: var(--accent-color); background: rgba(139, 92, 246, 0.08); box-shadow: 0 8px 16px -4px rgba(139, 92, 246, 0.2); }
.rpg-card.skill-card { border-color: rgba(16, 185, 129, 0.2); }
.rpg-card.skill-card:hover { border-color: var(--success); background: rgba(16, 185, 129, 0.08); box-shadow: 0 8px 16px -4px rgba(16, 185, 129, 0.2); }
.rpg-card .name { font-size: 0.8rem; font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; width: 100%; }
.rpg-card .qty { position: absolute; top: -8px; right: -8px; background: var(--accent-gradient); color: white; font-size: 0.7rem; padding: 3px 8px; border-radius: 10px; font-weight: 700; box-shadow: 0 2px 4px rgba(0,0,0,0.3); }

/* ===================== ADMIN INVENTORY MGMT ===================== */
.inventory-mgmt { margin-top: 2rem; padding-top: 2rem; border-top: 1px solid var(--card-border); }
.mgmt-section { margin-bottom: 2rem; }
.mgmt-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; gap: 1rem; flex-wrap: wrap; }
.mgmt-list { display: flex; flex-direction: column; gap: 0.5rem; }
.mgmt-item { display: flex; justify-content: space-between; align-items: center; padding: 0.85rem 1rem; background: rgba(255,255,255,0.02); border-radius: 12px; border: 1px solid var(--card-border); gap: 0.75rem; flex-wrap: wrap; transition: background 0.2s; }
.mgmt-item:hover { background: rgba(255,255,255,0.04); }
.passive-count { color: var(--text-secondary); font-size: 0.8rem; margin-left: 0.5rem; font-weight: 500; }

/* ===================== MODALS ===================== */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 1.5rem;
    overflow-y: auto;
    opacity: 0;
    animation: fadeInModal 0.3s forwards;
}
@keyframes fadeInModal { to { opacity: 1; } }
.modal-content {
    background: var(--sidebar-bg);
    padding: 2.5rem;
    border-radius: 24px;
    width: 100%;
    max-width: 650px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    margin: auto;
    border: 1px solid var(--card-border);
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
    transform: translateY(20px);
    animation: slideUpModal 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes slideUpModal { to { transform: translateY(0); } }
.modal-content::-webkit-scrollbar { width: 6px; }
.modal-content::-webkit-scrollbar-track { background: transparent; }
.modal-content::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }

.modal-content h2 { margin-bottom: 1.5rem; font-size: 1.5rem; }

.modal-detail-view { text-align: center; }
.modal-detail-view h2 { margin-bottom: 1rem; color: var(--accent-color); font-size: 1.8rem; }
.modal-detail-view .props { background: rgba(0,0,0,0.2); padding: 1.25rem; border-radius: 14px; margin: 1.5rem 0; font-style: italic; color: #cbd5e1; word-break: break-word; border: 1px solid var(--card-border); line-height: 1.6; }

/* ===================== WIKI ===================== */
.wiki-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.wiki-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 1.75rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.wiki-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: var(--accent-gradient);
    opacity: 0;
    transition: opacity 0.3s ease;
}
.wiki-card:hover { border-color: rgba(139, 92, 246, 0.3); transform: translateY(-4px); box-shadow: 0 12px 24px -8px rgba(139, 92, 246, 0.2); }
.wiki-card:hover::before { opacity: 1; }
.wiki-card h3 { font-size: 1.2rem; margin-bottom: 0.75rem; color: var(--text-primary); line-height: 1.4; font-weight: 700; }
.wiki-card .wiki-preview {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}
.wiki-card .wiki-meta { margin-top: 1.25rem; font-size: 0.75rem; color: rgba(148, 163, 184, 0.6); font-weight: 500; }

/* Wiki view modal */
.wiki-view-content {
    max-width: 800px;
    width: 100%;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
}
.wiki-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    gap: 1.5rem;
    flex-wrap: wrap;
    flex-shrink: 0;
}
.wiki-modal-header h2 { font-size: clamp(1.4rem, 3vw, 1.8rem); line-height: 1.3; color: var(--text-primary); font-weight: 800; }
.wiki-modal-actions { display: flex; gap: 0.75rem; flex-shrink: 0; }
.wiki-content-body {
    flex: 1;
    overflow-y: auto;
    color: #e2e8f0;
    font-size: 1rem;
    line-height: 1.8;
    white-space: pre-wrap;
    word-break: break-word;
    border-top: 1px solid var(--card-border);
    padding-top: 1.5rem;
    min-height: 0;
}

/* Wiki editor modal */
.wiki-editor-content { max-width: 800px; width: 100%; }
.wiki-editor-content #wiki-title { font-size: 1.1rem; font-weight: 600; }
.wiki-editor-content #wiki-content { resize: vertical; min-height: 300px; max-height: 60vh; font-size: 0.95rem; line-height: 1.7; font-family: monospace; }

.inventory-tag { font-size: 0.75rem; color: #a78bfa; background: rgba(139, 92, 246, 0.15); padding: 3px 8px; border-radius: 6px; margin-right: 6px; font-weight: 600; }

/* Sub-Tabs */
.sub-tabs { display: flex; gap: 0.75rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.sub-tab-btn { background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1); color: var(--text-color); padding: 0.6rem 1.25rem; border-radius: 8px; cursor: pointer; transition: all 0.3s; font-size: 0.95rem; font-weight: 500; }
.sub-tab-btn:hover { background: rgba(255, 255, 255, 0.1); }
.sub-tab-btn.active { background: var(--primary-color); border-color: var(--primary-color); color: white; font-weight: 600; box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3); }
.sub-tab-content { display: none; animation: fadeIn 0.3s ease; }
.sub-tab-content.active { display: block; }

/* ===================== RESPONSIVE ===================== */

/* --- Desktop Small / Tablet Landscape (≤ 1024px) --- */
@media (max-width: 1024px) {
    .main-content { padding: 2rem; }
    .form-grid { grid-template-columns: 1fr; }
    .full-width { grid-column: span 1; }
}

/* --- Tablet (≤ 900px) --- */
@media (max-width: 900px) {
    :root { --sidebar-width: 240px; }
    .tavern-grid { grid-template-columns: 1fr; grid-template-rows: 1fr auto; height: calc(100vh - 160px); }
    .active-players { max-height: 220px; display: flex; gap: 0.75rem; flex-wrap: wrap; align-content: flex-start; padding: 1.25rem; }
    .active-players h3 { width: 100%; margin-bottom: 0.5rem; }
    .active-p-card { margin-bottom: 0; flex: 1 1 120px; }
}

/* --- Mobile (≤ 640px) --- */
@media (max-width: 640px) {
    #sidebar-toggle { display: flex; align-items: center; justify-content: center; }
    .sidebar {
        position: fixed;
        left: 0; top: 0; bottom: 0;
        transform: translateX(-100%);
        height: 100vh;
        width: 280px;
        box-shadow: 20px 0 50px rgba(0,0,0,0.5);
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay.open { display: block; opacity: 1; }
    #dashboard { flex-direction: column; }
    .main-content { padding: 1.25rem; padding-top: 4.5rem; height: 100vh; }

    .header { flex-direction: column; align-items: flex-start; gap: 1rem; margin-bottom: 1.5rem; }
    .grid-container { grid-template-columns: 1fr; }
    .wiki-grid { grid-template-columns: 1fr; }

    /* Modals fill screen on mobile smoothly */
    .modal { padding: 0.5rem; align-items: flex-end; }
    .modal-content { border-radius: 24px 24px 12px 12px; max-height: 92vh; padding: 1.5rem; animation: slideUpMobile 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
    @keyframes slideUpMobile { from { transform: translateY(100%); } to { transform: translateY(0); } }
    
    .wiki-view-content { border-radius: 24px 24px 12px 12px; max-height: 92vh; }

    .data-table-container { border-radius: 16px; }

    .currency-box { gap: 0.5rem; font-size: 0.85rem; }

    .tavern-grid { height: calc(100vh - 140px); gap: 1rem; }
    .chat-window { padding: 1rem; }
    .message-bubble { max-width: 90%; }

    .auth-card { padding: 2rem 1.5rem; border-radius: 20px; }

    .form-actions { flex-direction: column; gap: 0.75rem; }
    .form-actions .btn { width: 100%; text-align: center; }

    .btn { padding: 0.85rem 1rem; }
    td, th { padding: 0.8rem 1rem; font-size: 0.9rem; }
}

/* --- Very small (≤ 380px) --- */
@media (max-width: 380px) {
    .main-content { padding: 1rem; padding-top: 4rem; }
    .wiki-card { padding: 1.25rem; }
    .modal-content { padding: 1.25rem; }
    html { font-size: 14px; }
}

.estate-ancestry { background: rgba(0,0,0,0.2); border: 1px solid #333; border-radius: 8px; padding: 0.8rem; margin-top: 1rem; } .estate-ancestry li { position: relative; } .estate-ancestry li:not(:last-child)::after { content: ''; position: absolute; left: -2px; top: 15px; height: 100%; width: 2px; background: #444; }
