@font-face {
    font-family: 'MulmaruMono';
    font-weight: 500;
    font-display: swap;
    src: local('MulmaruMono Thin'), url(../font/MulmaruMono/MulmaruMono.woff2) format('woff2');
}

:root {
    --pixel-border: 8px;
    --bg-color: #E3F6F0;
    --panel-bg: #ffffff;
    --pixel-theme: #419F8F;
    --pixel-theme-light: #48d1bc;
    --pixel-theme-dark: #136b5f;
    --pixel-neg: #ff5277;
    --pixel-accent: #ffb800;
    --pixel-safe: #528FFF;
    --pixel-warning: #62C5B0;
    --pixel-danger: #FFA033;
    --pixel-overload: #FF5255;
    --pixel-stone: #94a3b8;
    --text-main: #2c3e50;
    --timer-color: #419F8F;
}

body {
    font-family: 'MulmaruMono', monospace;
    font-size: 18px;
    background-color: var(--bg-color);
    color: var(--text-main);
    overflow: hidden;
    touch-action: none;
    image-rendering: pixelated;
    background-color: var(--bg-color);
    background-size: 40px 40px;
}

#game-container {
    height: calc(100vh - 220px);
    position: relative;
    overflow: visible;
    background: var(--panel-bg);
    border: var(--pixel-border) solid var(--pixel-theme);
    margin: 10px;
    box-shadow: 0 10px 30px rgba(31, 167, 149, 0.15);
    border-radius: 25.6px;
    margin: 0 60px;
}

#word-layer {
    position: absolute;
    inset: 0;
    overflow: hidden;
    border-radius: inherit;
    z-index: 140;
}

#effect-layer {
    position: absolute;
    inset: 0;
    overflow: visible;
    z-index: 141;
    pointer-events: none;
}

#pixel-character {
    position: absolute;
    bottom: -46px;
    left: 50%;
    transform: translateX(-50%);
    width: 400px;
    height: 400px;
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
    image-rendering: pixelated;
    z-index: 140;
    pointer-events: none;
    transform-origin: center bottom;
}

.char-safe {
    background-image: url('../image/effect/status_safe_moni.svg');
}

.char-warning {
    background-image: url('../image/effect/status_warning_moni.svg');
}

.char-danger {
    background-image: url('../image/effect/status_danger_moni.svg');
    animation: char-state-shake 0.5s infinite;
}

.char-overload {
    background-image: url('../image/effect/status_overload_moni.svg');
    animation: char-state-shake 0.5s infinite;
}

.char-event-positive {
    background-image: url('../image/effect/status_safe_moni.svg');
}

.char-event-vitabridge {
    background-image: url('../image/effect/vitabridge_effect_moni.svg');
}

.char-event-vacation {
    background-image: url('../image/effect/vacation_effect_moni.svg');
}

.char-hit {
    animation: char-hit 0.1s steps(20) both;
}

.word-effect-sprite {
    position: absolute;
    width: 180px;
    height: auto;
    transform: translate(-50%, -50%);
    animation: effect-float-out 0.95s ease-out forwards;
    filter: drop-shadow(0 4px 0 rgba(0, 0, 0, 0.2));
}

.word-node {
    position: absolute;
    cursor: pointer;
    user-select: none;
    padding: 25px 50px;
    min-height: 73px;
    font-size: 46.4px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.03em;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border: 8px solid #111111;
    border-radius: 0;
    clip-path: polygon(0 8px,
            4px 8px,
            4px 4px,
            8px 4px,
            8px 0,
            calc(100% - 8px) 0,
            calc(100% - 8px) 4px,
            calc(100% - 4px) 4px,
            calc(100% - 4px) 8px,
            100% 8px,
            100% calc(100% - 8px),
            calc(100% - 4px) calc(100% - 8px),
            calc(100% - 4px) calc(100% - 4px),
            calc(100% - 8px) calc(100% - 4px),
            calc(100% - 8px) 100%,
            8px 100%,
            8px calc(100% - 4px),
            4px calc(100% - 4px),
            4px calc(100% - 8px),
            0 calc(100% - 8px));
    box-shadow: inset 0 0 0 8px #2470ff, 0 0 0 8px #d9f3ff, 3px 3px 0 rgba(51, 65, 85, 0.35);
    color: #111111;
    transition: opacity 0.1s;
}

.style-negative {
    background: #ffd6e5;
    border-color: #111111;
    box-shadow: inset 0 0 0 8px #ff5a4f, 0 0 0 8px #ffd6e5, 3px 3px 0 rgba(51, 65, 85, 0.35);
}

