/*
 * CaseUP Tactical design system.
 * Graphite HUD surfaces, CS2 amber accent, skin-rarity colours as secondary semantics,
 * chamfered corners instead of round ones, monospaced numbers.
 * Legacy token names (--bg, --primary, --text…) are kept so module styles and themes keep working.
 */
:root {
    color-scheme: dark;

    /* surfaces */
    --bg: #0b0e13;
    --bg-elevated: #10141b;
    --bg-soft: #141922;
    --panel: #141922;
    --panel-2: #1a202b;
    --panel-3: #222937;
    --surface: rgba(231, 235, 241, 0.035);
    --surface-strong: rgba(231, 235, 241, 0.06);
    --grid-line: rgba(231, 235, 241, 0.028);

    /* text */
    --text: #e7ebf1;
    --text-soft: #b6bfcc;
    --text-muted: #7d8796;

    /* accent: CS2 amber */
    --accent: #f5a623;
    --accent-hot: #ff7a1a;
    --accent-soft: rgba(245, 166, 35, 0.14);
    --accent-ink: #1a1203;
    --primary: var(--accent);
    --primary-hover: #ffb94a;
    --secondary: #1a202b;
    --border: rgba(231, 235, 241, 0.08);
    --border-strong: rgba(231, 235, 241, 0.14);

    /* market semantics */
    --success: #3ddc84;
    --warning: #f5a623;
    --danger: #ff5d5d;
    --info: #5e98d9;
    --up: var(--success);
    --down: var(--danger);

    /* CS2 rarity palette */
    --rarity-consumer: #b0c3d9;
    --rarity-industrial: #5e98d9;
    --rarity-milspec: #4b69ff;
    --rarity-restricted: #8847ff;
    --rarity-classified: #d32ce6;
    --rarity-covert: #eb4b4b;
    --rarity-contraband: #e4ae39;

    /* type */
    --font-display: "Exo 2", "Arial Narrow", system-ui, sans-serif;
    --font-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;

    --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.45);
    --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.32);

    --radius-lg: 6px;
    --radius-md: 6px;
    --radius-sm: 4px;
    --cut: 12px;
    --cut-sm: 8px;

    --container: 1240px;

    --space-1: 8px;
    --space-2: 12px;
    --space-3: 16px;
    --space-4: 24px;
    --space-5: 32px;
    --space-6: 48px;
    --space-7: 64px;
    --space-8: 96px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    background-color: var(--bg);
    background-image:
        radial-gradient(ellipse 70% 420px at 50% -80px, rgba(245, 166, 35, 0.10), transparent 70%),
        linear-gradient(var(--grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
    background-size: 100% 100%, 48px 48px, 48px 48px;
    background-position: 0 0, -1px -1px, -1px -1px;
    background-attachment: fixed;
    color: var(--text);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: 0.01em;
    text-wrap: balance;
}

h1 {
    font-weight: 800;
    font-style: italic;
    text-transform: uppercase;
    letter-spacing: -0.005em;
    line-height: 1;
}

::selection {
    background: rgba(245, 166, 35, 0.35);
    color: #fff;
}

a {
    color: inherit;
    text-decoration: none;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

img {
    display: block;
    max-width: 100%;
}

code,
kbd,
.mono,
.metric,
.farm-mono {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--panel-3);
    border: 2px solid var(--bg);
}

::-webkit-scrollbar-thumb:hover {
    background: #2e3646;
}

.cut {
    clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut));
}

.container {
    width: min(100% - 32px, var(--container));
    margin: 0 auto;
}

.text-muted {
    color: var(--text-muted);
}

.text-up {
    color: var(--up);
}

.text-down {
    color: var(--down);
}

.section {
    padding: var(--space-7) 0;
}

.section--compact {
    padding-top: 0;
}

.section-heading {
    max-width: 760px;
    margin-bottom: var(--space-5);
}

.section-heading h1,
.section-heading h2 {
    margin: 12px 0;
    font-size: clamp(1.8rem, 3vw, 2.6rem);
    font-weight: 800;
    font-style: italic;
    text-transform: uppercase;
    line-height: 1;
    letter-spacing: -0.005em;
}

.page-header {
    max-width: 760px;
    margin-bottom: var(--space-5);
}

.page-title {
    margin: 12px 0;
    font-size: clamp(2rem, 3vw, 3rem);
    line-height: 1;
}

.page-title--sm {
    margin-bottom: 10px;
    font-size: clamp(1.8rem, 3vw, 2.4rem);
}

