/* Chroma Core - UI REVISION PASS V5 (Navigation & Mobile) */

:root {
    --game-bg: #000000;
    --primary: #ebd9cd;
    --primary-dark: #1a282c;
    --primary-dim: rgba(235, 217, 205, 0.6);
    --primary-bg: rgba(235, 217, 205, 0.15);
    --success: #E7E2FF;
    --error: #ee7d77;
    --font-ui: 'Bricolage Grotesque', sans-serif;
}

/* Base Body mapped to main portfolio theme */
body.chroma-body {
    background-color: var(--bg);
    color: var(--fg);
    font-family: var(--font-ui);
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Suppress global noise overlay from main.css on the game page */
body.chroma-body::before {
    display: none;
}

/* Landing Screen & Frame Stability */
.ui-frame {
    z-index: 1001 !important;
    /* Ensure nav is always above landing/app */
    pointer-events: none;
    transition: opacity 0.3s ease;
}

/* Hide frame only during active gameplay to avoid overlap with game header */
body.game-active .ui-frame {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

.chroma-landing {
    position: absolute;
    inset: 0;
    z-index: 200;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: var(--bg);
    transition: opacity 0.5s ease;
    padding: 20px;
}

.landing-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2;
    width: 100%;
    max-width: 900px;
}

.landing-title {
    font-size: clamp(3rem, 15vw, 8rem);
    line-height: 0.9;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--fg);
}

.landing-subtitle {
    font-size: clamp(0.9rem, 2vw, 1.2rem);
    font-weight: 300;
    color: rgba(235, 217, 205, 0.7);
    margin-bottom: 56px;
    padding: 0 20px;
}

/* Button & Link Refinement */
.view-btn {
    cursor: pointer;
    align-self: center;
    border: none;
    display: inline-block;
    outline: none;
    font-family: inherit;
    transition: 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    display: flex;
    align-items: center;
    padding: 13px 24px;
    justify-content: center;
}

.landing-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 32px;
}

/* Color Quantity Stepper */
.color-qty-selector {
    display: flex;
    align-items: center;
    background: var(--primary-dark);
    border: 1px solid var(--frame-color);
    border-radius: 4px;
    padding: 2px;
    gap: 0px;
    backdrop-filter: blur(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.color-qty-selector:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.qty-btn {
    width: 38px;
    height: 38px;
    border-radius: 2px;
    border: none;
    background: transparent;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.qty-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    color: var(--fg);
}

.qty-btn:active:not(:disabled) {
    transform: scale(0.92);
}

.qty-btn:disabled {
    opacity: 0.2;
    cursor: default;
    filter: grayscale(1);
    background: transparent !important;
}

.qty-val {
    min-width: 32px;
    text-align: center;
    font-size: .8rem;
    font-weight: 800;
    font-family: 'Bricolage Grotesque', sans-serif;
    color: var(--primary);
    user-select: none;
}

.select-colors-desc {
    margin-top: 16px;
    font-size: .8rem;
    font-weight: 200;
    font-family: 'Bricolage Grotesque', sans-serif;
    color: var(--primary-dim);
    user-select: none;
}

.btn-primary {
    background: var(--primary) !important;
    color: var(--primary-dark) !important;
    font-weight: 800;
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05) !important;
    color: var(--fg) !important;
    border: 1px solid var(--frame-color) !important;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1) !important;
}

/* Gameplay HUD & Header */
.chroma-app {
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    z-index: 100;
    background-color: var(--game-bg);
}

.chroma-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 64px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(20px);
    z-index: 1010;
    /* Above countdown overlay (1000) */
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    padding-right: 20px;
    border-bottom: 1px solid var(--frame-color);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 24px;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 16px;
    /* Space between title and badge */
}

.header-title {
    font-size: 16px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.header-scheme {
    font-size: 10px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--primary);
    border-radius: 4px;
    transition: all 0.2s ease;
}

.header-status {
    display: flex;
    gap: 32px;
    align-items: center;
}

.status-col {
    display: flex;
    flex-direction: column;
}

.status-label {
    font-size: 9px;
    text-transform: uppercase;
    color: var(--primary-dim);
    letter-spacing: 0.1em;
}

.status-value {
    font-size: 13px;
    font-weight: 700;
    color: var(--fg);
}

.status-divider {
    height: 24px;
    width: 1px;
    background: var(--frame-color);
}

.timer {
    display: flex;
    justify-content: center;
    align-items: center;
}

.timer-text {
    font-size: 20px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    font-variation-settings: "wdth" 60;
    letter-spacing: -0.02em;
}

