/* ===========================
   CSS Variables — Rust theme
   =========================== */
:root {
    --color-primary:       #b5561f;
    --color-primary-hover: #923f14;
    --color-secondary:     #d47133;
    --color-ember:         #f97316;
    --color-warning:       #f59e0b;
    --color-danger:        #b91c1c;
    --color-success:       #65a30d;
    --color-khaki:         #a3865a;

    --color-surface-50:    #4a3626;
    --color-surface-100:   #3a2a1c;
    --color-surface-200:   #2e2014;
    --color-surface-300:   #241810;
    --color-surface-400:   #1f140b;
    --color-surface-500:   #1a120b;
    --color-surface-600:   #140d07;
    --color-surface-700:   #0f0905;

    --color-text-primary:  #e7dccf;
    --color-text-muted:    #a3865a;
    --color-text-faint:    #6b533a;
    --color-white:         #ffffff;
    --color-black:         #000000;
    --color-error:         #ef4444;

    --font-display:        'Oswald', 'Barlow Condensed', Impact, sans-serif;
    --font-sans:           'Barlow', system-ui, -apple-system, sans-serif;
    --font-condensed:      'Barlow Condensed', Impact, sans-serif;
    --font-mono:           'JetBrains Mono', Consolas, monospace;

    --animation-duration-slow:   8s;
    --animation-duration-medium: 5s;
    --animation-duration-fast:   1.2s;
    --transition-ease:           cubic-bezier(0.16, 1, 0.3, 1);
    --transition-duration:       0.25s;

    --radius-sm: 2px;
    --radius-md: 4px;
    --radius-lg: 6px;
    --radius-xl: 10px;
    --border-radius: 4px;
    --box-shadow: 0 2px 16px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

/* ===========================
   Keyframes
   =========================== */

@keyframes gradientAnimation {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-10px); }
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(50px); }
    to   { opacity: 1; transform: translateY(0); }
}

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

@keyframes emberFlicker {
    0%, 100% { opacity: 0.85; filter: brightness(1); }
    50%      { opacity: 1;    filter: brightness(1.15); }
}

/* ===========================
   Body — warm wasteland gradient + grain overlay
   =========================== */
body {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    font-family: var(--font-sans);
    color: var(--color-text-primary);
    background-color: var(--color-surface-500);
    background-image:
        radial-gradient(ellipse 80% 60% at 50% -10%, rgba(181, 86, 31, 0.18) 0%, transparent 55%),
        radial-gradient(ellipse 120% 50% at 50% 120%, rgba(70, 32, 12, 0.4) 0%, transparent 60%);
    position: relative;
    transition: color 0.3s var(--transition-ease);
}

/* Film-grain overlay — fixed, non-interactive, blended */
body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0.08;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='0.9'/></svg>");
}

/* Containers */
.container {
    width: 90%;
    max-width: 400px;
    margin: 80px auto;
    padding: 30px;
    background-color: var(--color-surface-300);
    border: 1px solid rgba(164, 107, 65, 0.15);
    border-top-color: rgba(212, 113, 51, 0.25);
    border-radius: var(--radius-lg);
    box-shadow: var(--box-shadow);
}

/* Headings */
h1, h2 {
    text-align: center;
    margin-bottom: 20px;
    color: var(--color-text-primary);
    font-family: var(--font-display);
    letter-spacing: 0.02em;
}

/* Input Groups */
.input-group {
    margin-bottom: 15px;
}

.input-group label {
    display: block;
    margin-bottom: 5px;
    color: var(--color-text-primary);
}

.input-group input {
    width: 100%;
    padding: 10px;
    box-sizing: border-box;
    border: 1px solid rgba(110, 46, 14, 0.5);
    border-radius: var(--radius-sm);
    background-color: var(--color-surface-600);
    color: var(--color-text-primary);
    transition: border-color 0.25s var(--transition-ease), box-shadow 0.25s var(--transition-ease);
}

.input-group input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(181, 86, 31, 0.2);
    outline: none;
}

/* Buttons */
button, .logout-button {
    width: 100%;
    padding: 10px;
    background-color: var(--color-primary);
    border: 1px solid #6e2e0e;
    color: #fff1e6;
    cursor: pointer;
    font-size: 16px;
    font-family: var(--font-condensed);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    transition: background-color var(--transition-duration) var(--transition-ease);
    border-radius: var(--radius-md);
}

button:hover, .logout-button:hover {
    background-color: var(--color-primary-hover);
}

button:focus, .logout-button:focus {
    outline: 2px solid var(--color-secondary);
    outline-offset: 2px;
}

/* Error Message */
.error {
    color: var(--color-error);
    text-align: center;
    margin-bottom: 15px;
}

/* ===========================
   Custom Scrollbar — warm brown
   =========================== */
