:root {
    --color-bg: #f5f1eb;
    --color-primary: #8b7355;
    --color-male: #7fb3d5;
    --color-female: #f5a5b8;
    --color-text: #3d3d3d;
    --color-white: #ffffff;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --font-main: 'M PLUS Rounded 1c', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* フルスクリーン対応 */
body {
    font-family: var(--font-main);
    background: var(--color-bg);
    color: var(--color-text);
    width: 100vw;
    min-height: 100vh;
    position: relative;
}

/* 画面管理 */
.screen {
    display: none;
    width: 100vw;
    min-height: 100vh;
    position: relative;
}

.screen.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}

/* 戻るボタン */
.btn-back {
    position: fixed;
    top: 10px;
    left: 10px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid var(--color-primary);
    background: white;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 100;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-back:active {
    background: var(--color-primary);
    color: white;
    transform: scale(0.95);
}

/* 削除ボタン（右上） */
.btn-delete-participant {
    position: fixed;
    top: 10px;
    right: 10px;
    padding: 10px 20px;
    border-radius: 20px;
    border: 2px solid #e74c3c;
    background: white;
    color: #e74c3c;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    z-index: 100;
    transition: all 0.3s;
    font-family: var(--font-main);
}

.btn-delete-participant:active {
    background: #e74c3c;
    color: white;
    transform: scale(0.95);
}

.btn-delete-participant:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* モード選択画面 */
.mode-container {
    text-align: center;
    padding: 60px 20px 20px;
    width: 100%;
}

.app-title {
    font-size: 2rem;
    color: var(--color-primary);
    margin-bottom: 40px;
}

.mode-cards {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 350px;
    margin: 0 auto;
}

.mode-card {
    background: white;
    padding: 30px 20px;
    border-radius: 15px;
    width: 100%;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: transform 0.2s;
}

.mode-card:active {
    transform: scale(0.98);
}

.mode-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.mode-card h2 {
    font-size: 1.3rem;
    margin-bottom: 10px;
    color: var(--color-primary);
}

.mode-card p {
    color: var(--color-text);
    font-size: 0.95rem;
}

.mode-price {
    margin-top: 8px;
    font-weight: 800;
    color: #f5d76e;
    font-size: 1.1rem;
}

.mode-special {
    border: 3px solid #f5d76e;
    position: relative;
    overflow: hidden;
}

.mode-special::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.3) 50%, transparent 70%);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%) translateY(-100%);
    }
    100% {
        transform: translateX(100%) translateY(100%);
    }
}

/* 参加者設定画面(縦向き) */
.setup-container {
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 70px 20px 100px;
}

