:root {
    --accent: #dfa0f2;
    --accent-ink: #2b1650;
    --panel-bg: rgba(18, 12, 28, 0.94);
    --panel-line: rgba(255, 255, 255, 0.1);
    --text: #f4effa;
    --text-dim: #b4a9c4;
    --field-bg: rgba(255, 255, 255, 0.07);
    --error: #ff8a8a;
    --ok: #8de0a6;
    --warn: #ffd27a;
}

body {
    margin: 0;
    overflow: hidden;
    background: black;
    color: var(--text);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

body.idle,
body.idle * {
    cursor: none !important;
}

#container {
    width: 100vw;
    height: 100vh;
    position: relative;
}

#canvas-container {
    width: 100%;
    height: 100%;
}

canvas {
    width: 100%;
    height: 100%;
    display: block;
}

[hidden] {
    display: none !important;
}

/* Client overlays. Sizes are in vh so they scale with the screen, from a laptop to an LED wall. */
.overlay {
    position: fixed;
    z-index: 2500;
    pointer-events: none;
    user-select: none;
}

#overlay-logo {
    top: 3vh;
    left: 3vh;
    height: 18vh;
    max-width: 35vw;
    object-fit: contain;
    object-position: left top;
}

#overlay-qr {
    right: 3vh;
    bottom: 3vh;
    height: 22vh;
    aspect-ratio: 1;
    display: flex;
}

#overlay-qr img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

#overlay-qr.backing {
    background: white;
    padding: 1.2vh;
    border-radius: 1.2vh;
    box-sizing: border-box;
}

#overlay-message {
    left: 3vh;
    bottom: 3vh;
    max-width: 55vw;
    padding: 0.5em 0.8em;
    border-radius: 0.4em;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(6px);
    font-size: 3.5vh;
    font-weight: 600;
    line-height: 1.25;
    white-space: pre-line;
    overflow-wrap: anywhere;
}

/* Welcome messages */
#intro {
    position: fixed;
    inset: 0;
    z-index: 2600;
    pointer-events: none;
}

.intro-shade {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(6, 3, 12, 0.9) 0%, rgba(6, 3, 12, 0.72) 42%, rgba(6, 3, 12, 0) 78%);
    opacity: 0;
    transition: opacity 0.9s ease;
}

#intro.shaded .intro-shade {
    opacity: 1;
}

.intro-message {
    position: absolute;
    /* Just below the middle of the screen, so it can't be cropped off the art */
    top: 54vh;
    left: 5vw;
    right: 5vw;
    text-align: center;
    opacity: 0;
    transform: translateY(1.5vh);
    transition: opacity 0.9s ease, transform 0.9s ease;
}

.intro-message.shown {
    opacity: 1;
    transform: none;
}

.intro-header {
    margin: 0;
    font-size: 8vh;
    font-weight: 800;
    letter-spacing: -0.01em;
    line-height: 1.1;
    text-shadow: 0 0.3vh 2vh rgba(0, 0, 0, 0.5);
}

.intro-sub {
    margin: 1.6vh 0 0;
    font-size: 3.6vh;
    color: var(--text-dim);
}

.intro-link {
    padding: 0;
    border: none;
    background: none;
    color: var(--accent);
    font: inherit;
    text-shadow: inherit;
    cursor: pointer;
}

.intro-message.shown .intro-link {
    pointer-events: auto;
}

.intro-link:hover {
    text-decoration: underline;
    text-underline-offset: 0.2em;
}

#roaming-mark {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 2600;
    pointer-events: none;
    white-space: nowrap;
    font-size: 7vh;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: rgba(255, 255, 255, 0.85);
    text-shadow: 0 0.3vh 2.5vh rgba(0, 0, 0, 0.7);
    opacity: 0;
    transition: opacity 0.9s ease;
}

#roaming-mark.shown {
    opacity: 1;
}

