/* =================================================================
   iPhone Duo シミュレーター（iphoneduo）
   全セレクタを #app-iphoneduo でスコープ。ライト/ダーク両対応。
   端末の色（Night Sky / Star White）はテーマに関係なく固定。
   ================================================================= */

#app-iphoneduo code {
    background: var(--bs-secondary-bg);
    color: var(--bs-body-color);
    padding: 0.1em 0.4em;
    border-radius: 4px;
    font-size: 0.9em;
}

#app-iphoneduo #duo-url-error:empty {
    display: none !important;
}

/* ---- 操作パネル ----
   狭い幅: ステージの上に横並びで置き、スクロールしても上に追従する。
   xl 以上: ステージの右列に縦に置き、同じく追従する。プレビューと操作を離さない。 */
#app-iphoneduo .duo-panel {
    position: sticky;
    top: 0.5rem;
    z-index: 5;
}

#app-iphoneduo .duo-panel-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.75rem 1rem;
}

#app-iphoneduo .duo-info {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

#app-iphoneduo .duo-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

/* 角度のスライダー */
#app-iphoneduo .duo-angle-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#app-iphoneduo .duo-angle-row + .duo-angle-row {
    margin-top: 0.15rem;
}

#app-iphoneduo .duo-angle-label {
    flex: 0 0 2em;
    font-size: 0.8rem;
    color: var(--bs-secondary-color);
}

#app-iphoneduo .duo-angle-row .form-range {
    flex: 1 1 auto;
    min-width: 0;
}

#app-iphoneduo .duo-angle-val {
    flex: 0 0 2.6em;
    text-align: right;
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
    color: var(--bs-secondary-color);
}

@media (min-width: 768px) and (max-width: 1199.98px) {
    /* 横並び: 姿勢 ＝ 上段いっぱい、中段に 色・倍率・角度、下段に操作 */
    #app-iphoneduo .duo-panel-grid {
        grid-template-columns: repeat(12, minmax(0, 1fr));
    }
    #app-iphoneduo .duo-panel-posture { grid-column: span 12; }
    #app-iphoneduo .duo-panel-color { grid-column: span 3; }
    #app-iphoneduo .duo-panel-scale { grid-column: span 2; }
    #app-iphoneduo .duo-panel-angle { grid-column: span 7; }
    #app-iphoneduo .duo-panel-actions { grid-column: span 12; }
    #app-iphoneduo .duo-panel-actions-label { display: none; }
    #app-iphoneduo .duo-panel-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; }
    #app-iphoneduo .duo-panel-actions .duo-info { margin-bottom: 0 !important; }
}

@media (max-width: 767.98px) {
    /* スマホ: パネルは追従させない（画面の半分を占めてしまう）。倍率は自動で収まるので近い。
       姿勢は5つを1行に、寸法は隠す。操作は3つを1行に */
    #app-iphoneduo .duo-panel {
        position: static;
    }
    #app-iphoneduo .duo-panel .card-body {
        padding: 0.75rem;
    }
    #app-iphoneduo .duo-panel-grid {
        grid-template-columns: repeat(12, minmax(0, 1fr));
        gap: 0.6rem 0.6rem;
    }
    #app-iphoneduo .duo-panel-posture { grid-column: span 12; }
    #app-iphoneduo .duo-panel-color { grid-column: span 7; }
    #app-iphoneduo .duo-panel-scale { grid-column: span 5; }
    #app-iphoneduo .duo-panel-angle { grid-column: span 12; }
    #app-iphoneduo .duo-panel-actions { grid-column: span 12; }
    #app-iphoneduo .duo-panel-actions-label { display: none; }

    #app-iphoneduo .duo-panel .duo-posture-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 0.3rem;
    }
    #app-iphoneduo .duo-panel .duo-posture-grid .btn {
        padding: 0.35rem 0.1rem;
        gap: 0.1rem;
    }
    #app-iphoneduo .duo-panel .duo-posture-name {
        font-size: 0.7rem;
        letter-spacing: -0.02em;
    }
    #app-iphoneduo .duo-panel .duo-posture-size {
        display: none;
    }
    #app-iphoneduo .duo-panel .duo-posture-ico {
        width: 22px;
        height: 22px;
        transform: scale(0.85);
        margin-bottom: 0;
    }
    #app-iphoneduo .duo-color-group .btn,
    #app-iphoneduo #duo-scale {
        font-size: 0.85rem;
        padding-top: 0.3rem;
        padding-bottom: 0.3rem;
    }
    #app-iphoneduo .duo-info {
        margin-bottom: 0.4rem !important;
    }
    #app-iphoneduo .duo-actions .btn {
        flex: 1 1 0;
        padding-inline: 0.25rem;
        white-space: nowrap;
    }
}

