/* グローバルスタイル */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --color-pink: #FF69B4;
    --color-pink-light: #FFB6D9;
    --color-pink-dark: #FF1493;
    --color-blue: #87CEEB;
    --color-blue-light: #B0E0E6;
    --color-blue-dark: #4A90E2;
    --color-purple: #DDA0DD;
    --color-yellow: #FFD700;
    --color-green: #90EE90;
    --color-gray: #F5F5F5;
    --color-text: #333;
    --color-text-light: #666;
    --color-white: #FFFFFF;
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    --shadow-large: 0 8px 30px rgba(0, 0, 0, 0.15);
}

body {
    font-family: 'M PLUS Rounded 1c', 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', 'Meiryo', sans-serif;
    background: linear-gradient(135deg, #FFB6D9 0%, #87CEEB 50%, #DDA0DD 100%);
    min-height: 100vh;
    color: var(--color-text);
    overflow-x: hidden;
    position: relative;
}

/* 背景デコレーション */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: 
        radial-gradient(circle at 20% 80%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(255, 182, 217, 0.1) 0%, transparent 50%);
    animation: float 20s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(30px, -30px) rotate(120deg); }
    66% { transform: translate(-20px, 20px) rotate(240deg); }
}

/* 画面共通スタイル */
.screen {
    display: none;
    min-height: 100vh;
    padding: 20px;
    position: relative;
    z-index: 1;
}

.screen.active {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.5s ease;
}

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

/* ロゴ */
.logo-container {
    text-align: center;
    margin-bottom: 30px;
    animation: bounceIn 1s ease;
}

@keyframes bounceIn {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

.main-logo {
    width: 200px;
    height: auto;
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.2));
}

/* カード */
.card-container {
    background: var(--color-white);
    border-radius: 30px;
    padding: 40px 30px;
    box-shadow: var(--shadow-large);
    max-width: 400px;
    width: 100%;
    text-align: center;
    animation: slideUp 0.6s ease;
}

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

.welcome-text {
    font-size: 32px;
    font-weight: 800;
    color: var(--color-pink);
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(255, 105, 180, 0.2);
}

.subtitle {
    font-size: 16px;
    color: var(--color-text-light);
    margin-bottom: 30px;
    line-height: 1.6;
}

.screen-title {
    font-size: 28px;
    font-weight: 800;
    color: var(--color-pink);
    text-align: center;
    margin-bottom: 25px;
    text-shadow: 2px 2px 4px rgba(255, 105, 180, 0.2);
}