#settings-hint {
    position: fixed;
    top: 28px;
    right: 76px;
    z-index: 4000;
    width: 44px;
    height: 22px;
    color: var(--accent);
    filter: drop-shadow(0 0 6px rgba(0, 0, 0, 0.6));
    pointer-events: none;
    animation: hint-blink 0.7s ease-in-out 4;
}

#settings-hint svg {
    display: block;
    width: 100%;
    height: 100%;
}

@keyframes hint-blink {
    0%, 100% { opacity: 0; transform: translateX(-8px); }
    50% { opacity: 1; transform: none; }
}

#camera-error {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 2900;
    max-width: min(560px, 90vw);
    padding: 24px 28px;
    border-radius: 14px;
    background: var(--panel-bg);
    text-align: center;
}

#camera-error h2 {
    margin: 0 0 8px;
}

#camera-error p {
    margin: 0;
    color: var(--text-dim);
    line-height: 1.5;
}

/* Settings button */
#settings-button {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 4000;
    width: 48px;
    height: 48px;
    padding: 10px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    color: white;
    cursor: pointer;
    transition: opacity 0.4s ease, background 0.2s ease;
}

#settings-button:hover {
    background: rgba(0, 0, 0, 0.8);
}

#settings-button svg {
    width: 100%;
    height: 100%;
}

body.idle:not(.hinting) #settings-button,
body.panel-open #settings-button {
    opacity: 0;
    pointer-events: none;
}

/* Admin panel */
#admin-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 4100;
    width: min(400px, 100vw);
    box-sizing: border-box;
    overflow-y: auto;
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    border-left: 1px solid var(--panel-line);
    font-size: 14px;
    line-height: 1.4;
    cursor: auto !important;
}

#admin-panel * {
    cursor: inherit;
}

.panel-header {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: var(--panel-bg);
    border-bottom: 1px solid var(--panel-line);
}

.panel-header h2 {
    flex: 1;
    margin: 0;
    font-size: 17px;
}

.panel-logo {
    width: 28px;
    height: 28px;
}

.icon-button {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.icon-button:hover {
    background: var(--field-bg);
}

.panel-section {
    padding: 16px;
    border-bottom: 1px solid var(--panel-line);
}

.panel-section h3 {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin: 0 0 12px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.where {
    color: var(--text-dim);
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
}

.price-tag {
    margin-left: auto;
    color: var(--accent);
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
}

.hint {
    margin: 8px 0 0;
    color: var(--text-dim);
    font-size: 12.5px;
}

.error {
    margin: 8px 0 0;
    color: var(--error);
}

.warning {
    margin: 8px 0 0;
    color: var(--warn);
    font-size: 13px;
}

kbd {
    padding: 1px 5px;
    border: 1px solid var(--panel-line);
    border-radius: 4px;
    background: var(--field-bg);
    font-family: inherit;
    font-size: 12px;
}

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

input[type="text"],
textarea,
select {
    width: 100%;
    box-sizing: border-box;
    padding: 9px 10px;
    border: 1px solid var(--panel-line);
    border-radius: 8px;
    background: var(--field-bg);
    color: var(--text);
    font: inherit;
}

select option {
    background: #1d1428;
}

textarea {
    resize: vertical;
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible,
button:focus-visible,
.button:focus-within {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

input[type="range"] {
    width: 100%;
    accent-color: var(--accent);
}

input[type="checkbox"] {
    accent-color: var(--accent);
}

.field {
    display: grid;
    grid-template-columns: 110px 1fr;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
}

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

.check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    padding: 9px 14px;
    border: none;
    border-radius: 8px;
    background: var(--accent);
    color: var(--accent-ink);
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}

.button:hover {
    filter: brightness(1.08);
}

.button.secondary {
    background: var(--field-bg);
    color: var(--text);
    border: 1px solid var(--panel-line);
}

.button.wide {
    width: 100%;
    margin-top: 4px;
}

.link-button {
    padding: 4px 0;
    border: none;
    background: none;
    color: var(--text-dim);
    font: inherit;
    text-decoration: underline;
    cursor: pointer;
}

/* Pass */
.contact-lead {
    margin: 0 0 8px;
    color: var(--text-dim);
}

#owner-lock {
    margin-top: 10px;
}


.pass-status {
    margin-bottom: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    background: var(--field-bg);
}

.pass-status .state {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.pass-status .dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--error);
}

.pass-status.active .dot {
    background: var(--ok);
}

.pass-status.upcoming .dot {
    background: var(--warn);
}

.pass-status .detail {
    margin-top: 4px;
    color: var(--text-dim);
}

/* Art styles */
.mode-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.mode-cell {
    position: relative;
}

.mode-tile {
    width: 100%;
    height: 100%;
    padding: 14px 6px;
    border: 1px solid var(--panel-line);
    border-radius: 8px;
    background: var(--field-bg);
    color: var(--text);
    font: inherit;
    cursor: pointer;
}

.mode-tile:hover {
    border-color: rgba(255, 255, 255, 0.3);
}

.mode-tile.current {
    border-color: var(--accent);
    background: rgba(223, 160, 242, 0.18);
}

/* Room for the rotation checkbox */
.mode-grid.cycling .mode-tile {
    padding-left: 26px;
    padding-right: 6px;
}

.mode-cell .in-cycle {
    position: absolute;
    top: 6px;
    left: 6px;
    z-index: 1;
    width: 16px;
    height: 16px;
    margin: 0;
    cursor: pointer;
}

/* Uploads */
.upload {
    display: flex;
    gap: 12px;
    align-items: center;
}

.upload-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 84px;
    height: 84px;
    flex: none;
    border: 1px dashed var(--panel-line);
    border-radius: 8px;
    background: repeating-conic-gradient(#2a2233 0 25%, #1d1726 0 50%) 50% / 16px 16px;
    overflow: hidden;
}

.upload-preview img {
    max-width: 100%;
    max-height: 100%;
}

.upload-preview img:not([src]) {
    display: none;
}

.upload-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.qr-link-row {
    margin-top: 12px;
}

/* Tuning */
#grid-preview {
    position: fixed;
    inset: 0;
    z-index: 2450;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
}

