/* ==========================================================================
   LUMEN_MIRROR - CORE SYSTEM STYLING (v2.1 - READABILITY UPGRADE)
   ========================================================================== */

/* 1. CSS variables / Design Tokens */
:root {
    --bg-dark: #050508;
    --bg-surface: rgba(12, 12, 20, 0.75);
    --border-color: rgba(255, 255, 255, 0.10);
    --border-glow: rgba(255, 255, 255, 0.18);
    
    /* Neon Colors */
    --color-photon: #00f3ff;
    --color-photon-glow: rgba(0, 243, 255, 0.4);
    --color-mirror: #c0c0d8;
    --color-mirror-glow: rgba(192, 192, 216, 0.45);
    --color-prism: #ff007f;
    --color-prism-glow: rgba(255, 0, 127, 0.5);
    --color-portal-in: #00bfff;
    --color-portal-out: #ff8c00;
    --color-erase: #ff4060;
    --color-erase-glow: rgba(255, 64, 96, 0.4);
    --color-block: #ff003c;
    --color-block-glow: rgba(255, 0, 60, 0.85);
    --color-block-dim: rgba(255, 0, 60, 0.4);
    --color-block-bg: rgba(255, 0, 60, 0.05);
    --color-text-dim: #9090a0;    /* brighter than before for readability */
    --color-rank-s: #ffd700;
    --color-rank-a: #00f3ff;
    --color-rank-b: #c0c0d8;
    --color-rank-c: #9090a0;
    
    /* Typography */
    --font-primary: 'Inter', 'Noto Sans JP', sans-serif;
    
    /* Dimensions */
    --logical-width: 900px;
    --logical-height: 1200px;
}

/* 2. Reset & Base Settings */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
}

body {
    background-color: var(--bg-dark);
    color: #ffffff;
    font-family: var(--font-primary);
    font-weight: 300;
    letter-spacing: 0.06em;
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 3. Main Game Container */
#game-container {
    width: min(100vw, calc(100vh * 3 / 4));
    height: min(100vh, calc(100vw * 4 / 3));
    max-width: var(--logical-width);
    max-height: var(--logical-height);
    background-color: var(--bg-surface);
    border: 1.5px solid var(--border-color);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    display: flex;
    flex-direction: column;
    position: relative;
    border-radius: 12px;
    overflow: hidden;
}

/* 4. HUD Header */
#hud {
    height: 60px;
    border-bottom: 1.5px solid var(--border-color);
    display: grid;
    grid-template-columns: minmax(100px, 1fr) minmax(170px, 1.3fr) minmax(100px, 1fr);
    align-items: center;
    padding: 0 12px;
    font-size: 11px;
    background: rgba(3, 3, 6, 0.7);
    position: relative;
    z-index: 10;
    flex-shrink: 0;
    gap: 8px;
}

.hud-item {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    height: 38px;
    padding: 0 12px;
    border-radius: 20px;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
}

.hud-item.left {
    border-color: rgba(0, 243, 255, 0.15);
    background: rgba(0, 243, 255, 0.02);
    box-shadow: inset 0 0 8px rgba(0, 243, 255, 0.05);
}

.hud-item.center {
    justify-content: center;
    border-color: rgba(255, 255, 255, 0.08);
    padding: 0 16px;
}

.hud-item.right {
    justify-content: flex-end;
    border-color: rgba(255, 0, 127, 0.15);
    background: rgba(255, 0, 127, 0.01);
    box-shadow: inset 0 0 8px rgba(255, 0, 127, 0.03);
    gap: 8px;
}

.label {
    color: var(--color-text-dim);
    font-weight: 300;       /* was 100 */
    font-size: 10px;
    letter-spacing: 0.1em;
}

.value {
    color: rgba(255, 255, 255, 0.95);
    font-family: 'Inter', monospace;
    font-weight: 400;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.25);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stb-value {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.7);
}

#stage-name {
    color: var(--color-photon);
    font-weight: 400;
    font-size: 11px;
    text-shadow: 0 0 6px var(--color-photon-glow);
}

/* INFO CHIP BUTTON */
.info-chip-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(0, 243, 255, 0.06);
    border: 1px solid rgba(0, 243, 255, 0.25);
    color: var(--color-photon);
    font-family: var(--font-primary);
    font-size: 9px;
    font-weight: 400;
    letter-spacing: 0.12em;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.25s ease;
    flex-shrink: 0;
    white-space: nowrap;
}

.info-chip-btn:hover {
    background: rgba(0, 243, 255, 0.12);
    border-color: rgba(0, 243, 255, 0.5);
    box-shadow: 0 0 8px rgba(0, 243, 255, 0.2);
}

.info-chip-icon {
    font-size: 11px;
    font-weight: 500;
    line-height: 1;
    font-family: 'Inter', monospace;
}

.info-chip-label {
    font-size: 8px;
    letter-spacing: 0.15em;
}

/* Ink Meter */
.ink-meter-container {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    max-width: 170px;
    margin: 0 auto;
}

.ink-bar-wrapper {
    flex-grow: 1;
    height: 12px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.07);
    position: relative;
    padding: 2px;
}

#ink-bar {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, var(--color-mirror), #ffffff);
    box-shadow: 0 0 8px var(--color-mirror-glow);
    transition: width 0.1s ease-out, background 0.3s ease;
}

#ink-bar.low {
    background: linear-gradient(90deg, #ff4060, #ff8080);
    box-shadow: 0 0 8px rgba(255, 64, 96, 0.5);
    animation: inkPulse 0.8s ease infinite;
}

@keyframes inkPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.ink-ticks {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
    padding: 0 4px;
}

.ink-ticks span {
    width: 1px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    margin-top: 3px;
}

/* 5. Viewport / Play Area */
#viewport {
    flex-grow: 1;
    position: relative;
    background-color: #030305;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 0;
}

#game-canvas {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    z-index: 2;
    cursor: crosshair;
    touch-action: none;
}

/* Precision Grid Overlay */
.grid-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 1;
    opacity: 0.15;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.08) 1.5px, transparent 1.5px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1.5px, transparent 1.5px);
    background-size: 40px 40px;
}

.grid-overlay::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-image: 
        linear-gradient(rgba(0, 243, 255, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 243, 255, 0.04) 1px, transparent 1px);
    background-size: 200px 200px;
}

/* 6. Screens & Overlays - Base */
#start-screen, #overlay, #stage-select {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(5, 5, 8, 0.93);
    z-index: 100;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 24px 24px;
    text-align: center;
    transition: opacity 0.4s ease, visibility 0.4s ease;
    overflow: hidden;
}

#start-screen.hidden, #overlay.hidden, #stage-select.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    display: none !important;
}

/* ========== TITLE SCREEN ========== */
.title-logo {
    margin-bottom: 22px;
}

