/* Stand UDP panel design system: game-styled dark UI, mobile first */

@font-face {
    font-family: "Eurostile Bold SO2";
    src: url("/assets/fonts/eurostile-bold-so2.woff2") format("woff2");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Eurostile Med SO2";
    src: url("/assets/fonts/eurostile-med-so2.woff2") format("woff2");
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Eurostile SO2";
    src: url("/assets/fonts/eurostile-regular.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

:root {
    --bg: #0b0d11;
    --bg-2: #0f1216;
    --surface: #15181e;
    --surface-2: #1b1f26;
    --surface-3: #232831;
    --surface-4: #2c323c;
    --line: rgba(255, 255, 255, 0.07);
    --line-2: rgba(255, 255, 255, 0.13);
    --text: #f1f3f6;
    --text-2: #a4acb6;
    --text-3: #6d757f;
    --accent: #ff9f2e;
    --accent-2: #f7822a;
    --accent-grad: linear-gradient(180deg, #ffb446 0%, #f7862c 100%);
    --accent-glow: 0 6px 22px rgba(247, 134, 44, 0.28);
    --brand: #e1352b;
    --ct: #4a9bf0;
    --t: #f5a33c;
    --danger: #ef5350;
    --success: #3ec27a;
    --radius-s: 8px;
    --radius: 12px;
    --radius-l: 16px;
    --shadow: 0 12px 34px rgba(0, 0, 0, 0.45);
    --font-head: "Eurostile Bold SO2", "Eurostile Med SO2", "Segoe UI", Arial, sans-serif;
    --font-ui: "Eurostile Med SO2", "Segoe UI", Arial, sans-serif;
    --font-body: "Eurostile SO2", "Eurostile Med SO2", "Segoe UI", Arial, sans-serif;
    --header-h: 64px;
    --tabbar-h: 62px;
    --pad: clamp(12px, 3.2vw, 24px);
    color-scheme: dark;
}

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    background: radial-gradient(1100px 520px at 50% -180px, rgba(247, 134, 44, 0.09), transparent 70%), radial-gradient(900px 600px at 100% 0, rgba(74, 155, 240, 0.05), transparent 60%), var(--bg);
    background-attachment: fixed;
    color: var(--text);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scrollbar-color: #2b313a transparent;
    overflow-x: hidden;
}

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

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

button, input, select, textarea {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
}

[hidden] {
    display: none !important;
}

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

::selection {
    background: rgba(247, 134, 44, 0.35);
}

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

::-webkit-scrollbar-thumb {
    background: #2b313a;
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

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

.container {
    width: 100%;
    max-width: 1320px;
    margin: 0 auto;
    padding-left: var(--pad);
    padding-right: var(--pad);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

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

.dim {
    color: var(--text-3);
}

.mono {
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
    font-size: 13px;
    word-break: break-all;
}

.eyebrow {
    font-family: var(--font-ui);
    font-size: 12px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--text-3);
}

.h1, .h2, .h3 {
    font-family: var(--font-head);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    margin: 0;
    line-height: 1.1;
}

.h1 {
    font-size: clamp(24px, 4.6vw, 38px);
}

.h2 {
    font-size: clamp(18px, 3vw, 24px);
}

.h3 {
    font-size: 16px;
}

/* App header: logo, sections and the user menu; on phones the sections move to the bottom tab bar */
.app-header {
    position: sticky;
    top: 0;
    z-index: 40;
    height: var(--header-h);
    background: rgba(11, 13, 17, 0.82);
    backdrop-filter: saturate(140%) blur(14px);
    -webkit-backdrop-filter: saturate(140%) blur(14px);
    border-bottom: 1px solid var(--line);
}

.app-header .container {
    height: 100%;
    display: flex;
    align-items: center;
    gap: 20px;
}

.brand {
    display: flex;
    align-items: center;
    align-self: stretch;
    flex: none;
}

.brand img {
    height: 26px;
    width: auto;
}

.app-nav {
    display: none;
    align-items: stretch;
    gap: 4px;
    height: 100%;
    margin-left: 12px;
}

.app-nav a {
    position: relative;
    display: flex;
    align-items: center;
    padding: 0 14px;
    font-family: var(--font-ui);
    font-size: 13px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-2);
    transition: color 0.15s;
}

.app-nav a:hover {
    color: var(--text);
}

.app-nav a.active {
    color: var(--text);
}

.app-nav a.active::after {
    content: "";
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 0;
    height: 2px;
    background: var(--brand);
    border-radius: 2px 2px 0 0;
}

.header-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.header-actions .dropdown {
    min-width: 0;
}

/* narrow phones: the login shortens with an ellipsis, the language button keeps only the globe */
@media (max-width: 400px) {
    .app-header .container {
        gap: 12px;
    }

    .lang-btn span, .user-btn > svg {
        display: none;
    }

    .lang-btn {
        padding: 0 11px;
    }

    .user-btn {
        gap: 8px;
        padding: 0 10px 0 6px;
    }
}

.user-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    height: 42px;
    padding: 0 12px 0 8px;
    border-radius: 10px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    font-family: var(--font-head);
    font-size: 13px;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    min-width: 0;
    max-width: 220px;
}

.user-btn:hover {
    background: var(--surface-3);
}

.user-btn .avatar {
    flex: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: #fff;
    color: var(--bg);
}

.user-btn .avatar svg {
    width: 18px;
    height: 18px;
}

.user-btn .login {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-btn > svg {
    flex: none;
    width: 16px;
    height: 16px;
    color: var(--text-3);
}

/* Language: a globe with the current code in the header, the list in its menu */
.lang-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 42px;
    padding: 0 11px;
    border-radius: 10px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    color: var(--text-2);
    font-family: var(--font-head);
    font-size: 13px;
    line-height: 1;
    letter-spacing: 0.04em;
}

.lang-btn:hover {
    background: var(--surface-3);
    color: var(--text);
}

.lang-btn svg {
    flex: none;
    width: 18px;
    height: 18px;
}

.menu-lang {
    min-width: 180px;
}

.menu-lang .lang-code {
    flex: none;
    width: 22px;
    color: var(--text-3);
    font-family: var(--font-head);
    font-size: 12px;
}

.menu-lang a.on svg {
    margin-left: auto;
    color: var(--accent);
}

/* Language switch of the pages without a header (sign-in) */
.lang-switch {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 14px);
    right: 16px;
    z-index: 5;
    display: flex;
    gap: 2px;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(21, 24, 30, 0.85);
}

