    body {
        font-family: system-ui, "Yu Mincho", serif;
        margin: 0;
        background: #f6f3ee;
    }

    .wrap {
        max-width: 720px;
        margin: 24px auto;
        padding: 0 16px 96px;
    }

    canvas {
        display: block;
        margin: 0 auto 16px;
        background: #fff;
        border-radius: 12px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
    }

    #clock {
        /* 1. 起動直後からサイズを確定させるため、画面の短い方を基準にする */
        width: 85vmin;
        height: 85vmin;

        /* 2. PCなど巨大画面用の上限（ここは好みで700px程度まで上げてもOK） */
        max-width: 600px;
        max-height: 600px;

        /* 3. 情報パネルの改行を防ぐための絶対防衛ライン */
        min-width: 320px;
        min-height: 320px;

        /* 4. アスペクト比と中央寄せの安定化 */
        aspect-ratio: 1 / 1;
        object-fit: contain;
        margin: auto;
    }

    .panel {
        background: #fff;
        border-radius: 12px;
        padding: 16px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
    }

    .panel-flip {
        width: 100%;
        max-width: 400px;
        perspective: 1000px;
        cursor: pointer;
    }

    .panel-inner {
        position: relative;
        width: 100%;
        transform-style: preserve-3d;
        -webkit-transform-style: preserve-3d;
        transition: transform .45s ease;
        overflow: hidden;
    }

    .panel-flip.is-flipped .panel-inner {
        transform: rotateY(180deg);
    }

    .panel-flip.panel-2d .panel-inner,
    .panel-flip.panel-2d.is-flipped .panel-inner {
        transform: none;
        -webkit-transform: none;
    }

    .panel-face {
        position: absolute;
        inset: 0;
        backface-visibility: hidden;
        -webkit-backface-visibility: hidden;
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
        background: #fff;
        transition: opacity .2s ease;
    }

    .panel-front {
        transform: rotateY(0deg) translateZ(1px);
        -webkit-transform: rotateY(0deg) translateZ(1px);
        z-index: 2;
        opacity: 1;
        pointer-events: auto;
    }

    .panel-back {
        transform: rotateY(180deg) translateZ(1px);
        -webkit-transform: rotateY(180deg) translateZ(1px);
        z-index: 1;
        opacity: 0;
        pointer-events: none;
    }

    .panel-flip.panel-2d .panel-front,
    .panel-flip.panel-2d .panel-back {
        transform: none;
        -webkit-transform: none;
    }

    .panel-flip.is-flipped .panel-front {
        opacity: 0;
        pointer-events: none;
    }

    .panel-flip.is-flipped .panel-back {
        opacity: 1;
        pointer-events: auto;
    }

    .bottom-menu-bar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 40;
        display: flex;
        justify-content: center;
        padding: 8px 12px calc(10px + env(safe-area-inset-bottom));
        background: #f6f3ee;
        border-top: 1px solid #dfd9ce;
    }

    .menu-dock-button {
        border: none;
        border-radius: 0;
        background: transparent;
        color: #6b4b2b;
        padding: 8px 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        font: inherit;
        font-weight: 600;
        cursor: pointer;
    }

    .menu-dock-button:focus-visible {
        outline: 2px solid #b19a7e;
        outline-offset: 2px;
        border-radius: 8px;
    }

    .menu-dock-icon {
        font-size: 1.15rem;
        line-height: 1;
    }

    .menu-dock-label {
        font-size: 1rem;
        line-height: 1;
    }

    .panel-view {
        display: none;
    }

    .panel-view.is-active {
        display: block;
    }

    .menu-list {
        display: grid;
        gap: 10px;
        margin-top: 12px;
    }

    .menu-btn {
        border: 1px solid #d5d0c7;
        border-radius: 10px;
        background: #faf9f6;
        padding: 10px 12px;
        text-align: left;
        font: inherit;
        color: #333;
    }

    .panel-actions {
        margin-top: 12px;
        position: sticky;
        bottom: 0;
        background: linear-gradient(to top, #fff 75%, rgba(255, 255, 255, 0));
        padding-top: 8px;
    }

    .legal-content {
        line-height: 1.5;
        font-size: .95em;
    }

    .legal-scroll {
        max-height: 42vh;
        overflow-y: auto;
        border: 1px solid #e5ddd2;
        border-radius: 8px;
        padding: 10px;
        background: #fcfbf8;
    }

    .legal-content p {
        margin: 0 0 8px;
    }

    .legal-content h1,
    .legal-content h2,
    .legal-content h3 {
        margin: 10px 0 6px;
        color: #6b4b2b;
        font-size: 1em;
    }

    .legal-content ul {
        margin: 0 0 8px 1.2em;
        padding: 0;
    }

    .legal-content li {
        margin-bottom: 4px;
    }

    .legal-title {
        font-weight: 600;
        margin-bottom: 10px;
        color: #6b4b2b;
    }

    .legal-text {
        line-height: 1.5;
    }

    .row {
        display: grid;
        grid-template-columns: 140px 1fr;
        gap: 12px;
        align-items: start;
        padding: 8px 0;
    }

    .label {
        color: #6b4b2b;
    }

    .value {
        font-variant-numeric: tabular-nums;
    }

    .row-setting .value {
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .setting-value {
        justify-content: flex-start;
    }

    .ios-switch {
        position: relative;
        display: inline-block;
        width: 52px;
        height: 32px;
    }

    .ios-switch input {
        opacity: 0;
        width: 0;
        height: 0;
    }

    .ios-slider {
        position: absolute;
        cursor: pointer;
        inset: 0;
        background-color: #d9d9de;
        transition: .2s;
        border-radius: 999px;
    }

    .ios-slider:before {
        content: "";
        position: absolute;
        width: 28px;
        height: 28px;
        left: 2px;
        top: 2px;
        background-color: #fff;
        transition: .2s;
        border-radius: 50%;
        box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
    }

    .ios-switch input:checked+.ios-slider {
        background-color: #007aff;
    }

    .ios-switch input:checked+.ios-slider:before {
        transform: translateX(20px);
    }

    .ios-switch input:focus+.ios-slider {
        box-shadow: 0 0 0 2px rgba(0, 122, 255, .25);
    }

    .panel-flip.is-subflipping .panel-back {
        animation: backViewFlip .36s ease;
    }

    @keyframes backViewFlip {
        0% {
            transform: rotateY(180deg);
        }

        50% {
            transform: rotateY(270deg);
        }

        100% {
            transform: rotateY(180deg);
        }
    }

    /* --- index.html の <style> 内に追加・修正 --- */

    .wrap {
        max-width: 900px;
        /* 横並び用に少し広げる */
        margin: 24px auto;
        padding: 0 16px calc(88px + env(safe-area-inset-bottom));
        /* 横向き時のための Flex 設定 */
        display: flex;
        flex-direction: column;
        /* 基本は縦並び */
        gap: 20px;
        align-items: center;
    }

    /* 横向き（Landscape）の時の微調整 */
    @media (orientation: landscape) {
        .wrap {
            width: 100%;
            max-width: 1280px;
            flex-direction: row;
            align-items: center;
            height: 100vh;
            justify-content: center;
            /* 全体を中央に寄せる */
            padding: 0 5vw;
            /* 左右に少し余裕を持たせる */
        }

        /* セレクタを一つに統合 */
        #clock {
            /* 1. 基本は高さ基準（上下にはみ出さない） */
            height: 75vh;
            width: 75vh;

            /* 2. ただし、横幅が狭い端末でもパネルを圧迫しないよう制限 */
            max-width: 45vw;
            max-height: 45vw;
            /* 正円を維持 */

            margin: 0 30px 0 0;
            /* 右側にだけパネルとの間隔を作る */

            /* 以前の下限設定を継承 */
            min-width: 320px;
            min-height: 320px;
        }

        .panel {
            flex: 0 0 360px;
            width: 360px;
            min-width: 340px;
            max-width: 400px;
            /* パネルが浮いて見えないよう、中身を左寄せにするなら以下 */
            text-align: left;
        }
    }