/* Layout layer: API contracts and game data handling stay in index.html. */
:root {
    color-scheme: dark;
    --bg: #121516; --bg-grad: #121516; --header-bg: #181c1d;
    --card: #1c2122; --card-2: #1c2122; --border: #343c3e; --border-2: #465153;
    --input-bg: #15191a; --text: #eef3f1; --text-1: #eef3f1;
    --text-2: #b1bebb; --text-3: #98aaa5; --accent: #62d9b9;
    --accent-2: #167d65; --accent-soft: #193a31; --th-bg: #252c2d;
    --th-text: #c0cec9; --td-border: #333b3b; --hover: #283130;
    --nav-bg: transparent; --nav-active: transparent; --footer: #91a29c;
    --danger: #ff858b; --gold: #e9c66e; --shadow: transparent;
    --card-bg: var(--card);
}
[data-theme="light"] {
    color-scheme: light;
    --bg: #f3f5f4; --bg-grad: #f3f5f4; --header-bg: #ffffff;
    --card: #ffffff; --card-2: #ffffff; --border: #d6dedb; --border-2: #bbc9c3;
    --input-bg: #f8faf9; --text: #192d26; --text-1: #192d26;
    --text-2: #4e655b; --text-3: #60766c; --accent: #14795c;
    --accent-2: #167d65; --accent-soft: #e2f2e9; --th-bg: #edf2ef;
    --th-text: #475f53; --td-border: #e0e7e3; --hover: #eef6f1;
    --nav-bg: transparent; --nav-active: transparent; --footer: #647a6f;
    --danger: #b82f45; --gold: #886513; --shadow: transparent;
}
body { font-family: "Segoe UI", "Microsoft YaHei", sans-serif; line-height: 1.6; }
body, button, input, select, h1, h2, h3, .logo, .logo-sub { letter-spacing: 0 !important; }
button, input, select { font: inherit; }
button { touch-action: manipulation; }
button:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
button:disabled { opacity: .5; cursor: not-allowed; }
header { padding: 18px max(24px, calc((100% - 1280px) / 2)); gap: 16px; border-bottom: 1px solid var(--border); }
header h1 { font-size: 23px; font-weight: 750; line-height: 1.4; }
header .sub { margin-top: 3px; font-size: 12px; }
.header-right { flex-wrap: wrap; justify-content: flex-end; gap: 8px; min-width: 0; }
.icon-btn { height: 38px; min-width: 38px; padding: 0 10px; border-radius: 6px; font-size: 17px; }
.status-pill { max-width: 100%; min-height: 36px; padding: 6px 10px; border-radius: 6px; font-size: 12px; }
#statusText { white-space: normal; overflow-wrap: anywhere; text-align: left; }
.status-pill .dot { width: 7px; height: 7px; box-shadow: none !important; }
nav { max-width: 1328px; margin: 0 auto; padding: 0 24px; gap: 24px; flex-wrap: nowrap; border-bottom: 1px solid var(--border); }
nav.show { display: flex; }
nav button { min-height: 54px; padding: 12px 4px; border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: transparent; white-space: nowrap; }
nav button.active { color: var(--accent); border-bottom-color: var(--accent); background: transparent; }
nav button:hover { color: var(--text); }
main { max-width: 1328px; padding: 28px 24px 48px; min-height: calc(100vh - 200px); }
.panel > .card, #ocmResult > .card, #welcomeBox > .card {
    background: transparent; border: 0; border-radius: 0; box-shadow: none;
    padding: 0 0 24px; margin-bottom: 24px; border-bottom: 1px solid var(--border);
}
.card h3 { color: var(--text); font-size: 17px; margin-bottom: 16px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.section-heading h2 { font-size: 21px; font-weight: 650; }
#welcomeBox h3 { font-size: 22px; margin-bottom: 8px; }
#welcomeBox .meta { font-size: 12px; color: var(--text-2); line-height: 1.9; overflow-wrap: anywhere; }
.row, .toolbar { gap: 10px; }
.row > *, .toolbar > * { min-width: 0; max-width: 100%; }
input[type=text], input[type=password], input[type=number], input[type=search], input[type=email], input[type=tel], select {
    min-width: 0; min-height: 44px; padding: 10px 12px; border-radius: 6px; font-size: 14px;
}
.row select { flex: 1 1 220px; width: 0; }
.row input { flex: 1 1 160px; }
button.primary, button.secondary { min-height: 42px; padding: 10px 16px; border-radius: 6px; font-size: 13px; }
button.primary:hover { background: #126852; }
button.secondary { background: var(--input-bg); border: 1px solid var(--border-2); color: var(--text-2); cursor: pointer; }
button.secondary:hover { border-color: var(--accent); color: var(--accent); }
.hint { line-height: 1.8; color: var(--text-3); }
#loginWrap { padding: 32px 0; }
.login-card { width: 100%; max-width: 420px; padding: 24px 32px 32px; border-radius: 8px; box-shadow: none; }
.login-card .logo { font-size: 24px; }
.login-card .logo-sub { margin: 6px 0 24px; font-size: 11px; }
.login-card .field { margin-bottom: 18px; }
.field label { display: block; margin-bottom: 7px; font-size: 12px; color: var(--text-2); }
.login-card .btn-login { min-height: 46px; font-size: 14px; }
.grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 18px; }
.car-box { border-radius: 8px; padding: 16px; gap: 10px; min-width: 0; overflow-wrap: anywhere; }
.car-box .car-img { border: 0; border-radius: 4px; background: #303a38; aspect-ratio: 5 / 2; display: flex; align-items: center; justify-content: center; padding: 16px; }
.car-box .car-img img { width: 100%; height: 100%; max-width: 100%; object-fit: contain; }
.car-box .nm { font-size: 19px; gap: 8px; }
.car-box .title-line { font-size: 12px; }
.car-box .meta { font-size: 12px; }
.tag { border-radius: 4px; padding: 3px 8px; }
.car-box .mv-row { border-top: 1px solid var(--border); padding-top: 12px; margin-top: auto; }
.car-box .mv { min-height: 36px; border-radius: 4px; font-size: 17px; }
#carGrid > .row { margin: 0 0 20px !important; }
#carGrid > h3 { margin: 0 0 14px !important; color: var(--text) !important; font-size: 18px !important; }
.tool-section { border-bottom: 1px solid var(--border); }
.tool-section summary { display: flex; align-items: center; gap: 12px; padding: 19px 0; cursor: pointer; list-style: none; font-size: 15px; font-weight: 600; }
.tool-section summary::-webkit-details-marker { display: none; }
.tool-section summary::before { content: "+"; display: grid; place-items: center; width: 24px; height: 24px; flex: none; color: var(--accent); font-size: 21px; font-weight: 400; }
.tool-section[open] summary::before { content: "\2212"; }
.tool-content { padding: 0 0 24px 36px; max-width: 960px; }
.tool-section.danger summary, .tool-section.danger summary::before { color: var(--danger); }
.sort-panel { max-height: 480px; overflow: auto; margin: 16px 0; }
.sort-item { min-width: 0; }
.sort-info { min-width: 0; overflow-wrap: anywhere; }
.sort-actions .mv { width: 32px; min-height: 32px; border-radius: 4px; }
.car-select-preview { width: 68px; height: 40px; object-fit: contain; }
.table-wrap { max-width: 100%; border: 1px solid var(--border); border-radius: 6px; }
.table-wrap table { min-width: 650px; }
th { padding: 13px 14px; font-size: 12px; }
td { padding: 14px; }
tbody tr:last-child td { border-bottom: 0; }
.rank2 { color: var(--text-2); }
.admin-modal, .rn-modal { border-radius: 8px; padding: 24px; }
.admin-section { padding: 20px 0; margin: 0; border-top: 1px solid var(--border); }
.admin-head { margin-bottom: 20px; }
.admin-online-row, .np-grid, .rn-char-grid, .rn-otp-cell, .rn-del, .toast-item { border-radius: 6px; }
.admin-title { color: var(--text); }
footer { padding: 18px 24px; border-top: 1px solid var(--border); }
@media (max-width: 768px) {
    header { padding: 16px; align-items: flex-start; }
    header h1 { font-size: 20px; }
    .header-right { width: 100%; justify-content: flex-start; }
    .status-pill { flex: 1 1 0; min-width: 0; max-width: none; margin-right: auto; }
    .header-right > .icon-btn { flex: none; }
    nav, nav.show { padding: 0 16px; gap: 0; }
    nav { display: none; }
    nav.show { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
    nav button { font-size: 13px; min-height: 50px; padding: 10px 0; border-radius: 0; border: 0; border-bottom: 3px solid transparent; }
    main { padding: 22px 16px 36px; }
    .row { flex-direction: row; align-items: center; flex-wrap: wrap; }
    .row select, .row input { width: 100%; flex: 1 1 180px; }
    .row button.primary { width: auto; flex: 0 0 auto; }
    .toolbar { flex-direction: row; align-items: center; }
    .toolbar select { flex: 1 1 180px; }
    .toolbar button.primary { width: auto; }
    .tool-content { padding-left: 0; }
    #welcomeBox h3 { font-size: 20px; }
    .grid { gap: 14px; }
    .login-card { padding: 24px; }
    #loginWrap { padding: 8px 0 20px; }
    .admin-modal { padding: 18px; max-height: 90dvh; }
    .sort-row { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
