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

body {
    background-color: #fcfaf5; /* 和紙のような僅かに温かみのある白 */
    color: #111;
    font-family: 'Shippori Mincho', serif;
    overflow-x: hidden;
    line-height: 1.6;
}

#app {
    position: relative;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    opacity: 0;
    transition: opacity 0.8s ease;
    overflow-y: auto;
}

.screen.active {
    display: flex;
    opacity: 1;
}

/* Typography */
h1.title {
    font-size: 2.5rem;
    letter-spacing: 0.2rem;
    text-align: center;
    margin-bottom: 2rem;
    color: #111;
}

h1.title .en-title {
    display: block;
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.2rem;
    letter-spacing: 0.5rem;
    color: #b22222; /* 和の深紅 */
    margin-top: 0.5rem;
}

.subtitle {
    font-size: 1rem;
    text-align: center;
    color: #444;
    margin-bottom: 3rem;
}

/* Forms & Inputs */
#dob-form {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.input-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.2rem;
}

select {
    background: transparent;
    color: #111;
    border: none;
    border-bottom: 1px solid #999;
    padding: 0.5rem;
    font-size: 1.2rem;
    font-family: inherit;
    text-align: center;
    cursor: pointer;
}
select:focus { outline: none; border-bottom-color: #b22222; }

.unit { color: #555; font-size: 1rem; margin-right: 0.5rem; }

/* Buttons */
.btn {
    padding: 0.8rem 2.5rem;
    font-size: 1.1rem;
    font-family: inherit;
    cursor: pointer;
    border-radius: 4px;
    letter-spacing: 0.1em;
    transition: all 0.3s ease;
}

.primary-btn {
    background: #111;
    color: #fdfaf6;
    border: 1px solid #111;
}
.primary-btn:hover {
    background: #b22222;
    color: #fff;
    border-color: #b22222;
    box-shadow: 0 0 15px rgba(178, 34, 34, 0.2);
}

.outline-btn {
    background: transparent;
    color: #333;
    border: 1px solid #999;
}
.outline-btn:hover {
    border-color: #111;
    color: #111;
    background: #f0f0f0;
}

.text-btn {
    background: transparent;
    border: none;
    color: #555;
    text-decoration: underline;
    margin-top: 1rem;
}

.reset-dob-link {
    cursor: pointer;
    font-size: 0.8rem;
    color: #555;
    text-decoration: underline;
}

.btn-group {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
}

/* Animations */
.animation-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.glow-ring {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    border: 1px solid #b22222;
    box-shadow: 0 0 20px rgba(178, 34, 34, 0.2), inset 0 0 15px rgba(178, 34, 34, 0.1);
    animation: pulseMix 2s infinite ease-in-out;
}

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

/* Omikuji & Cards */
.omikuji-result-layout {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    justify-content: center;
    gap: 3rem;
    margin-bottom: 3rem;
    width: 100%;
    max-width: 800px;
}

.omikuji-visual {
    width: 250px;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.2);
}

.omikuji-paper {
    background: #fff;
    color: #111;
    padding: 2.5rem;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    writing-mode: vertical-rl;
    text-orientation: upright;
    min-height: 400px;
    border-left: 2px solid #b22222;
}

.omikuji-body {
    font-size: 1.2rem;
    line-height: 2.5;
    letter-spacing: 0.1em;
}

.next-action-card {
    background: #fff;
    padding: 2rem;
    border-radius: 8px;
    border: 1px solid #eee;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    text-align: center;
    max-width: 500px;
}

/* Kyusei Result */
.star-badge {
    text-align: center;
    margin-bottom: 3rem;
}
.star-badge .label { color: #666; font-size: 0.9rem; letter-spacing: 0.2em; display: block; margin-bottom: 0.5rem;}
#kyusei-star-name {
    font-size: 2.5rem;
    color: #b22222;
}

.fortune-cards {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    max-width: 600px;
    margin-bottom: 3rem;
}

.fortune-card {
    background: #fff;
    border-left: 4px solid #b22222;
    padding: 1.5rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}
.day-label {
    font-weight: bold;
    color: #b22222;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}
.fortune-text {
    font-size: 1.1rem;
    line-height: 1.8;
}

/* Event A: God Descent (Freeze) */
#freeze-layer {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: transparent;
    z-index: 100;
    pointer-events: none;
    display: none;
    justify-content: center;
    align-items: center;
}
#freeze-layer.active {
    display: flex;
    pointer-events: all;
}
#freeze-text {
    color: #fff;
    font-size: 1rem;
    opacity: 0;
    transition: opacity 1s;
    letter-spacing: 1em;
}
.god-event-screen {
    background: #000;
    z-index: 200;
    color: #fff; /* 強制的に白文字 */
}
.god-bg {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0.6;
    z-index: 1;
}
.god-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 2rem;
    background: rgba(0,0,0,0.5);
    border-radius: 10px;
    box-shadow: 0 0 50px rgba(0,0,0,1);
}
.god-name {
    font-size: 3rem;
    color: #fff;
    letter-spacing: 0.5em;
    margin-bottom: 1rem;
    text-shadow: 0 0 20px rgba(255,255,255,0.5);
}
.god-message {
    font-size: 1.5rem;
    line-height: 2;
    margin-bottom: 2rem;
    white-space: pre-line;
    color: #fff;
}

