/* Font families */
body {
    font-family: 'Khand-Regular', sans-serif;
}

h1, h2, h3, h4, h5, h6, .landing-title, .card-title {
    font-family: 'Khand-Regular', sans-serif;
}

/* Brand title — red/orange for deathroll */
.brand-title {
    font-family: 'Khand-Regular', sans-serif;
    color: #ff4444;
}

/* Action button */
.create-card-btn {
    font-family: 'Khand-Regular', sans-serif;
    font-size: 1rem;
    padding: 0.6rem 1.8rem;
    border: 2px solid var(--bs-border-color, #373b3e);
    border-radius: 8px;
    background: var(--bs-dark-bg-subtle, #1a1d20);
    color: #ff4444;
    cursor: pointer;
    transition: all 0.2s ease;
}

.create-card-btn:hover {
    border-color: #ff4444;
    box-shadow: 0 0 12px rgba(255, 68, 68, 0.25);
}

.create-card-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.theme-night .create-card-btn {
    background: #111111;
    border-color: #222222;
}

.theme-night .create-card-btn:hover {
    border-color: #ff4444;
}

/* Join page — constrain width */
.join-box {
    max-width: 820px;
    margin: 0 auto;
}

.create-lower-box {
    max-width: 820px;
    margin-left: auto;
    margin-right: auto;
}

/* Server status */
.server-status-icon {
    font-size: 3rem;
    color: #ff4444;
    margin-bottom: 0.5rem;
}

.server-status-title {
    font-family: 'Khand-Regular', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.6rem;
}

.server-status-specs {
    font-family: 'Khand-Regular', sans-serif;
    font-size: 1.25rem;
    line-height: 2;
}

.server-status-specs div {
    margin-bottom: 4px;
}

/* Sortable table headers */
.sortable-th {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.sortable-th:hover {
    color: #ff4444;
}

.sortable-th i {
    margin-left: 4px;
    font-size: 0.75rem;
}

/* Wallet sidebar section */
.wallet-sidebar-section {
    display: flex;
    flex-direction: column;
}

.wallet-sidebar-section .wallet-info-box {
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.wallet-toggle-btn {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 10px 16px;
    background: transparent;
    border: none;
    color: #888888;
    font-family: 'Khand-Regular', sans-serif;
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.2s;
}

.wallet-toggle-btn:hover {
    color: #c0c0c0;
}

.theme-night .wallet-toggle-btn {
    color: #666666;
}

.theme-night .wallet-toggle-btn:hover {
    color: #999999;
}

.wallet-info-box {
    padding: 14px 16px;
    border: none;
    border-radius: 0;
    background: transparent;
    font-size: 1.15rem;
    line-height: 1.8;
}

.wallet-info-box strong {
    font-size: 1.3rem;
}

.wallet-info-box .wallet-name-row {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-size: 1.3rem;
}

.wallet-info-box .small {
    font-size: 0.95rem !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.wallet-info-box .small .btn-link {
    margin-left: auto;
}

.theme-night .wallet-info-box {
    border-color: #222222;
    background: #0d0d0d;
}

/* Dark theme overrides */
code {
    color: #ff4444;
}

/* ============================================
   Theme: Night mode — black, grey, red accents
   ============================================ */
.theme-night {
    --bs-body-bg: #0d0d0d;
    --bs-dark-bg-subtle: #111111;
    --bs-border-color: #222222;
    --bs-body-color: #c0c0c0;
    --bs-link-color: #ff4444;
    --bs-link-hover-color: #ff6666;
}

.theme-night body {
    background-color: #0d0d0d;
}

.theme-night .bg-dark {
    background-color: #0a0a0a !important;
}

.theme-night .card {
    background-color: #111111;
    border-color: #222222;
}

.theme-night .table-dark {
    --bs-table-bg: #0d0d0d;
    --bs-table-border-color: #1a1a1a;
    --bs-table-hover-bg: #1a0f0f;
}

.theme-night .form-control {
    background-color: #111111;
    border-color: #333333;
    color: #c0c0c0;
}

.theme-night .form-control:focus {
    border-color: #ff4444;
    box-shadow: 0 0 0 0.2rem rgba(255, 68, 68, 0.2);
}

.theme-night .btn-primary {
    background-color: #ff4444;
    border-color: #ff4444;
    color: #0d0d0d;
}

.theme-night .btn-primary:hover {
    background-color: #ff6666;
    border-color: #ff6666;
    color: #0d0d0d;
}

.theme-night .btn-outline-light {
    color: #888888;
    border-color: #333333;
}

.theme-night .btn-outline-light:hover {
    background-color: #1a1a1a;
    color: #ff4444;
    border-color: #ff4444;
}

.theme-night .badge.bg-secondary {
    background-color: #1a0f0f !important;
    color: #ff4444;
    border: 1px solid #2f1a1a;
}

.theme-night .text-secondary {
    color: #666666 !important;
}

.theme-night .border-secondary {
    border-color: #222222 !important;
}

.theme-night .nav-toolbar .btn {
    color: #888888;
    border-color: #333333;
}

.theme-night .nav-toolbar .btn:hover {
    color: #c0c0c0;
    border-color: #ff4444;
    background: rgba(255, 68, 68, 0.08);
}

.theme-night .nav-toolbar .btn.active {
    background-color: rgba(255, 68, 68, 0.15);
    color: #ff4444;
    border: 2px solid #ff4444;
}

.theme-night .sidebar-link,
.theme-night .nav-link {
    color: #666666;
}

.theme-night .sidebar-link:hover,
.theme-night .nav-link:hover {
    color: #ff4444;
}

.theme-night .sidebar-link.active,
.theme-night .nav-link.active {
    color: #ff4444;
    border: 2px solid #ff4444;
    border-radius: 8px;
    box-shadow: 0 0 12px rgba(255, 68, 68, 0.25);
    background: #111111;
}

.sidebar-link.active {
    border: 2px solid #ff4444;
    border-radius: 8px;
    box-shadow: 0 0 12px rgba(255, 68, 68, 0.25);
}

.theme-night .plan-card {
    background: #111111;
    border-color: #222222;
}

.theme-night .plan-card:hover {
    border-color: #444444;
}

.theme-night .plan-card.selected {
    border-color: #ff4444;
    box-shadow: 0 0 12px rgba(255, 68, 68, 0.25);
}

.theme-night h1,
.theme-night h2,
.theme-night h3 {
    color: #d0d0d0;
}

.theme-night .card-title {
    color: #ff4444;
}

.theme-night .btn-danger {
    background-color: #4a1a1a;
    border-color: #5a2020;
    color: #ff6b6b;
}

.theme-night .btn-danger:hover {
    background-color: #5a2020;
    border-color: #6a2a2a;
    color: #ff8888;
}

.theme-night ::-webkit-scrollbar-track {
    background: #0d0d0d;
}

.theme-night ::-webkit-scrollbar-thumb {
    background: #333333;
}

.theme-night ::-webkit-scrollbar-thumb:hover {
    background: #444444;
}

/* ============================================
   Nav toolbar
   ============================================ */
.nav-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-toolbar .btn {
    padding: 4px 8px;
    font-size: 14px;
    line-height: 1;
    color: #b0b0b0;
    border-color: #505050;
    transition: all 0.2s ease;
}

.nav-toolbar .btn:hover {
    color: #e0e0e0;
    border-color: #ff4444;
    background: rgba(255, 68, 68, 0.08);
}

.nav-toolbar .btn.active {
    color: #ff4444;
    border-color: #ff4444;
    background-color: rgba(255, 68, 68, 0.18);
}

/* ============================================
   Success/Error boxes
   ============================================ */
.success-box {
    background-color: #1a2f1a;
    color: #7cfc00;
    padding: 12px 16px;
    border-radius: 4px;
    border: 1px solid #2a4a2a;
}

.error-box {
    background-color: #2a0a0a;
    color: #ff6b6b;
    padding: 12px 16px;
    border-radius: 4px;
    border: 1px solid #4a1a1a;
}

.tx-status-box {
    background-color: #1a1a1a;
    color: #888888;
    padding: 12px 16px;
    border-radius: 4px;
    border: 1px solid #333333;
    font-style: italic;
}

/* ============================================
   Game top row
   ============================================ */
.game-top-row {
    display: flex;
    align-items: stretch;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.game-top-row .chat-header-box {
    flex: 1 1 0;
    min-width: 200px;
    margin-bottom: 0;
}

.game-top-row .chat-status-card {
    flex: 1 1 0;
    min-width: 200px;
    max-width: none;
    cursor: default;
}

.chat-header-box {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.8rem 1.2rem;
    border: 2px solid #444444;
    border-radius: 8px;
    background: var(--bs-dark-bg-subtle, #1a1d20);
    margin-bottom: 1rem;
}

.theme-night .chat-header-box {
    background: #111111;
    border-color: #333333;
}

.chat-header-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.chat-header-name {
    font-family: 'Khand-Regular', sans-serif;
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.2;
    color: #c0c0c0;
}

.chat-header-token {
    font-family: monospace;
    font-size: 0.85rem;
    color: #666666;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-header-token .btn-link {
    color: #666666;
    padding: 0;
    font-size: 0.85rem;
}

.chat-header-token .btn-link:hover {
    color: #999999;
}

.chat-info-sep {
    color: #444444;
    margin: 0 6px;
}

.status-connected {
    color: #7cfc00;
    font-weight: 600;
}

.status-disconnected {
    color: #ff6b6b;
}

/* ============================================
   Roll log — game rolls display
   ============================================ */
.roll-log {
    max-height: calc(100vh - 500px);
    min-height: 150px;
    overflow-y: auto;
    padding: 8px;
}

.roll-entry {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    margin-bottom: 4px;
    border-radius: 6px;
    background: #1a1a1a;
    border: 1px solid #222222;
    font-family: monospace;
    font-size: 0.95rem;
}

.roll-entry.roll-mine {
    background: #1a1a22;
    border-color: #2a2a3a;
}

.roll-entry.roll-death {
    background: #2a0a0a;
    border-color: #4a1a1a;
    animation: death-flash 0.5s ease;
}

@keyframes death-flash {
    0%, 100% { background: #2a0a0a; }
    50% { background: #4a1a1a; }
}

.roll-player {
    color: #888888;
    min-width: 120px;
}

.roll-ceiling {
    color: #555555;
    min-width: 100px;
}

.roll-arrow {
    color: #444444;
}

.roll-value {
    color: #ff4444;
    font-weight: 700;
    font-size: 1.1rem;
}

.theme-night .roll-entry {
    background: #0d0d0d;
    border-color: #1a1a1a;
}

.theme-night .roll-entry.roll-mine {
    background: #0d0d14;
    border-color: #1a1a2a;
}

/* ============================================
   Error page
   ============================================ */
.error-page-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 200px);
    text-align: center;
}

.error-page-icon {
    font-size: 4rem;
    color: #ff6b6b;
    margin-bottom: 1rem;
}

.error-page-wrapper h1 {
    margin-bottom: 0.5rem;
}

/* ============================================
   Error UI
   ============================================ */
#blazor-error-ui {
    background: #2a0a0a;
    color: #ff6b6b;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.5);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #1a1a1a;
}

::-webkit-scrollbar-thumb {
    background: #404040;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555555;
}

/* ============================================
   Mobile bottom bar
   ============================================ */
.mobile-bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 8px 12px;
    background-color: #1a1a1a;
    border-top: 1px solid #333333;
}

.theme-night .mobile-bottom-bar {
    background-color: #0a0a0a;
    border-color: #1a1a1a;
}

/* ============================================
   Plan cards (game type selection)
   ============================================ */
.plan-cards {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.plan-card {
    flex: 1;
    min-width: 180px;
    max-width: 260px;
    border: 2px solid var(--bs-border-color, #373b3e);
    border-radius: 8px;
    padding: 1.2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--bs-dark-bg-subtle, #1a1d20);
}

.plan-card:hover {
    border-color: #555555;
}

.plan-card.selected {
    border-color: #ff4444;
    box-shadow: 0 0 12px rgba(255, 68, 68, 0.25);
}

.plan-card.disabled {
    opacity: 0.35;
    pointer-events: none;
    filter: grayscale(1);
}

/* Wallet carousel */
.wallet-carousel {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    max-width: 620px;
    margin-left: auto;
    margin-right: auto;
}

.carousel-item-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    min-width: 0;
    cursor: pointer;
}

.wallet-circle {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    border: 2px solid var(--bs-border-color, #373b3e);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #ff4444;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bs-dark-bg-subtle, #1a1d20);
}

.wallet-circle:hover {
    border-color: #555;
}

.wallet-circle.selected {
    border-color: #ff4444;
    box-shadow: 0 0 12px rgba(255, 68, 68, 0.25);
}

.wallet-circle.disabled {
    opacity: 0.35;
    pointer-events: none;
    filter: grayscale(1);
}

.carousel-label {
    font-family: 'Khand-Regular', sans-serif;
    font-size: 1.1rem;
    margin-top: 0.4rem;
    text-align: center;
}

.carousel-detail {
    margin-top: 0.15rem;
    text-align: center;
    font-size: 0.75rem;
}

.plan-card-icon {
    font-size: 2rem;
    color: #ff4444;
    margin-bottom: 0.5rem;
}

.plan-card-name {
    font-family: 'Khand-Regular', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 0.4rem;
}

.plan-card-specs {
    font-size: 0.85rem;
    color: #888888;
    margin-bottom: 0.6rem;
}

.chat-status-card .plan-card-name {
    font-size: 1.6rem;
}

.chat-status-card .plan-card-specs {
    font-size: 1.1rem;
    line-height: 1.8;
}

.chat-status-card .plan-card-price {
    font-size: 1.3rem;
}

.chat-status-card .plan-card-icon {
    font-size: 2.5rem;
}

.plan-card-specs div {
    margin-bottom: 2px;
}

.plan-card-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: #ff4444;
}

/* ============================================
   Tablet+
   ============================================ */
@media (min-width: 768px) {
    .roll-entry {
        font-size: 1rem;
    }

    .roll-log {
        max-height: calc(100vh - 400px);
    }
}

/* ============================================
   Landing page
   ============================================ */
.landing-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 80px);
    overflow: hidden;
}

.landing-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 68, 68, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 68, 68, 0.03) 1px, transparent 1px);
    background-size: 24px 24px;
    animation: grid-scroll 20s linear infinite;
}

@keyframes grid-scroll {
    0% { background-position: 0 0; }
    100% { background-position: 0 240px; }
}

.landing-content {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 2rem;
}

.landing-icon {
    font-size: 4rem;
    color: #ff4444;
    margin-bottom: 1rem;
    animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { opacity: 0.7; text-shadow: 0 0 10px rgba(255, 68, 68, 0.3); }
    50% { opacity: 1; text-shadow: 0 0 25px rgba(255, 68, 68, 0.6); }
}

.landing-title {
    font-size: 3.5rem;
    font-weight: 700;
    color: #e0e0e0;
    letter-spacing: 2px;
    margin-bottom: 0.5rem;
}

.landing-tagline {
    font-size: 1.1rem;
    color: #ff4444;
    letter-spacing: 4px;
    text-transform: lowercase;
    font-family: monospace;
    margin-bottom: 2.5rem;
}

.landing-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.landing-btn {
    font-family: monospace;
    font-size: 0.95rem;
    padding: 0.7rem 1.6rem;
    border-radius: 2px;
    border: 1px solid;
    cursor: pointer;
    text-transform: lowercase;
    letter-spacing: 1px;
    transition: all 0.2s ease;
}

.landing-btn-primary {
    background-color: #ff4444;
    color: #0a0a0a;
    border-color: #ff4444;
}

.landing-btn-primary:hover {
    background-color: #ff6666;
    box-shadow: 0 0 15px rgba(255, 68, 68, 0.4);
}

.landing-btn-secondary {
    background-color: transparent;
    color: #ff4444;
    border-color: #ff4444;
}

.landing-btn-secondary:hover {
    background-color: rgba(255, 68, 68, 0.18);
    box-shadow: 0 0 15px rgba(255, 68, 68, 0.2);
}

/* ============================================
   Sidebar collapse (desktop)
   ============================================ */
.sidebar-collapsed {
    width: 60px !important;
    min-width: 60px !important;
}

.sidebar-collapsed .sidebar-brand {
    text-align: center;
    padding: 12px 8px !important;
}

.sidebar-collapsed .sidebar-link {
    text-align: center;
    padding: 10px 8px !important;
    font-size: 1.1rem;
}

.sidebar-collapsed .nav-toolbar {
    flex-direction: column;
}

/* ============================================
   Mobile sidebar
   ============================================ */
.mobile-sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1060;
}

.mobile-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 240px;
    z-index: 1070;
    background: #1a1a1a;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #333333;
    animation: slide-in-left 0.2s ease;
}

.theme-night .mobile-sidebar {
    background: #0a0a0a;
    border-color: #222222;
}

@keyframes slide-in-left {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}