@media (min-width: 1200px) {
    /* 右列: 姿勢は縦一列（アイコン・名前・寸法を横に）。
       基本ルールより後ろに書けないので .duo-panel を足して詳細度で勝たせる */
    #app-iphoneduo .duo-panel .duo-posture-grid {
        grid-template-columns: minmax(0, 1fr);
    }
    #app-iphoneduo .duo-panel .duo-posture-grid .btn {
        flex-direction: row;
        justify-content: flex-start;
        gap: 0.6rem;
        padding: 0.35rem 0.75rem;
    }
    #app-iphoneduo .duo-panel .duo-posture-ico {
        margin-bottom: 0;
        flex-shrink: 0;
    }
    #app-iphoneduo .duo-panel .duo-posture-name {
        flex: 1 1 auto;
        text-align: left;
    }
    #app-iphoneduo .duo-panel .duo-actions .btn {
        flex: 1 1 100%;
        text-align: left;
    }
}

/* ---- 姿勢の選択肢（等幅グリッドで折り返す。btn-group は数が多いと幅が偏る） ---- */
#app-iphoneduo .duo-posture-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
    gap: 0.5rem;
}

#app-iphoneduo .duo-posture-grid .btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    padding: 0.5rem 0.25rem;
    line-height: 1.2;
}

#app-iphoneduo .duo-posture-name {
    font-weight: 700;
    font-size: 0.85rem;
    white-space: nowrap;
}

#app-iphoneduo .duo-posture-size {
    font-size: 0.72rem;
    opacity: 0.75;
    font-variant-numeric: tabular-nums;
}

/* 姿勢のミニ図（CSS だけで描く） */
#app-iphoneduo .duo-posture-ico {
    display: block;
    width: 26px;
    height: 26px;
    position: relative;
    margin-bottom: 0.15rem;
}

#app-iphoneduo .duo-posture-ico::before,
#app-iphoneduo .duo-posture-ico::after {
    content: "";
    position: absolute;
    border: 2px solid currentColor;
    border-radius: 3px;
    box-sizing: border-box;
}

#app-iphoneduo .duo-posture-ico-closed::before { left: 8px; top: 2px; width: 12px; height: 22px; }
#app-iphoneduo .duo-posture-ico-closed::after { display: none; }

#app-iphoneduo .duo-posture-ico-landscape::before { left: 1px; top: 5px; width: 12px; height: 16px; border-right-width: 1px; border-radius: 3px 0 0 3px; }
#app-iphoneduo .duo-posture-ico-landscape::after { left: 13px; top: 5px; width: 12px; height: 16px; border-left-width: 1px; border-radius: 0 3px 3px 0; }

#app-iphoneduo .duo-posture-ico-portrait::before { left: 5px; top: 1px; width: 16px; height: 12px; border-bottom-width: 1px; border-radius: 3px 3px 0 0; }
#app-iphoneduo .duo-posture-ico-portrait::after { left: 5px; top: 13px; width: 16px; height: 12px; border-top-width: 1px; border-radius: 0 0 3px 3px; }

#app-iphoneduo .duo-posture-ico-seated::before { left: 6px; top: 2px; width: 14px; height: 13px; }
#app-iphoneduo .duo-posture-ico-seated::after { left: 3px; top: 15px; width: 20px; height: 7px; }

#app-iphoneduo .duo-posture-ico-standing::before {
    left: 3px; top: 4px; width: 20px; height: 18px;
    border-radius: 0;
    clip-path: polygon(50% 0, 100% 100%, 0 100%);
    border: 0;
    background: currentColor;
    opacity: 0.85;
}
#app-iphoneduo .duo-posture-ico-standing::after {
    left: 9px; top: 12px; width: 8px; height: 10px;
    border: 0;
    background: var(--bs-body-bg);
    clip-path: polygon(50% 0, 100% 100%, 0 100%);
    border-radius: 0;
}

/* 本体色の2択。狭い幅でラベルを折り返さない */
#app-iphoneduo .duo-color-group .btn {
    white-space: nowrap;
    padding-inline: 0.4rem;
    font-size: 0.9rem;
}

#app-iphoneduo .duo-badge {
    display: inline-flex;
    align-items: center;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