/* ボタン */
.button-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.btn {
    border: none;
    border-radius: 20px;
    padding: 18px 30px;
    font-size: 16px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

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

.btn-large {
    width: 100%;
    padding: 20px 30px;
    font-size: 18px;
}

.btn-medium {
    padding: 15px 25px;
    font-size: 16px;
}

.btn-pink {
    background: linear-gradient(135deg, var(--color-pink) 0%, var(--color-pink-dark) 100%);
    color: var(--color-white);
}

.btn-pink:hover {
    background: linear-gradient(135deg, var(--color-pink-dark) 0%, var(--color-pink) 100%);
    box-shadow: 0 6px 20px rgba(255, 20, 147, 0.3);
}

.btn-blue {
    background: linear-gradient(135deg, var(--color-blue) 0%, var(--color-blue-dark) 100%);
    color: var(--color-white);
}

.btn-blue:hover {
    background: linear-gradient(135deg, var(--color-blue-dark) 0%, var(--color-blue) 100%);
    box-shadow: 0 6px 20px rgba(74, 144, 226, 0.3);
}

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

.btn-outline:hover {
    background: var(--color-blue-light);
    border-color: var(--color-blue-dark);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-icon {
    font-size: 24px;
}

.btn-text {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.btn-text small {
    font-size: 12px;
    opacity: 0.9;
    font-weight: 500;
}

/* 遊び方画面 */
.howto-container {
    background: var(--color-white);
    border-radius: 30px;
    padding: 40px 30px;
    box-shadow: var(--shadow-large);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.howto-content {
    text-align: left;
    margin-bottom: 30px;
}

.howto-step {
    display: flex;
    gap: 20px;
    margin-bottom: 25px;
    align-items: flex-start;
}

.step-number {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--color-pink), var(--color-pink-dark));
    color: var(--color-white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 800;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(255, 105, 180, 0.3);
}

.step-content h3 {
    font-size: 18px;
    color: var(--color-text);
    margin-bottom: 8px;
    font-weight: 700;
}

.step-content p {
    font-size: 14px;
    color: var(--color-text-light);
    line-height: 1.6;
}

.role-info {
    background: var(--color-gray);
    border-radius: 20px;
    padding: 20px;
    margin-top: 25px;
}

.role-info h3 {
    font-size: 18px;
    color: var(--color-text);
    margin-bottom: 15px;
    text-align: center;
    font-weight: 700;
}

.role-card {
    background: var(--color-white);
    border-radius: 15px;
    padding: 15px;
    margin-bottom: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.role-card:last-child {
    margin-bottom: 0;
}

.role-card strong {
    display: block;
    font-size: 16px;
    margin-bottom: 5px;
    color: var(--color-text);
}

.role-card p {
    font-size: 13px;
    color: var(--color-text-light);
    line-height: 1.5;
}

.role-citizen strong { color: var(--color-blue-dark); }
.role-witch strong { color: var(--color-pink-dark); }
.role-influencer strong { color: var(--color-purple); }

/* 設定画面 */
.setup-container {
    background: var(--color-white);
    border-radius: 30px;
    padding: 40px 30px;
    box-shadow: var(--shadow-large);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.setup-section {
    margin-bottom: 30px;
}

.setup-section h3 {
    font-size: 18px;
    color: var(--color-text);
    margin-bottom: 15px;
    font-weight: 700;
}

.player-input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.player-input-group input {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid var(--color-gray);
    border-radius: 15px;
    font-size: 16px;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.player-input-group input:focus {
    outline: none;
    border-color: var(--color-pink);
}

.player-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    min-height: 40px;
}

.player-tag {
    background: linear-gradient(135deg, var(--color-pink-light), var(--color-purple));
    color: var(--color-white);
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(255, 105, 180, 0.2);
    animation: popIn 0.3s ease;
}

@keyframes popIn {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

.player-tag .remove-btn {
    background: rgba(255, 255, 255, 0.3);
    border: none;
    color: var(--color-white);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    transition: background 0.2s ease;
}

.player-tag .remove-btn:hover {
    background: rgba(255, 255, 255, 0.5);
}

.hint-text {
    font-size: 13px;
    color: var(--color-text-light);
    margin-top: 10px;
}

/* トグルスイッチ */
.toggle-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

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

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.4s;
    border-radius: 34px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background: linear-gradient(135deg, var(--color-pink), var(--color-pink-dark));
}

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

.toggle-label {
    font-size: 16px;
    color: var(--color-text);
    font-weight: 600;
}

/* 役割配布画面 */
.role-container {
    background: var(--color-white);
    border-radius: 30px;
    padding: 40px 30px;
    box-shadow: var(--shadow-large);
    max-width: 500px;
    width: 100%;
    text-align: center;
}

.player-turn-info {
    margin: 30px 0;
}

.turn-text {
    font-size: 18px;
    color: var(--color-text-light);
    margin-bottom: 10px;
}

.player-name-large {
    font-size: 36px;
    font-weight: 800;
    color: var(--color-pink);
    margin: 15px 0;
    text-shadow: 2px 2px 4px rgba(255, 105, 180, 0.2);
}

.instruction-text {
    font-size: 14px;
    color: var(--color-text-light);
    margin-bottom: 25px;
    line-height: 1.6;
}

.role-reveal {
    animation: fadeIn 0.5s ease;
}

.role-title {
    font-size: 24px;
    color: var(--color-text);
    margin-bottom: 20px;
    font-weight: 700;
}

.role-card-large {
    background: linear-gradient(135deg, #FFB6D9 0%, #DDA0DD 100%);
    border-radius: 25px;
    padding: 40px;
    margin-bottom: 25px;
    box-shadow: var(--shadow-large);
    animation: scaleIn 0.6s ease;
}

@keyframes scaleIn {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.role-icon {
    font-size: 80px;
    margin-bottom: 15px;
}

.role-name {
    font-size: 32px;
    font-weight: 800;
    color: var(--color-white);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.topic-display {
    background: var(--color-gray);
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 25px;
    text-align: center;
}

.topic-text {
    font-size: 28px;
    font-weight: 800;
    color: var(--color-blue-dark);
    line-height: 1.4;
}

.topic-text-large {
    font-size: 28px;
    font-weight: 800;
    color: var(--color-white);
    line-height: 1.4;
    text-align: center;
}

.game-info {
    margin: 30px 0;
}

.info-text {
    font-size: 16px;
    color: var(--color-text-light);
    margin-bottom: 20px;
}

.topic-reminder {
    background: linear-gradient(135deg, #FFB6D9 0%, #87CEEB 100%);
    border-radius: 20px;
    padding: 30px;
    margin: 20px 0;
}

/* タイマー画面 */
.timer-container {
    background: var(--color-white);
    border-radius: 30px;
    padding: 40px 30px;
    box-shadow: var(--shadow-large);
    max-width: 500px;
    width: 100%;
    text-align: center;
}

.timer-display {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 40px 0;
}

.timer-circle {
    width: 250px;
    height: 250px;
    border-radius: 50%;
    background: linear-gradient(135deg, #FFB6D9 0%, #87CEEB 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 8px 30px rgba(255, 105, 180, 0.3);
    position: relative;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.timer-text {
    font-size: 64px;
    font-weight: 800;
    color: var(--color-white);
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.2);
}

.timer-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

/* 役割確認画面（個別） */
.role-check-container {
    background: var(--color-white);
    border-radius: 30px;
    padding: 40px 30px;
    box-shadow: var(--shadow-large);
    max-width: 500px;
    width: 100%;
}

.role-check-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

.role-check-item {
    background: var(--color-gray);
    border: 3px solid transparent;
    border-radius: 20px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    position: relative;
}

.role-check-item:hover {
    background: var(--color-blue-light);
    transform: translateY(-2px);
}

.role-check-item.revealed {
    cursor: default;
}

.role-check-item.revealed.citizen {
    background: linear-gradient(135deg, #87CEEB 0%, #4A90E2 100%);
    color: var(--color-white);
    border-color: var(--color-blue-dark);
}

.role-check-item.revealed.witch {
    background: linear-gradient(135deg, #FFB6D9 0%, #FF1493 100%);
    color: var(--color-white);
    border-color: var(--color-pink-dark);
}

.role-check-item.revealed.influencer {
    background: linear-gradient(135deg, #DDA0DD 0%, #9370DB 100%);
    color: var(--color-white);
    border-color: #9370DB;
}

.role-check-item .player-name {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 10px;
}

.role-check-item .role-label {
    font-size: 16px;
    font-weight: 600;
    display: none;
}

.role-check-item.revealed .role-label {
    display: block;
    margin-top: 8px;
}

.role-check-item .role-icon-small {
    font-size: 32px;
    display: none;
}

.role-check-item.revealed .role-icon-small {
    display: block;
    margin-bottom: 5px;
}

/* 投票画面（削除済みだが念のため残す） */
.voting-container {
    background: var(--color-white);
    border-radius: 30px;
    padding: 40px 30px;
    box-shadow: var(--shadow-large);
    max-width: 500px;
    width: 100%;
}

.vote-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

.vote-option {
    background: var(--color-gray);
    border: 3px solid transparent;
    border-radius: 20px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.vote-option:hover {
    background: var(--color-pink-light);
    transform: translateY(-2px);
}

.vote-option.selected {
    background: linear-gradient(135deg, var(--color-pink), var(--color-pink-dark));
    border-color: var(--color-pink-dark);
    color: var(--color-white);
    box-shadow: 0 4px 15px rgba(255, 105, 180, 0.4);
}

.vote-option .player-name {
    font-size: 18px;
    font-weight: 700;
}

/* 結果画面 */
.result-container {
    background: var(--color-white);
    border-radius: 30px;
    padding: 40px 30px;
    box-shadow: var(--shadow-large);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.result-content {
    margin-bottom: 30px;
}

.role-reveal-section {
    margin-top: 20px;
}

.role-reveal-section h4 {
    font-size: 18px;
    color: var(--color-text);
    margin-bottom: 15px;
    font-weight: 700;
    text-align: center;
}

.role-reveal-item {
    background: var(--color-white);
    border-radius: 15px;
    padding: 15px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.role-reveal-player {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-text);
}

.role-reveal-role {
    font-size: 16px;
    font-weight: 700;
    padding: 5px 12px;
    border-radius: 12px;
}

.role-reveal-role.citizen {
    background: var(--color-blue-light);
    color: var(--color-blue-dark);
}

.role-reveal-role.witch {
    background: var(--color-pink-light);
    color: var(--color-pink-dark);
}

.role-reveal-role.influencer {
    background: var(--color-purple);
    color: var(--color-white);
}

/* モーダル */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-content {
    background: var(--color-white);
    border-radius: 25px;
    padding: 30px;
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-large);
    animation: slideUp 0.4s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h3 {
    font-size: 24px;
    font-weight: 800;
    color: var(--color-pink);
}

.modal-close {
    background: none;
    border: none;
    font-size: 32px;
    color: var(--color-text-light);
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--color-gray);
}

.modal-description {
    font-size: 14px;
    color: var(--color-text-light);
    margin-bottom: 20px;
    line-height: 1.6;
}

.topic-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 25px;
}

.topic-item {
    background: linear-gradient(135deg, var(--color-pink-light) 0%, var(--color-blue-light) 100%);
    border-radius: 15px;
    padding: 15px 20px;
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    animation: slideInLeft 0.4s ease;
}

@keyframes slideInLeft {
    from { transform: translateX(-20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* スクロールバーのスタイル */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--color-gray);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--color-pink), var(--color-blue));
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, var(--color-pink-dark), var(--color-blue-dark));
}

/* レスポンシブ対応 */
@media (max-width: 480px) {
    .main-logo {
        width: 160px;
    }
    
    .welcome-text {
        font-size: 28px;
    }
    
    .screen-title {
        font-size: 24px;
    }
    
    .card-container,
    .howto-container,
    .setup-container,
    .role-container,
    .voting-container,
    .result-container {
        padding: 30px 20px;
    }
    
    .vote-grid {
        grid-template-columns: 1fr;
    }
}