.lang-switch a {
    display: inline-flex;
    align-items: center;
    height: 30px;
    padding: 0 11px;
    border-radius: 7px;
    color: var(--text-3);
    font-family: var(--font-head);
    font-size: 12px;
    line-height: 1;
    letter-spacing: 0.06em;
}

.lang-switch a:hover {
    color: var(--text);
}

.lang-switch a.on {
    background: var(--surface-3);
    color: var(--text);
}

.tabbar a svg, .menu svg, .btn svg {
    flex: none;
}

.menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    min-width: 230px;
    padding: 6px;
    background: var(--surface-2);
    border: 1px solid var(--line-2);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    z-index: 60;
}

.menu a, .menu button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 42px;
    padding: 0 12px;
    border: 0;
    border-radius: 8px;
    background: none;
    text-align: left;
    color: var(--text);
    font-family: var(--font-ui);
}

.menu a:hover, .menu button:hover {
    background: var(--surface-3);
}

.menu .sep {
    height: 1px;
    margin: 6px 4px;
    background: var(--line);
}

.menu svg {
    width: 18px;
    height: 18px;
    color: var(--text-2);
}

.dropdown {
    position: relative;
}

.tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 45;
    display: flex;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(13, 15, 19, 0.94);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
}

.tabbar a {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-family: var(--font-ui);
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-3);
}

.tabbar a svg {
    width: 22px;
    height: 22px;
}

.tabbar a.active {
    color: var(--text);
}

.tabbar a.active svg {
    color: var(--accent);
}

.page {
    padding-top: 20px;
    padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 28px);
}

.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px 20px;
    margin-bottom: 18px;
}

.page-head .eyebrow {
    margin-bottom: 6px;
}

