@charset "utf-8";

:root {
    /* 文字サイズはこの3つの変数で一括調整 */
    --fs-lg: 52px;
    --fs-md: 40px;
    --fs-sm: 30px;
}

body { font-size: var(--fs-md); }

#game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
    padding: 25px 20px;
    background: #0b1120 url('images/hanafuda_bg.webp') center / cover no-repeat;
    gap: 15px;
}

.screen {
    display: none;
    width: 100%;
    height: 100%;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    box-sizing: border-box;
}
.screen.active { display: flex; }

.game-title, .mode-title, #draw-step-count, .role-badge,
#overlay-card-name, #overlay-keyword, .slot-role, .card-meta,
#summary-message-text, .bonus-value, .bonus-number-value {
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9);
}

.hidden { display: none !important; }
.fade-out { opacity: 0 !important; }

/* ホーム画面 */
#screen-home { justify-content: center; text-align: center; }
.game-title { font-size: var(--fs-lg); font-weight: bold; margin: 0 0 20px; color: #fef08a; letter-spacing: 8px; }
.game-subtitle { font-size: var(--fs-sm); color: #e2e8f0; margin-bottom: 80px; }
.menu-buttons { width: 100%; display: flex; flex-direction: column; gap: 30px; }

/* ヘッダー */
.result-header { text-align: center; width: 100%; flex-shrink: 0; margin: 12px 0 18px; }
.mode-title { margin: 0 0 8px; font-size: var(--fs-lg); color: #fff; letter-spacing: 4px; line-height: 1.2; }
.step-sub { display: flex; justify-content: center; align-items: center; gap: 20px; }
#draw-step-count { font-size: var(--fs-sm); color: #fde047; font-weight: bold; }
.role-badge {
    display: inline-block;
    padding: 4px 22px;
    background: rgba(185, 28, 28, 0.85);
    border: 2px solid rgba(253, 224, 71, 0.7);
    border-radius: 30px;
    color: #fef9c3;
    font-size: var(--fs-sm);
    font-weight: bold;
}

/* 前半：カード反転演出 */
.card-fade-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: opacity 0.4s ease-in-out;
    flex-shrink: 0;
}
.card-display-area {
    position: relative;
    width: 560px;
    height: 860px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    margin-top: 50px; /* ← カードの上下位置はここで微調整 */
    flex-shrink: 0;
}
.card-wrapper {
    width: 100%;
    height: 100%;
    perspective: 1500px;
    transition: transform 0.75s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.3s ease;
}
.card-wrapper.slide-from-top { transform: translateY(-950px) scale(0.9); opacity: 0; }
#card-inner {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.75s cubic-bezier(0.4, 0.2, 0.2, 1);
}

.card-face {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    background: transparent;
    will-change: transform;
    transform: translateZ(0);
}
.card-face img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center top;
    filter: drop-shadow(0 20px 30px rgba(0, 0, 0, 0.85));
}
.card-face-a { transform: rotateY(0deg) translateZ(1px); }
.card-face-b { transform: rotateY(180deg) translateZ(1px); }

.card-overlay-box {
    position: absolute;
    top: 48%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 720px;
    min-height: 220px;
    background: rgba(15, 23, 42, 0.9);
    border-top: 3px solid rgba(250, 204, 21, 0.6);
    border-bottom: 3px solid rgba(250, 204, 21, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 25px 40px;
    box-sizing: border-box;
    transition: opacity 0.3s ease-in-out;
    z-index: 10;
}
.card-overlay-box.hidden { opacity: 0; pointer-events: none; display: flex !important; }
.overlay-content { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; }
#overlay-card-name { margin: 0; font-size: var(--fs-lg); color: #fde047; font-weight: bold; }
#overlay-keyword { margin: 0; color: #fff; font-weight: bold; letter-spacing: 2px; }

/* 後半：3枚横並び＆解説 */
.summary-header { margin-bottom: 15px; }
.summary-cards-row {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 20px;
    margin-bottom: 28px;
    flex-shrink: 0;
}
.summary-card-slot {
    width: 205px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    opacity: 0.55;
    transform: scale(0.95);
    transition: all 0.3s ease;
    pointer-events: none;
}
.summary-card-slot.active { opacity: 1; transform: scale(1.05) translateY(-8px); }
.slot-role { font-size: var(--fs-sm); font-weight: bold; color: #cbd5e1; }
.summary-card-slot.active .slot-role { color: #fde047; }

.slot-img-box {
    width: 205px;
    height: 325px;
    background: #0f172a;
    border: 3px solid transparent;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.7);
    box-sizing: border-box;
    overflow: hidden;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.slot-img-box img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}
.summary-card-slot.active .slot-img-box { border-color: #fde047; box-shadow: 0 0 25px rgba(253, 224, 71, 0.55); }

.summary-message-box {
    width: 660px;
    height: 410px;
    background: rgba(15, 23, 42, 0.88);
    border: 2px solid rgba(250, 204, 21, 0.45);
    border-radius: 16px;
    padding: 28px 36px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    flex-shrink: 0;
}
.card-meta { font-size: var(--fs-sm); color: #fde047; font-weight: bold; }
.summary-main-text-area { width: 100%; flex: 1; display: flex; align-items: center; justify-content: center; }
#summary-message-text {
    margin: 0;
     font-weight: bold;
    line-height: 1.65;
    color: #fff;
    text-wrap: balance;
    line-break: strict;
    word-break: normal;
}

.action-footer.summary-footer { width: 600px; display: flex; flex-direction: column; gap: 16px; margin-top: 28px; flex-shrink: 0; }
.btn.secondary-btn { background: rgba(30, 41, 59, 0.9); border: 2px solid rgba(226, 232, 240, 0.5); color: #e2e8f0; }
.btn.is-invisible { visibility: hidden; pointer-events: none; }

/* おまけ画面 */
#screen-bonus { justify-content: center; }
.bonus-panel {
    width: 640px;
    background: rgba(15, 23, 42, 0.92);
    border: 3px solid rgba(253, 224, 71, 0.65);
    border-radius: 20px;
    padding: 45px 35px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 32px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.85);
    transition: opacity 0.4s ease-in-out;
}
.bonus-mode-subtitle { margin: 0; color: #fde047; font-weight: bold; letter-spacing: 3px; }
.bonus-item-block {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 22px 15px;
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(253, 224, 71, 0.3);
    border-radius: 14px;
    box-sizing: border-box;
}
.bonus-label { font-size: var(--fs-sm); color: #93c5fd; font-weight: bold; letter-spacing: 2px; }
.bonus-value { margin: 0; font-weight: bold; color: #fff; line-height: 1.4; }
.bonus-number-value { margin: 0; font-size: var(--fs-lg); font-weight: bold; color: #fde047; line-height: 1.1; }
.bonus-auto-note { margin: 5px 0 0; font-size: var(--fs-sm); color: #94a3b8; }