/* Blocks Stage & Badges */
.chroma-stage {
    flex: 1;
    display: flex;
    flex-wrap: nowrap;
    width: 100%;
    /* Accounting for fixed header (64px) and footer (180px) */
    padding-top: 64px;
    padding-bottom: 180px;
    box-sizing: border-box;
    background: var(--game-bg);
}

.color-block {
    flex: 1;
    position: relative;
    transition: flex 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s ease;
    overflow: hidden;
    min-width: 0;
    /* Allow shrinking */
}

.color-block.active {
    flex: 1.8;
}

.color-block {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding-bottom: 48px;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    touch-action: none;
    /* Prevent scroll while dragging colors */
}

.color-block.editable {
    cursor: pointer;
}

.color-block.active {
    flex: 1.6;
    z-index: 10;
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.2);
    border: 4px solid rgba(255, 255, 255, 1);
    outline-offset: -2px;
    cursor: default;
}

/* Badge Stabilization Logic */
.block-badge {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.lock-badge {
    top: 48px;
    /* Header 64px + 32px offset */
    flex-direction: row;
    background: rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    padding: 6px 12px;
    padding-left: 10px;
    border-radius: 999px;
    color: var(--primary);
    gap: 8px;
    opacity: 1;
}

.edit-badge {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(255, 255, 255, 0.95);
}

.color-block.active .edit-badge {
    opacity: .5;
    transform: translate(-50%, -50%);
}

.badge-text {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    white-space: nowrap;
}

.block-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 4px;
    color: rgba(255, 255, 255, 1);
}

/* Drag Handle */
.drag-handle {
    position: absolute;
    top: 51px;
    width: 20px;
    height: 20px;
    left: 50%;
    transform: translateX(-50%) rotate(90deg);
    /* Horizontal arrow */
    opacity: 0;
    transition: opacity 0.2s ease;
    cursor: grab;
}

.color-block.editable:hover .drag-handle {
    opacity: 0.5;
}

.color-block.active .drag-handle {
    opacity: 0.5;
}

/* Controls & Hex Input Fix */
.chroma-controls {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(10, 15, 18, 0.95);
    backdrop-filter: blur(40px);
    border-top: 1px solid var(--frame-color);
    padding: 32px 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 80px;
    z-index: 150;
    height: 180px;
    user-select: none;
    /* Prevent text selection glitches during slider drags */
}

.color-wheel-wrapper {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    flex-shrink: 0;
    background: #000;
    border: 2px solid var(--frame-color);
}

#color-wheel-canvas {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    cursor: crosshair;
    touch-action: none;
}

.color-wheel-handle {
    position: absolute;
    width: 14px;
    height: 14px;
    border: 2px solid var(--primary);
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
    pointer-events: none;
    transform: translate(-50%, -50%);
}

.sliders-container {
    flex: 1.5;
    display: flex;
    flex-direction: column;
    gap: 12px;
    justify-content: center;
}

.slider-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.slider-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.slider-header label {
    font-size: 10px;
    text-transform: uppercase;
    color: var(--primary-dim);
    letter-spacing: 0.1em;
    font-weight: 500;
}

.slider-val {
    font-size: 12px;
    font-weight: 800;
    color: var(--primary);
}

.slider-track {
    position: relative;
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    cursor: pointer;
    margin: 4px 0;
    touch-action: none;
}

.hue-track {
    background: linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00);
}

.slider-thumb {
    position: absolute;
    top: 50%;
    width: 20px;
    height: 20px;
    background: var(--primary);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    cursor: pointer;
    box-shadow: 0 0 12px rgba(0, 0, 0, 0.6);
    transition: transform 0.1s;
}

.action-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0px;
    min-width: 340px;
}

.in-game {
    width: 100%;
    border-radius: 0px 0px 4px 4px;
}

.input-group label {
    display: block;
    font-size: 10px;
    text-transform: uppercase;
    color: var(--primary-dim);
    margin-bottom: 8px;
    font-weight: 500;
    user-select: none;
    /* Prevent selection glitch on drag */
}

#hue-val,
#sat-val,
#lit-val {
    user-select: none;
}

.hex-input-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 4px 0px 0px 0px;
    border: 1px solid var(--frame-color);
    padding: 12px 16px;
    position: relative;
    flex: 1;
}

.hex-input-wrapper span {
    color: var(--primary-dim);
    font-size: 14px;
    font-weight: 700;
}