.title-logo h1 {
    font-size: 36px;
    font-weight: 300;       /* was 100 */
    letter-spacing: 0.22em;
    margin-bottom: 12px;
    line-height: 1.2;
}

/* Colored title spans */
.title-lumen {
    color: rgba(255, 255, 255, 0.95);
    text-shadow: 0 0 20px rgba(255,255,255,0.15);
}

.title-sep {
    color: var(--color-photon);
    text-shadow: 0 0 14px var(--color-photon-glow), 0 0 28px rgba(0, 243, 255, 0.2);
    font-weight: 200;
}

.title-mirror {
    background: linear-gradient(120deg, var(--color-photon) 0%, rgba(255,255,255,0.85) 55%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.title-logo .subtitle {
    font-size: 12px;           /* was 11px */
    color: var(--color-photon);
    letter-spacing: 0.35em;
    opacity: 0.8;
    font-weight: 300;
}

.instruction-box {
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(255, 255, 255, 0.07);
    padding: 18px 22px;
    border-radius: 6px;
    width: 100%;
    max-width: 400px;
    margin-bottom: 22px;
    font-size: 12px;
    line-height: 1.8;
}

.instruction-box p {
    font-weight: 400;           /* was 300 */
    font-size: 14px;            /* was 12px */
    margin-bottom: 14px;
    color: rgba(255, 255, 255, 0.9);
    letter-spacing: 0.05em;
}

.control-hints {
    display: flex;
    flex-direction: column;
    gap: 7px;
    text-align: left;
    font-size: 12px;            /* was 11px */
    font-weight: 300;           /* was default 300 */
    color: var(--color-text-dim);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: 12px;
}

.control-hints div {
    display: flex;
    gap: 6px;
}

.control-hints span {
    color: var(--color-photon);
    font-weight: 500;           /* was 400 */
    width: 50px;
    flex-shrink: 0;
    font-size: 11px;
    letter-spacing: 0.1em;
}

/* 7. Stage Select Screen */
#stage-select {
    justify-content: flex-start;
    padding-top: 20px;
    overflow-y: auto;
    overflow-x: hidden;
}

.stage-select-header {
    margin-bottom: 20px;
    flex-shrink: 0;
}

.select-title {
    font-size: 22px;
    font-weight: 300;           /* was 100 */
    letter-spacing: 0.2em;
    color: rgba(255, 255, 255, 0.95);
    margin-bottom: 6px;
}

.select-subtitle {
    font-size: 12px;            /* was 11px */
    color: var(--color-text-dim);
    letter-spacing: 0.12em;
    font-weight: 300;
}

#stage-cards-container {
    width: 100%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    max-height: calc(100% - 140px);
    padding: 4px 2px;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 243, 255, 0.3) transparent;
}

.stage-card {
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 6px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    transition: all 0.25s ease;
    text-align: left;
    position: relative;
    overflow: hidden;
}

.stage-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 3px; height: 100%;
    background: var(--color-photon);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.stage-card:hover:not(.locked) {
    background: rgba(0, 243, 255, 0.04);
    border-color: rgba(0, 243, 255, 0.2);
    transform: translateX(3px);
}

.stage-card:hover:not(.locked)::before {
    opacity: 1;
}

.stage-card:active:not(.locked) {
    transform: translateX(1px) scale(0.99);
}

.stage-card.locked {
    opacity: 0.35;
    cursor: not-allowed;
}

.card-num {
    font-size: 10px;
    color: var(--color-text-dim);
    font-weight: 300;
    letter-spacing: 0.15em;
    min-width: 36px;
}

.card-info {
    flex-grow: 1;
}

.card-name {
    font-size: 13px;            /* was 12px */
    font-weight: 400;           /* was 300 */
    color: rgba(255, 255, 255, 0.95);
    letter-spacing: 0.1em;
    margin-bottom: 3px;
}

.card-gimmicks {
    font-size: 10px;
    color: var(--color-text-dim);
    letter-spacing: 0.06em;
    font-weight: 300;
}

.card-rank {
    font-size: 16px;
    font-weight: 400;
    min-width: 28px;
    text-align: center;
}

.card-rank.rank-s { color: var(--color-rank-s); text-shadow: 0 0 8px rgba(255, 215, 0, 0.6); }
.card-rank.rank-a { color: var(--color-rank-a); text-shadow: 0 0 8px var(--color-photon-glow); }
.card-rank.rank-b { color: var(--color-rank-b); }
.card-rank.rank-c { color: var(--color-rank-c); }
.card-rank.rank-none { color: rgba(255,255,255,0.12); font-size: 11px; }

.card-lock-icon {
    color: var(--color-text-dim);
    font-size: 14px;
    opacity: 0.5;
}

/* 8. Clear Overlay */
#overlay-title {
    font-size: 26px;
    font-weight: 300;           /* was 100 */
    letter-spacing: 0.2em;
    color: var(--color-photon);
    text-shadow: 0 0 14px var(--color-photon-glow);
    margin-bottom: 8px;
}

#overlay-subtitle {
    font-size: 12px;            /* was 11px */
    color: var(--color-text-dim);
    margin-bottom: 18px;
    font-weight: 300;
}

.best-banner {
    background: linear-gradient(90deg, rgba(255,215,0,0.08), rgba(255,215,0,0.15), rgba(255,215,0,0.08));
    border: 1px solid rgba(255, 215, 0, 0.3);
    color: var(--color-rank-s);
    font-size: 11px;
    font-weight: 400;           /* was default */
    letter-spacing: 0.2em;
    padding: 8px 24px;
    border-radius: 3px;
    margin-bottom: 16px;
    animation: bannerPulse 1.5s ease-in-out infinite;
}

@keyframes bannerPulse {
    0%, 100% { box-shadow: 0 0 6px rgba(255, 215, 0, 0.2); }
    50% { box-shadow: 0 0 18px rgba(255, 215, 0, 0.5); }
}

.best-banner.hidden {
    display: none;
}

.stats-box {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    width: 100%;
    max-width: 280px;
    padding: 18px;
    border-radius: 4px;
    margin-bottom: 28px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    font-size: 12px;
}

.stat-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-line span:first-child {
    color: var(--color-text-dim);
    font-weight: 300;
}

.stat-val {
    font-family: 'Inter', monospace;
    font-weight: 500;           /* was 400 */
    font-size: 14px;
    color: rgba(255, 255, 255, 0.95);
}

.dim-val {
    font-size: 12px;
    color: var(--color-text-dim);
    font-weight: 300;
}

#stat-rank {
    color: var(--color-prism);
    font-weight: 500;
    text-shadow: 0 0 8px var(--color-prism-glow);
}

#stat-rank.rank-s { color: var(--color-rank-s); text-shadow: 0 0 12px rgba(255, 215, 0, 0.6); }
#stat-rank.rank-a { color: var(--color-rank-a); text-shadow: 0 0 12px var(--color-photon-glow); }
#stat-rank.rank-b { color: var(--color-rank-b); }
#stat-rank.rank-c { color: var(--color-rank-c); }

