:root {
    --bg-color: #fff9f0; /* 温かみのあるオフホワイト */
    --main-color: #e67e22; /* オレンジ（火、卵をイメージ） */
    --accent-red: #d35400; /* 濃いオレンジ・赤 */
    --accent-gold: #f39c12; /* 黄色 */
    --text-dark: #5d4037; /* こげ茶 */
    --text-light: #ffffff;
    --transition-speed: 0.5s;
    --font-main: 'Shippori Mincho', serif;
}

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

body {
    font-family: var(--font-main);
    background-color: #ffe0b2;
    color: var(--text-dark);
    line-height: 1.6;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

#app {
    position: relative;
    height: 100%;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    background-color: var(--bg-color);
    box-shadow: 0 0 30px rgba(0,0,0,0.15);
}

/* 画面共通設定 */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-speed);
    padding: 20px;
}

.screen.active {
    opacity: 1;
    pointer-events: auto;
}

/* スタート画面 */
#start-screen {
    background: radial-gradient(circle at center, var(--bg-color) 0%, #ffe0b2 100%);
    text-align: center;
}

.title {
    font-size: 2.8rem;
    color: var(--main-color);
    margin-bottom: 0.5rem;
    font-weight: 700;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.05);
}

.serial {
    font-size: 1.6rem;
    vertical-align: super;
    margin-left: 5px;
}

.subtitle {
    font-size: 1.4rem;
    margin-bottom: 3rem;
    letter-spacing: 0.3rem;
    color: var(--text-dark);
}

.start-decoration {
    margin-bottom: 3rem;
    font-size: 4rem;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* ボタン類 */
.btn-primary, .btn-action, .btn-share {
    font-family: var(--font-main);
    background-color: var(--main-color);
    color: var(--text-light);
    border: none;
    padding: 14px 45px;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: 50px;
    cursor: pointer;
    transition: transform 0.2s, background-color 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 15px rgba(230, 126, 34, 0.3);
}

.btn-primary:active, .btn-action:active {
    transform: translateY(2px);
    box-shadow: 0 2px 5px rgba(230, 126, 34, 0.3);
}

.guide-text {
    margin-top: 2rem;
    font-size: 0.85rem;
    color: #a1887f;
}

/* MISSION演出 */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(93, 64, 55, 0.98);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s;
}

.overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.mission-box {
    text-align: center;
    color: var(--text-light);
    padding: 50px 30px;
    border: 1px solid var(--accent-gold);
    background: rgba(255, 255, 255, 0.05);
    position: relative;
    width: 85%;
    max-width: 320px;
    border-radius: 8px;
}

.mission-label {
    color: var(--accent-gold);
    font-size: 0.9rem;
    letter-spacing: 0.6rem;
    margin-bottom: 1.5rem;
    font-weight: 700;
}

.mission-text {
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.5;
}

/* ゲーム画面 */
#game-screen {
    padding: 0;
}

.game-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 10px 0;
}

.problem-container {
    position: relative;
    width: 100%;
    max-width: 500px;
    max-height: 58vh;
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

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

#problem-image {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    transition: opacity 0.3s ease;
}

/* 入力エリア */
.input-area {
    width: 90%;
    max-width: 320px;
    display: flex;
    gap: 10px;
    margin-bottom: 0.8rem;
}

#answer-input {
    flex: 1;
    min-width: 0;
    padding: 12px 15px;
    border: 2px solid #e0d9cc;
    border-radius: 8px;
    font-family: var(--font-main);
    font-size: 1.1rem;
    outline: none;
    transition: border-color 0.3s;
    background-color: rgba(255, 255, 255, 0.9);
}

#answer-input:focus {
    border-color: var(--main-color);
}

.btn-action {
    padding: 12px 20px;
    white-space: nowrap;
    box-shadow: none;
    border-radius: 8px;
}

.hint-text-label {
    font-size: 0.9rem;
    color: #9e9a94;
    margin-bottom: 25px;
}

/* ヒント機能 */
.hint-container {
    width: 95%;
    max-width: 400px;
    text-align: center;
}

.hint-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 12px;
}

.btn-hint {
    background: #fff;
    border: 1px solid #dcd7cd;
    color: #7e7a74;
    padding: 8px 16px;
    font-size: 0.8rem;
    border-radius: 20px;
    cursor: pointer;
    font-family: var(--font-main);
    transition: all 0.3s;
}

.btn-hint:hover {
    background: #fff3e0;
    color: var(--main-color);
    border-color: var(--main-color);
}

.hint-box-inline {
    margin-top: 15px;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    border-left: 5px solid var(--main-color);
    font-size: 0.95rem;
    text-align: left;
    display: none;
    animation: fadeIn 0.5s forwards;
    line-height: 1.6;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    word-break: break-all;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* エラー時のシェイク */
.shake {
    animation: horizontalShake 0.4s;
}

@keyframes horizontalShake {
    0% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    50% { transform: translateX(5px); }
    75% { transform: translateX(-5px); }
    100% { transform: translateX(0); }
}

/* クリアモーダル */
.modal-content {
    background-color: var(--bg-color);
    padding: 45px 25px;
    border-radius: 15px;
    text-align: center;
    width: 88%;
    max-width: 340px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.2);
    border: 2px solid var(--accent-gold);
    position: relative;
}

.clear-badge {
    color: var(--accent-red);
    font-weight: 700;
    font-size: 1.3rem;
    margin-bottom: 1.2rem;
    letter-spacing: 0.2rem;
}

.clear-title {
    font-size: 2.2rem;
    margin-bottom: 1.2rem;
    color: var(--text-dark);
}

.clear-message {
    margin-bottom: 2.5rem;
    font-size: 1rem;
    color: #6e6a64;
}

.btn-share {
    width: 100%;
    background-color: #000;
    box-shadow: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border-radius: 8px;
    padding: 12px;
}

.x-icon {
    width: 18px;
    fill: white;
}

.btn-follow {
    width: 100%;
    background-color: transparent;
    color: #1d9bf0;
    border: 1px solid #1d9bf0;
    padding: 12px;
    font-size: 0.9rem;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 12px;
    font-family: var(--font-main);
    transition: background-color 0.2s;
}

.btn-follow:hover {
    background-color: rgba(29, 155, 240, 0.05);
}

.btn-secondary {
    background: none;
    border: none;
    color: #aaa;
    margin-top: 25px;
    cursor: pointer;
    text-decoration: underline;
    font-family: var(--font-main);
    font-size: 0.85rem;
}

/* カスタムポップアップ */
.popup-content {
    background-color: var(--bg-color);
    padding: 35px 25px;
    border-radius: 12px;
    text-align: center;
    width: 82%;
    max-width: 300px;
    border: 1px solid var(--accent-red);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

#popup-message {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 25px;
    color: var(--text-dark);
}

.popup-content .btn-action {
    background-color: var(--accent-red);
    padding: 10px 30px;
}

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

/* 虹演出（未使用だが維持） */
#rainbow-container {
    display: none;
}

/* レスポンシブ調整 */
@media screen and (max-height: 650px) {
    .title { font-size: 2.2rem; }
    .subtitle { margin-bottom: 1.5rem; font-size: 1.1rem; }
    .start-decoration { margin-bottom: 1.5rem; font-size: 3rem; }
    .problem-container { margin-bottom: 15px; }
    .hint-text-label { margin-bottom: 10px; }
}