.hex-input {
    background: none !important;
    border: none !important;
    color: var(--primary) !important;
    font-family: 'Bricolage Grotesque', sans-serif;
    font-size: 16px;
    font-weight: 400;
    text-transform: uppercase;
    width: 100%;
    outline: none;
    letter-spacing: 0.05em;
    padding: 0;
}

.hex-row {
    display: flex;
    align-items: stretch;
}

.color-picker-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--frame-color);
    border-left: 0px;
    border-radius: 0px 4px 0px 0px;
    color: var(--primary-dim);
    cursor: pointer;
    padding: 0 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
    flex-shrink: 0;
}

.color-picker-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--primary);
}

.color-picker-btn.sampling-active {
    background: var(--primary);
    color: var(--primary-dark);
}

.chroma-stage.sampling-mode .color-block {
    cursor: crosshair !important;
}

.chroma-stage.sampling-mode .color-block::after {
    content: "Tap to sample";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    border-radius: 4px;
    pointer-events: none;
    opacity: 0.8;
    z-index: 20;
}

.chroma-stage.sampling-mode .block-badge,
.chroma-stage.sampling-mode .block-label {
    opacity: 0 !important;
}

/* Countdown Overlay UI Refinement */
.countdown-overlay {
    --controls-h: 180px;
    --mask-top: 64px;
    --mask-left: 0px;
    --mask-bottom: 180px;

    position: absolute;
    inset: 0;
    z-index: 1000;
    pointer-events: auto;
    transition: none;
    /* Instant IN */
}

.countdown-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.5s ease, visibility 0.5s ease;
    /* Fade OUT */
}

/* Stage Mask: Grayscale + Tint exactly over non-locked blocks */
.stage-mask {
    position: absolute;
    top: var(--mask-top);
    left: var(--mask-left);
    right: 0;
    bottom: var(--mask-bottom);
    backdrop-filter: grayscale(1) blur(10px);
    background: rgba(255, 255, 255, 0.75);
    overflow: hidden;
    z-index: 1;
}

/* Controls Mask: Covers the footer totally */
.controls-mask {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--controls-h);
    background: var(--game-bg);
    border-top: 1px solid var(--frame-color);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
}

.countdown-content {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0 40px;
    z-index: 1002;
    pointer-events: none;
}

.countdown-instruction {
    display: flex;
    align-items: center;
    gap: 40px;
}

.instruction-arrow {
    width: 320px;
    height: 2px;
    background: #000;
    position: relative;
    display: flex;
    align-items: center;
}

/* Desktop: pointing LEFT */
.instruction-arrow::after {
    content: '';
    position: absolute;
    left: 0;
    width: 12px;
    height: 12px;
    border-left: 2px solid #000;
    border-top: 2px solid #000;
    transform: rotate(-45deg);
}

.instruction-text {
    pointer-events: auto;
}

.instruction-text h2 {
    font-size: clamp(1.2rem, 3.5vw, 2.2rem);
    font-weight: 800;
    line-height: 1;
    margin: 0;
    color: #000;
    max-width: 400px;
    letter-spacing: -0.02em;
}

.instruction-text p {
    font-size: 11px;
    font-weight: 600;
    color: rgba(0, 0, 0, 0.6);
    margin-top: 12px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

#countdown-number {
    font-weight: 800;
}

.skip-btn {
    min-width: 220px;
    padding: 16px 32px;
    border-radius: 4px;
    font-size: 14px;
    pointer-events: auto;
}

/* Response Arrow & Layout for Mobile */
@media (max-width: 768px) {
    .countdown-instruction {
        flex-direction: column;
        /* Arrow above text */
        text-align: center;
        gap: 24px;
    }

    .instruction-arrow {
        width: 2px;
        height: 5vh;
        background: #000;
    }

    /* Mobile: pointing UP */
    .instruction-arrow::after {
        top: 0;
        left: 50%;
        border-left: 2px solid #000;
        border-top: 2px solid #000;
        border-bottom: none;
        transform: translateX(-50%) rotate(45deg);
    }

    .instruction-text h2 {
        font-size: 1.4rem;
    }
}

/* Modal and Graph */
.result-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    opacity: 1;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    padding: 0;
}

.result-modal-container {
    display: flex;
    width: 100%;
    min-height: 100%;
    flex-shrink: 0;
    /* Critical for scrollability in flex column */
}

.result-modal {
    width: 100%;
    max-width: 1060px;
    margin: auto;
    /* Centered on Desktop! */
    background: rgba(18, 22, 25, 0.6);
    border: 1px solid var(--frame-color);
    border-radius: 12px;
    display: flex;
    flex-direction: row;
    overflow: hidden;
    position: relative;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
}