.overlay-btn-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    width: 100%;
    max-width: 280px;
}

.overlay-btn-row .control-btn {
    width: 100%;
    padding: 12px 32px;
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.12em;
    border-color: rgba(255, 255, 255, 0.15);
    text-align: center;
}

/* 9. Buttons */
.glow-btn {
    background: transparent;
    border: 1.5px solid var(--color-photon);
    color: rgba(255, 255, 255, 0.95);
    font-family: var(--font-primary);
    font-size: 11px;
    font-weight: 400;           /* was 300 */
    letter-spacing: 0.18em;
    padding: 13px 32px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 0 12px rgba(0, 243, 255, 0.12);
    width: 100%;
}

.glow-btn::before {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: 0; height: 0;
    background: var(--color-photon);
    opacity: 0.12;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.4s ease, height 0.4s ease;
}

.glow-btn:hover {
    box-shadow: 0 0 24px var(--color-photon-glow);
    border-color: #ffffff;
}

.glow-btn:hover::before {
    width: 300px;
    height: 300px;
}

.glow-btn:active {
    transform: scale(0.98);
}

.glow-btn:disabled {
    border-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.3);
    box-shadow: none;
    pointer-events: none;
}

.flat-btn {
    background: transparent;
    border: none;
    color: var(--color-text-dim);
    font-family: var(--font-primary);
    font-size: 11px;
    font-weight: 300;
    letter-spacing: 0.1em;
    margin-top: 14px;
    cursor: pointer;
    transition: color 0.3s;
    padding: 6px 12px;
}

.flat-btn:hover {
    color: rgba(255, 255, 255, 0.9);
}

/* 10. Controls Footer */
#controls {
    height: 66px;
    border-top: 1.5px solid var(--border-color);
    background: rgba(5, 5, 8, 0.6);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 14px;
    gap: 8px;
    z-index: 10;
    flex-shrink: 0;
}

#editor-controls {
    height: 66px;
    border-top: 1.5px solid var(--border-color);
    background: rgba(5, 5, 8, 0.72);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 10px;
    gap: 7px;
    z-index: 10;
    flex-shrink: 0;
}

.control-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: rgba(255, 255, 255, 0.9);
    font-family: var(--font-primary);
    font-size: 10px;
    font-weight: 400;           /* was default */
    letter-spacing: 0.1em;
    padding: 9px 16px;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.control-btn:hover:not(:disabled) {
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.04);
}

.control-btn:disabled {
    border-color: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.2);
    pointer-events: none;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--color-text-dim);
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-primary);
    font-size: 10px;
    font-weight: 400;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: color 0.3s;
    white-space: nowrap;
}

.icon-btn:hover {
    color: rgba(255, 255, 255, 0.9);
}

.active-emit {
    padding: 9px 20px !important;
    font-size: 10px !important;
    font-weight: 500 !important;
    width: auto !important;
    flex-shrink: 0;
    letter-spacing: 0.15em !important;
}

/* 11. Mode Indicator */
.mode-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px 10px;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 500;           /* was 400 */
    letter-spacing: 0.15em;
    border: 1px solid;
    transition: all 0.2s ease;
    white-space: nowrap;
    min-width: 72px;
    flex-shrink: 0;
}

.mode-indicator.draw-mode {
    color: rgba(0, 243, 255, 0.85);
    border-color: rgba(0, 243, 255, 0.25);
    background: rgba(0, 243, 255, 0.05);
}

.mode-indicator.erase-mode {
    color: rgba(255, 64, 96, 0.95);
    border-color: rgba(255, 64, 96, 0.4);
    background: rgba(255, 64, 96, 0.07);
    animation: eraseFlash 0.6s ease infinite;
}

@keyframes eraseFlash {
    0%, 100% { box-shadow: 0 0 4px rgba(255, 64, 96, 0.15); }
    50% { box-shadow: 0 0 12px rgba(255, 64, 96, 0.4); }
}

/* 12. Toast system */
#toast-container {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    z-index: 200;
    width: 90%;
    max-width: 380px;
}

.toast {
    background: rgba(10, 10, 18, 0.92);
    border: 1.5px solid var(--color-photon);
    box-shadow: 0 0 12px var(--color-photon-glow);
    padding: 10px 20px;
    font-size: 12px;            /* was 11px */
    font-weight: 400;           /* was 300 */
    letter-spacing: 0.06em;
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.95);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    text-align: center;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.hint-toast {
    border-color: rgba(255, 255, 255, 0.12);
    background: rgba(8, 8, 14, 0.88);
    box-shadow: none;
    font-size: 11px;
    color: rgba(200, 200, 220, 0.8);
    font-weight: 300;
}

/* 13. Stage Card Scrollbar */
#stage-cards-container::-webkit-scrollbar {
    width: 3px;
}
#stage-cards-container::-webkit-scrollbar-track {
    background: transparent;
}
#stage-cards-container::-webkit-scrollbar-thumb {
    background: rgba(0, 243, 255, 0.25);
    border-radius: 2px;
}

/* ==========================================================================
   14. INFO PANEL
   ========================================================================== */
#info-panel {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(3, 3, 8, 0.96);
    z-index: 110;
    overflow-y: auto;
    overflow-x: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    transform: translateX(0);
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 243, 255, 0.25) transparent;
    touch-action: pan-y;
    overscroll-behavior: contain;
}

#info-panel.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateX(100%);
    display: none !important;
}

#info-panel::-webkit-scrollbar {
    width: 3px;
}
#info-panel::-webkit-scrollbar-thumb {
    background: rgba(0, 243, 255, 0.2);
    border-radius: 2px;
}

.info-panel-inner {
    padding: 24px 28px;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Info Panel Header */
.info-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    padding-bottom: 18px;
    border-bottom: 1px solid rgba(0, 243, 255, 0.12);
}

.info-stg-num {
    display: block;
    font-size: 10px;
    font-weight: 400;
    color: var(--color-photon);
    letter-spacing: 0.25em;
    margin-bottom: 6px;
    font-family: 'Inter', monospace;
    text-shadow: 0 0 6px var(--color-photon-glow);
}

.info-stg-name {
    font-size: 22px;
    font-weight: 300;
    letter-spacing: 0.15em;
    color: rgba(255, 255, 255, 0.95);
    line-height: 1.2;
}

.info-close-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--color-text-dim);
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.08em;
    padding: 7px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    margin-left: 12px;
    white-space: nowrap;
}

.info-close-btn:hover {
    border-color: rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.07);
}

/* Info Panel Sections */
.info-section {
    margin-bottom: 24px;
}

.info-section-label {
    font-size: 9px;
    font-weight: 500;
    letter-spacing: 0.28em;
    color: var(--color-photon);
    margin-bottom: 10px;
    text-transform: uppercase;
    opacity: 0.75;
}

