/* assets/style.css */
:root {
    --bg-color: #0d0d0d;
    --text-color: #f0f0f0;
    --accent-red: #c00;
    --dim-red: #500;
    --border-color: #444;
}

html,
body {
    height: 100%;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Yuji Syuku', serif;
    /* 筆文字 */
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* 共通ユーティリティ */
.hidden {
    display: none !important;
}

.fade-in {
    animation: fadeIn 2s ease forwards;
}

.glitch {
    position: relative;
}

/* JSでグリッチクラス制御 */

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Intro Overlay */
#intro-gate {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 1s, visibility 1s;
}

#intro-logo {
    font-size: 3rem;
    margin-bottom: 2rem;
    text-shadow: 0 0 10px #f00;
}

#enter-btn {
    padding: 1rem 2rem;
    border: 1px solid #fff;
    background: transparent;
    color: #fff;
    font-family: 'Yuji Syuku', serif;
    font-size: 1.5rem;
    cursor: pointer;
    animation: blink 3s infinite;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }
}

/* Main Container */
.container {
    padding: 20px;
    max-width: 600px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* Background */
.bg-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('forest_bg.jpg');
    background-size: cover;
    background-position: center;
    filter: brightness(0.3) blur(2px) sepia(0.5) hue-rotate(-20deg);
    z-index: -1;
}

/* Ritual Form (Horizontal) */
.ritual-form {
    background: rgba(0, 0, 0, 0.4);
    /* Overlay transparency increased */
    backdrop-filter: blur(2px);
    padding: 30px 20px;
    border: 1px solid #333;
    margin-top: 50px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
    position: relative;
    z-index: 2;
}

.input-group {
    margin-bottom: 25px;
    position: relative;
}

.input-group label {
    display: block;
    font-size: 0.9rem;
    color: #aaa;
    margin-bottom: 5px;
}

.input-field {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 2px solid #666;
    color: #fff;
    font-size: 1.2rem;
    font-family: 'Yuji Syuku', serif;
    padding: 5px 0;
    outline: none;
    transition: border-color 0.3s;
}

.input-field:focus {
    border-bottom-color: var(--accent-red);
}

.input-field::placeholder {
    color: #444;
}

/* 五寸釘ボタン */
.nail-submit {
    display: block;
    width: 100%;
    margin-top: 30px;
    background: transparent;
    border: none;
    color: var(--accent-red);
    font-size: 2rem;
    font-family: 'Yuji Syuku', serif;
    text-shadow: 0 0 5px #f00;
    cursor: pointer;
    padding: 20px;
    border: 1px solid var(--dim-red);
    transition: all 0.2s;
}

.nail-submit:active {
    transform: scale(0.95);
    background: #300;
}

.nail-submit:disabled {
    color: #444;
    border-color: #222;
    cursor: not-allowed;
}

/* Checkbox */
.contract-chk {
    display: flex;
    align-items: center;
    margin-top: 20px;
    color: #aaa;
    font-size: 0.9rem;
}

.contract-chk input {
    margin-right: 10px;
    transform: scale(1.5);
    accent-color: var(--accent-red);
}

/* Straw Doll Mockup (Background) */
.container>.doll-wrapper {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 0;
    /* Behind form (z-index 2) but in container */
    margin: 0;
    pointer-events: none;
}

.doll-img {
    max-width: 80%;
    opacity: 0.15;
    /* Faintly visible */
    filter: grayscale(100%);
    transition: all 0.5s ease-out;
}

