﻿:root {
    color-scheme: light;
    --bg: #f4f1e8;
    --panel: #ffffff;
    --ink: #172015;
    --muted: #66705f;
    --line: #d8d0bd;
    --accent: #2f6f3e;
    --accent-dark: #234f2e;
    --soft: #e8f0de;
    --field: #fbfaf6;
    --field-line: #c8bea8;
    --field-line-soft: #9b927d;
    --button-ink: #ffffff;
    --danger: #8a2020;
    --danger-line: #d68b8b;
    --danger-bg: #fff3f3;
    --code-bg: #172015;
    --code-ink: #eef7df;
    --shadow: rgba(38, 31, 18, .08);
    --toggle-bg: #d7e2eb;
    --toggle-track: #aebdc8;
    --toggle-sun: #fbfaf6;
    --toggle-moon: #102f4a;
}
html[data-theme="dark"] {
    color-scheme: dark;
    --bg: #101412;
    --panel: #19211d;
    --ink: #edf4e9;
    --muted: #aab8a4;
    --line: #354138;
    --accent: #78b66f;
    --accent-dark: #9bd48e;
    --soft: #232e27;
    --field: #111915;
    --field-line: #465247;
    --field-line-soft: #607064;
    --button-ink: #0f1712;
    --danger: #ffaaa6;
    --danger-line: #7c3a3a;
    --danger-bg: #321b1b;
    --code-bg: #07100c;
    --code-ink: #dff2d6;
    --shadow: rgba(0, 0, 0, .28);
    --toggle-bg: #243443;
    --toggle-track: #485b67;
    --toggle-sun: #f7f3e8;
    --toggle-moon: #061a2d;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif;
}

main {
    width: min(1480px, calc(100% - 32px));
    margin: 0 auto;
    padding: clamp(20px, 3vw, 40px) 0 56px;
}

header {
    display: grid;
    gap: 12px;
    margin-bottom: 24px;
}

.page-header {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
}

.theme-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    width: 96px;
    height: 52px;
    padding: 8px 10px;
    border: 0;
    border-radius: 999px;
    background: var(--toggle-bg);
    color: var(--ink);
    box-shadow: inset 0 0 0 1px var(--toggle-track);
}

.theme-toggle:hover {
    background: var(--toggle-bg);
}

.theme-toggle:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 3px;
}

.theme-toggle-icon {
    position: relative;
    z-index: 1;
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
}

.theme-toggle-icon svg {
    width: 24px;
    height: 24px;
}

.theme-toggle-moon {
    color: var(--toggle-moon);
}

.theme-toggle-sun {
    color: #d8d1c8;
}

.theme-toggle-thumb {
    position: absolute;
    top: 6px;
    left: 50px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--toggle-sun);
    box-shadow: 0 3px 10px var(--shadow);
    transition: left .2s ease, background .2s ease;
}

html[data-theme="dark"] .theme-toggle-thumb {
    left: 6px;
    background: var(--toggle-moon);
}

html[data-theme="dark"] .theme-toggle-moon {
    color: #dce8f5;
}

html[data-theme="dark"] .theme-toggle-sun {
    color: var(--toggle-sun);
}

h1 {
    margin: 0;
    font-size: clamp(32px, 5vw, 62px);
    line-height: 1;
}

h2, h3 {
    margin: 0;
    line-height: 1.2;
}

p {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.mt-0 {
    margin-top: 0;
}

.mt-8 {
    margin-top: 8px;
}

.mt-10 {
    margin-top: 10px;
}

.mt-12 {
    margin-top: 12px;
}

.mt-14 {
    margin-top: 14px;
}

.mt-16 {
    margin-top: 16px;
}

.is-hidden {
    display: none;
}

.upload {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
    gap: 14px;
    align-items: center;
    padding: 18px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 12px 24px var(--shadow);
}

.upload h2,
.upload p,
.upload .editor-actions {
    grid-column: 1 / -1;
}

input[type="file"],
input[type="number"],
input[type="text"],
select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--field-line);
    border-radius: 6px;
    background: var(--field);
    color: var(--ink);
    min-width: 0;
}

input[type="file"] {
    border: 1px dashed var(--field-line-soft);
}

button,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 18px;
    border: 0;
    border-radius: 6px;
    background: var(--accent);
    color: var(--button-ink);
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}