.info-objective-text {
    font-size: 14px;
    font-weight: 400;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.9);
    letter-spacing: 0.04em;
    background: rgba(0, 243, 255, 0.04);
    border: 1px solid rgba(0, 243, 255, 0.1);
    border-radius: 4px;
    padding: 12px 16px;
}

.info-story-text {
    font-size: 13px;
    font-weight: 300;
    line-height: 2.0;
    color: rgba(220, 220, 240, 0.8);
    letter-spacing: 0.04em;
    font-style: normal;
    padding: 4px 0;
    border-left: 2px solid rgba(0, 243, 255, 0.2);
    padding-left: 14px;
}

/* Gimmick List */
.info-gimmicks-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

.editor-guide-lead {
    color: rgba(232, 242, 255, 0.92);
    font-size: 13px;
    line-height: 1.8;
    margin-bottom: 15px;
}

.editor-guide-steps {
    display: grid;
    gap: 9px;
    margin-bottom: 15px;
}

.editor-guide-step {
    display: grid;
    grid-template-columns: 34px 98px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    padding: 11px 12px;
    border: 1px solid rgba(0, 243, 255, 0.12);
    border-radius: 7px;
    background: rgba(0, 243, 255, 0.035);
    font-size: 11px;
    line-height: 1.5;
    color: rgba(214, 220, 236, 0.9);
}

.editor-guide-step strong {
    color: #ffffff;
    font-size: 11px;
    letter-spacing: 0.12em;
}

.editor-guide-num {
    color: var(--color-photon);
    font-family: 'Inter', monospace;
    font-size: 10px;
    letter-spacing: 0.14em;
}

.editor-guide-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.editor-guide-tools span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 9px;
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 5px;
    color: rgba(210, 215, 230, 0.85);
    font-size: 10px;
}

.editor-guide-tools b {
    color: var(--color-photon);
    font-size: 9px;
    letter-spacing: 0.12em;
}

.info-gimmick-item {
    display: flex;
    align-items: center;
    gap: 14px;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 6px;
    padding: 12px 16px;
}

.gimmick-visual {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    border-radius: 8px;
    border: 1px solid;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    position: relative;
    overflow: hidden;
}

.gimmick-visual.mirror {
    border-color: rgba(192, 192, 216, 0.3);
    background: rgba(192, 192, 216, 0.05);
}

.gimmick-visual.mirror::after {
    content: '';
    position: absolute;
    width: 36px;
    height: 2px;
    background: linear-gradient(90deg, transparent, #c0c0d8, transparent);
    box-shadow: 0 0 8px rgba(192, 192, 216, 0.8);
    transform: rotate(-45deg);
}

.gimmick-visual.blackhole {
    border-color: rgba(0, 243, 255, 0.3);
    background: radial-gradient(circle, rgba(0, 0, 0, 0.9) 35%, rgba(0, 243, 255, 0.12) 70%, transparent 100%);
    box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.8), 0 0 8px rgba(0, 243, 255, 0.15);
}

.gimmick-visual.blackhole::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1.5px solid rgba(0, 243, 255, 0.6);
    box-shadow: 0 0 8px rgba(0, 243, 255, 0.4);
    animation: bhSpin 3s linear infinite;
}

@keyframes bhSpin {
    from { transform: rotate(0deg) scaleX(1.5); }
    to { transform: rotate(360deg) scaleX(1.5); }
}

.gimmick-visual.wormhole {
    border-color: rgba(0, 191, 255, 0.3);
    background: rgba(0, 20, 40, 0.6);
    gap: 4px;
    flex-direction: column;
}

.gimmick-visual.wormhole::before {
    content: '';
    width: 14px; height: 14px;
    border-radius: 50%;
    background: var(--color-portal-in);
    box-shadow: 0 0 8px var(--color-portal-in);
    opacity: 0.8;
}

.gimmick-visual.wormhole::after {
    content: '';
    width: 14px; height: 14px;
    border-radius: 50%;
    background: var(--color-portal-out);
    box-shadow: 0 0 8px var(--color-portal-out);
    opacity: 0.8;
}

.gimmick-visual.block {
    border-color: var(--color-block-dim);
    background: rgba(3, 3, 8, 0.85);
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.9), 0 0 6px rgba(255, 0, 60, 0.2);
}

.gimmick-visual.block::after {
    content: 'BLOCK';
    font-family: 'Inter', monospace;
    font-size: 8px;
    font-weight: bold;
    color: var(--color-block);
    text-shadow: 0 0 8px var(--color-block-glow);
    border: 1.5px solid var(--color-block);
    padding: 2px 4px;
    border-radius: 3px;
    letter-spacing: 0.05em;
    background: var(--color-block-bg);
}

.gimmick-visual.colorfilter {
    border-color: #00ff3c;
    background: rgba(0, 255, 60, 0.05);
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.9), 0 0 6px rgba(0, 255, 60, 0.2);
}

.gimmick-visual.colorfilter::after {
    content: 'FILTER';
    font-family: 'Inter', monospace;
    font-size: 8px;
    font-weight: bold;
    color: #00ff3c;
    text-shadow: 0 0 8px rgba(0, 255, 60, 0.8);
    border: 1.5px solid #00ff3c;
    padding: 2px 4px;
    border-radius: 3px;
    letter-spacing: 0.05em;
    background: rgba(0, 255, 60, 0.05);
}

.gimmick-visual.patrol {
    border-color: rgba(255, 170, 0, 0.4);
    background: rgba(3, 3, 8, 0.85);
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.9), 0 0 6px rgba(255, 170, 0, 0.2);
}

.gimmick-visual.patrol::after {
    content: 'PATROL';
    font-family: 'Inter', monospace;
    font-size: 8px;
    font-weight: bold;
    color: #ffaa00;
    text-shadow: 0 0 8px rgba(255, 170, 0, 0.8);
    border: 1.5px solid #ffaa00;
    padding: 2px 4px;
    border-radius: 3px;
    letter-spacing: 0.05em;
    background: rgba(255, 170, 0, 0.05);
}

.gimmick-info {
    flex: 1;
}

.gimmick-name {
    font-size: 12px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    letter-spacing: 0.1em;
    margin-bottom: 5px;
}

.gimmick-desc {
    font-size: 11px;
    font-weight: 300;
    color: var(--color-text-dim);
    line-height: 1.7;
    letter-spacing: 0.03em;
}

/* ==========================================================================
   13. Responsive Sidebar Optimization (PC/Tablet/Mobile Layout Upgrade)
   ========================================================================== */

#app-layout {
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--bg-dark);
    overflow: hidden;
    position: relative;
}

/* Default state: Hide PC sidebars on Mobile and Tablet */
.pc-only-sidebar {
    display: none !important;
}

