:root {
    --bg: #08111c;
    --bg-deep: #04080f;
    --panel: rgba(10, 22, 35, 0.88);
    --panel-strong: rgba(12, 27, 43, 0.96);
    --panel-border: rgba(148, 187, 233, 0.16);
    --gold: #d9b773;
    --gold-soft: rgba(217, 183, 115, 0.14);
    --ice: #dce7f4;
    --muted: #8f9db0;
    --success: #57c68a;
    --warning: #f1b968;
    --danger: #eb7568;
    --info: #7bb8ff;
    --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    --radius-lg: 24px;
    --radius-md: 18px;
    --radius-sm: 12px;
    --nav-width: 320px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    background:
        radial-gradient(circle at top right, rgba(217, 183, 115, 0.12), transparent 28%),
        radial-gradient(circle at bottom left, rgba(76, 122, 189, 0.18), transparent 30%),
        linear-gradient(180deg, #0b1725 0%, #060b12 100%);
    color: var(--ice);
    font-family: "Inter", sans-serif;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.7), transparent 92%);
}

h1,
h2,
h3,
h4,
strong {
    font-family: "Cinzel", serif;
    letter-spacing: 0.02em;
}

p {
    margin: 0;
}

button,
a {
    font: inherit;
}

.app-shell {
    display: grid;
    grid-template-columns: var(--nav-width) minmax(0, 1fr);
    min-height: 100vh;
}

.side-nav {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 28px 22px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    background: linear-gradient(180deg, rgba(4, 10, 17, 0.96), rgba(6, 12, 20, 0.92));
    border-right: 1px solid var(--panel-border);
    backdrop-filter: blur(20px);
    z-index: 30;
    min-width: 0;
}

.logo-card,
.auth-panel,
.panel,
.hero-panel,
.status-card,
.subpanel,
.weekly-card,
.history-card,
.schedule-card {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    box-shadow: var(--shadow);
}

.logo-card {
    display: grid;
    grid-template-columns: 80px minmax(0, 1fr);
    gap: 16px;
    align-items: center;
    padding: 18px;
    border-radius: var(--radius-lg);
}

.logo-card-solo {
    display: block;
    padding: 14px;
}

.logo-mark {
    aspect-ratio: 1;
    width: 80px;
    border-radius: 22px;
    display: grid;
    place-items: center;
    color: var(--gold);
    font-size: 1.4rem;
    font-weight: 700;
    border: 1px solid rgba(217, 183, 115, 0.4);
    background:
        linear-gradient(135deg, rgba(217, 183, 115, 0.24), rgba(123, 184, 255, 0.08)),
        rgba(255, 255, 255, 0.02);
}

.logo-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.35));
}

.logo-banner {
    display: block;
    width: 100%;
    max-height: 112px;
    object-fit: contain;
    filter: drop-shadow(0 14px 26px rgba(0, 0, 0, 0.38));
}

.eyebrow {
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 0.72rem;
    margin-bottom: 8px;
}

.subtle,
.microcopy {
    color: var(--muted);
}

.microcopy {
    font-size: 0.82rem;
}

.nav-links {
    display: grid;
    gap: 10px;
}

.nav-links a {
    text-decoration: none;
    color: var(--ice);
    padding: 14px 16px;
    border-radius: 14px;
    background: transparent;
    border: 1px solid transparent;
    transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.nav-links a:hover,
.nav-links a.is-active {
    background: linear-gradient(135deg, rgba(217, 183, 115, 0.16), rgba(123, 184, 255, 0.12));
    border-color: rgba(217, 183, 115, 0.24);
    transform: translateX(2px);
}

.auth-panel,
.panel,
.hero-panel {
    border-radius: var(--radius-lg);
}

.auth-panel {
    padding: 18px;
    display: grid;
    gap: 14px;
    min-width: 0;
    overflow: hidden;
}

.user-chip,
.panel-heading,
.schedule-header,
.history-card,
.loot-row,
.top-bar,
.status-card,
.history-stats,
.buff-bar,
.raid-composition,
.fight-coverage,
.assignment-fights,
.auth-actions,
.loot-meta {
    display: flex;
    align-items: center;
}

.user-chip {
    gap: 12px;
    align-items: flex-start;
}

.avatar-ring {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(217, 183, 115, 0.4), rgba(123, 184, 255, 0.18));
    border: 1px solid rgba(217, 183, 115, 0.35);
}

.avatar-image {
    object-fit: cover;
    background: rgba(255, 255, 255, 0.06);
}

