@import url('https://fonts.googleapis.com/css2?family=Galmuri11&display=swap');

:root {
    --color-bg: #FDF6E3; 
    --color-device-shell: #FFD1DC; 
    --color-device-bezel: #FF9EAF; 
    --color-lcd-bg: #E0F2F1; 
    --color-pixel-text: #334155; 
    
    --color-btn-pink: #FFB6C1;
    --color-btn-pink-shadow: #DB8A98;
    --color-btn-blue: #B3E5FC;
    --color-btn-blue-shadow: #81D4FA;
    --color-btn-yellow: #FFF9C4;
    --color-btn-yellow-shadow: #FBC02D;
    --color-btn-green: #C8E6C9;
    --color-btn-green-shadow: #A5D6A7;
    --color-btn-purple: #E1BEE7;
    --color-btn-purple-shadow: #CE93D8;
}

body {
    font-family: 'Galmuri11', 'Courier New', Courier, monospace;
    background-color: var(--color-bg);
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    color: var(--color-pixel-text);
    height: 100svh;
    width: 100vw;
    margin: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

img {
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
    user-select: none;
    -webkit-user-select: none;
}

.main-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transform-origin: center center;
    transition: transform 0.1s ease-out;
}

.view-base {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.flex-center-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.panel-box {
    background-color: rgba(255, 255, 255, 0.8);
    border-top: 4px solid var(--color-pixel-text);
    box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
}

.modal-box {
    background-color: #ffffff;
    border: 4px solid var(--color-pixel-text);
    border-radius: 1.5rem;
    padding: 1.25rem;
    width: 100%;
    max-width: 95%;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
}

.stat-row {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.stat-label {
    font-weight: bold;
    color: #475569;
}

.tamagotchi-device {
    background: linear-gradient(135deg, #FFE4E9 0%, var(--color-device-shell) 100%);
    border: 12px solid var(--color-device-bezel);
    border-radius: 95px 95px 110px 110px; 
    box-shadow: 
        inset 10px 10px 20px rgba(255, 255, 255, 0.7), 
        inset -10px -10px 20px rgba(219, 138, 152, 0.4),
        15px 15px 35px rgba(0,0,0,0.15);
    position: relative;
    width: 420px;
    height: 560px;
    padding: 28px 18px 48px 18px; 
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.keychain {
    position: absolute;
    top: -45px;
    left: 50%;
    transform: translateX(-50%);
    width: 48px;
    height: 48px;
    border: 8px solid #D1D5DB;
    border-radius: 50%;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.15), inset 2px 2px 5px rgba(255,255,255,0.8);
    z-index: -1;
}

.device-header {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
}
.header-dot {
    width: 7px;
    height: 7px;
    background-color: var(--color-device-bezel);
    border-radius: 50%;
    box-shadow: inset 1px 1px 3px rgba(0,0,0,0.2);
}

.hardware-buttons {
    position: absolute;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 20px;
}
.hw-btn {
    width: 26px;
    height: 26px;
    background-color: var(--color-btn-blue);
    border-radius: 50%;
    border: 3px solid var(--color-btn-blue-shadow);
    box-shadow: 2px 2px 4px rgba(0,0,0,0.15), inset 2px 2px 5px rgba(255,255,255,0.9);
}

.lcd-screen {
    background-color: var(--color-lcd-bg);
    border: 7px solid #9CA3AF;
    border-radius: 40px;
    overflow: hidden;
    position: relative;
    flex: 1;
    box-shadow: inset 5px 5px 10px rgba(0,0,0,0.15);
    background-image: linear-gradient(rgba(0, 0, 0, 0.03) 1px, transparent 1px),
                        linear-gradient(90deg, rgba(0, 0, 0, 0.03) 1px, transparent 1px);
    background-size: 4px 4px;
}

.btn-round-bubble {
    color: var(--color-pixel-text);
    border: 3px solid var(--color-pixel-text);
    border-radius: 50px; 
    font-weight: bold;
    transition: all 0.1s ease;
    position: relative;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-shadow: 1px 1px 0 rgba(255,255,255,0.5);
}

.btn-round-bubble:active {
    top: 4px;
    box-shadow: 0 0px 0 0 var(--color-pixel-text) !important;
}

.btn-round-bubble:hover .stat-effect-plus {
    font-weight: 800 !important;
    color: #0f172a !important;
    opacity: 1 !important;
}

.btn-pink { background-color: var(--color-btn-pink); box-shadow: 0 5px 0 0 var(--color-btn-pink-shadow); }
.btn-blue { background-color: var(--color-btn-blue); box-shadow: 0 5px 0 0 var(--color-btn-blue-shadow); }
.btn-yellow { background-color: var(--color-btn-yellow); box-shadow: 0 5px 0 0 var(--color-btn-yellow-shadow); }
.btn-green { background-color: var(--color-btn-green); box-shadow: 0 5px 0 0 var(--color-btn-green-shadow); }
.btn-purple { background-color: var(--color-btn-purple); box-shadow: 0 5px 0 0 var(--color-btn-purple-shadow); }

.stat-bar-container {
    background-color: rgba(255,255,255,0.6);
    border: 2px solid var(--color-pixel-text);
    border-radius: 10px;
    height: 14px;
    overflow: hidden;
    position: relative;
}

.stat-bar {
    height: 100%;
    transition: width 0.3s ease-in-out;
    border-radius: 6px;
    background-image: linear-gradient(90deg, rgba(255,255,255,0.3) 50%, transparent 50%);
    background-size: 8px 100%;
}

.text-pixel-sm { font-size: 11px; }
.text-pixel-md { font-size: 13px; }
.text-pixel-lg { font-size: 15px; }

.fade-in { animation: fadeIn 0.4s ease-in forwards; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

.animate-bounce-slow { animation: bounceSlow 2.5s infinite; }
@keyframes bounceSlow { 0%, 100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-8px) scale(1.05); } }

.speech-bubble {
    position: relative;
    background: #ffffff;
    border: 3px solid var(--color-pixel-text);
    border-radius: 15px;
    box-shadow: 3px 3px 0 0 rgba(0,0,0,0.1);
}
.speech-bubble:after {
    content: ''; position: absolute; bottom: 0; left: 50%; width: 0; height: 0;
    border: 10px solid transparent; border-top-color: #ffffff; border-bottom: 0;
    margin-left: -10px; margin-bottom: -9px;
}
#dream-desc-text { white-space: pre-line; }

.speech-bubble:before {
    content: ''; position: absolute; bottom: 0; left: 50%; width: 0; height: 0;
    border: 13px solid transparent; border-top-color: var(--color-pixel-text); border-bottom: 0;
    margin-left: -13px; margin-bottom: -13px;
}

.dream-test-full { position:absolute; inset:0; z-index:46; background:#fff; display:flex; flex-direction:column; align-items:center; justify-content:center; padding:16px; }
.dream-test-dialogue { width:100%; max-width:92%; background:rgba(255,255,255,.9); border:2px solid #64748b; border-radius:14px; padding:12px 14px; margin:5px 0; text-align:center; font-weight:700; }
.dream-test-dialogue.result { min-height:180px; display:flex; flex-direction:column; justify-content:center; }

#character-img {
    touch-action: none;
    cursor: pointer;
}

.stat-bounce {
    animation: statBounce 0.5s ease;
    color: #EAB308 !important;
}

@keyframes statBounce {
    0% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-5px) scale(1.1); }
    100% { transform: translateY(0) scale(1); }
}