/* Tablet & Medium Screen Responsive Layout (Activated on landscape screens 768px <= width < 1150px) */
@media (min-width: 768px) and (max-width: 1149px) and (min-aspect-ratio: 1.1) {
    #app-layout {
        gap: 20px;
        padding: 0 20px;
        /* Subtly glowing grid lines in background for deep space aura */
        background-image: 
            radial-gradient(at 100% 100%, rgba(255, 0, 127, 0.03) 0px, transparent 50%),
            linear-gradient(rgba(255, 255, 255, 0.006) 1px, transparent 1px),
            linear-gradient(90deg, rgba(255, 255, 255, 0.006) 1px, transparent 1px);
        background-size: 100% 100%, 100px 100px, 100px 100px;
    }

    #game-container {
        /* Slightly adjust shadow blur and container scaling on tablet */
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9), 0 0 30px rgba(0, 243, 255, 0.02);
    }

    #pc-sidebar-right {
        display: flex !important;
        flex-direction: column;
        width: 290px;
        height: min(90vh, 1200px);
        background: var(--bg-surface);
        border: 1.5px solid var(--border-color);
        box-shadow: 0 15px 45px rgba(0, 0, 0, 0.8), 0 0 20px rgba(255, 255, 255, 0.02);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-radius: 12px;
        padding: 20px;
        overflow-y: auto;
        flex-shrink: 0;
        animation: sidebarFadeIn 0.6s cubic-bezier(0.25, 1, 0.5, 1) both;
    }

    /* Spacing optimizations for middle-size panel */
    #pc-sidebar-right .sidebar-header {
        border-bottom: 1.5px solid var(--border-color);
        padding-bottom: 10px;
        margin-bottom: 16px;
        flex-shrink: 0;
    }

    #pc-sidebar-right .cyber-tag {
        color: var(--color-photon);
        font-family: 'Inter', monospace;
        font-size: 8px;
        letter-spacing: 0.25em;
        font-weight: 500;
        text-shadow: 0 0 8px var(--color-photon-glow);
        background: rgba(0, 243, 255, 0.08);
        border: 1px solid rgba(0, 243, 255, 0.25);
        padding: 2px 6px;
        border-radius: 3px;
        text-transform: uppercase;
    }

    #pc-sidebar-right .sidebar-title {
        font-size: 15px;
        font-weight: 300;
        letter-spacing: 0.15em;
        color: rgba(255, 255, 255, 0.95);
        margin-top: 8px;
    }

    #pc-sidebar-right .sidebar-gimmick-container {
        display: flex;
        flex-direction: column;
        gap: 10px;
        margin-bottom: 16px;
        flex-grow: 1;
        overflow-y: auto;
        padding-right: 2px;
    }

    #pc-sidebar-right .sidebar-gimmick-item {
        background: rgba(255, 255, 255, 0.015);
        border: 1px solid rgba(255, 255, 255, 0.05);
        border-radius: 6px;
        padding: 8px 10px;
        transition: border-color 0.25s, background 0.25s;
    }

    #pc-sidebar-right .sidebar-gimmick-desc {
        font-size: 10.5px;
        line-height: 1.5;
    }

    #pc-sidebar-right .hint-section {
        border-top: 1.5px solid var(--border-color);
        padding-top: 12px;
        margin-bottom: 0;
        flex-shrink: 0;
    }

    #pc-sidebar-right .hint-text {
        font-size: 11.5px;
        padding: 8px 10px;
    }
}