.character-summary {
    display: grid;
    gap: 4px;
}

.auth-select-wrap {
    display: grid;
    gap: 6px;
    min-width: 0;
    width: 100%;
}

.auth-select {
    width: 100%;
    max-width: 240px;
    border: 1px solid rgba(123, 184, 255, 0.24);
    border-radius: 12px;
    background: rgba(6, 12, 20, 0.9);
    color: var(--ice);
    padding: 10px 12px;
    min-width: 0;
}

.flash-banner {
    margin-bottom: 18px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--panel-border);
    background: var(--panel);
    box-shadow: var(--shadow);
}

.flash-banner.success {
    border-color: rgba(87, 198, 138, 0.35);
}

.flash-banner.danger {
    border-color: rgba(235, 117, 104, 0.35);
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    padding: 12px 16px;
    cursor: pointer;
    color: var(--ice);
    text-decoration: none;
    transition: transform 160ms ease, opacity 160ms ease;
}

.button:hover {
    transform: translateY(-1px);
}

.button.primary {
    background: linear-gradient(135deg, #2465a8, #3e8bd7);
}

.button.secondary {
    background: rgba(123, 184, 255, 0.14);
    border: 1px solid rgba(123, 184, 255, 0.24);
}

.button.ghost {
    background: rgba(255, 255, 255, 0.06);
}

.content-wrap {
    padding: 26px;
}

.top-bar {
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
}

.top-bar-status {
    margin-left: auto;
}

.status-card {
    gap: 12px;
    padding: 14px 18px;
    border-radius: 18px;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.online {
    background: var(--success);
    box-shadow: 0 0 16px rgba(87, 198, 138, 0.7);
}

.menu-toggle {
    display: none;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--panel-border);
    padding: 10px;
}

.menu-toggle span {
    display: block;
    height: 2px;
    background: var(--ice);
    margin: 6px 0;
}

.main-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 22px;
}

.hero-panel {
    grid-column: span 12;
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 20px;
    padding: 28px;
    background:
        linear-gradient(135deg, rgba(217, 183, 115, 0.14), rgba(123, 184, 255, 0.08)),
        var(--panel-strong);
}

.hero-panel h3 {
    font-size: clamp(1.8rem, 3vw, 3rem);
    margin: 0 0 12px;
}

.hero-copy {
    color: #bfd0e3;
    max-width: 68ch;
    line-height: 1.7;
}

.hero-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.hero-metrics article {
    padding: 18px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.04);
}

.hero-metrics strong {
    display: block;
    margin: 10px 0 6px;
    font-size: 1.6rem;
}

.panel {
    padding: 22px;
}

.schedule-panel,
.roster-panel {
    grid-column: span 6;
}

.loot-panel,
.progress-panel,
.history-panel {
    grid-column: span 4;
}

.panel-wide {
    grid-column: span 12;
}

.panel-span-7 {
    grid-column: span 7;
}

.panel-span-5 {
    grid-column: span 5;
}

.panel-heading {
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 18px;
}

.schedule-list,
.history-list,
.weekly-list,
.roster-table {
    display: grid;
    gap: 14px;
}

.schedule-card,
.weekly-card,
.history-card,
.subpanel {
    border-radius: var(--radius-md);
    padding: 18px;
}

.schedule-card.is-primary {
    background: linear-gradient(135deg, rgba(217, 183, 115, 0.12), rgba(255, 255, 255, 0.03));
}

.schedule-header,
.loot-row {
    justify-content: space-between;
    gap: 14px;
}

.schedule-actions,
.inline-links {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.raid-composition,
.fight-coverage,
.buff-bar,
.auth-actions {
    flex-wrap: wrap;
    gap: 10px;
}

.raid-composition span,
.buff-pill,
.coverage-pill,
.fight-node {
    padding: 9px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.92rem;
}

.coverage-pill.success,
.tag.success,
.fight-node.active {
    background: rgba(87, 198, 138, 0.14);
    border-color: rgba(87, 198, 138, 0.28);
}

.coverage-pill.warning,
.tag.warning {
    background: rgba(241, 185, 104, 0.14);
    border-color: rgba(241, 185, 104, 0.28);
}

.coverage-pill.danger,
.tag.danger {
    background: rgba(235, 117, 104, 0.14);
    border-color: rgba(235, 117, 104, 0.28);
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 0.82rem;
    border: 1px solid transparent;
    white-space: nowrap;
}

.tag.neutral {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.08);
}

.tag.info {
    background: rgba(123, 184, 255, 0.14);
    border-color: rgba(123, 184, 255, 0.28);
}

