body {
    padding: 0 calc(20px * var(--space-scale)) calc(60px * var(--space-scale)) calc(20px * var(--space-scale));
}

#site-header {
    margin: 0 calc(-20px * var(--space-scale));
}

.header-controls {
    display: flex;
    align-items: center;
    gap: calc(8px * var(--space-scale));
}

@media (max-width: 640px) {
    .site-header-inner {
        flex-wrap: wrap;
        height: auto;
        padding: calc(12px * var(--space-scale)) calc(20px * var(--space-scale));
        gap: calc(10px * var(--space-scale));
    }

    .header-controls {
        width: 100%;
        justify-content: center;
    }
}

.container {
    max-width: 640px;
    padding: calc(40px * var(--space-scale));
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: calc(12px * var(--radius-scale));
    text-align: left;
}

h1 {
    color: var(--text);
    font-size: 2.2em;
    margin: 0 0 calc(10px * var(--space-scale)) 0;
    font-weight: 700;
    border-bottom: 1px solid var(--border);
    padding-bottom: calc(15px * var(--space-scale));
}

label {
    display: block;
    margin: calc(24px * var(--space-scale)) 0 calc(8px * var(--space-scale)) 0;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.95em;
}

input,
select,
button {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: calc(8px * var(--radius-scale));
    padding: calc(12px * var(--space-scale)) calc(14px * var(--space-scale));
    font-size: 1rem;
    font-family: inherit;
    box-sizing: border-box;
    transition: border-color 0.2s ease;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--accent-bright);
}

button {
    font-weight: 600;
    background: linear-gradient(180deg, var(--accent-bright), var(--accent));
    color: var(--text-strong);
    border: none;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(var(--accent-bright-rgb), 0.3);
}

.lookup-row {
    display: flex;
    gap: calc(10px * var(--space-scale));
}

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

.lookup-row button {
    flex-shrink: 0;
}

.status {
    min-height: 1.2em;
    margin: calc(10px * var(--space-scale)) 0 0 0;
    font-size: 0.9em;
    color: var(--text-muted);
}

.viewer-tab {
    padding: calc(8px * var(--space-scale)) calc(16px * var(--space-scale));
    font-size: 0.85rem;
    background: var(--surface-alt);
    color: var(--text-muted);
}

.viewer-tab.active {
    background: linear-gradient(180deg, var(--accent-bright), var(--accent));
    color: var(--text-strong);
    border-color: transparent;
}

.viewer-card {
    margin-top: calc(20px * var(--space-scale));
    text-align: center;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: calc(10px * var(--radius-scale));
    padding: calc(20px * var(--space-scale));
}

.hidden {
    display: none;
}

.player-info {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: calc(10px * var(--space-scale));
    margin: 0;
}

.player-name {
    color: var(--accent-bright);
    font-weight: 700;
    font-size: 0.95em;
}

.player-uuid {
    background: var(--surface-alt);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: calc(4px * var(--space-scale)) calc(12px * var(--space-scale));
    border-radius: 999px;
    font-size: 0.8em;
    font-family: var(--font-mono);
}

h3 {
    color: var(--text);
    font-size: 1.1em;
    margin: 0 0 calc(8px * var(--space-scale)) 0;
    font-weight: 700;
}

.render-credit {
    margin: 0 0 calc(16px * var(--space-scale)) 0;
    font-size: 0.85em;
    color: var(--text-muted);
}

.render-controls {
    display: flex;
    gap: calc(10px * var(--space-scale));
    justify-content: center;
    margin-bottom: calc(16px * var(--space-scale));
}

.render-controls select {
    flex: 1;
    max-width: 160px;
}

.render-toggles {
    display: flex;
    justify-content: center;
    gap: calc(20px * var(--space-scale));
    margin-bottom: calc(16px * var(--space-scale));
    font-size: 0.9em;
    color: var(--text-muted);
}

.render-toggle {
    display: flex;
    align-items: center;
    gap: calc(6px * var(--space-scale));
    cursor: pointer;
}

.render-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
    padding: 0;
    margin: 0;
    border-radius: calc(4px * var(--radius-scale));
    accent-color: var(--accent-bright);
    cursor: pointer;
}

.render-preview {
    display: block;
    max-width: 180px;
    min-height: 90px;
    margin: 0 auto;
    border-radius: calc(8px * var(--radius-scale));
    background:
        repeating-conic-gradient(var(--surface) 0% 25%, var(--bg) 0% 50%) 50% / 20px 20px;
}

#render-download {
    margin-top: calc(14px * var(--space-scale));
    padding: calc(8px * var(--space-scale)) calc(20px * var(--space-scale));
    font-size: 0.9rem;
}

/* Collapsible "Instructions" (a <details>, not a <section>). */
.instructions {
    margin: calc(20px * var(--space-scale)) 0 calc(30px * var(--space-scale)) 0;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: calc(10px * var(--radius-scale));
    overflow: hidden;
}

.instructions summary {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: calc(12px * var(--space-scale));
    padding: calc(16px * var(--space-scale)) calc(20px * var(--space-scale));
    font-weight: 700;
    color: var(--text);
    cursor: pointer;
    user-select: none;
}

.instructions summary::-webkit-details-marker {
    display: none;
}

.instructions summary::after {
    content: "\25BE";
    color: var(--accent-bright);
    font-size: 0.85em;
    transition: transform 0.2s ease;
}

.instructions[open] summary {
    border-bottom: 1px solid var(--border);
}

.instructions[open] summary::after {
    transform: rotate(180deg);
}

.instructions summary:hover {
    color: var(--accent-bright);
}

.instructions-body {
    padding: calc(18px * var(--space-scale)) calc(20px * var(--space-scale)) calc(4px * var(--space-scale)) calc(20px * var(--space-scale));
    color: var(--text-muted);
}

.instructions-body p {
    margin: 0 0 calc(14px * var(--space-scale)) 0;
}

.instructions-body strong,
.instructions-body em {
    color: var(--text);
}

#viewer-position,
#viewer-share {
    text-align: left;
}

#canvas-mount {
    margin: 0 auto;
    max-width: 420px;
}

.output-heading {
    margin: calc(24px * var(--space-scale)) 0 0 0;
    padding-top: calc(20px * var(--space-scale));
    border-top: 1px solid var(--border);
}

.output-gallery {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
    gap: calc(12px * var(--space-scale));
}

.output-gallery .tools-text {
    flex-basis: 100%;
    color: var(--text-muted);
    font-size: 0.85em;
    margin: 0 0 calc(4px * var(--space-scale)) 0;
    font-weight: 600;
}

.output-gallery a {
    display: block;
    max-width: 150px;
}

.output-gallery .ava {
    display: block;
    width: 100%;
    height: auto;
    border-radius: calc(4px * var(--radius-scale));
}

@media (max-width: 480px) {
    .output-gallery a {
        max-width: 120px;
    }
}

.output-gallery .fade-in {
    animation: outputFadeIn ease 0.5s;
}

@keyframes outputFadeIn {
    0% { opacity: 0; }
    40% { opacity: 0; }
    100% { opacity: 1; }
}

.share-actions {
    display: flex;
    flex-wrap: wrap;
    gap: calc(10px * var(--space-scale));
    margin-bottom: calc(20px * var(--space-scale));
}

.pose-share-row {
    display: flex;
    flex-wrap: wrap;
    gap: calc(10px * var(--space-scale));
}

.pose-share-row input {
    flex: 1;
    min-width: 200px;
}

.pose-share-row button {
    flex-shrink: 0;
}
