body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #010102;
    font-family: 'Orbitron', 'Segoe UI', Tahoma, sans-serif;
    color: #e0e0e0;
}

#canvas-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

#ui-overlay {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 2;
    width: 210px;
    max-height: calc(100dvh - 16px);
    overflow-y: auto;
    overflow-x: hidden;
    background: rgba(10, 10, 20, 0.6);
    backdrop-filter: blur(12px);
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(0, 242, 255, 0.2);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.8);
    pointer-events: auto;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 242, 255, 0.3) transparent;
    -webkit-overflow-scrolling: touch;
}

#ui-overlay::-webkit-scrollbar {
    width: 4px;
}
#ui-overlay::-webkit-scrollbar-track {
    background: transparent;
}
#ui-overlay::-webkit-scrollbar-thumb {
    background: rgba(0, 242, 255, 0.3);
    border-radius: 2px;
}

/* 横向き時はさらにコンパクトに */
@media (orientation: landscape) and (max-height: 500px) {
    #ui-overlay {
        top: 4px;
        left: 4px;
        max-height: calc(100dvh - 8px);
        padding: 6px 10px;
        width: 195px;
    }

    h1 {
        margin-bottom: 6px;
        font-size: 0.75rem;
    }

    .section-label {
        margin: 4px 0 2px 0;
    }

    select {
        margin-bottom: 5px;
        padding: 4px 28px 4px 8px;
        font-size: 0.7rem;
    }

    .toggle-row {
        margin-bottom: 4px;
        font-size: 0.7rem;
    }

    .toggle-switch {
        width: 30px;
        height: 17px;
    }

    .toggle-switch::after {
        width: 11px;
        height: 11px;
    }

    .toggle-switch.on::after {
        left: 15px;
    }

    button {
        padding: 3px 8px;
        font-size: 0.65rem;
    }

    .info {
        margin-top: 6px;
        padding-top: 5px;
        font-size: 0.62rem;
    }
}

#ui-overlay.hidden {
    transform: translateX(-120%);
    opacity: 0;
    pointer-events: none;
}

#show-ui-hint {
    position: absolute;
    bottom: 20px;
    left: 20px;
    font-size: 0.7rem;
    opacity: 0;
    z-index: 3;
    pointer-events: none;
    transition: opacity 0.5s ease;
    color: #00f2ff;
}

#ui-overlay.hidden ~ #show-ui-hint {
    opacity: 0.5;
}

h1 {
    margin: 0 0 10px 0;
    font-size: 0.85rem;
    font-weight: 300;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #00f2ff;
    text-shadow: 0 0 10px rgba(0, 242, 255, 0.5);
}

.section-label {
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.5;
    margin: 8px 0 4px 0;
}

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}
.controls button {
    width: 100%;
    padding: 5px 7px;
    background: rgba(0,242,255,0.06);
    border: 1px solid rgba(0,242,255,0.2);
    color: #888;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.68rem;
    border-radius: 3px;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s, color 0.15s;
}
.controls button:hover {
    background: rgba(0,242,255,0.16);
    color: #e0e0e0;
}

select {
    width: 100%;
    margin-bottom: 10px;
    padding: 7px 32px 7px 12px;
    background: rgba(255, 255, 255, 0.05)
        url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24'%3E%3Cpath fill='%2300f2ff' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E")
        no-repeat right 10px center;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: #fff;
    font-family: 'Orbitron', 'Segoe UI', sans-serif;
    font-size: 0.75rem;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

select:focus {
    outline: none;
    border-color: #00f2ff;
    box-shadow: 0 0 10px rgba(0, 242, 255, 0.3);
}

select option {
    background: #0a0a14;
    color: #e0e0e0;
}

select.inline-select {
    width: auto;
    margin: 0;
    padding: 4px 26px 4px 8px;
    font-size: 0.7rem;
}

.toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 7px;
    cursor: pointer;
    font-size: 0.75rem;
    color: #e0e0e0;
    user-select: none;
}

.toggle-switch {
    position: relative;
    width: 36px;
    height: 20px;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    background: rgba(255, 255, 255, 0.35);
    border-radius: 50%;
    transition: left 0.2s, background 0.2s;
}