.roster-table {
    margin-top: 16px;
}

.roster-row {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) auto;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.roster-row:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.player-meta {
    display: flex;
    align-items: center;
    gap: 12px;
}

.spec-icon {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    font-weight: 700;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.role-tank {
    background: rgba(123, 184, 255, 0.16);
}

.role-healer {
    background: rgba(87, 198, 138, 0.16);
}

.role-melee {
    background: rgba(235, 117, 104, 0.16);
}

.role-ranged {
    background: rgba(217, 183, 115, 0.16);
}

.assignment-status p {
    margin-top: 8px;
    color: var(--muted);
}

.fight-tabs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.fight-tabs button {
    background: rgba(255, 255, 255, 0.04);
    color: var(--ice);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    padding: 10px 14px;
    cursor: pointer;
}

.fight-tabs button.is-selected {
    background: var(--gold-soft);
    border-color: rgba(217, 183, 115, 0.3);
}

.loot-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

.loot-row + .loot-row {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.loot-meta {
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
    text-align: right;
}

.weekly-list,
.history-list {
    gap: 12px;
}

.history-card {
    justify-content: space-between;
    gap: 14px;
}

.history-link {
    color: inherit;
    text-decoration: none;
}

.history-card-active {
    border: 1px solid rgba(217, 183, 115, 0.28);
    background: linear-gradient(135deg, rgba(217, 183, 115, 0.12), rgba(255, 255, 255, 0.03));
}

.mini-link {
    color: var(--muted);
    text-decoration: none;
    padding: 8px 10px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.mini-link.is-active {
    color: var(--ice);
    border-color: rgba(217, 183, 115, 0.3);
    background: rgba(217, 183, 115, 0.12);
}

.gear-layout {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.armory-shell {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(220px, 280px) minmax(220px, 1fr);
    gap: 14px;
    align-items: start;
}

.armory-column {
    display: grid;
    gap: 12px;
}

.armory-character {
    position: sticky;
    top: 24px;
    display: grid;
    gap: 10px;
    justify-items: center;
    padding: 14px;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(217, 183, 115, 0.16);
    background:
        radial-gradient(circle at top, rgba(123, 184, 255, 0.18), transparent 36%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(8, 17, 28, 0.5));
}

.armory-character-frame {
    width: min(100%, 250px);
    aspect-ratio: 2.7 / 4;
    border-radius: 28px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background:
        radial-gradient(circle at top, rgba(217, 183, 115, 0.16), transparent 45%),
        rgba(255, 255, 255, 0.04);
    display: grid;
    place-items: center;
    isolation: isolate;
}

.armory-character-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: top center;
    transform: scale(1.7);
    transform-origin: center 16%;
    will-change: transform;
}

.armory-character-meta {
    display: grid;
    gap: 3px;
    text-align: center;
}

.armory-character-select {
    width: min(100%, 220px);
}

.armory-slot {
    padding: 8px;
}

.armory-slot-top,
.armory-bis-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
}

.armory-slot-copy {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.armory-slot-copy strong,
.gear-slot-bis strong {
    font-size: 0.84rem;
    line-height: 1.2;
}

.armory-item-icon {
    width: 36px;
    height: 36px;
}

.armory-item-icon-small {
    width: 24px;
    height: 24px;
}

.armory-bottom-weapons {
    margin-top: 12px;
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.armory-slot-weapon {
    width: min(100%, 300px);
}

.gear-slot-card {
    width: 100%;
    text-align: left;
    background: rgba(255, 255, 255, 0.04);
    color: var(--ice);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    padding: 10px;
    cursor: pointer;
    display: grid;
    gap: 6px;
}

.gear-slot-card.is-selected {
    border-color: rgba(217, 183, 115, 0.34);
    background: linear-gradient(135deg, rgba(217, 183, 115, 0.12), rgba(123, 184, 255, 0.08));
}

.gear-slot-card.is-bis-match {
    border-color: rgba(87, 198, 138, 0.34);
    background: linear-gradient(135deg, rgba(87, 198, 138, 0.18), rgba(123, 184, 255, 0.06));
}

.gear-slot-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--gold);
}

.gear-slot-subtle {
    color: var(--muted);
    font-size: 0.72rem;
}

.gear-slot-compare {
    display: grid;
    gap: 4px;
}

.item-preview {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
}

.gear-slot-current,
.gear-slot-bis {
    display: grid;
    gap: 2px;
    font-size: 0.82rem;
}

.item-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
}

.bis-inline-editor {
    display: grid;
    gap: 6px;
    margin-top: 6px;
}

.bis-search-input {
    width: 100%;
    border: 1px solid rgba(123, 184, 255, 0.24);
    border-radius: 12px;
    background: rgba(6, 12, 20, 0.9);
    color: var(--ice);
    padding: 8px 10px;
}

.bis-search-results {
    display: grid;
    gap: 8px;
}

.bis-search-loading {
    width: 100%;
    height: 6px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.08);
}