.setup-center {
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.setup-top, .setup-bottom {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

/* 参加者行(自動縮小対応) */
.participants-row {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
    width: 100%;
    padding: 0 10px;
    min-height: 95px; /* アバター1人分の高さを事前確保してレイアウトシフトを防ぐ */
}

/* 人数別のgap調整 */
.participants-row[data-count="1"],
.participants-row[data-count="2"],
.participants-row[data-count="3"],
.participants-row[data-count="4"] {
    gap: 15px;
}

.participants-row[data-count="5"] {
    gap: 12px;
}

.participants-row[data-count="6"],
.participants-row[data-count="7"] {
    gap: 8px;
}

.participants-row[data-count="8"],
.participants-row[data-count="9"],
.participants-row[data-count="10"] {
    gap: 5px;
    padding: 0 5px;
}

/* アイコンサイズ(人数に応じて自動調整) */
.participant-avatar {
    width: 80px;
    min-height: 95px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    cursor: pointer;
    background: transparent;
    transition: transform 0.2s;
}

/* 人数別のサイズ調整 */
.participants-row[data-count="1"] .participant-avatar,
.participants-row[data-count="2"] .participant-avatar,
.participants-row[data-count="3"] .participant-avatar {
    width: 90px;
    height: 90px;
}

.participants-row[data-count="4"] .participant-avatar {
    width: 80px;
    height: 80px;
}

.participants-row[data-count="5"] .participant-avatar {
    width: 70px;
    height: 70px;
}

.participants-row[data-count="6"] .participant-avatar,
.participants-row[data-count="7"] .participant-avatar,
.participants-row[data-count="8"] .participant-avatar {
    width: 60px;
    height: 60px;
}

.participants-row[data-count="9"] .participant-avatar,
.participants-row[data-count="10"] .participant-avatar {
    width: 55px;
    height: 55px;
}

.participant-avatar:active {
    transform: scale(0.95);
}

.participant-avatar .icon {
    width: 85%;
    height: auto;
    aspect-ratio: 1;
    border-radius: 999px;
    object-fit: cover;
}

.participant-avatar .name {
    font-size: 0.75rem;
    font-weight: 700;
    margin-top: 2px;
    padding-bottom: 3px;
    color: var(--color-text);
    text-align: center;
    width: 100%;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: visible;
}

/* 人数に応じて名前サイズ調整 */
.participants-row[data-count="1"] .participant-avatar .name,
.participants-row[data-count="2"] .participant-avatar .name,
.participants-row[data-count="3"] .participant-avatar .name {
    font-size: 0.85rem;
}

.participants-row[data-count="6"] .participant-avatar .name,
.participants-row[data-count="7"] .participant-avatar .name,
.participants-row[data-count="8"] .participant-avatar .name,
.participants-row[data-count="9"] .participant-avatar .name,
.participants-row[data-count="10"] .participant-avatar .name {
    font-size: 0.65rem;
}

.participant-avatar.large {
    width: clamp(80px, 20vw, 100px);
    height: clamp(80px, 20vw, 100px);
    margin-bottom: 10px;
}

.participant-avatar.large .icon {
    width: 85%;
    height: auto;
}

/* プラス・マイナスボタングループ */
.btn-group-side {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

/* プラスボタン(縦向き配置) */
.btn-add-side {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: 4px dashed;
    background: white;
    font-size: 2.5rem;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.btn-add-side.male-side {
    border-color: var(--color-male);
    color: var(--color-male);
    background: linear-gradient(135deg, rgba(127, 179, 213, 0.15), rgba(90, 155, 213, 0.25));
}

.btn-add-side.female-side {
    border-color: var(--color-female);
    color: var(--color-female);
    background: linear-gradient(135deg, rgba(245, 165, 184, 0.15), rgba(232, 138, 160, 0.25));
}

.btn-add-side:active {
    transform: scale(0.95);
}

.btn-add-side:disabled {
    opacity: 0.25;
    cursor: not-allowed;
}

.table-center {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 0;
}

.table-visual {
    background: linear-gradient(135deg, var(--color-primary), #6b5940);
    color: white;
    padding: 15px 50px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1.2rem;
    box-shadow: var(--shadow);
    text-align: center;
    line-height: 1.6;
}

.btn-start {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 15px 50px;
    background: linear-gradient(135deg, #e88aa0, #d4697d);
    color: white;
    border: none;
    border-radius: 30px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: all 0.2s;
    z-index: 90;
}

.btn-start:active {
    transform: translateX(-50%) scale(0.98);
}

/* 選択画面(縦向き) */
.selection-container {
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 70px 20px 20px;
}

.selection-message {
    font-size: 1.1rem;
    line-height: 1.8;
    text-align: center;
}

.selection-message span {
    font-weight: 800;
    font-size: 1.2rem;
}

/* 選択不可のアイコン */
.participant-avatar.disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.participant-avatar.selectable {
    cursor: pointer;
    position: relative;
}

.participant-avatar.selectable:active {
    transform: scale(1.1);
}

.participant-avatar.selectable::after {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    border: 3px solid var(--color-primary);
    border-radius: 999px;
    opacity: 0;
    transition: opacity 0.2s;
}

.participant-avatar.selectable:active::after {
    opacity: 1;
}

/* 処理中画面 */
.processing-container {
    text-align: center;
    padding: 100px 20px;
}

.processing-container h1 {
    font-size: 2rem;
    color: var(--color-primary);
    margin-bottom: 40px;
}

.loader {
    width: 60px;
    height: 60px;
    border: 6px solid var(--color-bg);
    border-top: 6px solid var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 結果画面(縦向き) */
.result-container {
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 70px 20px 100px;
}

.result-row {
    display: flex;
    gap: 12px;
    justify-content: center;
    align-items: center;
    flex-wrap: nowrap;
    width: 100%;
    padding: 0 10px;
}

.result-row .participant-avatar {
    flex-shrink: 0;
    min-height: unset;
}

/* 結果画面: 人数別アバター幅(縦向き) */
.result-row[data-count="5"] .participant-avatar {
    width: 70px;
}

.result-row[data-count="6"] .participant-avatar,
.result-row[data-count="7"] .participant-avatar {
    width: 60px;
}

.result-row[data-count="8"] .participant-avatar {
    width: 55px;
}

.result-row[data-count="9"] .participant-avatar,
.result-row[data-count="10"] .participant-avatar {
    width: 48px;
}

/* 結果画面: 人数別名前サイズ(縦向き) */
.result-row[data-count="6"] .participant-avatar .name,
.result-row[data-count="7"] .participant-avatar .name,
.result-row[data-count="8"] .participant-avatar .name,
.result-row[data-count="9"] .participant-avatar .name,
.result-row[data-count="10"] .participant-avatar .name {
    font-size: 0.65rem;
}

/* 結果画面も人数に応じてサイズ調整 */
.result-row[data-count="1"],
.result-row[data-count="2"],
.result-row[data-count="3"],
.result-row[data-count="4"] {
    gap: 15px;
}

.result-row[data-count="5"] {
    gap: 12px;
}

.result-row[data-count="6"],
.result-row[data-count="7"] {
    gap: 8px;
}

.result-row[data-count="8"],
.result-row[data-count="9"],
.result-row[data-count="10"] {
    gap: 5px;
    padding: 0 5px;
}

.result-actions {
    width: 220px;
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    justify-content: center;
    gap: 15px;
    z-index: 90;
}

/* ボタン */
.btn {
    padding: 12px 25px;
    border-radius: 20px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    font-family: var(--font-main);
    transition: all 0.2s;
    font-size: 0.95rem;
}

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

.btn-primary {
    background: var(--color-primary);
    color: white;
}

.btn-outline {
    background: white;
    color: var(--color-primary);
    border: 2px solid var(--color-primary);
}

.btn-large {
    width: 100%;
    padding: 15px 30px;
    font-size: 1.1rem;
}

.btn-small {
    padding: 10px 20px;
    font-size: 0.9rem;
}

/* ダイアログ */
.dialog-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.dialog-overlay.active {
    display: flex;
}

.dialog {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 350px;
    animation: slideUp 0.3s ease-out;
}

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

.dialog h2 {
    text-align: center;
    margin-bottom: 20px;
    color: var(--color-primary);
    font-size: 1.3rem;
}

.dialog p {
    text-align: center;
    margin-bottom: 20px;
    line-height: 1.6;
}

.dialog-buttons {
    display: flex;
    gap: 10px;
}

.dialog-buttons .btn {
    flex: 1;
}

/* 削除ダイアログ用 */
.dialog-delete {
    max-width: 400px;
}

.delete-list {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.delete-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
    margin-bottom: 10px;
    border-radius: 10px;
    background: var(--color-bg);
    cursor: pointer;
    transition: all 0.2s;
}

.delete-item:hover {
    background: #e8e4de;
}

.delete-item:active {
    transform: scale(0.98);
}

.delete-item-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.delete-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.delete-item-name {
    font-weight: 700;
    font-size: 1rem;
    color: var(--color-text);
}

.delete-item-gender {
    font-size: 0.85rem;
    color: #666;
}

.name-input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--color-primary);
    border-radius: 10px;
    font-size: 1rem;
    font-family: var(--font-main);
    margin-bottom: 20px;
    transition: all 0.3s;
}

.name-input:focus {
    outline: none;
    border-color: #6b5940;
    box-shadow: 0 0 0 3px rgba(139, 115, 85, 0.1);
}

/* PWAインストールバナー */
.install-banner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    background: linear-gradient(135deg, #8b7355, #6b5940);
    color: white;
    padding: 15px 20px;
    z-index: 10000;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.5s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
    }
    to {
        transform: translateY(0);
    }
}

.install-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
}

.install-content p {
    font-weight: 700;
    margin: 0;
    font-size: 0.95rem;
}

.install-content .btn {
    width: 100%;
    max-width: 200px;
}

/* iOS用インストールプロンプト */
.ios-install-prompt {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    padding: 20px;
}

.ios-prompt-content {
    background: white;
    padding: 25px;
    border-radius: 15px;
    width: 90%;
    max-width: 400px;
    max-height: 85vh;
    overflow-y: auto;
    text-align: center;
    animation: slideUp 0.3s ease-out;
}

.ios-prompt-content h3 {
    color: var(--color-primary);
    margin-bottom: 10px;
    font-size: 1.5rem;
}

.ios-subtitle {
    color: #666;
    margin-bottom: 25px;
    font-size: 0.9rem;
}

.ios-steps {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 25px;
}

.ios-step {
    display: flex;
    gap: 12px;
    text-align: left;
    align-items: flex-start;
}

.step-number {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary), #6b5940);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.step-content {
    flex: 1;
}

.step-title {
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 8px;
    font-size: 1rem;
}

.step-desc {
    color: #666;
    font-size: 0.85rem;
    margin-top: 5px;
    line-height: 1.5;
}

.step-desc strong {
    color: #0A84FF;
    font-weight: 700;
}

.share-icon-demo {
    margin: 10px 0;
    padding: 12px;
    background: #f0f0f0;
    border-radius: 10px;
    display: inline-block;
}

.icon-demo {
    margin: 10px 0;
}

.plus-square {
    width: 45px;
    height: 45px;
    border: 3px solid #0A84FF;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: #0A84FF;
    background: #f0f0f0;
}

.arrow-indicator {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 10002;
    pointer-events: none;
}

.arrow-text {
    color: white;
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 10px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
}

.arrow-animation {
    font-size: 2.5rem;
    animation: bounce 1.5s infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-15px);
    }
}