#app-iphoneduo .duo-badge .mach-mi {
    font-size: 1rem;
}

/* ---- ステージ ---- */
#app-iphoneduo .duo-stage {
    position: relative;
    background: var(--bs-tertiary-bg);
    border-radius: var(--bs-border-radius);
    padding: 24px 16px;
    overflow-x: auto;
    overflow-y: hidden;
    min-height: 220px;
}

/* 外側の箱は縮めた後の実寸（JS が幅・高さを入れる）。中身の元寸法のはみ出しを隠し、
   ステージの横スクロールに数えさせない（iOS Safari 対策） */
#app-iphoneduo .duo-stage-scaler {
    position: relative;
    overflow: hidden;
}

#app-iphoneduo .duo-scene {
    position: relative;
    transform-origin: 0 0;
    will-change: transform;
    box-sizing: border-box;
    padding: 0 36px 36px; /* 影のぶんの余白。JS の SHADOW_PAD と同じ値 */
}

/* ドラッグで回す。横方向は自前で受け、縦方向のスワイプはページのスクロールに残す */
#app-iphoneduo .duo-stage {
    touch-action: pan-y;
}

#app-iphoneduo .duo-stage.duo-has-url {
    cursor: grab;
}

#app-iphoneduo .duo-stage.duo-dragging {
    cursor: grabbing;
    user-select: none;
}

/* 「つかむ」オン: 画面の上でも回せるように iframe のポインタ操作を止める */
#app-iphoneduo .duo-stage.duo-drag-mode iframe {
    pointer-events: none;
}

#app-iphoneduo .duo-stage.duo-drag-mode {
    touch-action: none;
}

#app-iphoneduo .duo-angle-hint {
    font-size: 0.72rem;
    color: var(--bs-secondary-color);
}

#app-iphoneduo .duo-drag-toggle {
    font-size: 0.75rem;
    font-weight: 600;
}

/* 角度: 端末全体を回す包み。回しているときだけ scene に奥行きを持たせる */
#app-iphoneduo .duo-orient {
    position: relative;
    height: 100%;
    /* 回転は面（.duo-device / .duo-half / .duo-tent-panel）そのものに掛ける。
       ここは中央へ寄せる 2D の translate だけ */
}

/* ---- 駒・面・胴体 ----
   ページを映す面（.duo-face）は flat のまま。厚み（側面・角の板・背面）は兄弟の胴体（.duo-body）が
   preserve-3d で持ち、両方に同じ変換を JS（setPanel）が掛ける。駒（.duo-piece）は置き場所だけ。
   Safari は祖先に preserve-3d を持つ iframe を描かない（画面が黒いまま）ので、面の祖先に preserve-3d を置かない。
   ページを映さない面（ノートPC型の土台・テント型の奥）は、面1つに厚みを直接持たせたまま */
#app-iphoneduo .duo-piece {
    position: relative;
}

#app-iphoneduo .duo-body,
#app-iphoneduo .duo-face {
    position: absolute;
    inset: 0;
    transform-origin: inherit;
}

#app-iphoneduo .duo-body {
    border-radius: 46px;
    pointer-events: none; /* 厚みはつかむ対象にしない（ドラッグはステージが受ける） */
}

#app-iphoneduo .duo-body,
#app-iphoneduo .duo-half-bottom,
#app-iphoneduo .duo-tent-back {
    transform-style: preserve-3d;
}

/* ノートPC型のふたの駒（置き場所は .duo-half と同じ。見た目は中の面が持つ） */
#app-iphoneduo .duo-half-piece {
    position: absolute;
    bottom: 0;
    transform-origin: 50% 30%;
}

/* ふたの胴体: ヒンジは下辺（背面は rotateY(180deg) でも上下は変わらない） */
#app-iphoneduo .duo-body.duo-hinge-bottom {
    border-radius: 46px 46px 6px 6px;
}

#app-iphoneduo .duo-edge {
    position: absolute;
    /* backface-visibility: hidden を付けない。Safari はこの構造（胴体の transform に perspective() を
       含む 3D 文脈）で側面の表裏を逆に判定し、手前の側面を消してしまう（2026-09-17 実 Safari で確認）。
       遠い側の側面は、手前に重なる面（z-index）と胴体の中の奥行き順で隠れるので、表裏の判定に頼らなくてよい */
}

#app-iphoneduo .duo-stage[data-color="night"] .duo-edge {
    background: linear-gradient(90deg, #0c0d14, #23263a 50%, #0c0d14);
}