/* Desktop Responsive Layout (Activated on landscape screens width >= 1150px) */
@media (min-width: 1150px) and (min-aspect-ratio: 1.1) {
    #app-layout {
        --desktop-sidebar-width: clamp(225px, 18vw, 310px);
        --desktop-layout-gap: clamp(14px, 1.7vw, 32px);
        --desktop-layout-padding: clamp(14px, 2.1vw, 40px);
        gap: var(--desktop-layout-gap);
        padding: 0 var(--desktop-layout-padding);
        /* Stylized abstract glowing grid lines in background for deep space aura */
        background-image: 
            radial-gradient(at 0% 0%, rgba(0, 243, 255, 0.05) 0px, transparent 50%),
            radial-gradient(at 100% 100%, rgba(255, 0, 127, 0.04) 0px, transparent 50%),
            linear-gradient(rgba(255, 255, 255, 0.01) 1px, transparent 1px),
            linear-gradient(90deg, rgba(255, 255, 255, 0.01) 1px, transparent 1px);
        background-size: 100% 100%, 100% 100%, 120px 120px, 120px 120px;
    }

    #game-container {
        /* Slightly adjust shadow blur and container scaling on PC */
        box-shadow: 0 30px 80px rgba(0, 0, 0, 0.95), 0 0 40px rgba(0, 243, 255, 0.04);
        width: min(
            var(--logical-width),
            calc(100vh * 3 / 4),
            calc(100vw - (var(--desktop-sidebar-width) * 2) - (var(--desktop-layout-gap) * 2) - (var(--desktop-layout-padding) * 2))
        );
    }

    .pc-only-sidebar {
        display: flex !important;
        flex-direction: column;
        width: var(--desktop-sidebar-width);
        height: min(92vh, 1200px);
        background: var(--bg-surface);
        border: 1.5px solid var(--border-color);
        box-shadow: 0 15px 45px rgba(0, 0, 0, 0.8), 0 0 20px rgba(255, 255, 255, 0.02);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-radius: 12px;
        padding: 16px 18px 20px 18px;
        overflow-y: auto;
        overflow-x: hidden;
        flex-shrink: 0;
        animation: sidebarFadeIn 0.7s cubic-bezier(0.25, 1, 0.5, 1) both;
    }

    /* PCサイドバー用の細くて美しいカスタムスクロールバー */
    .pc-only-sidebar::-webkit-scrollbar {
        width: 6px;
    }
    .pc-only-sidebar::-webkit-scrollbar-track {
        background: transparent;
    }
    .pc-only-sidebar::-webkit-scrollbar-thumb {
        background: rgba(0, 243, 255, 0.2);
        border-radius: 3px;
    }
    .pc-only-sidebar::-webkit-scrollbar-thumb:hover {
        background: rgba(0, 243, 255, 0.5);
    }

    #pc-sidebar-left {
        animation-delay: 0.1s;
    }
    #pc-sidebar-right {
        animation-delay: 0.2s;
    }

    @keyframes sidebarFadeIn {
        from {
            opacity: 0;
            transform: translateY(20px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    /* Sidebar Internal Components styling */
    .sidebar-header {
        border-bottom: 1.5px solid var(--border-color);
        padding-bottom: 14px;
        margin-bottom: 20px;
        flex-shrink: 0;
    }

    .cyber-tag {
        color: var(--color-photon);
        font-family: 'Inter', monospace;
        font-size: 8px;
        letter-spacing: 0.25em;
        font-weight: 500;
        text-shadow: 0 0 8px var(--color-photon-glow);
        background: rgba(0, 243, 255, 0.08);
        border: 1px solid rgba(0, 243, 255, 0.25);
        padding: 2px 6px;
        border-radius: 3px;
        text-transform: uppercase;
    }

    .sidebar-title {
        font-size: 16px;
        font-weight: 300;
        letter-spacing: 0.15em;
        color: rgba(255, 255, 255, 0.95);
        margin-top: 10px;
    }

    .sidebar-section {
        margin-bottom: 22px;
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .section-label {
        font-size: 9px;
        color: var(--color-text-dim);
        letter-spacing: 0.15em;
        font-weight: 400;
    }

    .stg-badge {
        background: rgba(255, 255, 255, 0.03);
        border: 1px solid rgba(255, 255, 255, 0.08);
        color: #ffffff;
        font-size: 12px;
        font-weight: 400;
        letter-spacing: 0.05em;
        padding: 8px 12px;
        border-radius: 6px;
        text-shadow: 0 0 5px rgba(255,255,255,0.2);
    }

    .sidebar-text {
        font-size: 13px;
        line-height: 1.8;
        color: rgba(230, 230, 240, 0.9);
        letter-spacing: 0.04em;
        font-weight: 300;
        text-align: justify;
    }
    
    .sidebar-text.font-serif {
        font-family: 'Noto Sans JP', sans-serif;
        font-weight: 300;
    }

    /* Gimmick list styling */
    .sidebar-gimmick-container {
        display: flex;
        flex-direction: column;
        gap: 12px;
        margin-bottom: 22px;
        flex-grow: 1;
        overflow-y: auto;
        padding-right: 2px;
    }

    .sidebar-gimmick-item {
        background: rgba(255, 255, 255, 0.015);
        border: 1px solid rgba(255, 255, 255, 0.05);
        border-radius: 6px;
        padding: 10px 12px;
        transition: border-color 0.25s, background 0.25s;
    }

    .sidebar-gimmick-item:hover {
        background: rgba(255, 255, 255, 0.03);
        border-color: rgba(255, 255, 255, 0.1);
    }

    .sidebar-gimmick-header {
        display: flex;
        align-items: center;
        gap: 10px;
        margin-bottom: 6px;
    }

    .gimmick-visual-mini {
        width: 14px;
        height: 14px;
        border-radius: 3px;
        border: 1px solid;
    }
    
    .gimmick-visual-mini.mirror { border-color: var(--color-mirror); box-shadow: 0 0 5px var(--color-mirror-glow); background: rgba(192,192,216,0.1); }
    .gimmick-visual-mini.prism { border-color: var(--color-prism); box-shadow: 0 0 5px var(--color-prism-glow); background: rgba(255,0,127,0.1); }
    .gimmick-visual-mini.blackhole { border-color: #00f3ff; box-shadow: 0 0 5px rgba(0, 243, 255, 0.4); background: #000; }
    .gimmick-visual-mini.wormhole { border-color: #00bfff; box-shadow: 0 0 5px rgba(0,191,255,0.4); background: rgba(0,191,255,0.1); }
    .gimmick-visual-mini.block { border-color: var(--color-block); box-shadow: 0 0 5px var(--color-block-glow); background: var(--color-block-bg); }
    .gimmick-visual-mini.colorfilter { border-color: #00ff3c; box-shadow: 0 0 5px rgba(0, 255, 60, 0.4); background: rgba(0, 255, 60, 0.1); }
    .gimmick-visual-mini.patrol { border-color: #ffaa00; box-shadow: 0 0 5px rgba(255, 170, 0, 0.4); background: rgba(255, 170, 0, 0.1); }

    .sidebar-gimmick-name {
        font-size: 11px;
        font-weight: 500;
        letter-spacing: 0.08em;
        color: #ffffff;
    }

    .sidebar-gimmick-desc {
        font-size: 11px;
        line-height: 1.6;
        color: var(--color-text-dim);
        letter-spacing: 0.02em;
        font-weight: 300;
    }

    /* Hints Panel inside sidebar */
    .hint-section {
        border-top: 1.5px solid var(--border-color);
        padding-top: 16px;
        margin-bottom: 0;
        flex-shrink: 0;
    }

    .hint-text {
        font-size: 12px;
        color: #00f3ff;
        text-shadow: 0 0 5px var(--color-photon-glow);
        background: rgba(0, 243, 255, 0.02);
        border: 1px dashed rgba(0, 243, 255, 0.15);
        padding: 10px 12px;
        border-radius: 6px;
        line-height: 1.6;
    }
    
    .hint-item {
        margin-bottom: 4px;
    }
    .hint-item:last-child {
        margin-bottom: 0;
    }
}

/* ============================================================
   STAGE EDITOR (CREATIVE MODE) CYBER STYLES
   ============================================================ */

/* Creative Palette Grid Layout */
.editor-palette {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 12px;
}

.palette-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 6px;
    background: rgba(3, 3, 8, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    text-align: center;
    color: inherit;
    font: inherit;
}

.palette-item span {
    font-size: 9px;
    font-family: 'Inter', 'Noto Sans JP', sans-serif;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 6px;
    line-height: 1.3;
}

.palette-item:hover {
    border-color: rgba(0, 243, 255, 0.4);
    background: rgba(0, 243, 255, 0.04);
}

.palette-item.active {
    border-color: #00f3ff;
    background: rgba(0, 243, 255, 0.12);
    box-shadow: 0 0 12px rgba(0, 243, 255, 0.25);
}

.palette-item.active span {
    color: #ffffff;
    font-weight: 500;
}

/* Inspector / Properties Stylings */
.property-group {
    margin-bottom: 15px;
    padding: 10px;
    background: rgba(3, 3, 8, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 6px;
}

.property-group label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
}

.property-group input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    outline: none;
    margin-top: 10px;
}

.property-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #00f3ff;
    box-shadow: 0 0 6px #00f3ff;
    cursor: pointer;
    transition: transform 0.1s;
}

.property-group input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.25);
}

.color-picker-btn {
    transition: transform 0.15s;
}

.color-picker-btn:hover {
    transform: scale(1.15);
}

.color-picker-btn.active {
    box-shadow: 0 0 8px #ffffff;
}

.palette-item:focus-visible,
.tool-btn:focus-visible,
.color-picker-btn:focus-visible,
.info-close-btn:focus-visible,
.flat-btn:focus-visible,
.control-btn:focus-visible,
.glow-btn:focus-visible,
#prop-title:focus-visible,
#modal-textarea:focus-visible,
#game-canvas:focus-visible {
    outline: 2px solid var(--color-photon);
    outline-offset: 2px;
}

.stage-title-group input[type="text"] {
    width: 100%;
    margin-top: 7px;
    padding: 7px 8px;
    background: #030308;
    border: 1px solid rgba(0, 243, 255, 0.2);
    border-radius: 4px;
    color: #ffffff;
    font-family: 'Inter', 'Noto Sans JP', sans-serif;
    font-size: 11px;
    letter-spacing: 0.08em;
    user-select: text;
    -webkit-user-select: text;
    touch-action: manipulation;
}

.editor-history-actions {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    align-items: center;
    gap: 6px;
}

.editor-history-actions .flat-btn {
    padding: 7px 6px;
    font-size: 10px;
}

.draft-status {
    color: rgba(0, 243, 255, 0.72);
    font-size: 9px;
    letter-spacing: 0.08em;
    white-space: nowrap;
}

.editor-stage-preview {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px 9px;
    margin-bottom: 8px;
    border: 1px solid rgba(0, 243, 255, 0.12);
    border-radius: 5px;
    background: rgba(0, 243, 255, 0.035);
}

.editor-stage-preview strong {
    color: #ffffff;
    font-size: 11px;
    letter-spacing: 0.12em;
}

.editor-stage-preview span {
    color: rgba(208, 216, 232, 0.8);
    font-size: 9px;
    letter-spacing: 0.04em;
}

.editor-share-status {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px 9px;
    margin-top: 8px;
    border: 1px solid rgba(255, 0, 127, 0.25);
    border-radius: 5px;
    background: rgba(255, 0, 127, 0.04);
    line-height: 1.4;
}

.editor-share-status strong {
    color: #ff4b9d;
    font-size: 10px;
    letter-spacing: 0.12em;
}

.editor-share-status span {
    color: rgba(235, 196, 219, 0.9);
    font-size: 10px;
}

.editor-share-status.ready {
    border-color: rgba(0, 243, 255, 0.32);
    background: rgba(0, 243, 255, 0.05);
}

.editor-share-status.ready strong {
    color: var(--color-photon);
}

.editor-share-status.ready span {
    color: rgba(205, 246, 252, 0.92);
}

/* Editor Tools */
.editor-tool-group {
    display: flex;
    gap: 6px;
    background: rgba(3, 3, 8, 0.85);
    border: 1.5px solid var(--border-color);
    padding: 3px;
    border-radius: 8px;
}

.tool-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--color-text-dim);
    padding: 6px 14px;
    border-radius: 6px;
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.08em;
    cursor: pointer;
    transition: all 0.2s;
}

