/* =====================================================================
   RUST IDLE · Modern Rust theme
   Loaded after tailwind.css so it refines every page element.
   Keeps the Rust identity (Teko type, olive craft buttons, rust red,
   hazard stripes, scrap-metal surfaces) with a cleaner, modern finish:
   softer depth, rounded corners, glass bars and clear focus states.
   ===================================================================== */

:root {
    /* Surfaces: cool gunmetal with a warm rust undertone */
    --bg-0: #0b0b0c;
    --bg-1: #111113;
    --bg-2: #17171a;
    --surface: #1d1d21;
    --surface-2: #25252a;
    --line: #313137;
    --line-2: #45454d;

    /* Text */
    --text: #e3dfd4;
    --text-hi: #f2eee4;
    --muted: #9a958a;
    --muted-2: #6f6b63;

    /* Rust signature colors */
    --accent: #f0a53a;            /* sodium-lamp amber */
    --accent-rgb: 240, 165, 58;
    --rust: #e0522f;              /* oxidised rust red */
    --rust-rgb: 224, 82, 47;
    --green: #8cc152;             /* craft-menu green */
    --green-rgb: 140, 193, 82;
    --btn: #55702a;
    --btn-hi: #6c8c36;
    --btn-lo: #3c501c;

    /* Shape and depth */
    --r-sm: 6px;
    --r: 10px;
    --r-lg: 14px;
    --r-xl: 18px;
    --shadow-1: 0 1px 2px rgba(0,0,0,0.4), 0 4px 12px rgba(0,0,0,0.25);
    --shadow-2: 0 2px 4px rgba(0,0,0,0.35), 0 12px 32px rgba(0,0,0,0.45);
    --shadow-3: 0 24px 64px rgba(0,0,0,0.6);
    --edge: inset 0 1px 0 rgba(255,255,255,0.045);
    --ease: cubic-bezier(.2,.8,.2,1);

    --hazard-edge: repeating-linear-gradient(-45deg, var(--accent) 0 8px, #141414 8px 16px);
    color-scheme: dark;
}

/* ---------- Base ---------- */
html { background: var(--bg-1); scrollbar-color: var(--line-2) transparent; }
body {
    background-color: var(--bg-1);
    background-image:
        radial-gradient(1200px 600px at 50% -10%, rgba(var(--rust-rgb), 0.13), transparent 60%),
        radial-gradient(900px 500px at 100% 110%, rgba(var(--accent-rgb), 0.06), transparent 60%),
        linear-gradient(rgba(255,255,255,0.018) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.018) 1px, transparent 1px);
    background-size: auto, auto, 40px 40px, 40px 40px;
    background-attachment: fixed;
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}
::selection { background: rgba(var(--accent-rgb), 0.35); color: #fff; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--muted-2); background-clip: padding-box; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button { transition: background-color .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease), box-shadow .2s var(--ease), filter .15s var(--ease); }

/* ---------- Panels: brushed scrap metal ---------- */
.rust-panel {
    position: relative;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.025), transparent 120px),
        var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--edge), var(--shadow-2);
}

