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

body {
    background-color: #1e1e1e;
    color: #fff;
    font-family: system-ui, -apple-system, sans-serif;
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    max-width: 600px;
    margin: 8px auto;
    padding: 8px;
}

h3 {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.options-panel {
    margin-bottom: 8px;
}

.badge {
    font-size: 0.55em;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    background: #6c757d;
    vertical-align: middle;
}

.input-row {
    display: flex;
    gap: 4px;
    margin-top: 4px;
}

.input-row>* {
    flex: 1;
    min-width: 0;
}

input[type="text"],
input[type="password"],
input[type="number"] {
    color: #fff;
    background: #343a40;
    border: none;
    padding: 8px;
    font-size: 1rem;
    font-family: monospace;
}

input[type="number"]:focus,
input[type="text"]:focus,
input[type="password"]:focus {
    outline: none;
    background: #23272b;
}

input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: #6c757d;
}

.btn {
    min-height: 48px;
    font-size: 1rem;
    color: #fff;
    background: #343a40;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn:active {
    background: #23272b;
}

.btn svg {
    width: 24px;
    height: 24px;
}

.mode-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    margin-top: 8px;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    min-height: 44px;
    background: transparent;
    margin-top: 8px;
}

input[type="range"]::-webkit-slider-runnable-track {
    height: 6px;
    background: #6c757d;
    border-radius: 3px;
}

input[type="range"]::-moz-range-track {
    height: 6px;
    background: #6c757d;
    border-radius: 3px;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    margin-top: -8px;
}

input[type="range"]::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    border: none;
}

.map-grid {
    display: grid;
    grid-template-columns: 1fr 4fr 1fr;
    grid-template-rows: auto 1fr auto;
}

.map-north {
    grid-column: 2;
    grid-row: 1;
}

.map-west {
    grid-column: 1;
    grid-row: 2;
}

.map-center {
    grid-column: 2;
    grid-row: 2;
    position: relative;
}

.map-east {
    grid-column: 3;
    grid-row: 2;
}

.map-south {
    grid-column: 2;
    grid-row: 3;
}

.map-center img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.side-control {
    position: relative;
    overflow: hidden;
    background: transparent;
    cursor: pointer;
    touch-action: none;
    width: 100%;
    height: 100%;
}

.side-control[data-axis="x"] {
    aspect-ratio: 4;
}

.side-control-white {
    position: absolute;
    background: #fff;
}

.side-control[data-axis="x"] .side-control-white {
    top: 0;
    left: 0;
    height: 100%;
    width: 0;
}

.side-control[data-axis="y"] .side-control-white {
    bottom: 0;
    left: 0;
    width: 100%;
    height: 0;
}

.side-control-color {
    position: absolute;
    inset: 0;
}

.side-control input[type="color"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
}

.toggle-header {
    cursor: pointer;
    margin-top: 8px;
    user-select: none;
}

.collapsible {
    display: none;
    text-align: left;
}

.option-row {
    display: flex;
    align-items: stretch;
    gap: 8px;
    padding: 4px 0;
}

.option-label {
    flex: 1;
    background: #343a40;
    padding: 8px;
}

.option-unit {
    background: #343a40;
    padding: 8px;
}

.option-row input[type="number"] {
    width: 80px;
    align-self: stretch;
}

.option-row input[type="checkbox"] {
    align-self: center;
    width: 20px;
    height: 20px;
}

.code-btn {
    font-family: monospace;
    flex: 1;
    min-height: unset;
    text-align: left;
}