: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;
}

#answer-buttons {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    padding: 15px 25px 25px;
}

.answer-btn {
    padding: 18px 6px;
    min-height: 70px;
    border-radius: 14px;
    background: #fff;
    color: #0b3457;
    font-size: 24px;
    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;
    word-break: keep-all;
}

@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.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-width: 450px) {
    #hanja-char {
        font-size: 50px;
    }

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

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

    #quiz-question {
        padding: 8px 10px 0;
        gap: 4px;
    }
}
/* 보너스 상태일 때 테두리 색 변경 */
#app-wrapper.bonus {
    animation: bonusEffect 0.1s alternate infinite
}

@keyframes bonusEffect {
    0% {
        border-color: #fd690d
    }

    100% {
        border-color: #ff0
    }
}
/* 콤보 텍스트: 기본은 주황, 보너스는 보라 */
#combo-text.combo-bonus {
    /* background: #ea580c; */
    /* color: #fff; */
}
/* 게임이 끝나고 나오는 결과 화면을 설정한다. */
/* lottie 애니메이션 관련이다. */
/* 성공했을 때 나온다. */
.confetti-wrapper{   
    /* z-index가 가장 커야 한다. */  
    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; 
    /* active 클래스를 추가하면 보인다. */
    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;     
}
/* lottie 애니메이션 */

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

#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-title[data-type="ranking"] {
  color: #ffd93d;
  text-shadow: 0 0 12px #ffd93d88;
}
/* 최고 점수를 깼을 때다. */
#result-title[data-type="high"] {
  color: #ffd93d;
  text-shadow: 0 0 12px #ffd93d88;
}

/* 기본일 때다. */
#result-title[data-type="normal"] {
  color: #fff;
}

#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;
  color: #000;
  /* 모바일에서 작게 */
  font-size: 24px;
}

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

.result-info-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.result-grade-img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

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

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

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

@media screen and (max-width: 880px) {
  .result-row{
    font-size: 20px;
  } 
}