#app-iphoneduo .duo-stage[data-color="night"] .duo-edge-left,
#app-iphoneduo .duo-stage[data-color="night"] .duo-edge-right {
    background: linear-gradient(180deg, #0c0d14, #23263a 50%, #0c0d14);
}

#app-iphoneduo .duo-stage[data-color="star"] .duo-edge {
    background: linear-gradient(90deg, #b9b6ae, #ecebe6 50%, #b9b6ae);
}

#app-iphoneduo .duo-stage[data-color="star"] .duo-edge-left,
#app-iphoneduo .duo-stage[data-color="star"] .duo-edge-right {
    background: linear-gradient(180deg, #b9b6ae, #ecebe6 50%, #b9b6ae);
}

/* 角丸の区間の厚み（1px 刻みの薄い板。JS が translateZ で奥へ積む） */
#app-iphoneduo .duo-corner {
    position: absolute;
    pointer-events: none;
}

#app-iphoneduo .duo-stage[data-color="night"] .duo-corner {
    background: #1a1c28;
}

#app-iphoneduo .duo-stage[data-color="star"] .duo-corner {
    background: #d5d3cc;
}

/* 奥行きは .duo-orient の transform: perspective() 側で付ける（親の perspective は WebKit で効かなかった） */

#app-iphoneduo .duo-stage-empty {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    text-align: center;
    color: var(--bs-secondary-color);
    font-size: 0.95rem;
}

/* ---- 端末 ---- */
#app-iphoneduo .duo-device {
    position: absolute; /* 駒（.duo-piece）いっぱいに置く面 */
    inset: 0;
    border-radius: 46px;
    box-shadow:
        inset 0 0 0 1.5px rgba(255, 255, 255, 0.35),
        inset 0 0 0 4px rgba(0, 0, 0, 0.25),
        0 24px 48px -12px rgba(0, 0, 0, 0.45);
}

#app-iphoneduo .duo-stage[data-color="night"] .duo-device {
    background: linear-gradient(155deg, #2b2e40 0%, #14161f 45%, #1d1f2c 100%);
}

#app-iphoneduo .duo-stage[data-color="star"] .duo-device {
    background: linear-gradient(155deg, #f6f5f1 0%, #d3d1ca 45%, #e6e4de 100%);
    box-shadow:
        inset 0 0 0 1.5px rgba(255, 255, 255, 0.9),
        inset 0 0 0 4px rgba(0, 0, 0, 0.08),
        0 24px 48px -12px rgba(0, 0, 0, 0.35);
}

#app-iphoneduo .duo-screen {
    position: absolute;
    inset: 12px;
    border-radius: 34px;
    background: #000;
    overflow: hidden;
}

#app-iphoneduo .duo-frame {
    display: block;
    border: 0;
    background: #fff;
    transform-origin: 0 0;
}

/* ヒンジの辺は直角（閉じた状態＝左辺、テント型＝上辺）。画面の角もその辺だけ小さく */
#app-iphoneduo .duo-hinge-left {
    border-radius: 6px 46px 46px 6px;
}

/* 背面の顔は rotateY(180deg) で裏返っているので、左右の角丸を入れ替えて置く（見た目でヒンジ側と揃う） */
#app-iphoneduo .duo-hinge-left .duo-back-face {
    border-radius: 46px 6px 6px 46px;
}

#app-iphoneduo .duo-hinge-left .duo-screen {
    border-radius: 4px 34px 34px 4px;
}

#app-iphoneduo .duo-hinge-top,
#app-iphoneduo .duo-hinge-top .duo-back-face,
#app-iphoneduo .duo-hinge-top .duo-tent-inner {
    border-radius: 6px 6px 46px 46px;
}

#app-iphoneduo .duo-hinge-top .duo-screen,
#app-iphoneduo .duo-hinge-top .duo-tent-inner::after {
    border-radius: 4px 4px 34px 34px;
}

/* 外画面のパンチホールカメラ（右上。テント型は右下） */
#app-iphoneduo .duo-cam {
    position: absolute;
    top: 30px;
    right: 30px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #05060a;
    box-shadow: inset 0 0 0 3px #1e2029, 0 0 0 1.5px rgba(255, 255, 255, 0.1);
    z-index: 2;
}

#app-iphoneduo .duo-device-standing .duo-cam {
    top: auto;
    bottom: 30px;
}

/* 内画面の折り目（薄い陰影。サイトの操作を邪魔しない） */
#app-iphoneduo .duo-crease {
    position: absolute;
    pointer-events: none;
    z-index: 1;
}