.custom-scrollbar {
    scrollbar-width: thin;
    scrollbar-color: rgba(164, 107, 65, 0.35) transparent;
}

.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background-color: rgba(164, 107, 65, 0.35);
    border-radius: 2px;
    border: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background-color: rgba(212, 113, 51, 0.55);
}

/* ===========================
   Subscription Section
   =========================== */

#subs .bg-cover {
    backdrop-filter: blur(2px);
}

#subs .bg-gray-900 {
    background: rgba(26, 18, 11, 0.85);
}

.subscription-container {
    background-size: cover;
    background-position: center;
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
}

/* ===========================
   Blurred Info
   =========================== */
.blurred-info {
    filter: blur(5px);
    transition: filter 0.3s ease;
    cursor: pointer;
}

.blurred-info:hover {
    filter: blur(0);
}

/* ===========================
   Game Section
   =========================== */
.game-container {
    background-color: rgba(36, 24, 16, 0.85);
    padding: 20px;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(110, 46, 14, 0.3);
    border-top-color: rgba(212, 113, 51, 0.2);
    position: relative;
    overflow: hidden;
}

.game-banner {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-size: cover;
    background-position: center;
    opacity: 0.3;
    z-index: 0;
}

.game-content {
    position: relative;
    z-index: 1;
    color: var(--color-text-primary);
}

/* ===========================
   Status Circle
   =========================== */
.status-circle {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-left: 5px;
}

