:root {
    --gap: 14px;
    --radius: 14px
}

body {
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, sans-serif;
    background: #0b0c10;
    color: #e8e8e8;
    margin: 0
}

header {
    padding: 28px 18px 10px;
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap
}

header h1 {
    font-size: 20px;
    margin: 0
}

.wrap {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 18px 40px
}

.panel {
    background: #111318;
    border: 1px solid #222532;
    border-radius: var(--radius);
    padding: 16px;
    margin-top: 16px
}

.row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--gap)
}

.row>.panel {
    margin: 0
}

label {
    display: block;
    font-size: 13px;
    margin: 10px 0 4px;
    color: #cfd3dc
}

input[type=file],
select,
input[type=range],
input[type=number],
input[type=text],
input[type=color],
button {
    width: 100%;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid #2b2f3a;
    background: #0f1116;
    color: #e8e8e8
}

input[type=range] {
    padding: 0
}

.controls {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--gap)
}

.controls-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--gap)
}

.controls-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--gap)
}

.actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 8px
}

button {
    cursor: pointer
}

button[disabled] {
    opacity: .6;
    cursor: not-allowed
}

.muted {
    opacity: .8;
    font-size: 12px
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid #2b2f3a;
    background: #0f1116;
    border-radius: 999px;
    padding: 6px 10px
}

.progress {
    height: 10px;
    background: #1b1f2a;
    border-radius: 20px;
    overflow: hidden
}

.progress>span {
    display: block;
    height: 100%;
    background: #4da3ff;
    width: 0%
}

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

.card {
    background: #0f1116;
    border: 1px solid #222532;
    border-radius: 12px;
    padding: 10px;
    cursor: pointer;
    transition: transform .2s ease, box-shadow .2s ease
}

.card:hover {
    transform: scale(1.02);
    box-shadow: 0 0 12px rgba(0, 0, 0, 0.4)
}

.hint {
    font-size: 12px;
    color: #a9afbf
}

.footer {
    margin-top: 16px;
    font-size: 12px;
    color: #9aa3b2
}

canvas {
    max-width: 100%
}

.ok {
    color: #7DFF9A
}

.fail {
    color: #FF7D7D
}

.warn {
    color: #FFD37D
}

.mono {
    font-family: ui-monospace, SFMono-Regular, Consolas, Menlo, monospace;
    font-size: 12px
}

ul.inline {
    list-style: disc;
    padding-left: 18px;
    margin: 8px 0
}

/* === Modal Styles === */
.wm-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000
}

.wm-modal.open {
    display: flex
}

.wm-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .75)
}

.wm-modal__dialog {
    position: relative;
    background: #0f1116;
    border: 1px solid #222532;
    border-radius: 16px;
    max-width: 96vw;
    max-height: 92vh;
    width: min(1200px, 96vw);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .5)
}

.wm-modal__toolbar {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #222532
}

.wm-modal__title {
    font-weight: 600
}

.wm-modal__spacer {
    flex: 1
}

.wm-btn {
    background: #141821;
    border: 1px solid #2b2f3a;
    color: #e8e8e8;
    padding: 6px 10px;
    border-radius: 10px;
    cursor: pointer
}

.wm-btn:hover {
    background: #1a2030
}

.wm-modal__content {
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center
}

#wmModalImg {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain
}