.style-positive {
    background: #d9f3ff;
    border-color: #111111;
    box-shadow: inset 0 0 0 8px #2470ff, 0 0 0 8px #d9f3ff, 3px 3px 0 rgba(51, 65, 85, 0.35);
}

.style-deceptive-neg {
    background: #d9f3ff;
    border-color: #111111;
    box-shadow: inset 0 0 0 8px #2470ff, 0 0 0 8px #d9f3ff, 3px 3px 0 rgba(51, 65, 85, 0.35);
}

.style-deceptive-pos {
    background: #ffd6e5;
    border-color: #111111;
    box-shadow: inset 0 0 0 8px #ff5a4f, 0 0 0 8px #ffd6e5, 3px 3px 0 rgba(51, 65, 85, 0.35);
}

.style-stone {
    background: var(--pixel-stone);
    border-color: #e2e8f0;
    color: #334155;
    box-shadow: 6px 6px 0px #475569;
}

/* 균열 효과 */
.cracked::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M0 5l5 5h5l5-5M10 0l2 10-2 10" stroke="rgba(0,0,0,0.3)" stroke-width="1" fill="none"/></svg>');
    pointer-events: none;
}

.pixel-shatter {
    position: absolute;
    width: 8px;
    height: 8px;
    pointer-events: none;
    z-index: 100;
}

.pixel-btn {
    image-rendering: pixelated;
    border: var(--pixel-border) solid var(--pixel-theme-light);
    background: var(--pixel-theme);
    color: white;
    box-shadow: 6px 6px 0px var(--pixel-theme-dark);
    transition: all 0.1s;
}

.pixel-btn:active {
    transform: translate(4px, 4px);
    box-shadow: 2px 2px 0px var(--pixel-theme-dark);
}

.pixel-btn.inactive {
    filter: grayscale(1);
    opacity: 0.7;
    pointer-events: none;
}

.score-popup {
    position: absolute;
    font-size: 14px;
    font-weight: bold;
    pointer-events: none;
    animation: pixelJump 0.6s steps(8) forwards;
    z-index: 100;
}

@keyframes pixelJump {
    0% {
        transform: translateY(0);
        opacity: 1;
    }

    100% {
        transform: translateY(-80px);
        opacity: 0;
    }
}

@keyframes char-hit {
    0% {
        transform: translateX(-50%) translate(20px, 0);
    }

    50% {
        transform: translateX(-50%) translate(-20px, 0);
    }

    100% {
        transform: translateX(-50%) translate(0, 0);
    }
}

@keyframes char-state-shake {
    0% {
        transform: translateX(-50%) translate(4px, 0);
    }

    50% {
        transform: translateX(-50%) translate(-4px, 0);
    }

    100% {
        transform: translateX(-50%) translate(0, 0);
    }
}

@keyframes effect-float-out {
    0% {
        opacity: 0;
        transform: translate(-50%, -35%) scale(0.85);
    }

    20% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -115%) scale(1.08);
    }
}

.pixel-gauge-bg {
    background: #fff;
    border: var(--pixel-border) solid var(--pixel-theme);
    position: relative;
    height: 80px;
    border-radius: 25.6px;
}

.pixel-gauge-fill {
    height: 100%;
    transition: width 0.2s linear;
    background: var(--pixel-theme);
    border: 8px solid #fff;
    border-radius: 25.6px;
}

.pixel-gauge-fill.safe {
    background: var(--pixel-safe);
}
.pixel-gauge-fill.warning {
    background: var(--pixel-warning);
}
.pixel-gauge-fill.danger {
    background: var(--pixel-danger);
}
.pixel-gauge-fill.overload {
    background: var(--pixel-overload);
}

textarea {
    font-family: sans-serif;
    font-size: 14px;
}

/* 기믹 애니메이션 */
.rotating {
    animation: pixel-rotate 2s infinite linear;
}

@keyframes pixel-rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.pulsing {
    animation: pixel-pulse 1.5s infinite ease-in-out;
}

@keyframes pixel-pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.3);
    }
}
.header-section {
    margin-top: 72px;
    margin-bottom: 40.4px;
}
.timer-container {
    display: flex;
    justify-content: flex-end;
    margin: 0 60px;
    margin-top: 48.8px;
}
.timer, #timer-display {
    font-family: 'Press Start 2P', cursive;
    font-weight: 400;
    font-size: 44.8px;
    line-height: 100%;
    letter-spacing: 0%;
}
.status_gauge {
    margin: 40px 60px 80px 60px;
}
.gauge-label {
    font-weight: 500;
    font-size: 52.8px;
    line-height: 100%;
    letter-spacing: 0%;

}

.effect-layer-active {
    display: block;
}