#app-iphoneduo .duo-crease-v {
    top: 0;
    bottom: 0;
    left: 50%;
    width: 18px;
    transform: translateX(-50%);
    background: linear-gradient(90deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.16) 44%, rgba(255, 255, 255, 0.14) 52%, rgba(0, 0, 0, 0) 100%);
}

#app-iphoneduo .duo-crease-h {
    left: 0;
    right: 0;
    top: 50%;
    height: 18px;
    transform: translateY(-50%);
    background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.16) 44%, rgba(255, 255, 255, 0.14) 52%, rgba(0, 0, 0, 0) 100%);
}

/* ヒンジの切れ目（枠の縁、中央） */
#app-iphoneduo .duo-hinge {
    position: absolute;
    background: rgba(0, 0, 0, 0.55);
    border-radius: 3px;
    z-index: 2;
}

#app-iphoneduo .duo-hinge-v { left: 50%; width: 6px; height: 12px; transform: translateX(-50%); }
#app-iphoneduo .duo-hinge-v.duo-hinge-a { top: 0; }
#app-iphoneduo .duo-hinge-v.duo-hinge-b { bottom: 0; }

#app-iphoneduo .duo-hinge-h { top: 50%; width: 12px; height: 6px; transform: translateY(-50%); }
#app-iphoneduo .duo-hinge-h.duo-hinge-a { left: 0; }
#app-iphoneduo .duo-hinge-h.duo-hinge-b { right: 0; }

/* ---- ノートPC型（上下に折る） ----
   机に置いた側（下半分）を土台にして全体を奥へ倒し、ふた（上半分）は
   ヒンジを軸に土台から 80° 起こす（開き角 100°）。手前の辺が原寸で、
   奥へ行くほど小さくなるので、投影がステージからはみ出さない。 */
#app-iphoneduo .duo-fold {
    position: relative;
    height: 100%;
    /* 奥行きは各面の transform: perspective() 側で付ける（原点 50% 30%） */
}

#app-iphoneduo .duo-half {
    position: absolute;
    bottom: 0;
    transform-origin: 50% 30%;
    border-radius: 46px;
    box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.35), inset 0 0 0 4px rgba(0, 0, 0, 0.25);
}

#app-iphoneduo .duo-stage[data-color="night"] .duo-half {
    background: linear-gradient(155deg, #2b2e40 0%, #14161f 45%, #1d1f2c 100%);
}

#app-iphoneduo .duo-stage[data-color="star"] .duo-half {
    background: linear-gradient(155deg, #f6f5f1 0%, #d3d1ca 45%, #e6e4de 100%);
    box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.9), inset 0 0 0 4px rgba(0, 0, 0, 0.08);
}

/* 上半分＝ふた。土台の奥の辺（ヒンジ）を軸に起こす。top は JS が半身の高さぶん負に置く */
#app-iphoneduo .duo-half-top {
    border-radius: 46px 46px 6px 6px;
    /* 開き角は JS（applyAngle）が transform に入れる */
}

#app-iphoneduo .duo-half-top .duo-screen {
    inset: 12px 12px 0 12px;
    border-radius: 34px 34px 4px 4px;
}

/* 下半分＝机に置いた側。土台の面にそのまま置く。ページは映さず操作パネルの想定で暗く */
#app-iphoneduo .duo-half-bottom {
    border-radius: 6px 6px 46px 46px;
}

#app-iphoneduo .duo-base-screen {
    background: linear-gradient(180deg, #0b0c12 0%, #14151d 100%);
}

#app-iphoneduo .duo-base-bar {
    position: absolute;
    left: 50%;
    bottom: 14px;
    width: 140px;
    height: 5px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.35);
    transform: translateX(-50%);
}

#app-iphoneduo .duo-half-bottom .duo-screen {
    inset: 0 12px 12px 12px;
    border-radius: 4px 4px 34px 34px;
}

/* ---- テント型（外画面を横向きに、上辺を奥へ） ---- */
#app-iphoneduo .duo-tent {
    position: relative;
    height: 100%;
    /* 奥行きは各面の transform: perspective() 側で付ける */
}

/* テントの2枚。兄弟にして、それぞれに角度まで含めた変換を JS が掛ける（原点 50% 30%） */
#app-iphoneduo .duo-tent-panel {
    position: absolute;
    left: 0;
    bottom: 0;
    transform-origin: 50% 30%;
}

#app-iphoneduo .duo-device-standing {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
}