/* Safari誘導プロンプト */
.safari-prompt-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    padding: 20px;
}

.safari-prompt-content {
    background: white;
    padding: 25px;
    border-radius: 20px;
    width: 90%;
    max-width: 450px;
    max-height: 85vh;
    overflow-y: auto;
    text-align: center;
    animation: slideUp 0.3s ease-out;
}

.browser-icon {
    font-size: 3.5rem;
    margin-bottom: 15px;
}

.safari-prompt-content h3 {
    color: var(--color-primary);
    font-size: 1.6rem;
    margin-bottom: 10px;
}

.prompt-subtitle {
    color: #666;
    margin-bottom: 20px;
    line-height: 1.6;
    font-size: 0.9rem;
}

.current-browser-notice {
    background: #fff3cd;
    border: 2px solid #ffc107;
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 25px;
    color: #856404;
    font-size: 0.9rem;
}

.current-browser-notice strong {
    color: #000;
    font-weight: 700;
}

.safari-steps {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin-bottom: 25px;
}

.safari-step {
    display: flex;
    gap: 12px;
    text-align: left;
    align-items: flex-start;
}

.url-box {
    background: #f5f5f5;
    padding: 10px;
    border-radius: 8px;
    font-size: 0.75rem;
    word-break: break-all;
    margin: 10px 0;
    border: 2px dashed var(--color-primary);
    color: #0A84FF;
    font-family: monospace;
}