.tool-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
}

.tool-btn.active {
    background: #00f3ff;
    border-color: #00f3ff;
    color: #030308;
    font-weight: bold;
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.4);
}

/* Modal styling for stage imports/exports */
#editor-modal {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: opacity 0.25s ease;
}

#editor-modal.hidden {
    opacity: 0;
    pointer-events: none;
    display: none !important;
}

.modal-backdrop {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(3, 3, 8, 0.72);
    backdrop-filter: blur(5px);
}

.modal-content {
    position: relative;
    width: 90%;
    max-width: 440px;
    background: rgba(10, 10, 20, 0.85);
    border: 1.5px solid rgba(0, 243, 255, 0.35);
    box-shadow: 0 0 35px rgba(0, 243, 255, 0.15), inset 0 0 20px rgba(0,0,0,0.8);
    border-radius: 12px;
    backdrop-filter: blur(12px);
    overflow: hidden;
    animation: modalPulse 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPulse {
    from { transform: scale(0.92); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-header h3 {
    margin: 0;
    font-family: 'Inter', monospace;
    font-size: 13px;
    letter-spacing: 0.1em;
    color: #ffffff;
    text-shadow: 0 0 8px rgba(0, 243, 255, 0.5);
}

.modal-body {
    padding: 18px;
}

.modal-body p {
    font-size: 11px;
    margin: 0 0 10px 0;
    line-height: 1.5;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 12px 18px;
    background: rgba(3, 3, 8, 0.5);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* Visibility Control for creative assets */
.editor-only.hidden, .editor-only.hidden-el {
    display: none !important;
}

/* Toggle PC layout components under editor mode */
#app-layout.editing-mode #pc-sidebar-left {
    display: none !important;
}
#app-layout.editing-mode #pc-sidebar-right {
    display: none !important;
}
#app-layout.editing-mode #editor-sidebar-left {
    display: flex !important;
}
#app-layout.editing-mode #editor-sidebar-right {
    display: flex !important;
}
#app-layout.editing-mode #controls {
    display: none !important;
}
#app-layout.editing-mode #editor-controls {
    display: flex !important;
}

/* 狭幅でも編集機能を残し、キャンバスと操作パネルを並べ替える。 */
@media (max-width: 1149px) {
    #app-layout.editing-mode {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: minmax(320px, 1fr) 108px minmax(150px, 24vh);
        align-items: stretch;
        justify-content: stretch;
        gap: 8px;
        padding: 8px;
    }

    #app-layout.editing-mode #game-container {
        grid-column: 1;
        grid-row: 1;
        width: 100%;
        height: 100%;
        min-height: 0;
    }

    #app-layout.editing-mode #editor-sidebar-left {
        display: flex !important;
        grid-column: 1;
        grid-row: 2;
    }

    #app-layout.editing-mode #editor-sidebar-right {
        display: flex !important;
        grid-column: 1;
        grid-row: 3;
        overflow-y: auto;
        touch-action: pan-y;
        overscroll-behavior: contain;
    }

    #app-layout.editing-mode #editor-sidebar-left,
    #app-layout.editing-mode #editor-sidebar-right {
        flex-direction: column;
        width: 100%;
        height: auto;
        min-width: 0;
        min-height: 0;
        padding: 8px;
        background: var(--bg-surface);
        border: 1.5px solid var(--border-color);
        border-radius: 10px;
    }

    #app-layout.editing-mode #editor-sidebar-left .sidebar-header,
    #app-layout.editing-mode #editor-sidebar-right .sidebar-header {
        display: none;
    }

    #app-layout.editing-mode #editor-sidebar-left .sidebar-section {
        margin: 0;
        padding: 5px 7px;
    }

    #app-layout.editing-mode #editor-sidebar-left .section-label {
        display: none;
    }

    #app-layout.editing-mode #editor-sidebar-left .editor-palette {
        display: flex;
        gap: 7px;
        margin-top: 0;
        overflow-x: auto;
        overflow-y: hidden;
        padding-bottom: 2px;
    }

    #app-layout.editing-mode #editor-sidebar-left .palette-item {
        flex: 0 0 88px;
        padding: 7px 4px;
    }

    #app-layout.editing-mode #editor-sidebar-right .sidebar-section {
        margin-bottom: 7px;
        padding: 8px 10px;
    }
}

#modal-textarea {
    user-select: text;
    -webkit-user-select: text;
    touch-action: pan-y;
}

@media (min-width: 768px) and (max-width: 1149px) and (min-aspect-ratio: 1.1) {
    #app-layout.editing-mode {
        grid-template-columns: minmax(0, 1fr) 270px;
        grid-template-rows: minmax(0, 1fr) 120px;
    }

    #app-layout.editing-mode #game-container {
        grid-column: 1;
        grid-row: 1;
    }

    #app-layout.editing-mode #editor-sidebar-left {
        grid-column: 1;
        grid-row: 2;
    }

    #app-layout.editing-mode #editor-sidebar-right {
        grid-column: 2;
        grid-row: 1 / span 2;
        height: 100%;
    }
}