/* ---------- Buttons: the green Rust craft button, refined ---------- */
.rust-btn {
    transition: background .15s var(--ease), box-shadow .2s var(--ease), transform .12s var(--ease);
    background: linear-gradient(180deg, var(--btn-hi) 0%, var(--btn) 55%, var(--btn-lo) 100%);
    border: 1px solid #7d9c44;
    border-radius: var(--r-sm);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.18), 0 2px 0 rgba(0,0,0,0.45), 0 4px 10px rgba(0,0,0,0.25);
    text-shadow: 0 1px 1px rgba(0,0,0,0.6);
}
.rust-btn:hover:not(:disabled) {
    background: linear-gradient(180deg, #7b9d40 0%, #61802f 55%, #455c20 100%);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.22), 0 2px 0 rgba(0,0,0,0.45), 0 6px 18px rgba(var(--green-rgb), 0.22);
    transform: translateY(-1px);
}
.rust-btn:active:not(:disabled) {
    transform: translateY(1px);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.35);
}
.rust-btn:disabled {
    background: var(--surface-2);
    border-color: var(--line);
    color: var(--muted-2);
    box-shadow: none;
    transform: none;
}
.furnace-btn { background: linear-gradient(180deg, #a2491a, #7a3410 60%, #5c260b); border-color: #e0702a; }
.furnace-btn:hover:not(:disabled) { background: linear-gradient(180deg, #b95621, #8f4214 60%, #6a2c0d); box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 6px 18px rgba(224,112,42,0.3); }
.collection-redeem-btn { background: linear-gradient(180deg, #c9961c, #a67c00 60%, #7d5d00); border-color: var(--accent); }
.collection-redeem-btn:hover:not(:disabled) { background: linear-gradient(180deg, #ddaa2a, #b88a00 60%, #8a6700); }

/* ---------- Header: frosted glass with a hazard-stripe edge ---------- */
.rust-header {
    background: rgba(14,14,16,0.78);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    backdrop-filter: blur(16px) saturate(140%);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 10px 30px rgba(0,0,0,0.45);
}
.rust-header::after {
    content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; pointer-events: none;
    background: var(--hazard-edge);
    -webkit-mask: linear-gradient(90deg, transparent, #000 15%, #000 85%, transparent);
    mask: linear-gradient(90deg, transparent, #000 15%, #000 85%, transparent);
    opacity: 0.85;
}
.rust-header h1 {
    background: linear-gradient(180deg, #ffd27a 0%, var(--accent) 45%, var(--rust) 100%);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: none !important;
    filter: drop-shadow(0 2px 6px rgba(var(--rust-rgb), 0.35));
}

/* Header chips share one rounded, quiet style */
.resource-bar { border-radius: var(--r); border-width: 1px !important; overflow: hidden; background: rgba(0,0,0,0.35) !important; box-shadow: var(--edge), inset 0 1px 6px rgba(0,0,0,0.4); }
.resource-cell + .resource-cell { border-left-color: var(--line); }
.level-chip, .account-btn, .help-toggle, .volume-ctl, .welcome-toggle, .prestige-letter {
    border-radius: var(--r);
    border-width: 1px;
}
.level-chip, .account-btn { background: rgba(0,0,0,0.35); box-shadow: var(--edge); }
.help-toggle, .volume-ctl { background: var(--surface); box-shadow: var(--edge); }
.welcome-toggle {
    background: linear-gradient(180deg, #ffc35c, var(--accent) 60%, #d98a1e);
    border-color: #ffd27a; color: #17120a;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.35), 0 4px 14px rgba(var(--accent-rgb), 0.35);
}
.welcome-toggle:hover { filter: brightness(1.06); background: linear-gradient(180deg, #ffcc70, #f5ae48 60%, #e0952a); }
.level-bar { border-radius: 999px; background: rgba(255,255,255,0.07); }
.level-bar-fill { border-radius: 999px; box-shadow: 0 0 8px var(--lvl, transparent); }
.level-panel, .welcome-panel {
    border-radius: var(--r-lg);
    border-width: 1px;
    box-shadow: var(--shadow-3);
}

/* ---------- Tabs: segmented control ---------- */
.tab-bar { gap: 0.35rem; }
.game-tab {
    background: rgba(255,255,255,0.025);
    border: 1px solid var(--line);
    border-radius: var(--r);
    color: var(--muted);
    box-shadow: var(--edge);
}
.game-tab:hover { color: var(--text-hi); background: rgba(255,255,255,0.05); border-color: var(--line-2); }
.game-tab[aria-selected="true"] {
    color: var(--accent);
    border-color: rgba(var(--accent-rgb), 0.55);
    background: linear-gradient(180deg, rgba(var(--accent-rgb), 0.16), rgba(var(--accent-rgb), 0.04));
    box-shadow: inset 0 -3px 0 var(--accent), 0 0 0 1px rgba(var(--accent-rgb), 0.15), 0 6px 18px rgba(var(--accent-rgb), 0.12);
}
.inventory-view, .storage-box, .auction-filter { border-radius: var(--r-sm); }
.storage-box[aria-selected="true"], .inventory-view[aria-selected="true"], .auction-filter[aria-checked="true"] { background: rgba(var(--accent-rgb), 0.1); }

/* ---------- Skin cards and reels ---------- */
.skin-card {
    background: linear-gradient(180deg, var(--surface-2) 0%, var(--bg-2) 100%);
    border: 1px solid var(--line);
    border-bottom: 3px solid var(--rarity);
    border-radius: var(--r);
    box-shadow: var(--edge), 0 2px 8px rgba(0,0,0,0.3);
    transition: transform .18s var(--ease), box-shadow .2s var(--ease), border-color .2s var(--ease);
}
.skin-card::selection { background: transparent; }
@media (hover: hover) {
    .storage-grid .skin-card:hover, #inventoryList .skin-card:hover, .collection-grid .skin-card:hover {
        transform: translateY(-2px);
        box-shadow: var(--edge), 0 10px 22px rgba(0,0,0,0.45), 0 0 0 1px color-mix(in srgb, var(--rarity, var(--line)) 40%, transparent);
    }
}
.skin-card.tiered { border-bottom-width: 3px; }
.skin-card.is-fav { outline-offset: -1px; }
.golden-tag, .storage-stack-count { border-radius: 4px; }
.fav-btn { border-radius: var(--r-sm); backdrop-filter: blur(4px); }
.collection-slot { border-radius: var(--r-sm); }
.mini { border-radius: var(--r-sm); }

.reel-window {
    background: radial-gradient(ellipse at center, #121214 0%, #08080a 100%);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: inset 0 0 40px rgba(0,0,0,0.9), var(--edge);
}
.reel-window::before { background: linear-gradient(90deg, #08080a, transparent); }
.reel-window::after { background: linear-gradient(-90deg, #08080a, transparent); }
.reel-marker {
    width: 2px; margin-left: -1px;
    background: linear-gradient(180deg, transparent, var(--accent) 12%, var(--accent) 88%, transparent);
    box-shadow: 0 0 12px var(--accent), 0 0 24px rgba(var(--accent-rgb), 0.5);
}

/* ---------- Common game blocks ---------- */
.auction-card, .trade-card, .battle-card, .raid-base-card, .raid-step, .welcome-step,
.jp-card, .flip-row, .keno-pay, .rain-card-me > div, .battle-seat {
    border-radius: var(--r);
}
.auction-card, .trade-card, .battle-card, .raid-base-card, .welcome-step { border-width: 1px; box-shadow: var(--edge); }
.raid-step { border-width: 1px; }
.furnace-panel { border-radius: var(--r-lg); border-width: 1px; box-shadow: var(--edge), var(--shadow-2), inset 0 -40px 80px -40px rgba(224,112,42,0.18); }
.raid-hp-bar { border-radius: 999px; }
.mine-tile, .keno-tile { border-radius: var(--r-sm); }
.play-card { border-radius: 8px; }
.auction-live, .chat-online { border-radius: 999px; }

/* Welcome and account cards */
.welcome-banner {
    border-radius: var(--r-xl) !important;
    border: 1px solid rgba(var(--accent-rgb), 0.55);
    background:
        radial-gradient(600px 200px at 0% 0%, rgba(var(--accent-rgb), 0.14), transparent 70%),
        linear-gradient(180deg, var(--surface-2), var(--surface));
    box-shadow: var(--edge), var(--shadow-3), 0 0 0 1px rgba(0,0,0,0.4);
}
.welcome-step-num { border-radius: 999px; }
.account-overlay { background: rgba(5,5,6,0.7); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.account-overlay.gate { background: rgba(8,8,9,0.82); }
.account-input { border-radius: var(--r-sm); }

/* ---------- Dialogs ---------- */
.forge-dialog, .auction-dialog {
    border-radius: var(--r-xl);
    border-width: 1px;
    box-shadow: var(--shadow-3), 0 0 60px rgba(var(--accent-rgb), 0.18);
    overflow: hidden auto;
}
.forge-dialog { box-shadow: var(--shadow-3), 0 0 60px rgba(224,112,42,0.35); }
.forge-dialog::backdrop, .auction-dialog::backdrop, dialog::backdrop {
    background: rgba(5,5,6,0.7);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

/* ---------- Form fields ---------- */
input[type="text"], input[type="number"], input[type="search"], input[type="email"], input[type="password"], select, textarea {
    border-radius: var(--r-sm);
    transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
input[type="text"]:focus, input[type="number"]:focus, input[type="search"]:focus, input[type="email"]:focus, input[type="password"]:focus, select:focus, textarea:focus {
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.18);
}
input[type="range"] { accent-color: var(--accent); }
.toggle-label { border-radius: 999px; border-width: 1px; }
.toggle-knob { border-radius: 999px; border-width: 1px; box-shadow: 0 2px 4px rgba(0,0,0,0.5); }
.toggle-checkbox:checked + .toggle-label { background-color: var(--rust); border-color: #9c2f18; }

/* ---------- Chat ---------- */
.chat-panel {
    background: rgba(18,18,21,0.92);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border-left: 1px solid var(--line);
    box-shadow: -12px 0 40px rgba(0,0,0,0.55);
}
.chat-head { background: linear-gradient(180deg, var(--surface-2), var(--surface)); border-bottom: 1px solid var(--line); }
.chat-settings { border-bottom: 1px solid var(--line); }
.chat-size-btns button { border-radius: var(--r-sm); border-width: 1px; }
.chat-toggle { border-radius: var(--r) 0 0 var(--r); border-width: 1px; border-color: #ffd27a; background: linear-gradient(90deg, #ffc35c, var(--accent)); box-shadow: -4px 0 18px rgba(var(--accent-rgb), 0.25); }
.chat-toggle:hover { background: linear-gradient(90deg, #ffcc70, #f5ae48); }
.chat-unread { border-radius: 999px; }
.chat-rename, .chat-emoji-btn, .chat-jump { border-radius: var(--r-sm); }
.emoji-picker, .color-picker, .emoji-suggest { border-radius: var(--r-lg); box-shadow: var(--shadow-3); overflow: hidden; }
.rain-pill { border-radius: 0; }
.rain-join { border-radius: var(--r); border-width: 1px; box-shadow: 0 6px 18px rgba(124,196,255,0.25); }

/* ---------- Tailwind palette utilities, remapped to the theme ---------- */
.bg-\[\#0a0a09\] { background-color: var(--bg-0); }
.bg-\[\#1a1a17\] { background-color: var(--bg-2); }
.bg-\[\#cd412b\] { background-color: var(--rust); }
.bg-\[\#d4a017\] { background-color: var(--accent); }
.bg-\[\#7cb342\] { background-color: var(--green); }
.border-\[\#3a3831\] { border-color: var(--line); }
.border-\[\#2a2925\] { border-color: var(--surface-2); }
.border-\[\#d4a017\] { border-color: var(--accent); }
.text-\[\#8c8a82\] { color: var(--muted); }
.text-\[\#6b6a63\] { color: var(--muted-2); }
.text-\[\#d1d1c4\] { color: var(--text); }
.text-\[\#d4a017\] { color: var(--accent); }
.text-\[\#7cb342\] { color: var(--green); }
.text-\[\#cd412b\] { color: var(--rust); }
.focus\:border-\[\#d4a017\]:focus { border-color: var(--accent); }
.hover\:border-\[\#7cb342\]:hover { border-color: var(--green); }
.hover\:text-\[\#7cb342\]:hover { color: var(--green); }

/* Boxed areas built from utilities (stat boxes, inputs, lists) get the same soft corners */
.bg-\[\#0a0a09\].border-2, .bg-\[\#1a1a17\].border-2, .bg-\[\#0a0a09\].border, .bg-\[\#1a1a17\].border { border-radius: var(--r-sm); }
.border-2.border-\[\#3a3831\] { border-width: 1px; }
.rounded-sm { border-radius: var(--r-sm); }

/* ---------- Motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
    .rust-btn:hover:not(:disabled), .skin-card:hover { transform: none !important; }
}