.page-description {
    max-width: 720px;
}

.section-title {
    margin: 0 0 16px;
    font-size: 1.05rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.section-head-inline {
    display: flex;
    justify-content: space-between;
    gap: var(--space-3);
    align-items: center;
    margin-bottom: 16px;
}

.section-head-inline--subtle {
    margin-top: -4px;
    margin-bottom: 4px;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 24px;
    padding: 0;
    background: none;
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 0.74rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.eyebrow::before {
    content: "";
    width: 22px;
    height: 2px;
    background: currentColor;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 8px;
    border: 1px solid rgba(61, 220, 132, 0.45);
    border-radius: 2px;
    background: rgba(61, 220, 132, 0.08);
    color: var(--success);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-3);
}

.card {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: linear-gradient(180deg, rgba(26, 32, 43, 0.92), rgba(20, 25, 34, 0.92));
    box-shadow: var(--shadow-md);
}

.card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 22px;
    height: 2px;
    background: var(--accent);
    opacity: 0.85;
    pointer-events: none;
}

.card--soft {
    background: rgba(20, 25, 34, 0.7);
    box-shadow: none;
}

.card--soft::before {
    display: none;
}

.card-header {
    padding: var(--space-4) var(--space-4) 0;
}

.card-body {
    padding: var(--space-4);
}

.card h3 {
    margin-top: 0;
    font-size: 1.05rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.feature-list {
    margin: 0;
    padding-left: 0;
    list-style: none;
    color: var(--text-soft);
}

.feature-list li {
    position: relative;
    padding-left: 20px;
}

.feature-list li::before {
    content: "";
    position: absolute;
    left: 2px;
    top: 0.62em;
    width: 7px;
    height: 7px;
    background: var(--accent);
    transform: rotate(45deg);
}

.feature-list li + li,
.feature-list--tight li + li {
    margin-top: 10px;
}

.btn {
    --btn-cut: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 20px;
    border: 0;
    border-radius: 0;
    clip-path: polygon(var(--btn-cut) 0, 100% 0, 100% calc(100% - var(--btn-cut)), calc(100% - var(--btn-cut)) 100%, 0 100%, 0 var(--btn-cut));
    cursor: pointer;
    font-family: var(--font-display);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    white-space: nowrap;
    transition: filter 0.15s ease, background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.btn:disabled,
.btn[aria-disabled="true"] {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(180deg, var(--accent), var(--accent-hot));
    color: var(--accent-ink);
}

.btn-primary:hover {
    background: linear-gradient(180deg, var(--primary-hover), var(--accent));
    filter: brightness(1.05);
}

.btn-secondary {
    background: var(--panel-2);
    box-shadow: inset 0 0 0 1px var(--border-strong);
    color: var(--text);
}

.btn-secondary:hover {
    background: var(--panel-3);
    box-shadow: inset 0 0 0 1px rgba(245, 166, 35, 0.45);
}

.btn-danger {
    background: rgba(255, 93, 93, 0.14);
    box-shadow: inset 0 0 0 1px rgba(255, 93, 93, 0.45);
    color: #ffb1b1;
}

.btn-danger:hover {
    background: rgba(255, 93, 93, 0.22);
}

.btn-ghost {
    background: transparent;
    box-shadow: inset 0 0 0 1px var(--border-strong);
    color: var(--text-soft);
}

.btn-ghost:hover {
    color: var(--text);
    box-shadow: inset 0 0 0 1px rgba(245, 166, 35, 0.45);
}

.btn-sm {
    --btn-cut: 6px;
    min-height: 36px;
    padding: 0 14px;
    font-size: 0.74rem;
}

.btn svg {
    width: 16px;
    height: 16px;
    flex: none;
}

.btn-block {
    width: 100%;
}

.inline-form {
    margin: 0;
}

.inline-form--block {
    display: block;
}

.btn:focus-visible {
    outline: none;
    box-shadow: inset 0 0 0 2px var(--text);
}

.metric {
    margin: 12px 0 0;
    font-size: 1.9rem;
    font-weight: 700;
    line-height: 1;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid var(--border-strong);
    border-radius: 2px;
    background: rgba(9, 11, 15, 0.45);
    color: var(--text-soft);
    font-family: var(--font-mono);
    font-size: 0.84rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.status-pill--sm {
    min-height: 30px;
    padding: 0 10px;
    font-size: 0.76rem;
}

.table-wrap {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.93rem;
}

.table th,
.table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table thead th {
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    white-space: nowrap;
}

.table td {
    font-variant-numeric: tabular-nums;
}

.table tbody tr:hover,
.table--dark tbody tr:hover {
    background: rgba(231, 235, 241, 0.03);
}

.table-link {
    color: inherit;
    text-decoration: none;
    font-weight: 700;
}

.table-link:hover {
    color: var(--text);
    text-decoration: underline;
}

.empty-state {
    margin: 0;
}

.pagination-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 24px;
}

.messages-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.flash {
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-left: 3px solid var(--info);
    border-radius: 2px;
    background: var(--panel);
}

.flash--warning {
    border-left-color: var(--warning);
}

.flash--success {
    border-color: rgba(61,220,132, 0.28);
    border-left-color: var(--success);
    background: rgba(61,220,132, 0.10);
}

.flash--error,
.flash--danger {
    border-color: rgba(255,93,93, 0.28);
    border-left-color: var(--danger);
    background: rgba(255,93,93, 0.10);
}

.lang-switcher-wrap {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.lang-switcher {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
    padding: 4px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.04);
}

.lang-switcher__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-width: 0;
    min-height: 34px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text-soft);
    cursor: pointer;
    font-weight: 700;
    text-decoration: none;
    transition: 0.2s ease;
}

