:root {
    --timer-color: #ffdd00;
    --low-time-color: #ff0e42;
    --background-color: #0b3457;
}

.confetti-wrapper {
    z-index: 7;
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: transparent;
    pointer-events: none;
    visibility: hidden;
    opacity: 0;
}
.confetti-wrapper.active {
    visibility: visible;
    opacity: 1;
}
.confetti-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

section {
    padding-top: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
}

#app-wrapper {
    display: flex;
    justify-content: center;
    position: relative;
    width: 100%;
    height: 100%;
    padding: 10px;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.2);
    border: 5px solid var(--site-color-1);
    overflow-x: hidden;
    overflow-y: scroll;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

#app-wrapper::-webkit-scrollbar {
    display: none;
}

#app-wrapper.start {

}


#app-intro {
    z-index: 4;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    font-weight: 700;
    background: #fff;
    overflow-y: scroll;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

#app-intro::-webkit-scrollbar {
    display: none;
}

#app-notice {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin-bottom: 20px;
}

#app-notice ul {
    margin-left: 20px;
    padding-right: 20px;
}

#app-notice ul li {
    margin: 14px 0;
    list-style: circle;
    font-size: 20px;
    word-break: keep-all;
}

.heart-icon {
    color: #e0105a;
}

#start-button {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px 40px;
    font-size: 1.3rem;
    font-weight: bold;
    background: #fff;
    border-radius: 20px;
    border: 3px solid var(--site-color-1);
    cursor: pointer;
}

@media (hover: hover) {
  #start-button:hover {
    background: var(--site-color-1);
  }
}

#app-container {
    z-index: 3;
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    background: transparent;
    overflow-y: scroll;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

#app-container::-webkit-scrollbar {
    display: none;
}

#stage-text {
    flex-shrink: 0;
    font-size: 22px;
    font-weight: bold;
    color: var(--background-color);
    text-align: center;
    padding: 10px 0 0;
}

#quiz-info {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    padding: 4px 10px 0;
}

/* 하트(좌) | 코인(중) | 콤보(우) */
#quiz-status-bar {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    align-items: center;
    width: 100%;
    padding-bottom: 6px;
}

#hearts-display {
    justify-self: start;
    font-size: 24px;
    font-weight: bold;
    padding: 4px 8px;
    color: #e0105a;
}

#score-text {
    justify-self: center;
    color: var(--background-color);
    font-size: 24px;
    font-weight: bold;
    letter-spacing: 1px;
}

#combo-text {
    justify-self: end;
    color: #ea580c;
    font-size: 22px;
    font-weight: bold;
    padding: 0 8px;
    min-height: 1.3em;
    opacity: 0;
}

#combo-text.show {
    animation: comboAnim 0.7s forwards;
}

@keyframes comboAnim {
    0%   { opacity: 0; transform: scale(0.8); }
    20%  { opacity: 1; transform: scale(1.1); }
    60%  { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(1); }
}

#timer-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 95%;
    height: 20px;
    border-radius: 15px;
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.2);
    background: #fff;
    overflow: hidden;
    margin-bottom: 8px;
}

#timer-container {
    position: relative;
    width: 95%;
    height: 90%;
}

#timer-bar {
    position: absolute;
    top: 50%;
    left: 0;
    height: 70%;
    transform: translateY(-50%);
    width: 100%;
    border-radius: 15px;
    box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.2);
    background: var(--timer-color);
}

#timer-bar.start {
    animation: timerStart var(--quiz-time) linear forwards;
}

@keyframes timerStart {
    to { width: 0; }
}

#timer-bar.low-time {
    background: var(--low-time-color);
}

@media screen and (max-width: 450px) {
    #app-notice ul li {
        margin: 10px 0;
        font-size: 18px;
    }
}

#level-down-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.5);
}

#level-down-overlay.show {
    display: flex;
}

#level-down-box {
    background: #fff;
    border-radius: 16px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 28px;
    border: 3px solid var(--site-color-1);
    width: 90%;
    max-width: 300px;
    height: 300px;
}

#level-down-title {
    font-size: 1.8rem;
    font-weight: bold;
    letter-spacing: 3px;
    text-align: center;
    word-break: keep-all;
}

#level-down-confirm {
    padding: 12px 36px;
    font-size: 1.1rem;
    border: 2px solid var(--site-color-1);
    border-radius: 12px;
    background: #fff;
}

@media (hover: hover) {
    #level-down-confirm:hover {
        background: var(--site-color-1);
    }
}
#app-container {
    overflow: hidden;
}

#quiz-question {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    padding: 10px 15px 0;
    gap: 6px;
}

#hanja-char {
    flex-shrink: 0;
    font-size: 5rem;
    color: #161515;
    font-weight: bold;
    text-align: center;
    line-height: 1;
    padding: 6px 0 0;
}

#hanja-english {
    flex-shrink: 0;
    font-size: 26px;
    color: #555;
    text-align: center;
    letter-spacing: 0.03em;
    padding: 5px;
    word-break: keep-all;
}

