:root {
    --primary-color: #00f2ff; /* シアン系 */
    --secondary-color: #0066ff;
    --bg-dark: #0a0e14;
    --text-white: #ffffff;
    --accent-red: #ff3b3b;
    --font-digital: 'Orbitron', sans-serif;
    --font-main: 'Noto Sans JP', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-white);
    font-family: var(--font-main);
    overflow: hidden; /* スクロール防止 */
    width: 100vw;
    height: 100vh;
}

#app-container {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 500px; /* PC閲覧時の幅制限 */
    margin: 0 auto;
    background-color: #000;
}

/* --- Screen Transitions --- */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    z-index: 10;
}

.screen.active {
    display: flex;
}

/* --- Start Screen --- */
#start-screen {
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at center, #1a2a3a 0%, #000 100%);
    z-index: 100;
}

.start-content {
    text-align: center;
}

.title {
    font-size: 1.2rem;
    letter-spacing: 0.3em;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.serial {
    font-weight: bold;
}

.subtitle {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 3rem;
    letter-spacing: 0.1em;
    background: linear-gradient(to bottom, #fff, #999);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.btn-main {
    padding: 1.2rem 4rem;
    font-size: 1.5rem;
    font-family: var(--font-digital);
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 0 20px rgba(0, 242, 255, 0.3);
    transition: all 0.3s ease;
    position: relative;
    z-index: 2;
}

.btn-main:active {
    background: var(--primary-color);
    color: #000;
}

.start-decoration {
    position: relative;
    margin-bottom: 2rem;
}

.pulse-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    border: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: pulse 2s infinite;
    z-index: 1;
}

@keyframes pulse {
    0% { width: 100px; height: 100px; opacity: 0.8; }
    100% { width: 250px; height: 250px; opacity: 0; }
}

.start-note {
    font-size: 0.8rem;
    color: #666;
}

/* --- MISSION Overlay --- */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 200;
}

.overlay.active {
    display: flex;
}

.mission-text {
    text-align: center;
    border: 1px solid var(--primary-color);
    padding: 2rem;
    background: rgba(0, 242, 255, 0.05);
}

.mission-label {
    font-family: var(--font-digital);
    font-size: 1rem;
    color: var(--primary-color);
    letter-spacing: 0.5em;
    margin-bottom: 1rem;
}

.mission-content {
    font-size: 1.2rem;
    font-weight: bold;
}

/* --- Game Screen --- */
#game-screen {
    padding-bottom: 20px;
}

.problem-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    background: #000;
    position: relative;
}

.image-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

#problem-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* デジタル数字オーバーレイ */
.digital-counter {
    position: absolute;
    font-family: var(--font-digital);
    color: #d48806; /* 彩度を少し落としたオレンジ */
    font-weight: 700;
    line-height: 1;
    pointer-events: none;
    /* デジタル数字風のフォント設定 */
    letter-spacing: -0.05em;
    transform: translate(-50%, -50%);
}

#counter-1 {
    font-size: 36px; /* 初期。JSでスケーリング調整 */
}

#counter-2 {
    font-size: 36px;
}

/* --- Controls --- */
.controls {
    padding: 1.5rem;
    background: #111;
    border-top: 1px solid #333;
}

.input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

#answer-input {
    flex: 1;
    background: #222;
    border: 1px solid #444;
    color: #fff;
    padding: 0.8rem;
    border-radius: 5px;
    font-size: 1rem;
}

#answer-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn-submit {
    background: var(--primary-color);
    color: #000;
    border: none;
    padding: 0 1.5rem;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
}

.hint-group {
    display: flex;
    gap: 10px;
}

.btn-hint {
    flex: 1;
    background: transparent;
    border: 1px solid #555;
    color: #999;
    padding: 0.5rem 0.2rem;
    border-radius: 5px;
    font-size: 0.8rem;
    cursor: pointer;
}

/* --- Modal/Popup --- */
.hint-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 300;
}

.hint-modal-content {
    background: #1a1a1a;
    padding: 2rem;
    border-radius: 10px;
    width: 80%;
    max-width: 400px;
    text-align: center;
    border: 1px solid #333;
}

.hint-modal-content h3 {
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.hint-modal-content p {
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.btn-close {
    background: #444;
    color: #fff;
    border: none;
    padding: 0.5rem 2rem;
    border-radius: 5px;
    cursor: pointer;
}

.clear-content {
    text-align: center;
    animation: clearPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes clearPop {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.clear-title {
    font-size: 4rem;
    font-family: var(--font-digital);
    color: var(--primary-color);
    text-shadow: 0 0 20px var(--primary-color);
    margin-bottom: 1rem;
}

.clear-actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 2rem;
}

.btn-share {
    background: #fff;
    color: #000;
    border: none;
    padding: 1rem;
    border-radius: 50px;
    font-weight: bold;
    font-size: 1.1rem;
}

.btn-follow {
    background: transparent;
    border: 1px solid #fff;
    color: #fff;
    padding: 0.8rem;
    border-radius: 50px;
}

/* Popup */
.popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: #333;
    color: #fff;
    padding: 1.5rem;
    border-radius: 10px;
    display: none;
    z-index: 400;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    transition: all 0.2s;
}

.popup.active {
    display: block;
    transform: translate(-50%, -50%) scale(1);
}

#popup-close {
    margin-top: 1rem;
    background: var(--primary-color);
    border: none;
    padding: 0.5rem 1.5rem;
    border-radius: 5px;
    font-weight: bold;
}

/* Confetti */
#confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 500;
}

/* Shake Animation for input */
.shake {
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-10px); }
    40%, 80% { transform: translateX(10px); }
}
