:root {
    --bg-color: #faf9f6; /* 아주 부드러운 미색 화이트 (책장 종이 느낌) */
    --mainbox-bg: #f3f1ec; /* 라이트 그레이 계열 */
    --text-main: #2b2b2b; /* 깔끔하고 짙은 차콜 모노톤 */
    --title-color: #3b3a39; 
    --btn-start-bg: #4a4947; 
    --btn-hover-bg: #2b2b2b;
    
    --font-family: "Apple SD Gothic Neo", "맑은 고딕", sans-serif;
    --border-radius-lg: 18px;
    --border-radius-sm: 10px;

    --frame-line-color: #d1cdc7; /* 미니멀한 라이트 그레이 라인 */
    --frame-border-width: 2px;
}

body {
    background-color: #f2f0ec;
    background-image: 
    radial-gradient(#e3e0da 1px, transparent 1px);
    background-size: 20px 20px;
    color: var(--text-main);
    font-family: var(--font-family);
    text-align: center;
    margin: 0;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.iphone-frame {
    position: relative;
    width: 393px;
    height: 852px;
    background-color: var(--bg-color);
    border: var(--frame-border-width) solid var(--frame-line-color);
    border-radius: 40px;
    padding: 8px;
    box-sizing: border-box;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
    zoom: 0.8;
}

.iphone-screen {
    position: relative;
    width: 100%;
    height: 100%;
    background-color: var(--bg-color);
    border-radius: 32px;
    overflow-y: auto;
    padding: 50px 20px 20px 20px;
    box-sizing: border-box;
}

.iphone-screen::-webkit-scrollbar {
    display: none;
}
.iphone-screen {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.dynamic-island {
    position: absolute;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 24px;
    background-color: #3b3a39;
    border-radius: 15px;
    z-index: 1000;
}

.color-red { color: #8d6e63; }
.font-size { font-size: 20px; }
.font-weight { font-weight: 600; }

.page {
    display: none;
}
.page.active {
    display: block;
    animation: fadeIn 0.4s ease-in-out;
}

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

.app-header-icon {
    font-size: 32px;
    margin-top: 5px;
    margin-bottom: -5px;
}

.mainbox {
    background: #ffffff;
    border: 1px solid #e1ded8;
    padding: 22px 16px;
    border-radius: var(--border-radius-lg);
    width: 100%;
    box-sizing: border-box;
    margin: 15px auto;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
}

.main-title {
    color: var(--title-color);
    font-size: 24px;
    margin: 5px 0 10px 0;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.welcome-badge {
    display: inline-block;
    background-color: #78716c; /* 모노톤 웜그레이 */
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 15px;
    letter-spacing: 1.5px;
    margin-bottom: 8px;
}

.sub-text {
    margin: 6px 0;
    font-size: 13px;
    color: #78716c;
}

.guide-text {
    margin: 12px 0 4px 0;
    font-size: 13.5px;
    font-weight: 500;
    color: #44403c;
    line-height: 1.5;
}

.rules-card {
    background: #ffffff;
    border-radius: var(--border-radius-sm);
    padding: 12px 15px;
    margin: 15px 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
    border: 1px solid #e7e5e4;
}

.rule-item {
    font-size: 12.5px;
    text-align: left;
    background: #fafaf9;
    padding: 8px 10px;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid #f5f5f4;
}

.score-plus { color: #292524; } 
.score-minus { color: #78716c; } 
.score-total { color: #57534e; } 

.btn {
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    cursor: pointer;
    font-family: var(--font-family);
    transition: all 0.2s ease;
}

.btn:active {
    transform: scale(0.97); 
    filter: brightness(0.92); 
}

.btn-start {
    background: var(--btn-start-bg);
    color: white;
    padding: 15px 30px;
    font-weight: 600;
    width: 100%;
    margin-top: 5px;
    font-size: 15px;
    box-shadow: 0 4px 12px rgba(41, 37, 36, 0.15);
    border-radius: var(--border-radius-sm);
}

.btn-start:hover {
    background: var(--btn-hover-bg);
}

.btn-group {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    width: 90%;
    margin: 20px auto 0 auto;
}

/* 감성적인 모노톤 & 웜그레이 액션 버튼들 */
.btn-action.check {
    background-color: #44403c;
    color: white;
}
.btn-action.check:hover { background-color: #292524; }

.btn-action.hint {
    background-color: #d6d3d1;
    color: #292524;
}
.btn-action.hint:hover { background-color: #a8a29e; }

.btn-action.pass {
    background-color: #e7e5e4;
    color: #44403c;
}
.btn-action.pass:hover { background-color: #d6d3d1; }

.btn-action.delete {
    background-color: #f5f5f4;
    color: #78716c;
}
.btn-action.delete:hover { background-color: #e7e5e4; }

.btn-action {
    border: none;
    padding: 13px 10px;
    border-radius: var(--border-radius-sm);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-family);
    transition: all 0.2s ease;
    width: 100%;
    box-sizing: border-box;
}

.btn-restart {
    background-color: #44403c;
    color: white;
    padding: 13px 24px;
    margin: 10px auto;
    width: 90%;
}
.btn-restart:hover { background-color: #292524; }

.btn-home { 
    background-color: #e7e5e4; 
    color: #292524;
    border: none;
    padding: 13px 10px;
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-family);
    transition: all 0.2s ease;
    width: 90%;
    box-sizing: border-box;
    margin: 5px auto 15px auto;
}
.btn-home:hover { background-color: #d6d3d1; }

.question-number {
    display: inline-block;
    background: #e7e5e4;
    color: #44403c;
    font-size: 12px;
    font-weight: 600;
    padding: 5px 14px;
    border-radius: 12px;
    margin-top: 15px;
    letter-spacing: 0.5px;
}

.question {
    background-color: #ffffff;
    border: 1px solid #e7e5e4;
    border-radius: var(--border-radius-lg);
    padding: 22px 18px;
    font-size: 16px;
    font-weight: 500;
    color: #1c1917;
    margin: 15px auto;
    width: 90%;
    box-sizing: border-box;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
    line-height: 1.7;
    min-height: 75px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.quiz-input {
    width: 90%;
    padding: 13px;
    font-size: 15px;
    border-radius: 10px;
    border: 1px solid #d6d3d1;
    box-sizing: border-box;
    text-align: center;
    outline: none;
    background-color: #ffffff;
    color: #1c1917;
    transition: all 0.3s ease;
}

.quiz-input:focus {
    border-color: #44403c;
    box-shadow: 0 0 6px rgba(68, 64, 60, 0.15);
}

.quiz-result {
    font-size: 16px;
    margin: 10px 0;
    font-weight: 600;
}

.quiz-hint {
    background-color: #f5f5f4;
    color: #57534e;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12.5px;
    width: 85%;
    margin: 8px auto;
    border: 1px solid #e7e5e4;
}

.quiz-hint:empty {
    display: none;
}

.result-box {
    margin-top: 25px;
}

.divider {
    color: #d6d3d1;
    letter-spacing: -1px;
}

.stat-card {
    background: #ffffff;
    border-radius: 14px;
    padding: 14px 18px;
    width: 88%;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.03);
    border: 1px solid #e7e5e4;
    margin: 0 auto 15px auto;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: #57534e;
    padding: 8px 0;
    border-bottom: 1px dashed #f5f5f4;
}

.stat-item:last-child {
    border-bottom: none; 
}

.stat-item strong {
    font-size: 1rem;
    font-weight: 600;
    color: #1c1917;
}

.final-score {
    font-size: 1.1rem;
    font-weight: 600;
    color: #292524;
    margin-top: 5px;
}

.final-score-num {
    color: #44403c;
    font-size: 1.4rem;
    font-weight: 700;
}

.title-card {
    background: #ffffff;
    border: 1px solid #e7e5e4;
    border-radius: 14px;
    padding: 16px;
    margin: 15px auto;
    width: 88%;
    box-sizing: border-box;
    text-align: center;
}

.title-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    color: #78716c;
    background: #f5f5f4;
    padding: 3px 10px;
    border-radius: 15px;
    margin-bottom: 8px;
    letter-spacing: 1px;
}

.user-title {
    font-size: 18px;
    font-weight: 700;
    margin: 4px 0 6px 0;
    color: #1c1917;
}

.user-title-desc {
    font-size: 12.5px;
    color: #78716c;
    margin: 0;
    line-height: 1.4;
}

.btn-back {
    background: none;
    border: none;
    font-size: 12px;
    font-weight: 600;
    color: #57534e;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 0;
    margin-bottom: 15px;
    font-family: var(--font-family);
    transition: opacity 0.2s ease;
}

.btn-back:hover {
    opacity: 0.6;
}

@media screen and (max-width: 768px) {
    body {
        background-color: var(--bg-color);
        display: block;
    }
    .iphone-frame {
        width: 100% !important;
        height: 100vh !important;
        border: none !important;
        border-radius: 0 !important;
        padding: 0 !important;
        box-shadow: none !important;
    }
    .iphone-screen {
        width: 100% !important;
        height: 100% !important;
        border-radius: 0 !important;
        padding: 20px 16px !important;
    }
    .dynamic-island {
        display: none;
    }
}