@media (max-width: 767px) {
    #app-layout.editing-mode #editor-controls {
        height: 86px;
        display: grid !important;
        grid-template-areas:
            "tools tools tools"
            "back clear test";
        grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr);
        padding: 5px 7px;
        gap: 5px;
    }

    #app-layout.editing-mode #editor-controls .editor-tool-group {
        grid-area: tools;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        width: 100%;
    }

    #app-layout.editing-mode #editor-back-btn {
        grid-area: back;
    }

    #app-layout.editing-mode #editor-clear-btn {
        grid-area: clear;
    }

    #app-layout.editing-mode #editor-test-btn {
        grid-area: test;
    }

    #app-layout.editing-mode #editor-controls #editor-clear-btn,
    #app-layout.editing-mode #editor-controls #editor-test-btn {
        min-width: 0 !important;
        width: 100% !important;
        padding-right: 5px !important;
        padding-left: 5px !important;
    }
}

/* ==========================================================================
   14. Stage Editor UI/UX Layout Enhancements (Segmented & Polished Design)
   ========================================================================== */

/* 汎用的な非表示クラスの追加 */
.hidden {
    display: none !important;
}

/* エディタ専用のサイドバーセクション区分け（明確なサイバーカード化） */
#editor-sidebar-left .sidebar-section,
#editor-sidebar-right .sidebar-section {
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 14px;
    box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.4);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

/* セクション上部に超極細のサイバーアクセントラインを追加 */
#editor-sidebar-left .sidebar-section::before,
#editor-sidebar-right .sidebar-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
}

/* インスペクター（オブジェクト選択時）のアクティブ強調 */
#editor-sidebar-right #inspector-panel {
    border-color: rgba(255, 255, 255, 0.05);
}

#editor-sidebar-right #inspector-panel:has(#inspector-details:not(.hidden)),
#editor-sidebar-right #inspector-panel.active-panel {
    border-color: rgba(0, 243, 255, 0.25);
    box-shadow: inset 0 0 15px rgba(0, 243, 255, 0.05), 0 4px 12px rgba(0, 0, 0, 0.5);
    background: rgba(0, 243, 255, 0.01);
}

#editor-sidebar-right #inspector-panel:has(#inspector-details:not(.hidden))::before,
#editor-sidebar-right #inspector-panel.active-panel::before {
    background: linear-gradient(90deg, transparent, rgba(0, 243, 255, 0.4), transparent);
}

/* パレットセクション（左）のホバー連動 */
#editor-sidebar-left .sidebar-section:hover {
    border-color: rgba(0, 243, 255, 0.15);
    background: rgba(0, 243, 255, 0.01);
}

/* スライダー要素のUI改善（枠内に美しく収める） */
.property-group input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    outline: none;
    margin: 8px 0;
    transition: background 0.3s;
}

.property-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #00f3ff;
    cursor: pointer;
    box-shadow: 0 0 6px rgba(0, 243, 255, 0.8);
    transition: transform 0.1s;
}

.property-group input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* Compact editor arrangement for zoomed or short desktop workspaces. */
@media (min-width: 1150px) and (min-aspect-ratio: 1.1) and (max-height: 700px) {
    #app-layout.editing-mode {
        --desktop-sidebar-width: clamp(252px, 20vw, 270px);
        --desktop-layout-gap: clamp(10px, 1.25vw, 18px);
        --desktop-layout-padding: clamp(10px, 1.4vw, 20px);
    }

    #app-layout.editing-mode .pc-only-sidebar {
        height: calc(100vh - 48px);
        padding: 12px 14px;
        overflow-y: auto;
        touch-action: pan-y;
        overscroll-behavior: contain;
    }

    #app-layout.editing-mode #editor-controls {
        height: 88px;
        display: grid !important;
        grid-template-areas:
            "tools tools tools"
            "back clear test";
        grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr);
        padding: 5px 8px;
        gap: 5px 8px;
    }

    #editor-back-btn {
        grid-area: back;
    }

    #editor-controls .editor-tool-group {
        grid-area: tools;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 4px;
        width: 100%;
        padding: 3px;
    }

    #editor-controls .tool-btn {
        min-width: 0;
        padding: 6px 5px;
    }

    #editor-clear-btn {
        grid-area: clear;
    }

    #editor-test-btn {
        grid-area: test;
    }

    #editor-controls #editor-clear-btn,
    #editor-controls #editor-test-btn {
        min-width: 0 !important;
        width: 100% !important;
        padding-right: 7px !important;
        padding-left: 7px !important;
    }

    #editor-sidebar-right .sidebar-header {
        padding-bottom: 9px;
        margin-bottom: 10px;
    }

    #editor-sidebar-right .sidebar-section {
        padding: 9px 11px;
        margin-bottom: 7px;
        gap: 5px;
    }

    #editor-sidebar-right .property-group {
        margin-bottom: 7px;
        padding: 8px;
    }

    #editor-sidebar-right .property-group label {
        gap: 7px;
        white-space: nowrap;
    }

    #editor-sidebar-right .property-group label span {
        flex-shrink: 0;
    }

    #editor-sidebar-right .editor-share-status {
        padding: 5px 7px;
        margin-top: 5px;
    }
}

/* --- Sound Mute UI (SF Cyber Style) --- */
.sound-mute-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 12px;
    pointer-events: auto;
    width: 100%;
}

.sound-mute-checkbox {
    display: none;
}

.sound-mute-label {
    font-family: 'Inter', 'Noto Sans JP', sans-serif;
    font-size: 11px;
    font-weight: 400;
    padding: 6px 16px;
    border: 1px solid rgba(0, 243, 255, 0.4);
    color: #00f3ff;
    border-radius: 4px;
    cursor: pointer;
    background: rgba(3, 3, 8, 0.6);
    box-shadow: 0 0 8px rgba(0, 243, 255, 0.1);
    transition: all 0.2s ease;
    letter-spacing: 0.1em;
    display: inline-block;
    text-align: center;
}

.sound-mute-checkbox:checked + .sound-mute-label {
    border-color: rgba(255, 0, 127, 0.6);
    color: #ff007f;
    box-shadow: 0 0 8px rgba(255, 0, 127, 0.15);
}

.sound-mute-label:hover {
    background: rgba(0, 243, 255, 0.1);
    box-shadow: 0 0 12px rgba(0, 243, 255, 0.3);
    border-color: #00f3ff;
}

.sound-mute-checkbox:checked + .sound-mute-label:hover {
    background: rgba(255, 0, 127, 0.1);
    box-shadow: 0 0 12px rgba(255, 0, 127, 0.3);
    border-color: #ff007f;
}