.bis-search-loading[hidden] {
    display: none;
}

.bis-search-loading span {
    display: block;
    width: 40%;
    height: 100%;
    background: linear-gradient(90deg, var(--gold), var(--info));
    animation: loading-bar 0.9s ease-in-out infinite;
}

.bis-result {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    width: 100%;
    text-align: left;
    background: rgba(255, 255, 255, 0.05);
    color: var(--ice);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 8px;
    cursor: pointer;
}

.bis-result-copy {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.bis-result-copy span,
.bis-result-empty {
    color: var(--muted);
    font-size: 0.88rem;
}

.bis-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.bis-actions-tight {
    gap: 6px;
}

.button-small {
    padding: 5px 8px;
    font-size: 0.76rem;
}

.button-icon {
    width: 24px;
    height: 24px;
    padding: 0;
    line-height: 1;
}

.bis-highlight {
    padding: 5px 7px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(217, 183, 115, 0.22), rgba(123, 184, 255, 0.08));
    border: 1px solid rgba(217, 183, 115, 0.24);
}

.bis-highlight-empty {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
}

.bis-empty-copy {
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    color: var(--muted);
}

.bis-search-panel[hidden] {
    display: none;
}

.wishlist-form {
    margin-top: 16px;
    padding: 18px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.wishlist-form-danger {
    padding-top: 14px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.form-grid label {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.form-grid input,
.form-grid select {
    width: 100%;
    min-width: 0;
    border: 1px solid rgba(123, 184, 255, 0.24);
    border-radius: 12px;
    background: rgba(6, 12, 20, 0.9);
    color: var(--ice);
    padding: 10px 12px;
}

.form-span-2 {
    grid-column: span 2;
}

.detail-summary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 14px;
}

.empty-state {
    color: var(--muted);
    padding: 12px 0;
}

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(4, 8, 15, 0.78);
    backdrop-filter: blur(8px);
    display: grid;
    place-items: center;
    z-index: 200;
}

.loading-overlay[hidden] {
    display: none !important;
}

.loading-card {
    width: min(92vw, 420px);
    padding: 24px;
    border-radius: var(--radius-lg);
    background: var(--panel-strong);
    border: 1px solid var(--panel-border);
    box-shadow: var(--shadow);
    display: grid;
    gap: 12px;
    text-align: center;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 4px solid rgba(123, 184, 255, 0.2);
    border-top-color: var(--gold);
    margin: 0 auto;
    animation: spin 0.9s linear infinite;
}

body.is-loading {
    overflow: hidden;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes loading-bar {
    0% {
        transform: translateX(-110%);
    }
    100% {
        transform: translateX(260%);
    }
}

.history-stats {
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    color: var(--muted);
}

.roster-row.is-hidden {
    display: none;
}

body.nav-open .side-nav {
    transform: translateX(0);
}

@media (max-width: 1180px) {
    .schedule-panel,
    .roster-panel,
    .loot-panel,
    .progress-panel,
    .history-panel,
    .panel-span-7,
    .panel-span-5 {
        grid-column: span 12;
    }

    .hero-panel {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .side-nav {
        position: fixed;
        left: 0;
        width: min(88vw, 340px);
        transform: translateX(-100%);
        transition: transform 180ms ease;
        height: 100vh;
    }

    .content-wrap {
        padding: 18px;
    }

    .top-bar {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .menu-toggle {
        display: inline-block;
    }

    .hero-metrics {
        grid-template-columns: 1fr;
    }

    .gear-layout,
    .form-grid,
    .detail-summary-grid,
    .armory-shell {
        grid-template-columns: 1fr;
    }

    .armory-character {
        position: static;
    }

    .armory-bottom-weapons {
        justify-content: stretch;
    }

    .armory-slot-weapon {
        width: 100%;
    }

    .form-span-2 {
        grid-column: span 1;
    }

    .roster-row {
        grid-template-columns: 1fr;
    }

    .assignment-fights,
    .loot-meta,
    .history-stats {
        justify-content: flex-start;
        text-align: left;
        align-items: flex-start;
    }
}