@media (min-width: 820px) {
    .app-nav {
        display: flex;
    }

    .tabbar {
        display: none;
    }

    .page {
        padding-top: 28px;
        padding-bottom: 48px;
    }

    .brand img {
        height: 30px;
    }
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 44px;
    padding: 0 18px;
    border: 1px solid transparent;
    border-radius: var(--radius-s);
    font-family: var(--font-head);
    font-size: 14px;
    line-height: 1;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
    user-select: none;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s, filter 0.15s, transform 0.08s, box-shadow 0.15s;
}

.btn:active {
    transform: translateY(1px);
}

.btn:disabled {
    opacity: 0.45;
    pointer-events: none;
}

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

.btn-primary {
    background: var(--accent-grad);
    color: #fff;
    text-shadow: 0 1px 0 rgba(120, 50, 0, 0.35);
    box-shadow: var(--accent-glow);
}

.btn-primary:hover {
    filter: brightness(1.07);
}

.btn-secondary {
    background: var(--surface-2);
    border-color: var(--line);
    color: var(--text);
}

.btn-secondary:hover {
    background: var(--surface-3);
    border-color: var(--line-2);
}

.btn-ghost {
    background: transparent;
    color: var(--text-2);
}

.btn-ghost:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
}

.btn-outline {
    background: transparent;
    border-color: var(--line-2);
    color: var(--text);
}

.btn-outline:hover {
    border-color: rgba(255, 255, 255, 0.3);
}

.btn-danger {
    background: rgba(239, 83, 80, 0.12);
    border-color: rgba(239, 83, 80, 0.25);
    color: #ff8b88;
}

.btn-danger:hover {
    background: rgba(239, 83, 80, 0.2);
}

.btn-sm {
    height: 34px;
    padding: 0 12px;
    font-size: 12px;
}

.btn-lg {
    height: 52px;
    padding: 0 24px;
    font-size: 15px;
}

.btn-block {
    width: 100%;
}

.btn-icon {
    width: 44px;
    padding: 0;
}

.btn-icon.btn-sm {
    width: 34px;
}

.btn-team {
    position: relative;
    flex: 1 1 0;
    height: 52px;
    background: var(--surface-2);
    border-color: var(--line);
    color: var(--text);
}

.btn-team .team-tag {
    font-size: 15px;
}

.btn-team .team-state {
    font-family: var(--font-ui);
    font-size: 11px;
    letter-spacing: 0.08em;
    color: var(--text-2);
}

.btn-team.ct.on {
    background: linear-gradient(180deg, rgba(74, 155, 240, 0.28), rgba(74, 155, 240, 0.12));
    border-color: rgba(74, 155, 240, 0.6);
}

.btn-team.t.on {
    background: linear-gradient(180deg, rgba(245, 163, 60, 0.3), rgba(245, 163, 60, 0.12));
    border-color: rgba(245, 163, 60, 0.65);
}

.btn-team.on .team-state {
    color: var(--text);
}

/* Form controls */
.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.field-label {
    font-family: var(--font-ui);
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-2);
}

.field-hint {
    font-size: 12px;
    color: var(--text-3);
}

.input {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--text);
    outline: none;
    transition: border-color 0.15s, background-color 0.15s;
}

.input::placeholder {
    color: var(--text-3);
}

.input:hover {
    border-color: var(--line-2);
}

.input:focus {
    border-color: var(--accent);
    background: var(--surface);
}

.input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

.input[type=number]::-webkit-inner-spin-button, .input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    min-width: 0;
}

.input-wrap .input {
    padding-left: 40px;
    padding-right: 38px;
}

.input-wrap .lead {
    position: absolute;
    left: 12px;
    width: 18px;
    height: 18px;
    color: var(--text-3);
    pointer-events: none;
}

.input-wrap .clear {
    position: absolute;
    right: 6px;
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 8px;
    background: none;
    color: var(--text-3);
}

.input-wrap .clear:hover {
    color: var(--text);
    background: var(--surface-3);
}

.input-wrap .clear svg {
    width: 16px;
    height: 16px;
}

.switch {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-height: 40px;
    cursor: pointer;
    user-select: none;
}