.toggle-switch.on {
    background: rgba(0, 242, 255, 0.2);
    border-color: #00f2ff;
    box-shadow: 0 0 8px rgba(0, 242, 255, 0.3);
}

.toggle-switch.on::after {
    left: 18px;
    background: #00f2ff;
    box-shadow: 0 0 4px rgba(0, 242, 255, 0.7);
}

button {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 5px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.72rem;
}

button:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
}

button.active {
    background: rgba(0, 242, 255, 0.25);
    border-color: #00f2ff;
    color: #00f2ff;
    box-shadow: 0 0 15px rgba(0, 242, 255, 0.4);
    text-shadow: 0 0 5px rgba(0, 242, 255, 0.5);
}

.info {
    margin-top: 10px;
    font-size: 0.68rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 8px;
}

.status {
    color: #00f2ff;
    font-weight: bold;
}

/* Disabled UI sections */
.ui-section-disabled {
    opacity: 0.28;
    pointer-events: none;
    user-select: none;
}

.ui-section-disabled select,
.ui-section-disabled input[type="range"],
.ui-section-disabled button,
.ui-section-disabled .toggle-row {
    cursor: not-allowed;
}

/* Boot progress overlay */
#boot-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: radial-gradient(ellipse at center, #050519 0%, #010103 70%);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s ease;
}
#boot-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}
#boot-card {
    text-align: center;
    color: #00f2ff;
    text-shadow: 0 0 12px rgba(0, 242, 255, 0.5);
    min-width: 260px;
}
#boot-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.4rem;
    letter-spacing: 4px;
    margin-bottom: 18px;
    text-transform: uppercase;
}
#boot-stage {
    font-size: 0.75rem;
    letter-spacing: 1px;
    opacity: 0.75;
    margin-bottom: 10px;
    min-height: 1em;
}
#boot-progress {
    width: 240px;
    height: 6px;
    appearance: none;
    -webkit-appearance: none;
    border: none;
    background: rgba(0, 242, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}
#boot-progress::-webkit-progress-bar {
    background: rgba(0, 242, 255, 0.1);
}
#boot-progress::-webkit-progress-value {
    background: linear-gradient(90deg, #00f2ff, #66ffff);
    box-shadow: 0 0 10px rgba(0, 242, 255, 0.6);
    transition: width 0.2s ease;
}
#boot-progress::-moz-progress-bar {
    background: #00f2ff;
}

/* Help tooltip (?) */
.help-tip {
    display: inline-block;
    width: 13px;
    height: 13px;
    line-height: 13px;
    text-align: center;
    border-radius: 50%;
    background: rgba(0, 242, 255, 0.15);
    color: #00f2ff;
    font-size: 0.6rem;
    cursor: help;
    margin-left: 4px;
    border: 1px solid rgba(0, 242, 255, 0.3);
    user-select: none;
    position: relative;
    vertical-align: middle;
}
.help-tip:hover,
.help-tip:focus {
    background: rgba(0, 242, 255, 0.3);
    outline: none;
}

#help-tooltip {
    position: fixed;
    max-width: 240px;
    background: rgba(10, 10, 25, 0.95);
    border: 1px solid rgba(0, 242, 255, 0.4);
    color: #e0e0e0;
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 0.65rem;
    line-height: 1.4;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.7);
    text-shadow: none;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.12s ease;
}
#help-tooltip.visible {
    opacity: 1;
    visibility: visible;
}
.section-sub {
    font-size: 0.6rem;
    opacity: 0.45;
    line-height: 1.3;
    margin: -2px 0 4px 0;
    font-style: italic;
}

/* Number Types panel */
#type-panel {
    margin-top: 4px;
}

.type-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 5px;
    cursor: pointer;
    user-select: none;
    font-size: 0.68rem;
    color: #e0e0e0;
}

.type-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.type-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (orientation: landscape) and (max-height: 500px) {
    .type-row {
        margin-bottom: 3px;
        font-size: 0.62rem;
    }
}
