/* RPG Actor - Sprite Generator Styles */

/* ============================================
   LOADING STATE
   ============================================ */

.generator-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6rem 1rem;
    color: var(--ink-light, #8a7a5e);
    font-size: 1rem;
    gap: 1rem;
    max-width: 520px;
    margin: 0 auto;
    text-align: center;
}

.generator-loading p {
    margin: 0;
}

.generator-loading-title {
    font-size: 1.02rem;
    font-weight: 700;
    color: var(--ink-dark, #5f4e34);
    letter-spacing: 0.03em;
}

.generator-loading-status {
    width: min(620px, 100%);
    min-height: 2.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem 0.55rem;
    border-radius: 0.5rem;
    border: 1px solid rgba(140, 116, 67, 0.2);
    background: rgba(255, 248, 225, 0.35);
    color: var(--ink-dark, #5f4e34);
    font-size: 0.88rem;
    line-height: 1.2;
    letter-spacing: 0.005em;
}

.generator-loading-progress {
    width: min(420px, 100%);
    height: 10px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(148, 128, 92, 0.24);
    box-shadow: inset 0 1px 2px rgba(84, 66, 34, 0.18);
}

.generator-loading-progress-fill {
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent, #b8860b), #e0bf69);
    transition: width 0.2s linear;
}

.generator-loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--parchment-dark, #d4c9a8);
    border-top-color: var(--accent, #b8860b);
    border-radius: 50%;
    animation: gen-spin 0.8s linear infinite;
}

@keyframes gen-spin {
    to { transform: rotate(360deg); }
}

.generator-panel {
    transition: opacity 0.25s ease;
}

/* ============================================
   PAGE LAYOUT
   ============================================ */

.gen-coming-soon {
    color: var(--ink-light, #8a7a5e);
    font-style: italic;
    text-align: center;
    padding: 1rem 0;
    margin: 0;
}

.generator-page {
    max-width: 1060px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.generator-panel {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

body.generator-beta-mode .generator-page {
    max-width: 1380px;
}

body.generator-beta-mode .generator-panel {
    gap: 1.25rem;
}

/* ============================================
   CONTROLS (LEFT)
   ============================================ */

.generator-controls {
    flex: 1 1 0;
    min-width: 0;
}

.generator-beta-column {
    width: 280px;
    flex-shrink: 0;
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 2rem);
    overflow: auto;
}

.gen-fieldset {
    border: 1px solid var(--ink-light, #5c4a2e);
    padding: 0.75rem 1rem 1rem;
    margin-bottom: 1rem;
}

.gen-fieldset legend {
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0 0.4rem;
    color: var(--ink, #2c2416);
}

/* Body selector: sprite cards side-by-side, ears centered below */
.body-layout {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.body-selector {
    flex: 1;
    min-width: 0;
    margin-bottom: 0;
}

.body-picker-col {
    flex: 0 0 240px;
}

.body-type-row {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 0.5rem;
}

.body-type-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    border: 2px solid transparent;
    padding: 10px 16px;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.body-type-card:hover {
    border-color: var(--ink-light, #5c4a2e);
    background: rgba(44, 36, 22, 0.03);
}

.body-type-card.active {
    border-color: var(--gold, #c9a227);
    background: rgba(201, 162, 39, 0.08);
}

.body-type-thumb {
    width: 96px;
    height: 96px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    background-color: rgba(44, 36, 22, 0.03);
}

.body-type-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--ink, #2c2416);
    text-align: center;
}

.body-selector .body-toggle {
    margin: 0 auto;
    width: fit-content;
    justify-content: center;
}

.body-toggle-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.body-toggle-row .body-toggle {
    margin: 0;
}

.body-toggle {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.5rem;
    cursor: pointer;
    font-size: 0.82rem;
    color: var(--ink, #2c2416);
    border: 1px solid var(--ink-light, #5c4a2e);
    transition: background 0.15s ease;
}

.body-toggle:hover {
    background: rgba(44, 36, 22, 0.04);
}

.body-toggle input[type="checkbox"] {
    accent-color: var(--gold, #c9a227);
    margin: 0;
    width: 14px;
    height: 14px;
}

.body-toggle-label {
    font-weight: 500;
    user-select: none;
}

/* --- Randomize button --- */
.btn-randomize {
    display: block;
    margin: 0.5rem auto 0;
    padding: 0.35rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: inherit;
    color: var(--ink, #2c2416);
    background: transparent;
    border: 1px solid var(--ink-light, #5c4a2e);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.btn-randomize:hover {
    background: rgba(201, 162, 39, 0.12);
    border-color: var(--gold, #c9a227);
}
.btn-randomize:active {
    background: rgba(201, 162, 39, 0.22);
}

/* ============================================
   SWATCH GRIDS
   ============================================ */

.swatch-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.swatch {
    width: 28px;
    height: 28px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: border-color 0.15s ease, transform 0.1s ease;
    position: relative;
}

.swatch:hover {
    border-color: var(--ink-light, #5c4a2e);
    transform: scale(1.15);
    z-index: 1;
}

.swatch.active {
    border-color: var(--gold, #c9a227);
    box-shadow: 0 0 0 1px var(--gold, #c9a227);
}

/* Smaller swatches for skin grid */
.swatch-grid-sm .swatch {
    width: 18px;
    height: 18px;
    border-width: 1.5px;
}

/* ============================================
   HAIR / CLOTHING PICKER (scrollable thumbnail grid)
   ============================================ */

.hair-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    max-height: 200px;
    overflow-y: scroll;
    /* Always reserve the scrollbar's width (even when content doesn't
       overflow) so the grid's content-box width — and therefore how many
       item columns fit per row — never changes between categories. */
    scrollbar-gutter: stable;
    padding: 4px;
    border: 1px solid rgba(92, 74, 46, 0.2);
    background: rgba(44, 36, 22, 0.02);
    /* Thin scrollbar */
    scrollbar-width: thin;
    scrollbar-color: var(--ink-light, #5c4a2e) transparent;
}

.hair-picker::-webkit-scrollbar {
    width: 6px;
}
.hair-picker::-webkit-scrollbar-thumb {
    background: var(--ink-light, #5c4a2e);
}

.hair-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    cursor: pointer;
    border: 2px solid transparent;
    padding: 2px;
    transition: border-color 0.15s ease;
    min-width: 56px;
}

.hair-item[draggable="true"] {
    cursor: grab;
}

.hair-item.dragging {
    opacity: 0.45;
    cursor: grabbing;
}

.hair-item.beta-drop-before {
    border-left-color: var(--gold, #c9a227);
    box-shadow: inset 2px 0 0 var(--gold, #c9a227);
}

.hair-item.beta-drop-after {
    border-right-color: var(--gold, #c9a227);
    box-shadow: inset -2px 0 0 var(--gold, #c9a227);
}

.hair-item:hover {
    border-color: var(--ink-light, #5c4a2e);
}

.hair-item.active {
    border-color: var(--gold, #c9a227);
    background: rgba(201, 162, 39, 0.08);
}

.hair-item.active.stacked {
    border-color: #2e7d32;
    background: rgba(46, 125, 50, 0.12);
    box-shadow: inset 0 0 0 2px rgba(46, 125, 50, 0.25);
}

.hair-item.equipment-item {
    background: rgba(140, 180, 220, 0.12);
}

.hair-item.equipment-item:hover {
    background: rgba(140, 180, 220, 0.2);
}

.hair-item.equipment-item.active {
    background: rgba(140, 180, 220, 0.22);
}

.hair-item.gift-unclaimed-item {
    background: rgba(170, 46, 46, 0.13);
    border-color: rgba(170, 46, 46, 0.35);
}

.hair-item.gift-unclaimed-item:hover {
    background: rgba(170, 46, 46, 0.22);
    border-color: rgba(170, 46, 46, 0.6);
}

.hair-item.gift-unclaimed-item.active {
    background: rgba(170, 46, 46, 0.28);
    border-color: #aa2e2e;
}

.hair-thumb {
    width: 48px;
    height: 48px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    background: repeating-conic-gradient(rgba(44, 36, 22, 0.06) 0% 25%, transparent 0% 50%) 0 0 / 8px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* Equipment item badge (icon in corner of thumbnail) */
.equipment-badge {
    position: absolute;
    top: 1px;
    right: 1px;
    width: 12px;
    height: 12px;
    pointer-events: none;
    filter: drop-shadow(0 0 1px rgba(255,255,255,0.6));
}

/* Equipment attribution bar below pickers */
.equipment-attribution {
    font-size: 0.8rem;
    font-family: monospace;
    padding: 0.25rem 0.4rem;
    margin-top: 4px;
    border: 1px solid rgba(201, 162, 39, 0.3);
    background: rgba(201, 162, 39, 0.06);
    color: var(--ink-light, #5c4a2e);
}

.equipment-attribution-link {
    color: var(--link, #5a3e28);
    text-decoration: underline;
}

.hair-thumb.hair-none {
    font-size: 1.4rem;
    color: var(--ink-light, #5c4a2e);
    opacity: 0.5;
}

.hair-thumb.hair-add {
    font-size: 1.6rem;
    font-weight: bold;
    color: #2d6a3f;
    background: rgba(60, 160, 90, 0.10);
    border-color: rgba(60, 160, 90, 0.55);
}
.hair-item-add:hover .hair-thumb.hair-add {
    background: rgba(60, 160, 90, 0.22);
}
.hair-item-add.busy { opacity: 0.6; pointer-events: none; }

.hair-loading {
    width: 12px;
    height: 12px;
    border: 2px solid rgba(44, 36, 22, 0.15);
    border-top-color: var(--ink-light, #5c4a2e);
    border-radius: 50%;
    animation: hair-spin 0.6s linear infinite;
}

@keyframes hair-spin {
    to { transform: rotate(360deg); }
}

.hair-label {
    font-size: 0.58rem;
    color: var(--ink-light, #5c4a2e);
    text-align: center;
    font-family: monospace;
    line-height: 1.2;
    width: 100%;
    white-space: nowrap;
}

/* ============================================
   SIDEBAR (RIGHT) - Preview + Colours
   ============================================ */

.generator-sidebar {
    width: 300px;
    flex-shrink: 0;
    position: sticky;
    top: 1rem;
}

.preview-card {
    border: 2px solid var(--ink, #2c2416);
    background: var(--parchment, #f4f1e8);
    padding: 1rem;
    text-align: center;
    margin-bottom: 1rem;
}

/* ── Newly Added box (live generator) ── */
.gen-newly-box {
    border: 2px solid var(--ink, #2c2416);
    background: var(--parchment, #f4f1e8);
    padding: 0.6rem 0.75rem;
    margin-bottom: 1rem;
}

.gen-newly-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.gen-newly-title {
    font-weight: 700;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ink, #2c2416);
}

.gen-newly-hint {
    font-size: 0.68rem;
    opacity: 0.6;
    font-style: italic;
}

.gen-newly-list {
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
    justify-content: center;
    align-items: flex-start;
}

.gen-newly-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    cursor: pointer;
    border: 2px solid transparent;
    padding: 2px;
    min-width: 0;
    flex: 1 1 0;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.gen-newly-item:hover,
.gen-newly-item:focus {
    border-color: var(--gold, #c9a227);
    background: rgba(201, 162, 39, 0.08);
    outline: none;
}

.gen-newly-item .hair-label {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gen-newly-footer {
    margin-top: 0.55rem;
    padding-top: 0.45rem;
    border-top: 1px solid rgba(92, 74, 46, 0.25);
    text-align: center;
    font-size: 0.72rem;
    line-height: 1.35;
    color: var(--ink, #2c2416);
}

.gen-newly-footer .gen-request-btn {
    margin: 0.6rem auto 0;
}

.gen-terms-line {
    margin: 0.6rem 0 0;
    font-size: 0.72rem;
    line-height: 1.4;
    color: var(--ink, #2c2416);
}

.gen-terms-line a {
    color: var(--link, #5a3e28);
    text-decoration: underline;
}

.gen-combos-num {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--gold-dark, #9a7a1e);
}

.gen-combos-sub {
    font-size: 0.6rem;
    opacity: 0.7;
    font-style: italic;
}

.gen-assets-notice {
    border: 1px solid var(--ink, #2c2416);
    background: var(--parchment, #f4f1e8);
    padding: 0.75rem 1rem;
    font-size: 0.82rem;
    line-height: 1.45;
    color: var(--ink, #2c2416);
    opacity: 0.85;
}
.gen-assets-notice p { margin: 0 0 0.4rem; }
.gen-assets-notice p:last-child { margin-bottom: 0; }
.gen-assets-notice a { color: var(--link, #5a3e28); text-decoration: underline; }
.gen-request-btn {
    display: block;
    width: calc(100% - 1rem);
    margin: 0.6rem auto 0.75rem;
    padding: 0.5rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    text-align: center;
    transition: all 0.15s ease;
    border: 1px solid var(--ink, #2c2416);
    background: var(--ink, #2c2416);
    color: var(--parchment, #f4f1e8);
    border-radius: 0;
}
.gen-request-btn:hover {
    background: var(--ink-light, #5c4a2e);
    border-color: var(--ink-light, #5c4a2e);
}

.gen-request-btn:focus {
    outline: none;
}

.preview-card:focus-within {
    border-color: var(--gold, #c9a227);
    box-shadow: 0 0 0 1px var(--gold, #c9a227);
}

.preview-label {
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ink-light, #5c4a2e);
    margin-bottom: 0.75rem;
}

/* Full sprite sheet canvas — hidden but used for export */
#preview-canvas {
    display: none;
}

/* Sprite area: compass + sprite side by side */
.preview-sprite-area {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0.5rem;
    margin-bottom: 0.5rem;
    background: repeating-conic-gradient(rgba(44, 36, 22, 0.06) 0% 25%, transparent 0% 50%) 0 0 / 16px 16px;
    border: 1px solid rgba(92, 74, 46, 0.25);
}

/* Animated preview sprite — rendered by JS drawImage into a canvas element */
.preview-sprite-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 96px;
    height: 96px;
    overflow: hidden;
}

/* canvas.width/height are set in JS to Math.round(96*dpr) for 1:1 physical-pixel mapping.
   CSS size is always 96×96px; image-rendering: pixelated guards any residual rounding. */
.preview-sprite-canvas {
    display: block;
    width: 96px;
    height: 96px;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    image-rendering: pixelated;
}

.preview-hint {
    font-size: 0.65rem;
    color: var(--ink-light, #5c4a2e);
    opacity: 0.6;
    padding-top: 0.3rem;
}

.preview-bodytype-row {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    margin-top: 0.45rem;
}

body.generator-beta-mode .preview-bodytype-row {
    display: flex;
}

.preview-bodytype-label {
    font-size: 0.62rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ink-light, #5c4a2e);
}

.preview-bodytype-select {
    font-family: inherit;
    font-size: 0.72rem;
    padding: 0.2rem 1.4rem 0.2rem 0.5rem;
    border: 1px solid var(--ink-light, #5c4a2e);
    border-radius: 4px;
    background: var(--parchment, #f4f1e8);
    color: var(--ink, #2c2416);
    cursor: pointer;
}

.preview-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.preview-actions .popup-btn {
    flex: 1;
    font-size: 0.82rem;
    padding: 0.4rem 0.75rem;
    text-align: center;
}

/* Prominent "Set Sprite" CTA row */
.preview-actions-cta {
    margin-top: 0.4rem;
}

.btn-set-sprite-cta {
    width: 100%;
    font-size: 1.05rem !important;
    padding: 0.7rem 1rem !important;
    background: var(--accent, #8b5e3c) !important;
    color: var(--parchment, #f4f1e8) !important;
    border: 2px solid var(--ink, #2c2416) !important;
    font-weight: 700;
    letter-spacing: 0.03em;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
    transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}

.btn-set-sprite-cta:hover {
    background: var(--ink, #2c2416) !important;
    transform: translateY(-1px);
    box-shadow: 0 5px 14px rgba(0, 0, 0, 0.3);
}

.btn-set-sprite-cta:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* ============================================
   COMPASS CONTROLS (direction pad)
   ============================================ */

.compass-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    flex-shrink: 0;
}

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

.compass-btn {
    width: 26px;
    height: 26px;
    padding: 0;
    font-size: 10px;
    line-height: 1;
    background: var(--parchment, #f4f1e8);
    border: 1px solid var(--ink, #2c2416);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    font-family: inherit;
    color: var(--ink, #2c2416);
}
.compass-btn:hover { opacity: 1; background: rgba(44, 36, 22, 0.08); }
.compass-btn.active {
    background: var(--ink, #2c2416);
    color: var(--parchment, #f4f1e8);
    opacity: 1;
}

.compass-center {
    width: 26px;
    height: 26px;
    padding: 0;
    font-size: 10px;
    line-height: 1;
    background: var(--parchment, #f4f1e8);
    border: 1px solid var(--ink, #2c2416);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    font-family: inherit;
    color: var(--ink, #2c2416);
}
.compass-center:hover { opacity: 1; background: rgba(44, 36, 22, 0.08); }
.compass-center.walking {
    background: var(--gold, #c9a227);
    color: var(--ink, #2c2416);
    opacity: 1;
}

.step-btn {
    margin-top: 3px;
    width: 80px;
    height: 20px;
    padding: 0;
    font-size: 9px;
    font-weight: 600;
    line-height: 1;
    background: var(--parchment, #f4f1e8);
    border: 1px solid var(--ink, #2c2416);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    font-family: inherit;
    color: var(--ink, #2c2416);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.step-btn:not(:disabled):hover { opacity: 1; background: rgba(44, 36, 22, 0.08); }
.step-btn:disabled { opacity: 0.28; cursor: not-allowed; }

/* ============================================
   IN-PAGE COLOUR PICKER (SV square + hue bar)
   ============================================ */

.color-picker-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
    user-select: none;
    -webkit-user-select: none;
}

.cp-sv-canvas {
    width: 100%;
    aspect-ratio: 1;
    cursor: crosshair;
    border: 1px solid var(--ink-light, #5c4a2e);
    display: block;
}

.cp-hue-canvas {
    width: 100%;
    height: 18px;
    cursor: crosshair;
    border: 1px solid var(--ink-light, #5c4a2e);
    display: block;
}

.cp-info-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cp-preview {
    width: 28px;
    height: 28px;
    border: 1px solid var(--ink-light, #5c4a2e);
    flex-shrink: 0;
}

.cp-hex {
    width: 6.5em;
    padding: 0.3rem 0.4rem;
    font-family: monospace;
    font-size: 0.85rem;
    border: 1px solid var(--ink-light, #5c4a2e);
    background: transparent;
    color: var(--ink, #2c2416);
}

.cp-hex:focus {
    outline: 1px solid var(--gold, #c9a227);
    border-color: var(--gold, #c9a227);
}

.color-picker-inline {
    flex-direction: row;
    gap: 8px;
    align-items: stretch;
    margin-bottom: 0.5rem;
}

.color-picker-inline .cp-sv-canvas {
    width: 80px;
    height: 80px;
    aspect-ratio: auto;
    flex-shrink: 0;
}

.color-picker-inline .cp-hue-canvas {
    width: 80px;
    height: 14px;
}

.color-picker-inline .cp-right-col {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.color-picker-inline .cp-preview {
    width: 22px;
    height: 22px;
}

.color-picker-inline .cp-hex {
    width: 5.5em;
    font-size: 0.8rem;
}

/* ============================================
   COLOUR TABS (Skin/Eye/Hair & Clothing)
   ============================================ */

.colour-tabs {
    display: flex;
    flex-direction: column;
}

.colour-tab-bar {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--ink-light, #5c4a2e);
    margin-bottom: 0.5rem;
}

.colour-tab {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 2px 4px;
    padding: 0.3rem 0.4rem;
    font-family: inherit;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    border-bottom: none;
    background: transparent;
    color: var(--ink-light, #5c4a2e);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    transition: color 0.12s ease, background 0.12s ease;
}

.colour-tab:hover {
    color: var(--ink, #2c2416);
    background: rgba(44, 36, 22, 0.04);
}

.colour-tab.active {
    color: var(--ink, #2c2416);
    border-color: var(--ink-light, #5c4a2e);
    background: var(--parchment, #f4f1e8);
    margin-bottom: -1px;
    padding-bottom: calc(0.3rem + 1px);
}

.colour-tab-panel {
    display: none;
}

.colour-tab-panel.active {
    display: block;
}

/* ============================================
   FOLDABLE CONTAINERS (collapsible sections)
   ============================================ */

.gen-foldable {
    border: 1px solid var(--ink-light, #5c4a2e);
    margin-bottom: 1rem;
    padding: 0;
}

.gen-foldable > summary {
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.6rem 1rem;
    cursor: pointer;
    color: var(--ink, #2c2416);
    user-select: none;
    list-style: none;
    background: rgba(44, 36, 22, 0.06);
    transition: background 0.15s ease;
    display: flex;
    align-items: center;
}

.gen-foldable > summary:hover {
    background: rgba(44, 36, 22, 0.1);
}

.gen-foldable[open] > summary {
    border-bottom: 1px solid rgba(92, 74, 46, 0.15);
}

.gen-foldable > summary::-webkit-details-marker { display: none; }
.gen-foldable > summary::marker { display: none; content: ''; }

.gen-foldable > summary::before {
    content: '\25BE';
    margin-right: 0.5rem;
    flex: none;
}

.gen-foldable:not([open]) > summary::before {
    content: '\25B8';
}

.gen-foldable-body {
    padding: 0.5rem 0.75rem 1rem;
}

/* ============================================
   HAIR LAYOUT (rear + front stacked, colour right)
   ============================================ */

.hair-layout {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.hair-lists-col {
    flex: 1;
    /* Flex items with flex-basis 0% still contribute their MAX-CONTENT size
       when the flex container itself isn't stretched to a definite width
       (e.g. a foldable body that shrink-wraps). A category with very few
       items (like Face > Eyes, which may only have 2) would then let the
       whole row collapse to fit just those items, making that catalogue
       narrower than one with 20 items. Reserve enough width for 5 items
       per row (56px item + 4px gap, plus the picker's own padding) so every
       catalogue keeps the same minimum footprint regardless of item count. */
    min-width: 320px;
}

.hair-colour-col {
    flex: 0 0 240px;
}

.hair-colour-col .colour-section-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--ink-light, #5c4a2e);
    margin-bottom: 0.4rem;
}

.hair-colour-col .cp-sv-canvas {
    aspect-ratio: 1;
}

.hair-colour-col .cp-hue-canvas {
    height: 14px;
}

.hair-colour-col .cp-preview {
    width: 20px;
    height: 20px;
}

.hair-colour-col .cp-hex {
    width: 5.5em;
    font-size: 0.8rem;
}

/* Hair picker height inside tabs */
.hair-lists-col .hair-picker {
    max-height: 280px;
}

/* ============================================
   SKIN TONE LAYOUT (swatches left, picker right)
   ============================================ */

.skin-layout {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.skin-swatches-col {
    flex-shrink: 0;
    width: 100px;
    padding-left: 10px;
}

.skin-picker-col {
    flex: 0 0 120px;
}

.skin-picker-col .cp-sv-canvas {
    aspect-ratio: 1;
}

.skin-picker-col .cp-hue-canvas {
    height: 14px;
}

.skin-picker-col .cp-preview {
    width: 20px;
    height: 20px;
}

.skin-picker-col .cp-hex {
    width: 5.5em;
    font-size: 0.8rem;
}

/* ============================================
   CLOTHING / ACCESSORIES / HANDHELD / OTHER LAYOUT
   ============================================
   These sections all carry the canonical .hair-layout / .hair-lists-col /
   .hair-colour-col classes (added in the HTML alongside their own
    clothing and accessory names, which stay only as functional hooks for JS
   show/hide + node-move logic). No layout rules are duplicated here — see
   the HAIR LAYOUT block above for the single source of truth.
   ============================================ */



/* ============================================
   RESPONSIVE
   ============================================ */

/* --- Tablets / narrow desktops — tighten fixed columns --- */
@media (max-width: 920px) {
    .generator-beta-column {
        width: 240px;
    }

    .generator-sidebar {
        width: 260px;
    }

    /* All colour columns (body/face/hair/clothing/accessories/handheld/
       other) share .hair-colour-col, so one rule keeps them identical. */
    .hair-colour-col {
        flex: 0 0 200px;
    }
}

/* --- Mobile — single column, centred, restrained pickers --- */
@media (max-width: 700px) {
    .generator-page {
        margin: 1rem auto;
        padding: 0 0.5rem;
    }

    .generator-panel {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }

    .generator-sidebar { order: 1; }
    .generator-controls { order: 2; }
    .generator-beta-column { order: 3; }

    /* Preview: centred with a comfortable cap */
    .generator-sidebar {
        width: 100%;
        max-width: 340px;
        position: static;
        margin: 0 auto;
    }

    .generator-beta-column {
        width: 100%;
        max-width: 420px;
        position: static;
        max-height: none;
        overflow: visible;
        margin: 0 auto;
    }

    .preview-card {
        padding: 0.75rem;
    }

    .preview-hint {
        display: none; /* keyboard hint irrelevant on touch */
    }

    /* Controls fill width, content stays centred inside */
    .generator-controls {
        width: 100%;
    }

    /* Snugger foldable padding on smaller screens */
    .gen-foldable {
        margin-bottom: 0.75rem;
    }

    .gen-foldable > summary {
        padding: 0.65rem 0.75rem;
    }

    .gen-foldable-body {
        padding: 0.5rem 0.5rem 0.75rem;
    }

    /* Colour tabs: friendlier touch targets, full-width bar */
    .colour-tab {
        padding: 0.45rem 0.35rem;
        font-size: 0.7rem;
    }

    /* Tab bars always span the foldable width */
    .colour-tabs {
        width: 100%;
    }

    .colour-tab-bar {
        width: 100%;
    }

    /* ---- BODY ---- */
    .body-layout {
        flex-direction: column;
        align-items: center;
    }

    /* Keep body-type cards side-by-side — they're compact enough */
    .body-type-row {
        flex-direction: row;
        justify-content: center;
    }

    .body-type-card {
        padding: 8px 12px;
    }

    /* Skin swatches + picker stay side-by-side, centred within the full-width panel */
    .skin-layout {
        flex-direction: row;
        justify-content: center;
    }

    .skin-swatches-col {
        width: 100px;
        padding-left: 10px;
        flex-shrink: 0;
    }

    .skin-picker-col {
        flex: 0 0 120px;
    }

    /* ---- ALL CATALOGUE SECTIONS (Body/Face/Hair/Clothing/Accessories/
       Handheld/Other) share the canonical classes below, so one rule each
       keeps every section's mobile layout identical. */
    .hair-layout {
        flex-direction: column;
        align-items: center;
    }

    /* Thumbnail grid fills width (more items per row); the 320px desktop
       floor doesn't apply once the layout stacks to a single column. */
    .hair-lists-col {
        width: 100%;
        min-width: 0;
    }

    /* Colour picker column: full-width tab bar, centred canvas */
    .hair-colour-col {
        flex: 1 1 auto;
        width: 100%;
    }

    .hair-colour-col .color-picker-wrap {
        max-width: 210px;
        margin: 0 auto;
    }
}

/* --- Very small phones — scale down where needed --- */
@media (max-width: 380px) {
    .generator-page {
        padding: 0 0.35rem;
    }

    .body-type-thumb {
        width: 72px;
        height: 72px;
    }

    .body-type-card {
        padding: 6px 8px;
    }

    .generator-sidebar {
        max-width: 300px;
    }

    .hair-colour-col {
        max-width: 230px;
    }
}

/* ============================================
   BETA ITEM EDITOR PANEL
   ============================================ */

.beta-item-panel {
    border: 2px solid var(--ink, #2c2416);
    background: var(--parchment, #f4f1e8);
    padding: 1rem;
    text-align: center;
    margin-bottom: 1rem;
}

.beta-panel-hint {
    color: var(--ink-light, #5c4a2e);
    font-style: italic;
    margin: 0;
    padding: 0.5rem 0;
    font-size: 0.82rem;
}

/* Hero area: name input above, frame below */
.beta-panel-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin: 0.5rem 0 0.4rem;
}

.beta-panel-preview-grid {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.beta-panel-preview-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.beta-panel-preview-label {
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--ink-light, #5c4a2e);
    line-height: 1;
}

/* Single sprite frame (48×48, down-facing middle walk cel) */
.beta-panel-frame {
    width: 48px;
    height: 48px;
    background-repeat: no-repeat;
    background-position: -48px 0px; /* col 1, row 0 = front/down, middle step */
    background-size: 144px 192px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    border: 1px solid var(--ink-light, #5c4a2e);
    background-color: rgba(44, 36, 22, 0.06);
    flex-shrink: 0;
    cursor: pointer;
}

.beta-panel-frame:hover {
    border-color: var(--gold, #c9a227);
}

.beta-panel-frame-cmap {
    background-color: rgba(74, 127, 193, 0.08);
}

/* Always-visible name input */
.beta-panel-name-input {
    width: 100%;
    text-align: center;
    font-weight: 700;
    font-size: 0.84rem;
    font-family: inherit;
    color: var(--ink, #2c2416);
    background: rgba(255,255,255,0.6);
    border: 1px solid rgba(92, 74, 46, 0.35);
    padding: 3px 6px;
}

.beta-panel-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    background: #4a7fc1;
    color: #fff;
    padding: 2px 7px;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.beta-panel-badge-live {
    background: #2e7d32;
}

.beta-panel-sep {
    border: none;
    border-top: 1px solid var(--ink-light, #5c4a2e);
    margin: 0.6rem 0;
    opacity: 0.35;
}

.beta-panel-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--ink-light, #5c4a2e);
    margin-bottom: 3px;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    text-align: left;
}

.beta-panel-row {
    display: flex;
    gap: 4px;
    margin-bottom: 0.5rem;
    text-align: left;
}

.beta-panel-fit-input {
    flex: 0 0 13ch;
    min-width: 0;
    width: 13ch;
    font-size: 0.74rem;
    font-weight: 500;
    text-align: left;
    padding: 2px 5px;
    border: 1px solid rgba(92, 74, 46, 0.45);
    background: rgba(255,255,255,0.78);
    color: var(--ink, #2c2416);
}

.beta-panel-prefix {
    font-size: 0.72rem;
    opacity: 0.82;
    white-space: nowrap;
    margin: 0;
    align-self: center;
}

.beta-panel-fold {
    border: 1px solid rgba(92, 74, 46, 0.28);
    margin: 0.5rem 0;
    background: rgba(44, 36, 22, 0.03);
}

.beta-panel-fold > summary {
    cursor: pointer;
    list-style: none;
    user-select: none;
    padding: 0.4rem 0.5rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-light, #5c4a2e);
    background: rgba(44, 36, 22, 0.05);
}

.beta-panel-fold > summary::-webkit-details-marker {
    display: none;
}

.beta-panel-fold-body {
    padding: 0.5rem;
}

.beta-panel-row-cmap {
    margin-top: -0.1rem;
    margin-bottom: 0.02rem;
}

.beta-panel-row-downloads {
    margin-bottom: 0.3rem;
}

.beta-panel-input,
.beta-panel-select {
    flex: 1;
    min-width: 0;
    font-size: 0.78rem;
    font-family: inherit;
    padding: 3px 5px;
    border: 1px solid var(--ink-light, #5c4a2e);
    background: #fff;
    color: var(--ink, #2c2416);
}

.beta-panel-btn {
    flex-shrink: 0;
    padding: 3px 9px;
    font-size: 0.74rem;
    font-weight: 600;
    font-family: inherit;
    border: 1px solid var(--ink, #2c2416);
    background: var(--ink, #2c2416);
    color: var(--parchment, #f4f1e8);
    cursor: pointer;
    transition: background 0.1s, border-color 0.1s;
}

.beta-panel-btn:hover {
    background: var(--ink-light, #5c4a2e);
    border-color: var(--ink-light, #5c4a2e);
}

.beta-panel-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.beta-panel-btn-full {
    width: 100%;
    flex: none;
    text-align: center;
}

.beta-panel-btn-mini {
    width: 64px;
    padding: 2px 3px;
    font-size: 0.6rem;
    line-height: 1.15;
    text-align: center;
}

.beta-panel-actions {
    display: flex;
    gap: 6px;
    margin-top: 0.25rem;
}

.beta-panel-actions .beta-panel-btn {
    flex: 1;
}

.beta-panel-btn-danger {
    background: #8B000088;
    border-color: #8B0000;
    color: #fff;
}

.beta-panel-btn-danger:hover:not(:disabled) {
    background: #8B0000;
    border-color: #8B0000;
}

.beta-panel-btn-live {
    background: #2e7d3288;
    border-color: #2e7d32;
    color: #fff;
}

.beta-panel-btn-live:hover:not(:disabled) {
    background: #2e7d32;
    border-color: #2e7d32;
}

.beta-panel-btn-beta {
    background: #4a7fc188;
    border-color: #4a7fc1;
    color: #fff;
}

.beta-panel-btn-beta:hover:not(:disabled) {
    background: #4a7fc1;
    border-color: #4a7fc1;
}

.beta-panel-btn-promote {
    background: #2e7d3288;
    border-color: #2e7d32;
    color: #fff;
}

.beta-panel-btn-promote:hover:not(:disabled) {
    background: #2e7d32;
    border-color: #2e7d32;
}

.beta-panel-btn-demote {
    background: #ff9800aa;
    border-color: #ff9800;
    color: #fff;
}

.beta-panel-btn-demote:hover:not(:disabled) {
    background: #ff9800;
    border-color: #ff9800;
}

.beta-panel-btn-announce {
    background: #9a5c0088;
    border-color: #9a5c00;
    color: #fff;
}

.beta-panel-btn-announce:hover:not(:disabled) {
    background: #c47200;
    border-color: #f59000;
}

.beta-panel-btn-unlock {
    background: #0e587088;
    border-color: #0e5870;
    color: #fff;
}

.beta-panel-btn-unlock:hover:not(:disabled) {
    background: #0e5870;
    border-color: #1a7a9b;
}

/* Purple READY badge (beta item marked ready for publish) */
.beta-panel-badge-ready {
    background: #a855f7;
}

/* Mark Ready (purple) */
.beta-panel-btn-ready {
    background: #a855f788;
    border-color: #a855f7;
    color: #fff;
}

.beta-panel-btn-ready:hover:not(:disabled) {
    background: #a855f7;
    border-color: #c084fc;
}

/* Mark Unready (muted purple/grey) */
.beta-panel-btn-unready {
    background: #6b5b7e88;
    border-color: #6b5b7e;
    color: #fff;
}

.beta-panel-btn-unready:hover:not(:disabled) {
    background: #6b5b7e;
    border-color: #8a7aa0;
}

/* Notes (developer messageboard) — prominent so open tasks stand out. */
.beta-panel-btn-notes {
    background: #b9770e;
    border-color: #8a5800;
    color: #fff;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.beta-panel-btn-notes:hover:not(:disabled) {
    background: #d18a18;
    border-color: #a86c00;
}

/* Emphasis when the item has open (unresolved) notes for this user. */
.beta-panel-btn-notes.has-open {
    background: #e0890d;
    border-color: #ffce63;
    box-shadow: 0 0 0 1px #ffce63 inset, 0 0 8px rgba(224, 137, 13, 0.5);
}
.beta-panel-btn-notes.has-open:hover:not(:disabled) {
    background: #f59a1d;
}

/* ── Beta Status box (below the preview pane) ── */
.beta-status-box {
    border: 1px solid rgba(92, 74, 46, 0.3);
    background: rgba(44, 36, 22, 0.04);
    padding: 0.5rem 0.6rem;
    margin-top: 0.5rem;
}

.beta-status-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 0.45rem;
    flex-wrap: wrap;
}

.beta-status-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--ink-light, #5c4a2e);
}

.beta-status-summary {
    font-size: 0.66rem;
    font-family: monospace;
    color: var(--ink-light, #5c4a2e);
    opacity: 0.85;
}

.beta-status-controls {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.beta-status-group {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
}

.beta-status-glabel {
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-light, #5c4a2e);
    opacity: 0.7;
    min-width: 2.6em;
}

.beta-status-btn {
    font-size: 0.66rem;
    font-family: inherit;
    padding: 2px 8px;
    border: 1px solid rgba(92, 74, 46, 0.4);
    background: rgba(255, 255, 255, 0.55);
    color: var(--ink, #2c2416);
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease;
}

.beta-status-btn:hover {
    background: rgba(255, 255, 255, 0.85);
    border-color: var(--ink-light, #5c4a2e);
}

.beta-status-btn.active {
    background: var(--ink-light, #5c4a2e);
    border-color: var(--ink-light, #5c4a2e);
    color: #fff;
    font-weight: 700;
}

/* Status-tinted active states so the filter/sort tags read at a glance. */
.beta-status-btn[data-filter="beta"].active  { background: #4a7fc1; border-color: #4a7fc1; }
.beta-status-btn[data-filter="ready"].active { background: #a855f7; border-color: #a855f7; }
.beta-status-btn[data-filter="live"].active  { background: #3fae6b; border-color: #3fae6b; }
.beta-status-btn[data-filter="notes"].active { background: #d08a00; border-color: #d08a00; }
.beta-status-btn[data-sort="status"].active  { background: #2f9e8f; border-color: #2f9e8f; }
.beta-status-btn[data-sort="recent"].active  { background: #d9648a; border-color: #d9648a; }

/* Subtle colored text hint on the inactive status tags. */
.beta-status-btn[data-filter="beta"]:not(.active)  { color: #3a6aa8; }
.beta-status-btn[data-filter="ready"]:not(.active) { color: #8d3fd6; }
.beta-status-btn[data-filter="live"]:not(.active)  { color: #2f8f56; }
.beta-status-btn[data-filter="notes"]:not(.active) { color: #b07400; }

/* ── Beta notes dialog (developer messageboard / task list) ── */
.beta-notes-dialog {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    text-align: left;
    min-width: min(440px, 82vw);
}

.beta-notes-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.beta-notes-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--ink, #2c2416);
}

.beta-notes-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.beta-notes-count {
    font-size: 0.68rem;
    color: var(--ink-light, #5c4a2e);
    opacity: 0.8;
    font-family: monospace;
    margin-right: 2px;
}

.beta-notes-tool-btn {
    font-family: inherit;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 2px 9px;
    border: 1px solid rgba(92, 74, 46, 0.4);
    background: rgba(255, 255, 255, 0.6);
    color: var(--ink, #2c2416);
    cursor: pointer;
    border-radius: 3px;
    transition: background 0.12s ease, border-color 0.12s ease;
}
.beta-notes-tool-btn:hover {
    background: rgba(255, 255, 255, 0.9);
    border-color: var(--ink-light, #5c4a2e);
}
.beta-notes-tool-btn.active {
    background: #2f9e8f;
    border-color: #2f9e8f;
    color: #fff;
}
.beta-notes-tool-bulk {
    color: #8a5800;
    border-color: rgba(185, 119, 14, 0.5);
}
.beta-notes-tool-bulk:hover {
    background: rgba(185, 119, 14, 0.12);
    border-color: #b9770e;
}

.beta-notes-list {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    max-height: 48vh;
    overflow-y: auto;
    padding: 0.4rem;
    border: 1px solid rgba(92, 74, 46, 0.25);
    background: rgba(44, 36, 22, 0.03);
    border-radius: 3px;
}

.beta-notes-empty {
    font-size: 0.8rem;
    color: var(--ink-light, #5c4a2e);
    opacity: 0.8;
    margin: 0.3rem 0;
    text-align: center;
}

.beta-note-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    border-left: 3px solid rgba(168, 85, 247, 0.5);
    padding: 0.3rem 0.5rem;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 0 3px 3px 0;
}

.beta-note-main {
    flex: 1;
    min-width: 0;
}

.beta-note-row.resolved {
    border-left-color: rgba(63, 174, 107, 0.6);
    background: rgba(63, 174, 107, 0.07);
    opacity: 0.7;
}
.beta-note-row.resolved .beta-note-text {
    text-decoration: line-through;
    text-decoration-color: rgba(44, 36, 22, 0.35);
}

.beta-note-meta {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 2px;
    flex-wrap: wrap;
}

.beta-note-author {
    font-size: 0.72rem;
    font-weight: 700;
    color: #8b2fd0;
    font-family: monospace;
}

.beta-note-time {
    font-size: 0.64rem;
    color: var(--ink-light, #5c4a2e);
    opacity: 0.75;
}

.beta-note-tag {
    font-size: 0.58rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #2f8f56;
    background: rgba(63, 174, 107, 0.15);
    padding: 0 5px;
    border-radius: 7px;
}

.beta-note-text {
    font-size: 0.84rem;
    color: var(--ink, #2c2416);
    line-height: 1.35;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Per-note resolve / re-open toggle. */
.beta-note-toggle {
    flex: none;
    width: 24px;
    height: 24px;
    line-height: 1;
    font-size: 0.85rem;
    border: 1px solid rgba(92, 74, 46, 0.4);
    background: rgba(255, 255, 255, 0.7);
    color: #2f8f56;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.beta-note-toggle:hover:not(:disabled) {
    background: #3fae6b;
    border-color: #2f8f56;
    color: #fff;
}
.beta-note-toggle.is-resolved {
    color: #8a5800;
}
.beta-note-toggle.is-resolved:hover:not(:disabled) {
    background: #b9770e;
    border-color: #8a5800;
    color: #fff;
}
.beta-note-toggle:disabled {
    opacity: 0.5;
    cursor: default;
}

.beta-notes-loaderr {
    font-size: 0.72rem;
    color: #8B0000;
}

.beta-notes-add {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.beta-notes-input {
    width: 100%;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 0.84rem;
    padding: 5px 7px;
    border: 1px solid rgba(92, 74, 46, 0.4);
    background: rgba(255, 255, 255, 0.8);
    color: var(--ink, #2c2416);
    resize: vertical;
}

.beta-notes-add-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.beta-notes-msg {
    font-size: 0.72rem;
}

.beta-notes-msg.ok { color: #2e7d32; }
.beta-notes-msg.err { color: #8B0000; }


/* Trait announcement preview popup */
.trait-announce-preview {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.trait-announce-card-img {
    width: 100%;
    max-width: 560px;
    border-radius: 4px;
    display: block;
    margin: 0 auto;
}

.trait-announce-post-text {
    font-family: Georgia, serif;
    font-size: 0.88rem;
    line-height: 1.55;
    white-space: pre-wrap;
    background: rgba(0,0,0,0.12);
    border: 1px solid rgba(245,166,35,0.25);
    border-radius: 4px;
    padding: 0.6rem 0.8rem;
    color: inherit;
    width: 100%;
    box-sizing: border-box;
    resize: vertical;
}

/* Trait announcement popup button variants */
.popup-btn-trait-queue {
    background: #7a4800;
    color: #ffd166;
    border-color: #a86200;
}
.popup-btn-trait-queue:hover {
    background: #9a5c00;
    border-color: #c87800;
}
.popup-btn-trait-now {
    background: #1a5c1a;
    color: #90e890;
    border-color: #2a8a2a;
}
.popup-btn-trait-now:hover {
    background: #237023;
    border-color: #35a835;
}

.beta-panel-status {
    background: rgba(44, 36, 22, 0.05);
    border: 1px solid rgba(44, 36, 22, 0.15);
    padding: 0.5rem 0.75rem;
    border-radius: 3px;
    font-family: monospace;
    font-size: 0.85rem;
}

.beta-panel-msg {
    font-size: 0.74rem;
    min-height: 0;
    padding: 2px 0;
    text-align: left;
    line-height: 1.35;
    word-break: break-word;
}

.beta-panel-msg:empty {
    display: none;
}

.beta-panel-msg.ok { color: #2e7d32; font-weight: 600; }
.beta-panel-msg.err { color: #8B0000; font-weight: 600; }

/* Z-Layer draw-order control */
.beta-zlayer-stack {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin-bottom: 0.35rem;
    border: 1px solid rgba(92, 74, 46, 0.28);
    border-radius: 2px;
    overflow: hidden;
    font-size: 0.7rem;
    font-family: inherit;
}
.beta-zlayer-neighbor {
    padding: 3px 8px;
    color: var(--ink-light, #5c4a2e);
    background: rgba(44, 36, 22, 0.04);
    font-style: italic;
    line-height: 1.3;
}
.beta-zlayer-self {
    padding: 4px 8px;
    background: rgba(201, 162, 39, 0.12);
    border-top: 1px solid rgba(92, 74, 46, 0.18);
    border-bottom: 1px solid rgba(92, 74, 46, 0.18);
    font-weight: 700;
    font-style: normal;
    color: var(--ink, #2c2416);
    line-height: 1.3;
    text-align: center;
}
.beta-zlayer-btn-ctrl {
    flex: 1;
}
.beta-zlayer-dir-row {
    display: flex;
    gap: 4px;
    margin-bottom: 4px;
}
.beta-zlayer-dir-pill {
    flex: 1;
    padding: 3px 0;
    font-size: 0.95rem;
    line-height: 1;
    font-family: inherit;
    border: 1px solid rgba(92,74,46,0.35);
    background: var(--parchment, #f4f1e8);
    color: var(--ink, #2c2416);
    cursor: pointer;
    transition: background 0.1s;
}
.beta-zlayer-dir-pill.active {
    background: var(--ink, #2c2416);
    color: var(--parchment, #f4f1e8);
    border-color: var(--ink, #2c2416);
}
.beta-zlayer-dir-pill.custom::after {
    content: '\25CF';
    font-size: 0.4rem;
    vertical-align: super;
    margin-left: 1px;
    color: var(--gold, #c9a227);
}

/* Inline delete confirm */
.beta-panel-confirm {
    width: 100%;
}
.beta-panel-confirm-msg {
    font-size: 0.78rem;
    color: var(--ink, #2c2416);
    margin: 0 0 0.4rem;
    line-height: 1.4;
}
.beta-panel-confirm-msg span {
    color: #8B0000;
    font-style: italic;
}
.beta-panel-confirm-btns {
    display: flex;
    gap: 6px;
    margin-top: 0.4rem;
}

.beta-delete-modal {
    text-align: center;
}

.beta-delete-modal-previews {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 4px;
}

.beta-delete-modal-title {
    font-weight: 700;
    color: var(--ink, #2c2416);
    margin-bottom: 6px;
}

.beta-delete-modal-warning {
    margin: 8px 0 0;
    font-size: 0.82rem;
    color: #8B0000;
    text-align: right;
}

.beta-delete-modal-actions {
    display: flex;
    gap: 8px;
}

.beta-delete-modal-actions .beta-panel-btn {
    flex: 1;
}

/* Blue background tint on beta-only (unpublished) picker items */
.hair-item.beta-unpublished {
    background: rgba(74, 127, 193, 0.12);
    border-color: rgba(74, 127, 193, 0.3);
}

.hair-item.beta-unpublished:hover {
    background: rgba(74, 127, 193, 0.2);
    border-color: rgba(74, 127, 193, 0.6);
}

.hair-item.beta-unpublished.active {
    background: rgba(74, 127, 193, 0.25);
    border-color: #4a7fc1;
}

.hair-item.beta-unpublished .hair-label {
    color: #3a6aaa;
}

/* Bright purple tint on beta items a contributor has Marked Ready for publish */
.hair-item.beta-ready {
    background: rgba(168, 85, 247, 0.16);
    border-color: rgba(168, 85, 247, 0.45);
}

.hair-item.beta-ready:hover {
    background: rgba(168, 85, 247, 0.26);
    border-color: rgba(168, 85, 247, 0.7);
}

.hair-item.beta-ready.active {
    background: rgba(168, 85, 247, 0.32);
    border-color: #a855f7;
}

.hair-item.beta-ready .hair-label {
    color: #8b2fd0;
    font-weight: 700;
}

/* ── Realtime sync: presence, in-box notice, recent feed, category chips ── */

/* Tile another contributor currently has open in their Edit panel. */
.hair-item.being-edited {
    outline: 2px dashed #f59e0b;
    outline-offset: -2px;
}

.hair-item.being-edited::after {
    content: '\270E';
    position: absolute;
    top: 1px;
    right: 2px;
    font-size: 11px;
    line-height: 1;
    color: #f59e0b;
    text-shadow: 0 0 2px rgba(0, 0, 0, 0.6);
    pointer-events: none;
}

/* In-box transient notice (replaces the old floating toasts). */
.beta-sync-notice {
    margin-top: 4px;
    padding: 5px 8px;
    border-radius: 4px;
    font-size: 0.66rem;
    line-height: 1.35;
    background: rgba(74, 127, 193, 0.14);
    border-left: 3px solid #4a7fc1;
    color: var(--ink, #2c2416);
    animation: betaNoticeIn 0.25s ease;
}

.beta-sync-notice.warn {
    background: rgba(245, 158, 11, 0.18);
    border-left-color: #f59e0b;
    font-weight: 700;
}

.beta-sync-notice.ok {
    background: rgba(63, 174, 107, 0.16);
    border-left-color: #3fae6b;
}

@keyframes betaNoticeIn {
    from { opacity: 0; transform: translateY(-3px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* "Who is editing what" presence line inside the Beta Status box. */
.beta-sync-presence {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 4px;
    padding: 3px 6px;
    border-radius: 4px;
    background: rgba(185, 116, 0, 0.1);
    font-size: 0.64rem;
    line-height: 1.3;
    color: #8a5600;
}

.beta-presence-dot {
    flex: none;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #f59e0b;
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.6);
    animation: betaPresencePulse 1.8s infinite;
}

@keyframes betaPresencePulse {
    0%   { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.55); }
    70%  { box-shadow: 0 0 0 6px rgba(245, 158, 11, 0); }
    100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

/* Per-category status chips injected into each accordion <summary>. */
.beta-cat-counts {
    display: inline-flex;
    gap: 4px;
    margin-left: auto;
    vertical-align: middle;
}

.beta-cat-chip {
    display: inline-block;
    padding: 0 7px;
    border-radius: 8px;
    font-size: 0.62rem;
    font-weight: 700;
    line-height: 16px;
    letter-spacing: 0.02em;
    text-align: center;
    color: #fff;
    white-space: nowrap;
}

.beta-cat-chip.beta  { background: #4a7fc1; }
.beta-cat-chip.ready { background: #a855f7; }
.beta-cat-chip.noted { background: #d08a00; }

/* Compact count circles injected into catalogue sub-tabs (Hair, Bangs, …). */
.beta-subtab-counts {
    flex-basis: 100%;
    width: 100%;
    display: flex;
    gap: 3px;
    justify-content: center;
    margin: 2px 0 0;
}

.beta-subtab-dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 14px;
    height: 14px;
    padding: 0 3px;
    border-radius: 50%;
    font-size: 0.56rem;
    font-weight: 700;
    line-height: 1;
    color: #fff;
}

.beta-subtab-dot.beta  { background: #4a7fc1; }
.beta-subtab-dot.ready { background: #a855f7; }
.beta-subtab-dot.noted { background: #d08a00; }

/* ── Recently Updated panel (inside the Beta Status box) ── */
.beta-recent-panel {
    margin-top: 0.5rem;
    border-top: 1px solid rgba(92, 74, 46, 0.22);
    padding-top: 0.4rem;
}

.beta-recent-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 0.3rem;
}

.beta-recent-title {
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-light, #5c4a2e);
}

.beta-recent-hint {
    font-size: 0.58rem;
    opacity: 0.6;
    font-style: italic;
}

.beta-recent-list {
    max-height: 150px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    scrollbar-width: thin;
}

.beta-recent-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 6px;
    padding: 3px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.4);
    font-size: 0.64rem;
    line-height: 1.3;
    cursor: pointer;
    transition: background 0.12s ease;
}

.beta-recent-row[data-nav-key]:hover,
.beta-recent-row[data-nav-key]:focus {
    background: rgba(74, 127, 193, 0.18);
    outline: none;
}

.beta-recent-row.is-delete {
    opacity: 0.7;
}

.beta-recent-row.is-delete .beta-recent-item {
    text-decoration: line-through;
}

.beta-recent-row.mine {
    opacity: 0.72;
}

.beta-recent-row.mine .beta-recent-item {
    color: #6b6256;
}

.beta-recent-main {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--ink, #2c2416);
}

.beta-recent-item {
    font-weight: 600;
    color: #3a6aaa;
}

.beta-recent-time {
    flex: none;
    font-size: 0.58rem;
    font-family: monospace;
    opacity: 0.7;
}

.beta-recent-empty {
    font-size: 0.62rem;
    opacity: 0.6;
    font-style: italic;
    padding: 3px 6px;
}

.beta-recent-more {
    margin-top: 2px;
    padding: 4px 6px;
    border: 1px dashed rgba(92, 74, 46, 0.4);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.3);
    color: var(--ink-light, #5c4a2e);
    font-family: inherit;
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease;
}

.beta-recent-more:hover:not([disabled]) {
    background: rgba(74, 127, 193, 0.14);
    color: var(--ink, #2c2416);
}

.beta-recent-more[disabled] {
    opacity: 0.6;
    cursor: default;
}

.beta-recent-row.flash {
    animation: betaRecentFlash 1.4s ease;
}

@keyframes betaRecentFlash {
    0%   { background: rgba(245, 200, 80, 0.7); }
    100% { background: rgba(255, 255, 255, 0.4); }
}

/* Developer-note count badge on a picker tile */
.hair-note-badge {
    position: absolute;
    top: 1px;
    left: 1px;
    min-width: 13px;
    height: 13px;
    padding: 0 2px;
    box-sizing: border-box;
    background: #9a5c00;
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    line-height: 13px;
    text-align: center;
    border-radius: 7px;
    pointer-events: none;
    font-family: monospace;
}

/* ── Beta Status filter/sort (CSS-driven, auto-applies as pickers rebuild) ── */
/* Filtering: hide items whose status doesn't match. Items without a status
   (None tile, Add New tile) always remain visible. */
body[data-beta-filter="beta"]  .hair-item[data-status]:not([data-status="beta"]),
body[data-beta-filter="ready"] .hair-item[data-status]:not([data-status="ready"]),
body[data-beta-filter="live"]  .hair-item[data-status]:not([data-status="live"]),
body[data-beta-filter="notes"] .hair-item[data-status]:not([data-has-notes]) {
    display: none;
}

/* Sorting by status: ready first, then beta, then live (flex order). */
body[data-beta-sort="status"] .hair-item[data-status="ready"] { order: 0; }
body[data-beta-sort="status"] .hair-item[data-status="beta"]  { order: 1; }
body[data-beta-sort="status"] .hair-item[data-status="live"]  { order: 2; }


/* ============================================
   GENERATOR BETA BANNER (construction tape)
   ============================================ */

.gen-beta-banner {
    background: repeating-linear-gradient(
        -45deg,
        #ffd700,
        #ffd700 10px,
        #1a1100 10px,
        #1a1100 20px
    );
    text-align: center;
    padding: 0.3rem 1rem;
    user-select: none;
    position: relative;
    z-index: 10;
}

.gen-beta-banner-text {
    display: inline-block;
    background: #000;
    color: #ffd700;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 900;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    padding: 0.15rem 1rem;
    line-height: 1.2;
}

/* SWITCH TO LIVE VIEW button — sits above the preview card */
.btn-live-view {
    display: block;
    width: 100%;
    padding: 0.5rem 1rem;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    background: #2e7d32;
    color: #fff;
    border: 1px solid #1b5e20;
    cursor: pointer;
    margin-bottom: 0.5rem;
    transition: background 0.15s, border-color 0.15s;
}

.btn-live-view:hover {
    background: #1b5e20;
    border-color: #1b5e20;
}