.status-online  { background-color: #84cc16; }  /* lime-500 */
.status-offline { background-color: #b91c1c; }  /* red-700 */
.status-idle    { background-color: #f59e0b; }  /* amber-500 */

/* ===========================
   Tab Styles
   =========================== */
.tab-button {
    padding: 0.5rem 1rem;
    font-weight: 600;
    font-size: 0.875rem;
    font-family: var(--font-condensed);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-primary);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: color var(--transition-duration), border-color var(--transition-duration), background-color var(--transition-duration);
}

.tab-button:hover {
    color: var(--color-secondary);
}

.tab-button.active {
    color: var(--color-secondary);
    border-bottom: 2px solid var(--color-secondary);
}

.tab-button.inactive {
    color: var(--color-text-muted);
    background-color: var(--color-surface-400);
}

.tab-button.inactive:hover {
    background-color: var(--color-surface-200);
    color: var(--color-text-primary);
}

/* ===========================
   Feature Card
   =========================== */
.feature-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background-color: var(--color-surface-300);
    padding: 20px;
    border: 1px solid rgba(110, 46, 14, 0.3);
    border-top-color: rgba(212, 113, 51, 0.2);
    border-radius: var(--radius-lg);
    box-shadow: var(--box-shadow);
    cursor: pointer;
}

.feature-card:hover {
    transform: scale(1.04);
    box-shadow: 0 10px 22px rgba(181, 86, 31, 0.18), 0 2px 10px rgba(0, 0, 0, 0.45);
    border-color: rgba(212, 113, 51, 0.45);
}

/* ===========================
   Fade-up Effect
   =========================== */
.fade-up {
    opacity: 0;
    transform: translateY(50px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.fade-up.active {
    opacity: 1;
    transform: translateY(0);
}

/* ===========================
   Icon Bounce
   =========================== */
.icon-bounce:hover {
    animation: bounce var(--animation-duration-fast) infinite;
}

/* ===========================
   Gradient Text — rust palette
   =========================== */
.gradient-text {
    font-size: 1.2rem;
    font-style: italic;
    background: linear-gradient(270deg, #d47133, #b5561f, #f97316, #923f14, #d47133);
    background-size: 200% 200%;
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    animation: gradientAnimation var(--animation-duration-medium) ease infinite;
    display: inline-block;
}

.gradient-text-colorful {
    font-size: 1.2rem;
    font-style: italic;
    background: linear-gradient(45deg, #f97316, #fbbf24, #b5561f, #7f1d1d);
    background-size: 300% 300%;
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    animation: gradientAnimation var(--animation-duration-slow) ease infinite;
    display: inline-block;
}

/* ===========================
   Responsive Design
   =========================== */
@media (max-width: 600px) {
    .container {
        width: 95%;
        margin: 40px auto;
        padding: 20px;
    }

    .tab-button {
        padding: 0.5rem;
        font-size: 0.75rem;
    }

    .feature-card {
        padding: 15px;
    }
}

/* ===========================
   Utility Classes
   =========================== */
.text-center { text-align: center; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }

.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }

.text-white { color: var(--color-white); }
.text-khaki { color: var(--color-khaki); }
.text-error { color: var(--color-error); }

.bg-primary   { background-color: var(--color-primary); }
.bg-secondary { background-color: var(--color-secondary); }

html {
    scroll-behavior: smooth;
}

/* Loading Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(164, 107, 65, 0.3);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Tooltip */
.tooltip {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--color-surface-600);
    color: var(--color-text-primary);
    border: 1px solid rgba(110, 46, 14, 0.6);
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s var(--transition-ease);
    z-index: 10;
    font-family: var(--font-condensed);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.tooltip:hover::after {
    opacity: 1;
}

/* Card Flip Animation */
.flip-card {
    background-color: transparent;
    perspective: 1000px;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.flip-card:hover .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card-front, .flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: var(--radius-lg);
}

.flip-card-front {
    background-color: var(--color-surface-300);
    color: var(--color-text-primary);
    border: 1px solid rgba(110, 46, 14, 0.35);
    box-shadow: var(--box-shadow);
}

.flip-card-back {
    background-color: var(--color-primary);
    color: #fff1e6;
    transform: rotateY(180deg);
    box-shadow: var(--box-shadow);
}

/* ===========================
   Rust-flavor utilities
   =========================== */

/* Weathered panel — default card treatment with inner highlight + outer shadow */
.rust-panel {
    background: linear-gradient(180deg, rgba(58, 42, 28, 0.65) 0%, rgba(36, 24, 16, 0.85) 100%);
    border: 1px solid rgba(164, 107, 65, 0.18);
    border-top-color: rgba(212, 113, 51, 0.28);
    border-radius: var(--radius-lg);
    box-shadow:
        0 6px 20px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 211, 160, 0.04);
    backdrop-filter: blur(6px);
    position: relative;
}

/* Rivet border — decorative dots at four corners via single pseudo-element + box-shadow */
.rivet-border {
    position: relative;
}
.rivet-border::before {
    content: "";
    position: absolute;
    top: 8px;
    left: 8px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: radial-gradient(circle, #7a5a3f 0%, #2a1a0c 70%);
    box-shadow:
        calc(100% + 4px) 0 0 0 #2a1a0c,
        0 calc(100% + 4px) 0 0 #2a1a0c,
        calc(100% + 4px) calc(100% + 4px) 0 0 #2a1a0c;
    pointer-events: none;
}
.rivet-border.rivet-border--inset::before {
    top: 6px;
    left: 6px;
}

/* Stencil text — reserved for hero titles + error codes */
.stencil-text {
    font-family: var(--font-display);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: linear-gradient(180deg, #e88b52 0%, #b5561f 55%, #6e2e0e 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 2px 0 rgba(0,0,0,0.55)) drop-shadow(0 0 8px rgba(181, 86, 31, 0.25));
}

/* Hazard-stripe divider — yellow + black diagonals */
.warning-stripe {
    height: 6px;
    width: 100%;
    background: repeating-linear-gradient(
        45deg,
        #f59e0b 0,
        #f59e0b 12px,
        #1a120b 12px,
        #1a120b 24px
    );
    border-top: 1px solid rgba(0, 0, 0, 0.5);
    border-bottom: 1px solid rgba(0, 0, 0, 0.5);
    opacity: 0.85;
}

/* Primary CTA — squared, bolted, brick-orange */
.rust-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: linear-gradient(180deg, #c46325 0%, #923f14 100%);
    color: #fff1e6;
    font-family: var(--font-condensed);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border: 1px solid #6e2e0e;
    border-top-color: #d47133;
    border-radius: var(--radius-md);
    padding: 0.65rem 1.25rem;
    box-shadow:
        0 2px 0 rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 210, 170, 0.18);
    transition: background 0.2s var(--transition-ease), transform 0.1s, box-shadow 0.15s;
    cursor: pointer;
    text-decoration: none;
    width: auto;
}
.rust-btn:hover  {
    background: linear-gradient(180deg, #d47133 0%, #b5561f 100%);
    color: #fff1e6;
}
.rust-btn:active {
    transform: translateY(1px);
    box-shadow: 0 0 0 rgba(0,0,0,0), inset 0 2px 4px rgba(0,0,0,0.4);
}
.rust-btn--danger {
    background: linear-gradient(180deg, #dc2626 0%, #7f1d1d 100%);
    border-color: #450a0a;
    border-top-color: #ef4444;
}
.rust-btn--danger:hover {
    background: linear-gradient(180deg, #ef4444 0%, #b91c1c 100%);
}
.rust-btn--ghost {
    background: transparent;
    color: var(--color-secondary);
    border-color: rgba(212, 113, 51, 0.4);
    box-shadow: none;
}
.rust-btn--ghost:hover {
    background: rgba(181, 86, 31, 0.1);
    color: var(--color-secondary);
    border-color: rgba(212, 113, 51, 0.7);
}

/* Ember ambient glow — optional hero accent */
.ember-glow {
    text-shadow:
        0 0 6px rgba(249, 115, 22, 0.25),
        0 0 18px rgba(181, 86, 31, 0.18),
        0 2px 0 rgba(0, 0, 0, 0.55);
}
