body {
    font-family: "Roboto Condensed", "Oswald", sans-serif;
    background: #000000;
    color: #ffffff;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: hidden;
    /* 背景画像指定は削除 */
}

.top-buttons {
    position: fixed;
    top: 10px;
    left: 10px;
    display: flex;
    gap: 10px;
    z-index: 1000;
}

#openModalButton, #fullscreenButton, #settingImage, #fullscreenImage {
    background: none;
    border: none;
    width: 50px;
    height: 50px;
    cursor: pointer;
    border-radius: 5%;
    box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.5), -5px -5px 10px rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

#openModalButton:hover, #fullscreenButton:hover {
    box-shadow: 3px 3px 8px rgba(0, 0, 0, 0.6), -3px -3px 8px rgba(255, Body: 255, 255, 0.15);
    transform: translateY optionally(-2px);
}

#modalDialog {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    backdrop-filter: blur(3px);
}

#modalContent {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #1a1a1a;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 8px 8px 16px rgba(0, 0, 0, 0.6), -8px -8px 16px rgba(255, 255, 255, 0.05);
    color: #ffffff;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    border: 1px solid #ff3333;
}

.modal-title {
    font-size: 28px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 15px;
    color: #ff3333;
    text-shadow: 0 0 10px rgba(255, 51, 51, 0.5);
    border-bottom: 1px solid #ff3333;
    padding-bottom: 10px;
}

.inputRow {
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
    width: 100%;
}

#blindsInput {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.labelRow {
    display: flex;
    justify-content: space-between;
    width: 320px;
    font-weight: 700;
    margin-bottom: 5px;
    color: #ffffff;
    border-bottom: 1px solid #444;
    padding-bottom: 5px;
}

.blindInterval,
.sbInput,
.bbInput {
    width: 140px;
    font-size: 18px;
    padding: 10px;
    border: none;
    border-radius: 8px;
    background: #1a1a1a;
    color: #ffffff;
    box-shadow: inset 4px 4px 8px rgba(0, 0, 0, 0.5), inset -4px -4px 8px rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.blindInterval:focus,
.sbInput:focus,
.bbInput:focus {
    box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.6), inset -2px -2px 5px rgba(255, 255, 255, 0.15), 0 0 10px rgba(255, 51, 51, 0.5);
    outline: none;
}

#addBlinds,
#updateValues {
    background: #1a1a1a;
    color: #ffffff;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 700;
    box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.5), -5px -5px 10px rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    border: 1px solid #ff3333;
}

#addBlinds:hover,
#updateValues:hover {
    box-shadow: 3px 3px 8px rgba(0, 0, 0, 0.6), -3px -3px 8px rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    color: #ff3333;
    text-shadow: 0 0 10px rgba(255, 51, 51, 0.5);
}

.buttonRow {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 15px;
    border-top: 1px solid #ff3333;
    padding-top: 10px;
}

.main-flex {
    display: flex;
    height: 100vh;
    width: 100vw;
    box-sizing: border-box;
    justify-content: center;
    align-items: center;
    perspective: 1600px;
    gap: 0px;
    /* gapで中央の隙間をなくす */
}

.main-content {
    flex: 1 1 54%;
    max-width: 58vw;
    min-width: 320px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: #181818;
    background-image:
        linear-gradient(90deg, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0.95)),
        url('bg.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    /* 傾きを弱めてはみ出しを抑える */
    transform: perspective(1600px) rotateY(7deg) scale(1.01, 1.04);
    box-shadow: 0 16px 32px 0 rgba(0, 0, 0, 0.6), 0 0.5vw 1vw 0 rgba(0, 0, 0, 0.3);
    border-radius: 28px 0 0 28px;
    transition: transform 0.4s cubic-bezier(.4, 2, .6, 1), box-shadow 0.3s;
    z-index: 2;
    max-height: 92vh;
    margin: 2vh 0 2vh 0;
    overflow: hidden;
    backdrop-filter: blur(0.5px);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.structure-panel {
    flex: 1 1 30%;
    max-width: 28vw;
    min-width: 200px;
    background: #222;
    color: #fff;
    padding: 16px 24px 16px 12px;
    /* 右側に余白を追加 */
    box-sizing: border-box;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    height: auto;
    max-height: 92vh;
    margin: 2vh 0 2vh 0;
    /* 傾きを弱めてはみ出しを抑える */
    transform: perspective(1600px) rotateY(-6deg) scale(1.01, 1.03);
    box-shadow: 0 16px 32px 0 rgba(0, 0, 0, 0.5), 0 0.5vw 1vw 0 rgba(0, 0, 0, 0.2);
    border-radius: 0 28px 28px 0;
    transition: transform 0.4s cubic-bezier(.4, 2, .6, 1), box-shadow 0.3s;
    z-index: 1;
    backdrop-filter: blur(0.5px);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.structure-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    font-size: 1.3em;
    font-weight: bold;
    margin-bottom: 0;
    gap: 8px;
}

.structure-title-red {
    color: #ff3333;
    font-size: 2.2em;
    font-weight: bold;
    letter-spacing: 0.05em;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    display: block;
    transition: font-size 0.2s;
}

@media (max-width: 600px), (max-width: 420px) {
    .structure-title-red {
        font-size: 1.2em;
    }
}

.structure-title-red.shrink {
    font-size: 1em !important;
}

.structure-btn-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    margin-top: 8px;
    justify-content: flex-end;
}