.word-effect-dim {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.62);
    z-index: 58;
}

.word-effect-center-banner {
    position: absolute;
    left: 50%;
    top: 54%;
    width: 75%;
    max-width: 795px;
    transform: translate(-50%, -50%);
    z-index: 59;
    animation: effect-banner-pop 0.2s ease-out;
}

.word-effect-side {
    position: absolute;
    bottom: 16%;
    width: 86px;
    z-index: 59;
    animation: sparkle-pop 0.25s ease-out;
}

.word-effect-side.left {
    left: 24%;
}

.word-effect-side.right {
    right: 24%;
}

.word-effect-side.blue {
    filter: hue-rotate(8deg) saturate(1.05);
}

.word-effect-side.salary {
    --salary-center-gap: clamp(120px, 18vw, 230px);
    bottom: 15%;
    width: calc(50% - var(--salary-center-gap));
    min-width: 110px;
    max-width: none;
    height: auto;
    animation: salary-strip-pop 0.22s ease-out;
    filter: drop-shadow(0 6px 0 rgba(20, 64, 55, 0.2));
}

.word-effect-side.left.salary {
    left: 0;
}

.word-effect-side.right.salary {
    right: 0;
}

.word-effect-salary-strip {
    position: absolute;
    left: 50%;
    bottom: 18%;
    width: 88%;
    max-width: 600px;
    transform: translateX(-50%);
    z-index: 59;
    animation: salary-strip-pop 0.2s ease-out;
}

@keyframes effect-banner-pop {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.92);
    }

    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes sparkle-pop {
    0% {
        opacity: 0;
        transform: scale(0.9);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes salary-strip-pop {
    0% {
        opacity: 0;
        transform: translateX(-50%) scale(0.94);
    }

    100% {
        opacity: 1;
        transform: translateX(-50%) scale(1);
    }
}

.result-game-dim {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(106, 156, 255, 0.9) 0%, rgba(78, 106, 158, 0.78) 55%, rgba(35, 38, 45, 0.88) 100%);
    border-radius: 17.6px;
}

#result-screen {
    padding-top: 40px;
}

#result-screen[data-result-stage='safe'] .result-game-dim {
    background: linear-gradient(180deg, rgba(106, 156, 255, 0.9) 0%, rgba(78, 106, 158, 0.78) 55%, rgba(35, 38, 45, 0.88) 100%);
}

#result-screen[data-result-stage='warning'] .result-game-dim {
    background: linear-gradient(180deg, rgba(117, 206, 189, 0.9) 0%, rgba(96, 154, 145, 0.78) 55%, rgba(35, 40, 44, 0.88) 100%);
}

#result-screen[data-result-stage='danger'] .result-game-dim {
    background: linear-gradient(180deg, rgba(255, 170, 71, 0.9) 0%, rgba(171, 122, 67, 0.78) 55%, rgba(39, 42, 46, 0.9) 100%);
}

#result-screen[data-result-stage='overload'] .result-game-dim {
    background: linear-gradient(180deg, rgba(255, 101, 112, 0.9) 0%, rgba(170, 85, 97, 0.78) 55%, rgba(40, 41, 47, 0.9) 100%);
}

.result-panel {
    position: relative;
    z-index: 1;
    width: min(96.17%, 1000px);
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.result-chip {
    width: min(66%, 305px);
    height: auto;
    margin-bottom: 120px;
    image-rendering: pixelated;
}

.result-status-image {
    width: min(84.5%, 651px);
    height: auto;
    image-rendering: pixelated;
    filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.28));
    margin-bottom: 60px;
}
.result-message {
    font-weight: 500;
    font-size: 46.4px;
    line-height: 150%;
    letter-spacing: 0%;
    text-align: center;
    color: #fff;
}
.ready-screen-panel {
    position: relative;
    display: inline-block;
}

.ready-screen-panel > img {
    display: block;
    width: auto;
    height: auto;
    image-rendering: pixelated;
}

.start-button {
    position: absolute;
    left: 50%;
    bottom: 14.5%;
    padding: 0;
    border: 0;
    background: transparent;
    transform: translateX(-50%);
    cursor: pointer;
    image-rendering: pixelated;
}

.start-button img {
    display: block;
    width: 100%;
    height: auto;
    image-rendering: pixelated;
}

.start-button:active {
    transform: translateX(-50%) translate(4px, 4px);
}

@media (max-width: 960px) {
    #result-screen {
        padding: 18px;
    }

    .result-chip {
        width: min(72%, 320px);
        margin-bottom: 10px;
    }

    .result-status-image {
        width: min(98%, 620px);
    }
}