/* Removed redundant media query as center is now default */

.result-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.result-back-btn {
    position: fixed;
    /* Keep it visible while scrolling */
    top: 24px;
    left: 24px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: var(--primary);
    cursor: pointer;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
    z-index: 2100;
}

.result-back-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.1);
}

.header-scheme.match {
    background: transparent;
    color: var(--primary);
}

/* Styles moved to .result-modal definition above */

.result-info {
    flex: 1.1;
    padding: 56px;
    display: flex;
    flex-direction: column;
}

.result-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.result-sub {
    font-size: 11px;
    color: var(--primary-dim);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-weight: 500;
}

.result-line {
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
}

.result-score {
    font-size: 3rem;
    line-height: 1;
    font-weight: 800;
    margin: 0;
    letter-spacing: -3px;
    color: var(--primary);
}

.result-score .percent {
    font-size: 1.5rem;
    color: var(--primary-dim);
    margin-left: 2px;
}

.result-desc {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--primary-dim);
    margin-top: 12px;
    margin-bottom: 56px;
    letter-spacing: 0.12em;
    font-weight: 500;
}

.scheme-tag {
    margin-left: 50%;
    transform: translateX(-50%);
    display: inline-block;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    font-size: 9.5px;
    text-transform: uppercase;
    align-self: start;
    letter-spacing: 0.2em;
    color: var(--primary);
    margin-top: 8px;
    font-weight: 700;
}

.stats-list {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-label {
    font-size: 10px;
    text-transform: uppercase;
    color: var(--primary-dim);
    letter-spacing: 0.1em;
}

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

.stat-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    min-width: 44px;
}

.stat-bar-track {
    flex: 1;
    height: 2px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 1px;
    position: relative;
}

.stat-bar-fill {
    position: absolute;
    height: 100%;
    top: 0;
    background: var(--primary);
}

.wcag-box {
    margin-top: 24px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--frame-color);
    padding: 16px;
    border-radius: 6px;
    display: flex;
    align-items: center;
}

.wcag-res-tag {
    display: inline-block;
    background: #222;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 700;
    color: var(--primary);
    margin-right: 6px;
    font-size: 11px;
}

.result-actions {
    display: flex;
    gap: 12px;
    margin-top: 64px;
}

.result-actions .view-btn {
    flex: 1;
    padding: 16px;
    font-size: 15px;
    border-radius: 4px;
    font-weight: 600;
}

.result-graph {
    flex: 1;
    padding: 56px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.015);
    border-right: 1px solid var(--frame-color);
}

.graph-wrapper {
    position: relative;
    width: 280px;
    height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lit-track {
    background: linear-gradient(to right, #000, #fff);
    outline: 1px solid var(--frame-color);
}

#result-wheel-canvas {
    width: 280px;
    height: 280px;
}

.result-lines-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 280px;
    height: 280px;
}

@media (max-height: 786px) {

    .graph-wrapper,
    #result-wheel-canvas,
    .result-lines-overlay {
        width: 35vh;
        height: 35vh;
        min-width: 180px;
        min-height: 180px;
    }

    .graph-val {
        font-size: clamp(20px, 4vh, 32px);
    }
}