#structureList {
    flex: 1 1 auto;
    overflow-y: auto;
    font-size: 2em;
    transition: font-size 0.2s;
}

.structure-level-row {
    display: flex;
    justify-content: space-between;
    border-bottom: 2px solid rgba(68,68,68,0.5);
    padding: 8px 0;
    gap: 12px;
}

.structure-btn {
    background: #ff3333;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 8px 18px;
    font-size: 1.1em;
    font-weight: bold;
    margin-left: 6px;
    cursor: pointer;
    box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.2);
    transition: background 0.2s, color 0.2s, transform 0.15s;
}

.structure-btn:hover {
    background: #fff;
    color: #ff3333;
    transform: translateY(-2px) scale(1.05);
}

header {
    color: #ffffff;
    text-align: center;
    font-size: 3rem;
    font-weight: 700;
    margin: 5px 0;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
    letter-spacing: 2px;
    font-family: "Oswald", sans-serif;
    border-bottom: 1px solid #ff3333;
    padding-bottom: 5px;
    width: 100%;
}

.timer-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    border: 1px solid #444;
    border-radius: 10px;
    padding: 10px;
    box-sizing: border-box;
    flex-grow: 1;
    justify-content: center;
}

.timer {
    color: #ffffff;
    text-align: center;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

#Lv {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 5px 0;
    font-family: "Oswald", sans-serif;
    border-bottom: 1px solid #444;
    padding-bottom: 5px;
    width: 100%;
}

#display {
    font-size: 3.5rem;
    font-weight: 400;
    color: #ff3333;
    margin: 5px 0;
    text-shadow: 0 0 15px rgba(255, 51, 51, 0.4);
    border-bottom: 1px solid #444;
    padding-bottom: 5px;
    width: 100%;
    /* 秒数切り替えアニメーション用 */
    transition: color 0.2s, text-shadow 0.2s;
}

.display-animate {
    animation: display-flip 0.32s cubic-bezier(.4, 2, .6, 1);
}

@keyframes display-flip {
    0% {
        opacity: 0.2;
        transform: scaleY(1.5) scaleX(0.7) skewX(-10deg);
        filter: blur(2px);
    }

    60% {
        opacity: 1;
        transform: scaleY(0.95) scaleX(1.05) skewX(2deg);
        filter: blur(0.5px);
    }

    100% {
        opacity: 1;
        transform: scaleY(1) scaleX(1) skewX(0deg);
        filter: blur(0);
    }
}

#subDisplay {
    font-size: 12rem;
    font-weight: 700;
    color: #ffffff;
    text-shadow: 0 0 25px rgba(255, 255, 255, 0.8);
    border-bottom: 1px solid #444;
    width: 100%;
}

#Blind {
    font-size: 3.5rem;
    font-weight: 700;
    color: #ffffff;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
    border-bottom: 1px solid #444;
    padding-bottom: 5px;
    width: 100%;
}

#nextBlind {
    font-size: 3rem;
    font-weight: 400;
    color: #b0b0b0;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
    width: 100%;
}

.buttons {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin: 10px 0;
    width: 100%;
    border-top: 1px solid #ff3333;
    padding-top: 10px;
}

#back, #startStop, #reset, #next {
    background: #1a1a1a;
    border: none;
    border-radius: 12px;
    padding: 12px;
    width: 80px;
    height: 80px;
    cursor: pointer;
    box-shadow: 6px 6px 12px rgba(0, 0, 0, 0.5), -6px -6px 12px rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    border: 1px solid #ff3333;
}

#back:hover, #startStop:hover, #reset:hover, #next:hover {
    box-shadow: 4px 4px 8px rgba(0, 0, 0, 0.6), -4px -4px 8px rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

#backImage, #startStopImage, #resetImage, #nextImage, #fullscreenImage {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.2));
}

/* 現在のレベル行を強調表示 */
.structure-level-row.current-level {
    background: linear-gradient(90deg, #fff700 0%, #ffe066 100%);
    color: #222;
    font-weight: bold;
    border-radius: 6px;
    box-shadow: 0 0 8px 2px rgba(255, 247, 0, 0.25);
    transition: background 0.2s, color 0.2s;
}

/* レスポンシブ調整 */
@media (max-width: 600px) {

    .blindInterval,
    .sbInput,
    .bbInput {
        width: 120px;
        font-size: 16px;
    }

    .labelRow {
        width: 280px;
    }

    #modalContent {
        width: 95%;
        padding: 15px;
    }

    header {
        font-size: 2rem;
    }

    #Lv {
        font-size: 2rem;
    }

    #display {
        font-size: 2.5rem;
    }

    #subDisplay {
        font-size: 12rem;
    }

    #Blind {
        font-size: 4rem;
    }

    #nextBlind {
        font-size: 2rem;
    }

    #back, #startStop, #reset, #next {
        width: 60px;
        height: 60px;
    }
}

@media (max-height: 800px) {
    #subDisplay {
        font-size: 14rem;
    }

    #Blind {
        font-size: 5rem;
    }

    #nextBlind {
        font-size: 2.5rem;
    }

    header {
        font-size: 2.5rem;
    }

    #Lv {
        font-size: 2rem;
    }

    #display {
        font-size: 3rem;
    }
}

@media (max-height: 700px) {
    #structureList {
        font-size: 1.2em;
    }
}

@media (max-height: 500px) {
    #structureList {
        font-size: 1em;
    }
}

@media (max-height: 400px) {
    #structureList {
        font-size: 0.8em;
    }
}