.panel-section h4 {
    display: flex;
    gap: 8px;
    align-items: baseline;
    margin: 16px 0 4px;
    font-size: 13px;
}

.tune-row {
    display: grid;
    grid-template-columns: 1fr 110px 42px;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    font-size: 13px;
}

.tune-row span {
    color: var(--text-dim);
}

.tune-row output {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.tune-row input[type="color"] {
    grid-column: 2 / 4;
    width: 100%;
    height: 26px;
    padding: 0;
    border: 1px solid var(--panel-line);
    border-radius: 6px;
    background: none;
}

/* Marks settings that rebuild the grid */
.rebuilds::after {
    content: "";
    display: inline-block;
    width: 9px;
    height: 9px;
    margin-left: 6px;
    border: 1px solid var(--accent);
    background:
        linear-gradient(var(--accent), var(--accent)) center / 1px 100% no-repeat,
        linear-gradient(var(--accent), var(--accent)) center / 100% 1px no-repeat;
    vertical-align: 0;
}

.tune-actions {
    margin-top: 14px;
}

.tune-actions .button {
    flex: 1;
}

/* Price */
.price-table {
    width: 100%;
    border-collapse: collapse;
}

.price-table td {
    padding: 4px 0;
}

.price-table td:last-child {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.hours-row {
    justify-content: space-between;
    margin-top: 10px;
}

.stepper {
    display: flex;
    align-items: center;
    border: 1px solid var(--panel-line);
    border-radius: 8px;
    overflow: hidden;
}

.stepper button {
    width: 36px;
    height: 34px;
    border: none;
    background: var(--field-bg);
    color: var(--text);
    font-size: 18px;
    cursor: pointer;
}

.stepper output {
    min-width: 40px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.price-total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin: 12px 0;
    padding-top: 10px;
    border-top: 1px solid var(--panel-line);
    font-size: 16px;
}

.price-total strong {
    font-size: 22px;
    font-variant-numeric: tabular-nums;
}