.safari-icon-demo {
    margin: 10px 0;
    display: inline-block;
}

.prompt-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ========================================
   Sekigaeの真実 - 選択結果表示(視覚的な矢印表示)
   ======================================== */
.truth-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.92);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}

.truth-overlay.active {
    display: flex;
}

.truth-content {
    background: linear-gradient(135deg, #2d2d3a, #1a1a24);
    padding: 20px 15px 20px 15px;
    border-radius: 20px;
    width: 95%;
    max-width: 420px;
    max-height: 88vh;
    overflow-y: auto;
    animation: truthReveal 0.5s ease-out;
    border: 2px solid #f5d76e;
    box-shadow: 0 0 30px rgba(245, 215, 110, 0.3);
    position: relative;
}

@keyframes truthReveal {
    0% {
        opacity: 0;
        transform: scale(0.8) rotate(-5deg);
    }
    50% {
        transform: scale(1.02) rotate(1deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0);
    }
}

.truth-header {
    text-align: center;
    margin-bottom: 15px;
    padding-bottom: 12px;
    border-bottom: 2px solid rgba(245, 215, 110, 0.3);
}

.truth-header h2 {
    color: #f5d76e;
    font-size: 1.5rem;
    margin-bottom: 5px;
}

.truth-subtitle {
    color: #aaa;
    font-size: 0.9rem;
}

/* 視覚的なアイコン配置 */
#truth-results {
    position: relative;
    width: 100%;
    min-height: 350px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 80px;
    margin-bottom: 15px;
    padding: 10px 0;
}