.switch input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.switch .track {
    position: relative;
    flex: none;
    width: 44px;
    height: 26px;
    border-radius: 13px;
    background: var(--surface-4);
    transition: background-color 0.18s;
}

.switch .track::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #d8dde3;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    transition: transform 0.18s, background-color 0.18s;
}

.switch input:checked + .track {
    background: var(--accent-2);
}

.switch input:checked + .track::after {
    transform: translateX(18px);
    background: #fff;
}

.switch input:focus-visible + .track {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.switch .switch-text {
    font-family: var(--font-ui);
    font-size: 14px;
}

.seg {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 12px;
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
}

.seg::-webkit-scrollbar {
    display: none;
}

.seg button {
    flex: 1 0 auto;
    min-height: 36px;
    padding: 0 14px;
    border: 0;
    border-radius: 9px;
    background: none;
    color: var(--text-2);
    font-family: var(--font-head);
    font-size: 13px;
    line-height: 1;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
    transition: background-color 0.15s, color 0.15s;
}

.seg button:hover {
    color: var(--text);
}

.seg button.active {
    background: var(--surface-4);
    color: var(--text);
    box-shadow: inset 0 -2px 0 var(--accent);
}

.seg button.ct.active {
    background: rgba(74, 155, 240, 0.2);
    box-shadow: inset 0 -2px 0 var(--ct);
}

.seg button.t.active {
    background: rgba(245, 163, 60, 0.2);
    box-shadow: inset 0 -2px 0 var(--t);
}

.seg-lg button {
    min-height: 44px;
    padding: 0 22px;
    font-size: 15px;
}

.chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 2px;
}

.chips::-webkit-scrollbar {
    display: none;
}

.chip {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 34px;
    padding: 0 13px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-2);
    font-family: var(--font-ui);
    font-size: 13px;
    line-height: 1;
    white-space: nowrap;
}

.chip:hover {
    color: var(--text);
    border-color: var(--line-2);
}

.chip .dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--rc, var(--text-3));
}

.chip.active {
    color: var(--text);
    background: color-mix(in srgb, var(--rc, var(--accent)) 18%, var(--surface));
    border-color: color-mix(in srgb, var(--rc, var(--accent)) 60%, transparent);
}

.tabs {
    display: flex;
    gap: 2px;
    overflow-x: auto;
    scrollbar-width: none;
    border-bottom: 1px solid var(--line);
}

.tabs::-webkit-scrollbar {
    display: none;
}

.tab {
    position: relative;
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 46px;
    padding: 0 14px;
    border: 0;
    background: none;
    color: var(--text-3);
    font-family: var(--font-head);
    font-size: 13px;
    line-height: 1;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
}

.tab:hover {
    color: var(--text-2);
}

.tab.active {
    color: var(--text);
}

.tab.active::after {
    content: "";
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: -1px;
    height: 2px;
    background: var(--accent);
    border-radius: 2px;
}

.tab .count {
    font-family: var(--font-ui);
    font-size: 11px;
    color: var(--text-3);
}

.range {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 34px;
    background: transparent;
    cursor: pointer;
}

.range::-webkit-slider-runnable-track {
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--accent-2) var(--fill, 0%), var(--surface-4) var(--fill, 0%));
}

.range::-moz-range-track {
    height: 6px;
    border-radius: 3px;
    background: var(--surface-4);
}

.range::-moz-range-progress {
    height: 6px;
    border-radius: 3px;
    background: var(--accent-2);
}

.range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    margin-top: -7px;
    border-radius: 50%;
    background: #fff;
    border: 0;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

.range::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    border: 0;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

/* Custom select (combo): a button that opens a list with an optional search */
.combo {
    position: relative;
    min-width: 0;
}

.combo-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    height: 44px;
    padding: 0 12px 0 14px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 10px;
    text-align: left;
}

.combo-trigger:hover {
    border-color: var(--line-2);
}

.combo.open .combo-trigger {
    border-color: var(--accent);
}