.graph-center {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.graph-label {
    font-size: 9px;
    color: var(--primary-dim);
    text-transform: uppercase;
}

.graph-val {
    font-size: 32px;
    font-weight: 800;
    color: var(--primary);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .chroma-app {
        height: 100dvh;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }

    .chroma-header {
        padding: 9px 12px;
        padding-right: 20px;
        background: #000;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        position: fixed;
        width: 100%;
        top: 0;
        left: 0;
        z-index: 1010;
        /* Above countdown overlay (1000) */
        height: auto;
    }

    .header-left {
        flex-direction: row;
        align-items: center;
        gap: 8px;
    }

    .stats-list {
        display: flex;
        flex-direction: column;
        gap: 16px;
    }

    .header-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }

    .header-title {
        position: static;
        transform: none;
        font-size: 16px;
        letter-spacing: 0.1em;
    }

    .header-scheme {
        margin-left: 0;
        font-size: 10px;
    }

    .header-status {
        display: none;
    }

    .chroma-stage {
        padding-top: 52px;
        /* Smoother top padding */
        padding-bottom: 0;
        flex: 1;
        min-height: 0;
        flex-direction: column;
        display: flex;
        box-sizing: border-box;
        overflow: hidden;
    }

    .color-qty-selector {
        background: var(--primary-dark);
    }

    .color-qty-selector:hover {
        background: var(--primary-dark);
    }

    .qty-btn:hover:not(:disabled) {
        background: var(--primary-dark);
    }

    .color-block {
        flex: 1;
        min-height: 0;
        width: 100%;
        transition: flex 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding-bottom: 0;
    }

    .color-block.active {
        flex: 2;
        box-shadow: 0 0 30px rgba(0, 0, 0, 0.2);
    }

    .lock-badge,
    .edit-badge {
        position: absolute;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        flex-direction: row;
        gap: 10px;
    }

    .drag-handle {
        top: 50%;
        left: 20px;
        transform: translateY(-50%) rotate(0deg);
        /* Vertical arrow */
        width: 36px;
        height: 36px;
        display: none;
        /* Changed from flex to none by default */
        align-items: center;
        justify-content: center;
        opacity: 0;
        transition: opacity 0.2s ease, display 0.2s ease allow-discrete;
    }

    .color-block.active .drag-handle,
    .color-block.editable:hover .drag-handle {
        display: flex;
        opacity: 0.5;
    }

    .drag-handle svg {
        width: 10px;
        height: auto;
        pointer-events: none;
    }

    .edit-badge>svg {
        width: 14px;
        height: 14px;
    }

    .result-desc {
        margin-top: 8px;
        margin-bottom: 24px;
    }

    .result-actions {
        margin-top: 24px;
    }

    .result-header {
        margin-bottom: 4px;
    }

    .block-label {
        position: absolute;
        right: 12px;
        bottom: 50%;
        transform: translateY(50%);
        background: rgba(0, 0, 0, 0.2);
        font-size: 10px;
        font-weight: 800;
        left: auto;
    }

    .chroma-controls {
        padding: 12px 16px;
        flex: 0 0 auto;
        /* Only take required space */
        display: grid;
        grid-template-columns: 100px 1fr;
        grid-template-areas:
            "sliders sliders"
            "wheel actions";
        gap: 12px;
        position: relative;
        background: #0a0f12;
        border-top: 1px solid rgba(255, 255, 255, 0.05);
        align-items: center;
        overflow: visible;
        height: auto !important;
        user-select: none;
    }

    .result-back-btn {
        top: 12px;
        left: 12px;
        width: 36px;
        height: 36px;
    }

    .result-overlay {
        padding: 0px;
        align-items: flex-start;
    }

    .result-modal {
        flex-direction: column;
        max-width: 100%;
    }

    .result-left {
        padding: 40px 24px 24px;
        border-right: none;
        border-bottom: 1px solid var(--frame-color);
    }

    .result-right {
        padding: 24px;
    }

    .sliders-container {
        grid-area: sliders;
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .color-wheel-wrapper {
        grid-area: wheel;
        width: 100px;
        height: 100px;
        margin: 0;
    }

    .action-container {
        grid-area: actions;
        width: 100%;
        min-width: 0;
        display: flex;
        flex-direction: column;
        justify-content: center;
        height: 110px;
    }

    .in-game {
        width: 100%;
        border-radius: 0px 0px 4px 4px !important;
    }

    .slider-header {
        margin-bottom: 2px;
    }

    .input-group label {
        margin-bottom: 4px;
    }

    .hex-input-wrapper {
        padding: 8px 12px;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.1);
    }

    .in-game {
        height: 38px;
        font-size: 14px;
        font-weight: 700;
        letter-spacing: 0.05em;
        background: #ebd9cd !important;
        color: #000 !important;
        border-radius: 4px;
        margin: 0;
        width: 100%;
    }

    .result-modal-container {
        display: flex;
        flex-direction: column;
        justify-content: flex-end;
        /* Mobile Bottom Sheet */
        padding: 0;
        margin-top: 0;
        min-height: 100%;
        width: 100%;
    }

    .result-modal {
        flex-direction: column;
        width: 100%;
        max-width: 100%;
        margin: auto 0 0 0;
        /* Centered top if short, bottom if long */
        border-radius: 32px 32px 0 0;
        border: none;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        padding-bottom: env(safe-area-inset-bottom, 40px);
    }

    .result-info,
    .result-graph {
        padding: 24px;
        border: none;
        width: 100%;
    }

    .result-line {
        display: none;
    }
}

@media (max-width: 480px) {
    .landing-title {
        font-size: 3.5rem;
    }

    .landing-meta {
        left: 24px;
        bottom: 24px;
    }

}