button:hover,
.button:hover {
    background: var(--accent-dark);
}

.editor-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.editor-actions p {
    min-width: min(100%, 260px);
    flex: 1 1 260px;
}

.danger-check {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    color: var(--danger);
    font-weight: 700;
}

.danger-check input {
    width: 18px;
    height: 18px;
}

.error {
    margin-top: 12px;
    padding: 12px 14px;
    border: 1px solid var(--danger-line);
    border-radius: 6px;
    background: var(--danger-bg);
    color: var(--danger);
}

.results {
    display: grid;
    gap: clamp(14px, 2vw, 22px);
    margin-top: 24px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
    gap: 14px;
}

.section {
    min-width: 0;
    padding: clamp(14px, 2vw, 22px);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.stat {
    min-width: 0;
    padding: 14px;
    background: var(--soft);
    border-radius: 6px;
}

.label {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

.value {
    font-size: clamp(16px, 1.6vw, 20px);
    font-weight: 700;
    overflow-wrap: anywhere;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 14px;
    min-width: 760px;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

th, td {
    padding: 11px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
    overflow-wrap: anywhere;
}

th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

.item-cell {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
}

.item-icon-wrap {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--field);
}

.item-icon {
    width: 28px;
    height: 28px;
    image-rendering: pixelated;
    object-fit: contain;
}

.item-icon.is-missing {
    display: none;
}

.item-text {
    min-width: 0;
    overflow-wrap: anywhere;
}

.copy-inline {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto;
    gap: 8px;
    align-items: center;
    min-width: 320px;
}

.copy-inline input {
    font-family: Consolas, Monaco, monospace;
    font-size: 13px;
}

.copy-inline button {
    min-height: 40px;
    padding: 0 12px;
}

.history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr));
    gap: 14px;
    margin-top: 14px;
}

.history-search {
    margin-top: 14px;
    max-width: 520px;
}

.history-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
    gap: 10px;
    margin-top: 14px;
    max-width: 880px;
}

.history-card {
    display: grid;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--field);
}

.history-card header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    margin: 0;
    align-items: start;
}

.history-card h3 {
    font-size: 17px;
    overflow-wrap: anywhere;
}

.pill {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 9px;
    border-radius: 999px;
    background: var(--soft);
    color: var(--accent-dark);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.history-list {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.history-list li {
    display: grid;
    gap: 4px;
    padding-top: 8px;
    border-top: 1px solid var(--line);
}

.history-items {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
    gap: 8px;
    margin-top: 10px;
}

.history-item {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 6px;
            background: var(--panel);
}

.history-item .item-icon-wrap {
    width: 32px;
    height: 32px;
}

.history-item .item-icon {
    width: 24px;
    height: 24px;
}

.uuid-mono {
    font-family: Consolas, Monaco, monospace;
    font-size: 12px;
    overflow-wrap: anywhere;
}

code {
    display: block;
    max-height: 420px;
    overflow: auto;
    padding: 16px;
    border-radius: 6px;
    background: var(--code-bg);
    color: var(--code-ink);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

textarea.copy-list {
    width: 100%;
    min-height: 240px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--field);
    color: var(--ink);
    font-family: Consolas, Monaco, monospace;
    line-height: 1.5;
    resize: vertical;
}

textarea.item-token {
    width: 100%;
    min-height: 90px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--field);
    color: var(--ink);
    font-family: Consolas, Monaco, monospace;
    font-size: 12px;
    resize: vertical;
}

details summary {
    cursor: pointer;
    font-weight: 700;
}

@media (min-width: 1500px) {
    .grid {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    }
}

@media (max-width: 820px) {
    main {
        width: min(100% - 24px, 760px);
    }

    .grid {
        grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
    }

    table {
        min-width: 680px;
    }
}

@media (max-width: 560px) {
    main {
        width: min(100% - 16px, 520px);
        padding-top: 16px;
    }

    .upload,
    .section {
        padding: 12px;
    }

    .editor-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .editor-actions button,
    .editor-actions .button {
        width: 100%;
    }

    .value {
        font-size: 16px;
    }

    code,
    textarea.copy-list {
        font-size: 12px;
    }

    table {
        min-width: 620px;
    }
}