/* God Descent Sequence */
.god-intro-text {
    color: #fff;
    font-size: 2rem;
    letter-spacing: 0.8rem;
    text-align: center;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    animation: fadeInOut 4s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translateY(-30%); filter: blur(10px); }
    20% { opacity: 1; transform: translateY(-50%); filter: blur(0px); }
    80% { opacity: 1; transform: translateY(-50%); filter: blur(0px); }
    100% { opacity: 0; transform: translateY(-70%); filter: blur(10px); }
}

.god-main-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    height: 100%;
    padding-top: 10vh;
    animation: cardSlam 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    overflow-y: auto;
    padding-bottom: 50px;
}

@keyframes cardSlam {
    0% { opacity: 0; transform: scale(1.5) translateY(-20px); filter: blur(10px); }
    100% { opacity: 1; transform: scale(1) translateY(0); filter: blur(0); }
}

#heartbeat-layer {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle at center, transparent 30%, rgba(178, 34, 34, 0.5) 110%);
    opacity: 0;
    pointer-events: none;
    z-index: 0;
}

#heartbeat-layer.pulsing {
    animation: heartBeatPulse 1s infinite alternate cubic-bezier(0.4, 0, 0.6, 1);
}

@keyframes heartBeatPulse {
    0% { opacity: 0; transform: scale(1); }
    30% { opacity: 0.8; transform: scale(1.02); }
    50% { opacity: 0.2; transform: scale(1.01); }
    80% { opacity: 1; transform: scale(1.05); }
    100% { opacity: 0; transform: scale(1); }
}

.god-card {
    width: 90%;
    max-width: 300px;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.9), 0 0 20px rgba(255, 255, 255, 0.1);
    z-index: 2;
    border: 1px solid rgba(255, 255, 255, 0.15);
    display: block;
}

.god-text-overlay {
    width: 90%;
    max-width: 500px;
    background: rgba(15, 15, 15, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 2.5rem 2rem;
    border-radius: 8px;
    text-align: center;
    z-index: 1;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.9);
    margin-top: 2rem;
}

.god-text-overlay .god-name {
    font-size: 1rem;
    color: #ccc;
    margin-bottom: 1rem;
    letter-spacing: 0.2rem;
}

.god-text-overlay .god-message {
    font-size: 1.1rem;
    color: #ddd;
    line-height: 2;
    letter-spacing: 0.1rem;
}

.god-msg-highlight {
    display: block;
    font-size: 2.5rem;
    color: #fff;
    margin-bottom: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.1rem;
}

.god-btn {
    border-color: #fff;
    color: #fff;
    margin-top: 1.5rem;
}
.god-btn:hover {
    background: #fff;
    color: #000;
}

/* Event B: God Intrusion (Glitch) */
#glitch-layer {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: #000;
    z-index: 300;
    pointer-events: none;
    display: none;
    opacity: 0;
}
#glitch-layer.glitching {
    display: block;
    animation: glitchScreen 0.5s steps(2, end) 4;
    opacity: 1;
}

.error-flash {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    color: red;
    font-family: monospace;
    font-size: 1.5rem;
    letter-spacing: 0.2rem;
    text-align: center;
    z-index: 301;
    display: none;
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 1.5rem;
    align-items: center;
    width: 100%;
}

.action-buttons .god-btn,
.action-buttons .error-btn {
    margin-top: 0;
    width: 90%;
    max-width: 300px;
}

.solid-btn.banner-btn {
    background: linear-gradient(135deg, #d4af37 0%, #b8860b 100%);
    color: #000;
    font-weight: bold;
    border: none;
    letter-spacing: 0.1rem;
    text-shadow: none;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.4);
    text-decoration: none;
    display: inline-block;
    width: 90%;
    max-width: 300px;
    padding: 12px 20px;
    border-radius: 4px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.solid-btn.banner-btn:hover {
    background: linear-gradient(135deg, #f3d566 0%, #d4af37 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.6);
}
.error-flash.active {
    display: block;
    animation: blinkError 0.1s infinite;
}

.error-btn {
    border-color: red; color: red;
}
.error-btn:hover { background: red; color: #fff; box-shadow: 0 0 20px rgba(255,0,0,0.5);}

@keyframes blinkError {
    0% { opacity: 1; }
    50% { opacity: 0; }
}

@keyframes glitchScreen {
    0% { clip-path: inset(10% 0 80% 0); transform: translate(-5px, 2px); }
    20% { clip-path: inset(80% 0 5% 0); transform: translate(5px, -5px); background: #fff;}
    40% { clip-path: inset(40% 0 40% 0); transform: translate(-5px, 5px); }
    60% { clip-path: inset(20% 0 60% 0); transform: translate(5px, 2px); }
    80% { clip-path: inset(60% 0 20% 0); transform: translate(-2px, -2px); background: red;}
    100% { clip-path: inset(0 0 0 0); transform: translate(0); }
}

.glitch-text {
    animation: textGlitch 2s infinite;
}
@keyframes textGlitch {
    0% { text-shadow: 2px 0 red, -2px 0 blue; }
    5% { text-shadow: -2px 0 red, 2px 0 blue; transform: skewX(5deg); }
    10% { text-shadow: 2px 0 red, -2px 0 blue; transform: skewX(0); }
    15% { transform: translateY(-2px); }
    20% { transform: translateY(0); }
    100% { text-shadow: none; }
}

@media (max-width: 768px) {
    .omikuji-result-layout {
        flex-direction: column;
        align-items: center;
        gap: 1.5rem;
    }
}

@media (max-width: 600px) {
    .btn-group { flex-direction: column; }
    .omikuji-paper { padding: 1.5rem; min-height: 250px; }
}