.lang-switcher__btn:hover {
    background: rgba(245,166,35, 0.10);
    color: #fff;
}

.lang-switcher__btn.is-active {
    background: var(--primary);
    color: var(--accent-ink);
}

.lang-switcher__note {
    margin: 0;
    padding-left: 6px;
    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1.35;
}

.form-stack {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.form-field,
.investment-toolbar__field,
.investment-toolbar__search,
.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-field label,
.form-label {
    color: var(--text-soft);
    font-size: 0.86rem;
    font-weight: 600;
}

.form-control,
.form-field input:not([type="checkbox"]):not([type="radio"]),
.form-field select,
.form-field textarea,
.form-group input:not([type="checkbox"]):not([type="radio"]),
.form-group select,
.form-group textarea {
    width: 100%;
    min-height: 44px;
    padding: 0 14px;
    border: 1px solid var(--border-strong);
    border-radius: 2px;
    background: rgba(9, 11, 15, 0.55);
    color: var(--text);
    font: inherit;
    appearance: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus,
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus,
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(245, 166, 35, 0.18);
}

.form-control::placeholder,
.form-field input::placeholder,
.form-field textarea::placeholder {
    color: var(--text-muted);
}

textarea.form-control,
.form-field textarea,
.form-group textarea {
    min-height: 120px;
    padding: 14px;
    resize: vertical;
}

.form-field select,
.form-group select {
    padding-right: 42px;
    background-image:
        linear-gradient(45deg, transparent 50%, #b6bfcc 50%),
        linear-gradient(135deg, #b6bfcc 50%, transparent 50%);
    background-position:
        calc(100% - 18px) calc(50% - 3px),
        calc(100% - 12px) calc(50% - 3px);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
}

.form-field select option,
.form-group select option {
    background: #141922;
    color: #e7ebf1;
}

.form-field ul,
.form-errors ul {
    margin: 0;
    padding-left: 18px;
    color: #ffb4b4;
}

.toggle-field {
    gap: 12px;
}

.toggle-control {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    width: fit-content;
    cursor: pointer;
    user-select: none;
}

.toggle-control__input {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

.toggle-control__track {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    width: 52px;
    height: 30px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.toggle-control__track::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #e7ebf1;
    box-shadow: 0 6px 16px rgba(16,20,27, 0.28);
    transition: transform 0.2s ease;
}

.toggle-control__input:checked + .toggle-control__track {
    background: rgba(247,180,70, 0.35);
    border-color: rgba(250,192,92, 0.72);
}

.toggle-control__input:checked + .toggle-control__track::after {
    transform: translateX(22px);
}

.toggle-control__input:focus-visible + .toggle-control__track {
    box-shadow: 0 0 0 4px rgba(247,180,70, 0.18);
}

.toggle-control__text {
    font-weight: 600;
    color: var(--text-soft);
}

.form-errors,
.form-error,
.faceit-error {
    padding: 12px 14px;
    border: 1px solid rgba(255,93,93, 0.28);
    border-radius: 6px;
    background: rgba(255,93,93, 0.08);
    color: #ffd4d4;
}

.auth-section {
    padding: var(--space-7) 0;
}

.auth-grid {
    display: grid;
    gap: var(--space-4);
}

.auth-grid--single {
    max-width: 620px;
}

.auth-card__body {
    padding: var(--space-5);
}

.auth-title {
    margin: 16px 0 12px;
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: 1.05;
    letter-spacing: -0.04em;
}

.auth-description {
    margin-bottom: var(--space-4);
}

.auth-actions--stack,
.auth-card__actions,
.dashboard-form-grid,
.form-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-links {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: var(--space-4);
}

.auth-links a {
    color: #ffd08a;
    font-weight: 600;
}

.auth-card__title {
    margin: 0 0 6px;
    font-size: 1.125rem;
    font-weight: 700;
}

.auth-card__meta,
.dashboard-auth {
    margin: 0 0 16px;
}

.profile-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-4);
    margin-top: var(--space-4);
}

.profile-grid--3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.profile-history {
    margin-top: var(--space-4);
}

.profile-hero__body {
    display: flex;
    justify-content: space-between;
    gap: var(--space-4);
    align-items: flex-start;
}

.profile-hero__main {
    flex: 1;
}

.profile-hero__subtitle {
    max-width: 720px;
    margin-bottom: 0;
}

.profile-hero__aside,
.profile-badges {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.profile-badges {
    min-width: 240px;
    gap: 12px;
}

.profile-avatar {
    width: 96px;
    height: 96px;
    border: 1px solid var(--border);
    border-radius: 6px;
    object-fit: cover;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

.profile-avatar--lg {
    width: 160px;
    height: 160px;
}

.profile-hero__quick-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 20px;
}

.details-list {
    display: grid;
    gap: 0;
    margin: 0;
}

.details-list div {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.details-list div:last-child {
    border-bottom: 0;
}

.details-list dt {
    flex: none;
    color: var(--text-muted);
    font-size: 0.86rem;
}

.details-list dd {
    min-width: 0;
    margin: 0;
    font-size: 0.92rem;
    font-weight: 600;
    text-align: right;
    overflow-wrap: anywhere;
}

.details-list--compact div {
    padding: 8px 0;
}

.dashboard-actions,
.farm-mini-stats {
    margin: var(--space-4) 0;
}

.farm-item-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.farm-item-cell__image {
    width: 48px;
    height: 48px;
    border: 1px solid var(--border);
    border-radius: 6px;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.04);
    padding: 6px;
}

.farm-item-cell__content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.farm-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 18px;
}

.farm-mono {
    font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
    font-size: 0.92rem;
}

.farm-break {
    word-break: break-all;
}

.value-positive {
    color: #b7ffd0 !important;
}

.value-negative {
    color: #ffb8b8 !important;
}

@media (max-width: 1180px) {
    .profile-grid--3 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 960px) {
    .cards-grid,
    .stats-grid,
    .profile-grid,
    .profile-grid--3 {
        grid-template-columns: 1fr;
    }

    .nav-links--auth {
        margin-left: 0;
    }

    .profile-hero__body,
    .section-head-inline,
    .profile-hero__aside,
    .profile-badges {
        flex-direction: column;
        align-items: flex-start;
    }

    .profile-badges,
    .profile-hero__quick-meta {
        min-width: 0;
        width: 100%;
    }
}

/* Steam login consent (accounts/login.html) */
.auth-consent {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 8px;
}

.auth-consent__title {
    margin: 0;
    color: var(--text);
    font-weight: 600;
}

.auth-consent__item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    background: rgba(9, 11, 15, 0.35);
    color: var(--text-soft);
    font-size: 0.86rem;
    line-height: 1.45;
    cursor: pointer;
}

.auth-consent__item input {
    flex: none;
    width: 18px;
    height: 18px;
    margin: 1px 0 0;
    accent-color: var(--accent);
    cursor: pointer;
}

.auth-consent__item a {
    color: var(--accent);
}

.auth-consent__item.is-invalid {
    border-color: var(--danger);
}

.auth-consent__error {
    margin: -4px 0 0;
    color: var(--danger);
    font-size: 0.8rem;
}

.auth-consent__alert {
    margin-bottom: 4px;
    padding: 10px 12px;
    border: 1px solid var(--accent);
    background: var(--accent-soft);
    color: var(--text);
    font-size: 0.86rem;
}

/* The Steam button looks inactive until both boxes are ticked; the server checks them anyway. */
.auth-consent:has(input[type="checkbox"]:not(:checked)) .auth-consent__submit {
    opacity: 0.55;
    filter: saturate(0.6);
}