.combo-trigger .value {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.combo-trigger .value.placeholder {
    color: var(--text-3);
}

.combo-trigger svg {
    flex: none;
    width: 16px;
    height: 16px;
    color: var(--text-3);
    transition: transform 0.15s;
}

.combo.open .combo-trigger svg {
    transform: rotate(180deg);
}

.combo-pop {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 6px);
    z-index: 70;
    min-width: 220px;
    padding: 6px;
    background: var(--surface-2);
    border: 1px solid var(--line-2);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.combo-pop.up {
    top: auto;
    bottom: calc(100% + 6px);
}

.combo-search {
    margin-bottom: 6px;
}

.combo-list {
    max-height: 290px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.combo-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 40px;
    padding: 6px 10px;
    border: 0;
    border-radius: 8px;
    background: none;
    color: var(--text);
    text-align: left;
}

.combo-option:hover, .combo-option.hl {
    background: var(--surface-3);
}

.combo-option.selected {
    color: var(--accent);
}

.combo-option .dot {
    flex: none;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--rc, var(--text-3));
}

.combo-option .hint {
    margin-left: auto;
    font-size: 12px;
    color: var(--text-3);
}

.combo-empty {
    padding: 12px;
    color: var(--text-3);
    text-align: center;
}

/* Cards */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-l);
}

.card-pad {
    padding: clamp(14px, 2.6vw, 22px);
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
}

.card-body {
    padding: 16px 18px;
}

.stack {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.row-between {
    justify-content: space-between;
}

.grow {
    flex: 1 1 auto;
    min-width: 0;
}

.grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fill, minmax(var(--cell, 150px), 1fr));
}

@media (max-width: 420px) {
    .grid {
        gap: 10px;
        grid-template-columns: repeat(auto-fill, minmax(var(--cell-sm, 140px), 1fr));
    }
}

/* Item tile like the game inventory: the 2:1 preview edge to edge, the name over its bottom edge and a rarity bar; the tile is as high as the preview */
.item {
    --rc: #5b6470;
    position: relative;
    display: block;
    width: 100%;
    min-width: 0;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius-s);
    background: #171a1f;
    text-align: left;
    overflow: hidden;
    isolation: isolate;
    transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}

.item:hover {
    border-color: color-mix(in srgb, var(--rc) 70%, transparent);
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45), 0 0 18px -6px color-mix(in srgb, var(--rc) 70%, transparent);
}

.item.selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent), 0 8px 22px rgba(0, 0, 0, 0.45);
}

/* previews carry their own translucent grey backdrop, so the rarity glow under them shines through */
.item-art {
    position: relative;
    aspect-ratio: 2 / 1;
    display: grid;
    place-items: center;
    overflow: hidden;
    background: radial-gradient(120% 100% at 50% 125%, color-mix(in srgb, var(--rc) 50%, transparent), transparent 70%), linear-gradient(180deg, #23282f, #171a1f);
}

.item-art img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.25s;
}

.item:hover .item-art img {
    transform: scale(1.05);
}

.item-art .ph {
    width: 54%;
    height: auto;
    margin-bottom: 8%;
    object-fit: contain;
    opacity: 0.35;
}

/* drawn placeholder lifted above the name; sizes go by the width, as a percent height has nothing definite to resolve against here */
.item-art .ph-icon {
    height: auto;
    padding-bottom: 14%;
}

.item-art .ph-icon svg {
    width: 19%;
    max-width: none;
}

.item.square .item-art {
    aspect-ratio: 1 / 1;
}

.item-info {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 20px 10px 8px;
    background: linear-gradient(0deg, rgba(10, 12, 15, 0.88), rgba(10, 12, 15, 0.55) 55%, transparent);
    pointer-events: none;
}