.truth-participants-row {
    display: flex;
    gap: clamp(8px, 3vw, 15px);
    justify-content: center;
    align-items: center;
    flex-wrap: nowrap;
    width: 100%;
    padding: 0 10px;
    z-index: 2;
}

.truth-avatar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    position: relative;
}

/* 上段の名前をアイコンの上に配置 */
.truth-top .truth-avatar {
    flex-direction: column-reverse;
}

.truth-icon {
    width: clamp(50px, 15vw, 80px);
    height: clamp(50px, 15vw, 80px);
    border-radius: 50%;
    object-fit: cover;
}

.truth-name {
    font-size: clamp(0.65rem, 2.8vw, 0.85rem);
    color: #fff;
    text-align: center;
    max-width: clamp(50px, 15vw, 80px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* テーブル表示 */
.truth-table {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px 0;
    z-index: 1;
}

.truth-table-visual {
    background: linear-gradient(135deg, #f5d76e, #d4b84a);
    color: #2d2d3a;
    padding: 12px 30px;
    border-radius: 10px;
    font-weight: 800;
    font-size: 1rem;
    box-shadow: 0 4px 12px rgba(245, 215, 110, 0.4);
    text-align: center;
}

/* SVG矢印レイヤー（アイコンより下に表示） */
.truth-arrows-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: visible;
}

/* 保存・閉じるボタン */
.truth-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.truth-actions .btn {
    flex: 1;
}

/* トリプルタップヒント(デバッグ用、本番では非表示) */
.tap-hint {
    display: none;
}

/* Sekigaeの真実 説明モーダル */
.dialog-truth-info {
    max-width: 450px;
}

.truth-info-content {
    text-align: left;
}

.truth-info-desc {
    background: #f5f1eb;
    padding: 15px;
    border-radius: 10px;
    line-height: 1.7;
    margin-bottom: 20px;
    border-left: 4px solid var(--color-primary);
}

.truth-info-desc strong {
    color: var(--color-primary);
    font-weight: 800;
}

.truth-info-features {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.truth-info-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.truth-info-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.truth-info-text strong {
    display: block;
    color: var(--color-primary);
    font-size: 1rem;
    margin-bottom: 3px;
}

.truth-info-text p {
    margin: 0;
    font-size: 0.85rem;
    color: #666;
    line-height: 1.5;
}

.truth-info-price {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    margin-bottom: 20px;
    border: 2px solid #f5d76e;
}

.truth-info-price p {
    margin: 0;
    font-size: 1rem;
}

.truth-info-price strong {
    color: var(--color-primary);
    font-size: 1.3rem;
    font-weight: 800;
}

.truth-info-note {
    font-size: 0.75rem;
    color: #856404;
    margin-top: 5px;
}

.dialog-truth-info .btn {
    margin-top: 10px;
}

/* 管理者用隠しボタン */
.btn-admin-hidden {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    cursor: pointer;
    border-radius: 0 0 15px 0;
    opacity: 0;
    -webkit-tap-highlight-color: transparent;
}

/* ===== 横向き誘導オーバーレイ ===== */
.orientation-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(139, 115, 85, 0.96);
    z-index: 99999;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.orientation-overlay.active {
    display: flex;
}

.orientation-content {
    text-align: center;
    color: white;
    padding: 20px;
}

.orientation-icon {
    font-size: 4rem;
    display: block;
    margin-bottom: 24px;
    animation: rotate-hint 2s ease-in-out infinite;
    transform-origin: center;
}

@keyframes rotate-hint {
    0%   { transform: rotate(0deg); }
    35%  { transform: rotate(-90deg); }
    65%  { transform: rotate(-90deg); }
    100% { transform: rotate(0deg); }
}

.orientation-text {
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 12px;
}

.orientation-sub {
    font-size: 0.95rem;
    opacity: 0.85;
    line-height: 1.6;
}

/* ===================================================
   横向き時レイアウト全面最適化
   対象: iPhone SE~Plus 横向き (~375-414px 高さ)
   =================================================== */
@media (orientation: landscape) {

    /* ---- スクロール禁止（Safari ブラウザクロームによるオーバーフロー防止） ---- */
    html, body {
        height: 100%;
        overflow: hidden;
    }

    .screen.active {
        height: 100%;
        min-height: unset;
        overflow: hidden;
    }

    /* ---- モード選択画面 ---- */
    .mode-container {
        padding: 10px 20px;
        min-height: 100vh;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }

    .app-title {
        font-size: 1.3rem;
        margin-bottom: 12px;
    }

    /* カードを横並びに */
    .mode-cards {
        flex-direction: row;
        gap: 15px;
        max-width: 600px;
    }

    .mode-card {
        padding: 15px 12px;
    }

    .mode-icon {
        font-size: 2rem;
        margin-bottom: 8px;
    }

    .mode-card h2 {
        font-size: 1rem;
        margin-bottom: 5px;
    }

    .mode-card p {
        font-size: 0.85rem;
    }

    /* ---- 参加者設定画面: 左右に追加ボタン、中央にコンテンツ ---- */
    .setup-container {
        flex-direction: row;
        align-items: center;
        justify-content: center;
        padding: 58px 12px 62px;
        gap: 10px;
        min-height: 100vh;
    }

    .setup-container .btn-group-side {
        flex-shrink: 0;
        justify-content: center;
    }

    .setup-container .setup-center {
        flex: 1;
        max-width: none;
        gap: 5px;
    }

    /* ---- 選択画面 ---- */
    .selection-container {
        padding: 58px 20px 58px;
        min-height: 100vh;
        justify-content: center;
    }

    .selection-container .setup-center {
        max-width: 100%;
        gap: 5px;
    }

    /* 選択メッセージをコンパクトに */
    .selection-message {
        font-size: 0.9rem;
        line-height: 1.4;
    }

    .selection-message span {
        font-size: 0.95rem;
    }

    /* ---- 結果画面 ---- */
    .result-container {
        padding: 50px 15px 52px;
        min-height: unset;
        height: 100%;
        justify-content: center;
        overflow: hidden;
    }

    .result-container .setup-center {
        max-width: 100%;
        gap: 5px;
    }

    /* ---- テーブル・セクション間ギャップ (共通) ---- */
    .setup-top,
    .setup-bottom {
        gap: 5px;
    }

    /* 横画面ではアバターが小さいので min-height を解除 */
    .participants-row {
        min-height: unset;
    }

    .table-center {
        padding: 4px 0;
    }

    .table-visual {
        padding: 7px 25px;
        font-size: 0.9rem;
        line-height: 1.4;
    }

    /* ---- アバター共通: 高さをコンテンツ（アイコン＋名前）で決定 ---- */
    .participant-avatar {
        min-height: unset;
        height: auto;
    }

    /* アイコン: aspect-ratio はベースCSSで指定済み、height:auto を明示 */
    .participant-avatar .icon {
        height: auto;
    }

    /* ---- アバター幅: 参加者設定・選択画面（width のみ。height は auto） ---- */
    .participants-row[data-count="1"] .participant-avatar,
    .participants-row[data-count="2"] .participant-avatar,
    .participants-row[data-count="3"] .participant-avatar {
        width: 75px;
    }

    .participants-row[data-count="4"] .participant-avatar {
        width: 70px;
    }

    .participants-row[data-count="5"] .participant-avatar {
        width: 65px;
    }

    .participants-row[data-count="6"] .participant-avatar,
    .participants-row[data-count="7"] .participant-avatar,
    .participants-row[data-count="8"] .participant-avatar {
        width: 58px;
    }

    .participants-row[data-count="9"] .participant-avatar,
    .participants-row[data-count="10"] .participant-avatar {
        width: 52px;
    }

    /* ---- アバター幅: 結果画面 ---- */
    .result-row .participant-avatar {
        width: 72px;
        min-height: unset;
        height: auto;
    }

    .result-row[data-count="5"] .participant-avatar {
        width: 68px;
    }

    .result-row[data-count="6"] .participant-avatar,
    .result-row[data-count="7"] .participant-avatar {
        width: 62px;
    }

    .result-row[data-count="8"] .participant-avatar {
        width: 58px;
    }

    .result-row[data-count="9"] .participant-avatar,
    .result-row[data-count="10"] .participant-avatar {
        width: 54px;
    }

    /* ---- 追加ボタン ---- */
    .btn-add-side {
        width: 52px;
        height: 52px;
        font-size: 1.8rem;
    }

    /* ---- 固定ボタン ---- */
    .btn-start {
        bottom: 8px;
        padding: 10px 40px;
        font-size: 1rem;
    }

    .result-actions {
        bottom: 8px;
    }

    /* ---- 処理中画面 ---- */
    .processing-container {
        padding: 0 30px;
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 30px;
        min-height: 100vh;
    }

    .processing-container h1 {
        font-size: 1.5rem;
        margin-bottom: 0;
    }

    /* ---- ダイアログ共通 ---- */
    .dialog {
        max-height: 88vh;
        overflow-y: auto;
        padding: 18px 20px;
    }

    .dialog h2 {
        font-size: 1.1rem;
        margin-bottom: 10px;
    }

    .delete-list {
        max-height: 48vh;
    }

    /* ---- Sekigaeの真実オーバーレイ ---- */
    .truth-content {
        max-width: min(90vw, 720px);
        height: 96vh;
        max-height: 96vh;
        padding: 10px 20px 8px;
        display: flex;
        flex-direction: column;
        overflow-y: hidden;
    }

    /* ヘッダー非表示（アイコン領域を最大化） */
    .truth-header {
        display: none;
    }

    #truth-results {
        flex: 1;
        min-height: 0;
        gap: 0;
        justify-content: space-around;
        align-items: center;
        margin-bottom: 4px;
        padding: 0;
        overflow: hidden;
    }

    .truth-icon {
        width: clamp(56px, 14vh, 100px);
        height: clamp(56px, 14vh, 100px);
    }

    .truth-name {
        font-size: clamp(0.72rem, 1.6vh, 0.9rem);
        max-width: clamp(60px, 14vh, 104px);
    }

    .truth-table {
        padding: 2px 0;
    }

    .truth-table-visual {
        padding: 4px 16px;
        font-size: 0.8rem;
    }

    /* ボタンをコンパクトに */
    .truth-actions {
        margin-top: 6px;
        gap: 8px;
    }

    .truth-actions .btn {
        padding: 7px 20px;
        font-size: 0.88rem;
    }

    /* ---- PWAインストールプロンプト ---- */
    .ios-prompt-content,
    .safari-prompt-content {
        max-height: 90vh;
        padding: 15px;
    }

    .ios-steps,
    .safari-steps {
        gap: 12px;
        margin-bottom: 15px;
    }

}

/* スマホ横画面のみ: dialog が overflow:auto になるため fixed で画面隅に固定 */
@media (orientation: landscape) and (max-height: 500px) {
    .btn-admin-hidden {
        position: fixed;
        bottom: 0;
        right: 0;
        z-index: 10005;
    }
}