.doll-revealed {
    opacity: 1 !important;
    filter: drop-shadow(0 0 30px #f00) grayscale(0%) !important;
    transform: scale(1.1);
}

/* Success View */
.success-msg {
    text-align: center;
    margin-top: 50px;
    font-size: 2rem;
    color: var(--accent-red);
    text-shadow: 0 0 10px #000;
}

.share-area {
    margin-top: 30px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.share-btn {
    text-decoration: none;
    padding: 15px;
    text-align: center;
    border: 1px solid #fff;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    transition: background 0.3s;
}

.share-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Shake Animation (Slower) */
@keyframes shake {
    0% {
        transform: translate(1px, 1px) rotate(0deg);
    }

    10% {
        transform: translate(-1px, -2px) rotate(-0.5deg);
    }

    20% {
        transform: translate(-3px, 0px) rotate(0.5deg);
    }

    30% {
        transform: translate(3px, 2px) rotate(0deg);
    }

    40% {
        transform: translate(1px, -1px) rotate(0.5deg);
    }

    50% {
        transform: translate(-1px, 2px) rotate(-0.5deg);
    }

    60% {
        transform: translate(-3px, 1px) rotate(0deg);
    }

    70% {
        transform: translate(3px, 1px) rotate(-0.5deg);
    }

    80% {
        transform: translate(-1px, -1px) rotate(0.5deg);
    }

    90% {
        transform: translate(1px, 2px) rotate(0deg);
    }

    100% {
        transform: translate(1px, -2px) rotate(-0.5deg);
    }
}

.shake {
    animation: shake 2s infinite ease-in-out;
    /* Slower (0.5s -> 2s) */
}

/* Violent Shake (Stage 2/3) */
@keyframes violent-shake {
    0% {
        transform: translate(0px, 0px) rotate(0deg);
    }

    10% {
        transform: translate(-10px, -10px) rotate(-5deg);
    }

    20% {
        transform: translate(10px, 10px) rotate(5deg);
    }

    30% {
        transform: translate(-10px, 10px) rotate(-5deg);
    }

    40% {
        transform: translate(10px, -10px) rotate(5deg);
    }

    50% {
        transform: translate(5px, 5px) rotate(0deg);
        filter: invert(0.5);
    }

    60% {
        transform: translate(-5px, -5px) rotate(0deg);
    }

    70% {
        transform: translate(10px, 10px) rotate(5deg);
    }

    80% {
        transform: translate(-10px, -10px) rotate(-5deg);
    }

    90% {
        transform: translate(5px, 0px) rotate(0deg);
    }

    100% {
        transform: translate(0px, 0px) rotate(0deg);
    }
}

.shake-violent {
    animation: violent-shake 0.4s infinite;
}

/* Blood Effects (CSS Generated) */
.blood-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5000;
    opacity: 0;
    transition: opacity 0.5s;
}

/* Splatter 1: Moderate */
.blood-1 {
    background:
        radial-gradient(circle at 20% 30%, rgba(150, 0, 0, 0.8) 0%, transparent 20%),
        radial-gradient(circle at 80% 60%, rgba(130, 0, 0, 0.6) 0%, transparent 15%);
    mix-blend-mode: multiply;
}

/* Splatter 2: Intense */
.blood-2 {
    background:
        radial-gradient(circle at 20% 30%, rgba(150, 0, 0, 0.9) 0%, transparent 30%),
        radial-gradient(circle at 80% 60%, rgba(130, 0, 0, 0.8) 0%, transparent 25%),
        radial-gradient(circle at 50% 50%, rgba(100, 0, 0, 0.5) 0%, transparent 60%);
    mix-blend-mode: multiply;
}

/* Splatter 3: Vision obscuring */
.blood-3 {
    background:
        radial-gradient(ellipse at center, transparent 30%, rgba(100, 0, 0, 0.9) 100%),
        linear-gradient(rgba(255, 0, 0, 0.2), rgba(0, 0, 0, 0.5));
}

.blood-active {
    opacity: 1;
}

/* Red Flash */
.red-flash {
    animation: redFlash 0.1s;
}

@keyframes redFlash {
    0% {
        background-color: rgba(255, 0, 0, 0.8);
    }

    100% {
        background-color: transparent;
    }
}

/* Footer Links */
footer.global-footer {
    margin-top: 50px;
    text-align: center;
    padding-bottom: 30px;
    font-size: 0.8rem;
}

footer.global-footer a {
    color: #888;
    text-decoration: none;
    margin: 0 10px;
}

footer.global-footer a:hover {
    color: #fff;
}

/* Custom Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s;
}

.modal-box {
    background: #111;
    border: 2px solid #800;
    padding: 30px;
    max-width: 80%;
    text-align: center;
    box-shadow: 0 0 30px #500;
    position: relative;
}

.modal-text {
    font-size: 1.2rem;
    margin-bottom: 30px;
    color: #fff;
    text-shadow: 0 0 5px #f00;
}

.modal-actions {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.modal-btn {
    background: transparent;
    border: 1px solid #666;
    color: #ccc;
    padding: 10px 20px;
    font-family: 'Yuji Syuku', serif;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-btn:hover {
    background: #333;
    color: #fff;
    border-color: #fff;
}

.modal-btn.primary {
    border-color: #a00;
    color: #fcc;
}

.modal-btn.primary:hover {
    background: #300;
    color: #f00;
    box-shadow: 0 0 10px #f00;
}

/* Forest Overhaul */
.forest-block {
    position: relative;
    width: 100%;
    min-height: 80vh;
    /* 1 block per fetch roughly */
    border-bottom: 1px dashed #333;
}

.hitodama {
    position: absolute;
    /* Randomly placed */
    width: 60px;
    height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: transform 0.3s;
    /* Remove default margin/width from previous list style */
    margin: 0;
    padding: 0;
    max-width: none;
    border-bottom: none;
}

.hitodama .fire-soul {
    margin: 0;
    /* Reset */
    width: 100%;
    height: 100%;
    box-shadow: 0 0 15px #00f, inset 0 0 10px #aaf;
}

/* Burst Animation */
@keyframes burst-out {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.5);
        opacity: 0.8;
    }

    100% {
        transform: scale(2);
        opacity: 0;
    }
}

.bursting {
    animation: burst-out 0.3s forwards;
}

/* Blood Hint (Text) */
.blood-hint {
    position: absolute;
    /* Randomly placed anchor */
    color: #c00;
    font-size: 1rem;
    font-weight: bold;
    text-shadow: 0 0 5px #000;
    white-space: nowrap;
    opacity: 0;
    animation: bleed-in 1s forwards;
    pointer-events: auto;
    /* Allow clicking link */
    z-index: 10;
    background: rgba(0, 0, 0, 0.7);
    padding: 10px;
    border: 1px solid #500;
    border-radius: 5px;
    /* Centered on spawn point */
    transform: translate(-50%, -50%);
}

.blood-hint a {
    color: #fcc;
    text-decoration: underline;
    display: block;
    margin-top: 5px;
    font-size: 0.8rem;
}

@keyframes bleed-in {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }

    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}