.item-title {
    font-family: var(--font-head);
    font-size: 12.5px;
    line-height: 1.15;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.item-sub {
    margin-top: 1px;
    font-family: var(--font-ui);
    font-size: 11.5px;
    line-height: 1.2;
    color: rgba(255, 255, 255, 0.68);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.item.square .item-sub {
    display: none;
}

.item::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: var(--rc);
}

@media (max-width: 420px) {
    .item-info {
        padding: 14px 8px 6px;
    }

    .item-title {
        font-size: 11.5px;
    }

    .item-sub {
        font-size: 10.5px;
    }
}

.item-badges {
    position: absolute;
    top: 8px;
    left: 8px;
    right: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    pointer-events: none;
}

.item-badges .end {
    margin-left: auto;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 20px;
    padding: 0 7px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.55);
    color: var(--text);
    font-family: var(--font-head);
    font-size: 11px;
    line-height: 1;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.badge svg {
    width: 12px;
    height: 12px;
}

.badge-st {
    background: rgba(239, 120, 40, 0.92);
}

.mk {
    display: inline-block;
    height: 18px;
    width: auto;
    flex: none;
}

.mk-sm {
    display: inline-block;
    height: 13px;
    width: auto;
    flex: none;
}

.item-badges .mk {
    height: 20px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6));
}

.chip-img {
    height: 15px;
    width: auto;
}

.badge-ct {
    background: rgba(74, 155, 240, 0.9);
}

.badge-t {
    background: rgba(245, 163, 60, 0.92);
    color: #1b1206;
}

.badge-red {
    background: var(--brand);
}

/* Loadout slot without a skin: the stock render, dimmed */
.slot.is-stock .item-art img {
    opacity: 0.7;
    filter: grayscale(0.4);
}

.section {
    margin-top: 22px;
}

.section-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 10px;
}

.section-head .count {
    font-family: var(--font-ui);
    font-size: 13px;
    color: var(--text-3);
}

/* Sticker and charm slots, like the weapon menu in the game */
.sticker-slots {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
}

.sticker-slot {
    position: relative;
    aspect-ratio: 1 / 1;
    display: grid;
    place-items: center;
    padding: 6px;
    border: 1px dashed var(--line-2);
    border-radius: 10px;
    background: var(--surface-2);
    color: var(--text-3);
    min-width: 0;
}

.sticker-slot:hover {
    border-color: var(--accent);
    color: var(--text);
}