#hanja-meaning {
    flex-shrink: 0;
    font-size: 2.8rem;
    color: #161515;
    font-weight: bold;
    text-align: center;
    line-height: 1.2;
    padding: 4px 15px 10px;
    word-break: keep-all;
}

#answer-buttons {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -ms-overflow-style: none;
    scrollbar-width: none;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
    padding: 15px 25px 25px;
    align-content: start;
}

.answer-btn {
    padding: 16px 6px;
    min-height: 70px;
    border-radius: 14px;
    background: #fff;
    color: #0b3457;
    font-size: 1.4rem;
    font-weight: bold;
    text-align: center;
    cursor: pointer;
    border: 3px solid var(--site-color-1);
    box-shadow: 0 0px 2px rgba(0,0,0,0.2);
    transition: transform 0.12s, background 0.12s, box-shadow 0.12s, border-color 0.12s;
    word-break: keep-all;
}

.hanja-btn {
    font-size: 2.2rem;
}

@media (hover: hover) {
  .answer-btn:hover {
    background: var(--site-color-1);
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(168, 237, 212, 0.7);
  }
}

.answer-btn:active {
    transform: scale(0.95);
    box-shadow: none;
}

.answer-btn.selected {
    background: #bfdbfe;
    border-color: #3b82f6;
    color: #1e40af;
    box-shadow: 0 3px 10px rgba(59, 130, 246, 0.4);
    transform: translateY(-2px);
}

.answer-btn.correct-highlight {
    background: #4ade80;
    border-color: #16a34a;
    color: #fff;
    box-shadow: 0 3px 10px rgba(74, 222, 128, 0.5);
    animation: correctPulse 0.35s;
}

.answer-btn.wrong-dim {
    opacity: 0.3;
}

@keyframes correctPulse {
    0%   { transform: scale(0.97); }
    50%  { transform: scale(1.05); }
    100% { transform: scale(1); }
}

#app-result {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    display: none;
    justify-content: center;
    align-items: center;
    background: var(--background-color);
    border-radius: 15px;
}

#app-result.show {
    display: flex;
}

#result-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    width: 90%;
    max-width: 400px;
}

#result-title {
    font-size: 2.2rem;
    font-weight: bold;
    color: #fff;
    text-align: center;
}

#result-rows {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 24px;
}

.result-row span:last-child {
    font-weight: bold;
    color: #34a7ff;
}

#result-buttons {
    display: flex;
    gap: 12px;
}

#result-retry-button,
#app-result .item-link {
    padding: 14px 20px;
    background: var(--site-color-1);
    border-radius: 12px;
    font-size: 22px;
    min-width: 130px;
    font-weight: bold;
    color: #333 !important;
    cursor: pointer;
    text-align: center;
}

@media (hover: hover) {
  #result-retry-button:hover,
  #app-result .item-link:hover {
    opacity: 0.85;
  }
}

#milestone-overlay {
    display: none;
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    z-index: 20;
    align-items: center;
    justify-content: center;
}

#milestone-overlay.show {
    display: flex;
}

#milestone-box {
    background: #fff;
    border-radius: 24px;
    padding: 40px 35px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalIn 0.25s ease;
}

@keyframes modalIn {
    from { transform: scale(0.8); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}

#milestone-emoji {
    font-size: 4rem;
    margin-bottom: 10px;
}

#milestone-title {
    font-size: 2rem;
    font-weight: 900;
    color: #0b3457;
    margin-bottom: 24px;
}

#milestone-confirm {
    padding: 14px 44px;
    border-radius: 14px;
    background: var(--site-color-1);
    font-size: 1.2rem;
    font-weight: 700;
    color: #065f46;
    cursor: pointer;
    transition: background 0.15s;
}

@media (hover: hover) {
  #milestone-confirm:hover {
    background: #6ee7b7;
  }
}

/* 화면 높이가 작을 때: 글자/여백을 줄여 답지가 잘리지 않도록 */
@media screen and (max-height: 700px) {
    #hanja-char {
        font-size: 3.5rem;
        padding: 2px 0 0;
    }

    #hanja-english {
        font-size: 20px;
        padding: 2px;
    }

    #hanja-meaning {
        font-size: 2rem;
        padding: 2px 15px 6px;
    }

    #quiz-question {
        padding: 4px 15px 0;
        gap: 3px;
    }

    #answer-buttons {
        gap: 7px;
        padding: 8px 25px 15px;
    }

    .answer-btn {
        padding: 12px 6px;
        min-height: 54px;
        font-size: 1.2rem;
    }

    .hanja-btn {
        font-size: 1.8rem;
    }
}

@media screen and (max-width: 450px) {
    #hanja-char {
        font-size: 50px;
    }

    #hanja-english {
        font-size: 20px;
    }

    #hanja-meaning {
        font-size: 32px;
    }

    #answer-buttons {
        gap: 7px;
        padding: 10px 15px 15px;
    }

    .answer-btn {
        padding: 14px 4px;
        min-height: 58px;
        font-size: 1.1rem;
        border-radius: 10px;
        border-width: 2px;
    }

    .hanja-btn {
        font-size: 1.8rem;
    }

    #quiz-question {
        padding: 8px 10px 0;
        gap: 4px;
    }
}