/* 奥の面の内側（内画面の片方。消えている）。背面の顔は .duo-back-face が担う */
#app-iphoneduo .duo-tent-inner {
    position: absolute;
    inset: 0;
    border-radius: 46px;
    box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.35), inset 0 0 0 4px rgba(0, 0, 0, 0.25);
}

#app-iphoneduo .duo-tent-inner::after {
    content: "";
    position: absolute;
    inset: 12px;
    border-radius: 34px;
    background: #050609;
}

#app-iphoneduo .duo-stage[data-color="night"] .duo-tent-inner {
    background: linear-gradient(155deg, #2b2e40 0%, #14161f 45%, #1d1f2c 100%);
}

#app-iphoneduo .duo-stage[data-color="star"] .duo-tent-inner {
    background: linear-gradient(155deg, #f6f5f1 0%, #d3d1ca 45%, #e6e4de 100%);
    box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.9), inset 0 0 0 4px rgba(0, 0, 0, 0.08);
}

/* ---- 背面の顔 ----
   その面の裏が見えているとき（.duo-behind。JS の markFacing が面ごとに付ける）に出す。厚みぶん奥（translateZ）に置き、
   rotateY(180deg) で裏返して鏡像を戻している（JS がインラインで指定） */
#app-iphoneduo .duo-back-face {
    display: none;
    position: absolute;
    inset: 0;
    border-radius: inherit;
    z-index: 3;
    box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.35), inset 0 0 0 4px rgba(0, 0, 0, 0.25);
}

#app-iphoneduo .duo-stage[data-color="night"] .duo-back-face {
    background: linear-gradient(205deg, #2b2e40 0%, #14161f 45%, #1d1f2c 100%);
}

#app-iphoneduo .duo-stage[data-color="star"] .duo-back-face {
    background: linear-gradient(205deg, #f6f5f1 0%, #d3d1ca 45%, #e6e4de 100%);
    box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.9), inset 0 0 0 4px rgba(0, 0, 0, 0.08);
}

#app-iphoneduo .duo-behind .duo-back-face {
    display: block;
}

/* 背面を見ているあいだ、画面側の要素は隠す（影が透けないように） */
#app-iphoneduo .duo-behind .duo-screen,
#app-iphoneduo .duo-behind .duo-cam,
#app-iphoneduo .duo-behind .duo-hinge,
#app-iphoneduo .duo-behind .duo-tent-inner {
    visibility: hidden;
}

/* 背面の外画面（消えた黒いガラス）。カメラの無い側の半分に載る */
#app-iphoneduo .duo-back-glass {
    position: absolute;
    background: linear-gradient(160deg, #101218 0%, #05060a 55%, #0e1016 100%);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

#app-iphoneduo .duo-back-glass-right {
    top: 8px;
    bottom: 8px;
    left: 50%;
    right: 8px;
    border-radius: 3px 38px 38px 3px;
}

#app-iphoneduo .duo-back-glass-bottom {
    left: 8px;
    right: 8px;
    top: 50%;
    bottom: 8px;
    border-radius: 3px 3px 38px 38px;
}

/* ノートPC型の土台の裏（ヒンジは土台の上辺なので、上が直角・下が角丸） */
#app-iphoneduo .duo-back-glass-all {
    inset: 8px;
    border-radius: 3px 3px 38px 38px;
}

/* 背面のカメラ（2眼の台座） */
#app-iphoneduo .duo-back-camera {
    position: absolute;
    top: 28px;
    left: 28px;
    width: 64px;
    height: 128px;
    border-radius: 22px;
    background: rgba(0, 0, 0, 0.35);
    box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.15);
}

#app-iphoneduo .duo-back-camera::before,
#app-iphoneduo .duo-back-camera::after {
    content: "";
    position: absolute;
    left: 12px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 40%, #2a3350 0%, #05060a 60%);
    box-shadow: 0 0 0 3px #1e2029, 0 0 0 4.5px rgba(255, 255, 255, 0.12);
}

#app-iphoneduo .duo-back-camera::before { top: 12px; }
#app-iphoneduo .duo-back-camera::after { top: 74px; }

/* テント型の上辺のヒンジは、側面（.duo-edge-top）が担う */

/* 姿勢ボタンのミニ図はライト/ダークで currentColor に任せる。
   モバイルでは情報バッジを折り返しやすく */
@media (max-width: 575.98px) {
    #app-iphoneduo .duo-stage {
        padding: 16px 8px;
    }
    #app-iphoneduo .duo-badge {
        font-size: 0.72rem;
    }
}