.sticker-slot.filled {
    border-style: solid;
    border-color: color-mix(in srgb, var(--rc, #5b6470) 55%, transparent);
    background: radial-gradient(90% 70% at 50% 100%, color-mix(in srgb, var(--rc, #5b6470) 30%, transparent), transparent 70%), var(--surface-2);
}

.sticker-slot img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.sticker-slot .plus {
    width: 22px;
    height: 22px;
}

.sticker-slot .kind {
    position: absolute;
    left: 6px;
    top: 5px;
    width: 14px;
    height: 14px;
    color: var(--text-3);
}

.sticker-slot .remove {
    position: absolute;
    right: -6px;
    top: -6px;
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: var(--surface-4);
    color: var(--text);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
}

.sticker-slot .remove svg {
    width: 14px;
    height: 14px;
}

.sticker-slot .remove:hover {
    background: var(--danger);
}

/* Modal on wide screens, bottom sheet on phones */
.scrim {
    position: fixed;
    inset: 0;
    z-index: 80;
    background: rgba(4, 5, 8, 0.66);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    animation: fade-in 0.16s ease-out;
}

.sheet {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-height: 94vh;
    max-height: 94dvh;
    background: var(--surface);
    border: 1px solid var(--line-2);
    border-bottom: 0;
    border-radius: 18px 18px 0 0;
    box-shadow: var(--shadow);
    animation: sheet-up 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.sheet-handle {
    width: 42px;
    height: 5px;
    margin: 8px auto 0;
    border-radius: 3px;
    background: var(--surface-4);
}

.sheet-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px 12px 18px;
    border-bottom: 1px solid var(--line);
}

.sheet-title {
    flex: 1;
    min-width: 0;
    font-family: var(--font-head);
    font-size: 17px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sheet-body {
    flex: 1 1 auto;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 16px 18px;
}

.sheet-foot {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 18px 14px;
    border-top: 1px solid var(--line);
    background: var(--surface);
}

@media (min-width: 720px) {
    .scrim {
        align-items: center;
        padding: 24px;
    }

    .sheet {
        max-width: var(--sheet-w, 640px);
        max-height: min(88vh, 900px);
        border-bottom: 1px solid var(--line-2);
        border-radius: 18px;
        animation: sheet-pop 0.18s ease-out;
    }

    .sheet-handle {
        display: none;
    }
}

@keyframes fade-in {
    from {
        opacity: 0;
    }
}

@keyframes sheet-up {
    from {
        transform: translateY(40px);
        opacity: 0.6;
    }
}

@keyframes sheet-pop {
    from {
        transform: scale(0.97);
        opacity: 0;
    }
}

body.locked {
    overflow: hidden;
}

/* Toasts: a compact pill with a round state icon, above the tab bar on phones and bottom right on desktop */
.toast-host {
    position: fixed;
    left: 50%;
    bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 12px);
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: max-content;
    max-width: calc(100vw - 32px);
    transform: translateX(-50%);
    pointer-events: none;
}

.toast {
    --tc: var(--success);
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 100%;
    min-height: 40px;
    padding: 8px 16px 8px 9px;
    border: 1px solid var(--line-2);
    border-radius: 999px;
    background: rgba(27, 31, 38, 0.97);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
    color: var(--text);
    font-family: var(--font-ui);
    font-size: 13px;
    line-height: 1.25;
    animation: toast-in 0.2s ease-out;
    pointer-events: auto;
}

.toast svg {
    flex: none;
    width: 22px;
    height: 22px;
    padding: 4px;
    border-radius: 50%;
    background: var(--tc);
    color: #0b0d11;
    stroke-width: 3.2;
}

.toast.err {
    --tc: var(--danger);
}

.toast.err svg {
    color: #fff;
}

.toast.info {
    --tc: var(--accent);
}

.toast.info svg {
    color: #1b1206;
}

.toast.out {
    animation: toast-out 0.18s ease-in forwards;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.97);
    }
}

@keyframes toast-out {
    to {
        opacity: 0;
        transform: translateY(6px) scale(0.97);
    }
}

@media (min-width: 820px) {
    .toast-host {
        left: auto;
        right: 24px;
        bottom: 24px;
        transform: none;
        align-items: flex-end;
    }
}

/* Loading and empty states */
.skeleton {
    background: linear-gradient(90deg, var(--surface) 0%, var(--surface-3) 50%, var(--surface) 100%);
    background-size: 200% 100%;
    animation: shimmer 1.2s linear infinite;
    border-radius: var(--radius);
}

.skeleton.tile {
    aspect-ratio: 2 / 1;
    border-radius: var(--radius-s);
}

@keyframes shimmer {
    to {
        background-position: -200% 0;
    }
}

.empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 46px 20px;
    text-align: center;
    color: var(--text-2);
}

.empty .h3 {
    color: var(--text);
}

.empty svg {
    width: 42px;
    height: 42px;
    color: var(--text-3);
}

/* Tables become cards on narrow screens */
.table-wrap {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.table th {
    padding: 10px 12px;
    text-align: left;
    font-family: var(--font-ui);
    font-size: 11.5px;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-3);
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

.table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

.table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.table .actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
}

@media (max-width: 760px) {
    .table thead {
        display: none;
    }

    .table, .table tbody, .table tr, .table td {
        display: block;
        width: 100%;
    }

    .table tr {
        margin-bottom: 10px;
        padding: 8px 4px;
        background: var(--surface);
        border: 1px solid var(--line);
        border-radius: var(--radius);
    }

    .table td {
        display: flex;
        justify-content: space-between;
        gap: 14px;
        padding: 7px 12px;
        border: 0;
        text-align: right;
        overflow-wrap: anywhere;
    }

    .table td::before {
        content: attr(data-label);
        flex: none;
        font-family: var(--font-ui);
        font-size: 11.5px;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        color: var(--text-3);
        text-align: left;
    }

    .table td.actions {
        justify-content: flex-start;
    }

    .table td.actions::before {
        display: none;
    }
}

.kv {
    display: grid;
    grid-template-columns: minmax(110px, auto) 1fr;
    gap: 8px 16px;
    margin: 0;
}

.kv dt {
    font-family: var(--font-ui);
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-3);
}

.kv dd {
    margin: 0;
    min-width: 0;
    overflow-wrap: anywhere;
}

.divider {
    height: 1px;
    background: var(--line);
    margin: 16px 0;
}

.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        transition-duration: 0.001ms !important;
    }
}
