/* =========================================================
   menu.css — 전역 슬라이드 메뉴 / 모달 (하는 방법 · 닉네임 변경)
   layout.css 의 색 토큰 사용.
   ========================================================= */

/* ---------- 슬라이드 드로어 ---------- */
.drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 40;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.drawer-overlay.show { opacity: 1; }
.drawer-overlay[hidden] { display: none; }

.drawer {
    position: fixed;
    top: 0;
    right: 0;
    height: 100dvh;
    width: 82%;
    max-width: 320px;
    background: #fff;
    z-index: 41;
    box-shadow: -6px 0 24px rgba(0, 0, 0, 0.14);
    transform: translateX(100%);
    transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
    display: flex;
    flex-direction: column;
    padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
}
.drawer.open { transform: translateX(0); }

.drawer__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 6px 4px 16px;
    border-bottom: 1px solid var(--color-empty-border);
}
.drawer__nick-box { min-width: 0; }
.drawer__nick-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--color-absent);
    margin-bottom: 2px;
}
.drawer__nick {
    display: block;
    font-size: 18px;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.drawer__nick-edit {
    flex: 0 0 auto;
    border: 1.5px solid var(--color-empty-border);
    background: #fff;
    border-radius: 999px;
    padding: 7px 12px;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--color-text);
    cursor: pointer;
}
.drawer__nick-edit:active { background: #f2f2f2; }

.drawer__nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px 0;
    flex: 1 1 auto;
}
.drawer__item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px 10px;
    border: none;
    background: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 700;
    color: var(--color-text);
    text-decoration: none;
    text-align: left;
    cursor: pointer;
}
.drawer__item:active { background: #f4f4f4; }
.drawer__item-ic { font-size: 18px; width: 24px; text-align: center; }

.drawer__auth {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 0;
    border-top: 1px solid var(--color-empty-border);
}
.drawer-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 46px;
    border: 1.5px solid var(--color-tile-border);
    border-radius: 10px;
    background: #fff;
    color: var(--color-text);
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}
.drawer-btn:active { background: #f2f2f2; }
.drawer-btn--primary {
    background: var(--color-correct);
    border-color: var(--color-correct);
    color: #fff;
}

.drawer__foot {
    padding-top: 12px;
    text-align: center;
}
.drawer__foot a {
    font-size: 12.5px;
    color: var(--color-absent);
    text-decoration: underline;
}

/* ---------- 공통 모달 ---------- */
.modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal[hidden] { display: none; }
.modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    animation: fadeIn 0.15s ease;
}
.modal__panel {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 440px;
    max-height: 86dvh;
    overflow-y: auto;
    background: #fff;
    border-radius: 16px;
    padding: 26px 22px 22px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    animation: modalIn 0.18s cubic-bezier(0.22, 1, 0.36, 1);
}
.modal__panel--sm { max-width: 360px; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(0.98); } to { opacity: 1; transform: none; } }

.modal__x {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 34px;
    height: 34px;
    border: none;
    background: none;
    font-size: 18px;
    color: var(--color-absent);
    cursor: pointer;
    border-radius: 8px;
}
.modal__x:active { background: #f2f2f2; }
.modal__title { margin: 0 0 14px; font-size: 22px; font-weight: 800; }
.modal p { margin: 8px 0; font-size: 14.5px; line-height: 1.55; color: var(--color-text); }
.modal__hr { border: none; border-top: 1px solid var(--color-empty-border); margin: 16px 0; }

/* 하는 방법 예시 타일 */
.howto-sub { margin: 0 0 8px; font-size: 15px; font-weight: 800; }
.howto-row { display: flex; gap: 5px; margin-top: 6px; }
.howto-tile {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--color-empty-border);
    font-size: 20px;
    font-weight: 700;
    box-sizing: border-box;
    color: var(--color-text);
}
.howto-tile.state-correct { background: var(--color-correct); border-color: var(--color-correct); color: #fff; }
.howto-tile.state-present { background: var(--color-present); border-color: var(--color-present); color: #fff; }
.howto-tile.state-absent  { background: var(--color-absent);  border-color: var(--color-absent);  color: #fff; }
.howto-note { margin: 6px 0 12px; font-size: 13px; color: var(--color-text); }
.howto-foot { font-size: 13px; font-weight: 700; }
.howto-foot--dim { font-weight: 400; color: var(--color-absent); }

/* 닉네임 변경 */
.nick-hint { font-size: 13px; color: var(--color-absent); margin: 0 0 12px; }
.nick-input {
    width: 100%;
    height: 48px;
    border: 2px solid var(--color-tile-border);
    border-radius: 10px;
    padding: 0 14px;
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 6px;
}
.nick-input:focus { outline: none; border-color: var(--color-correct); }
.nick-error { min-height: 18px; margin: 0 0 10px; font-size: 13px; color: #d0021b; font-weight: 700; }

/* 소리 설정 */
.sound-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    margin-bottom: 12px;
    font-size: 15px;
    font-weight: 800;
}
.sound-toggle input {
    width: 20px;
    height: 20px;
    accent-color: var(--color-correct);
}
.sound-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-bottom: 12px;
}
.sound-field label {
    font-size: 13px;
    font-weight: 800;
    color: var(--color-absent);
}
.sound-select {
    width: 100%;
    height: 46px;
    border: 2px solid var(--color-tile-border);
    border-radius: 10px;
    padding: 0 12px;
    background: #fff;
    font-size: 15px;
    font-weight: 700;
}
.sound-select:focus { outline: none; border-color: var(--color-correct); }
.sound-actions {
    margin: 8px 0 12px;
}

/* 메뉴 전용 토스트 */
.menu-toast-wrap {
    position: fixed;
    top: 64px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 60;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    pointer-events: none;
}
.menu-toast {
    background: #1a1a1b;
    color: #fff;
    padding: 10px 16px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    animation: fadeIn 0.12s ease;
}

/* ---------- 언어 설정 모달 ---------- */
.lang-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 4px 0 10px;
}
.lang-option { width: 100%; }

/* 앱에서만 보이는 메뉴(광고 제거) — hidden 이 display 규칙에 지지 않게 */
.drawer__item[hidden] { display: none; }
/* 회원 탈퇴: 눈에 덜 띄게, 그러나 찾을 수 있게 (앱스토어 5.1.1(v)) */
.drawer__delete {
    align-self: center;
    font-size: 12.5px;
    color: var(--color-absent);
    text-decoration: underline;
    padding: 4px;
}

/* 광고 제거 구독 화면 (앱, native.js) */
.adfree { display: flex; flex-direction: column; gap: 10px; }
.adfree-plan { display: flex; flex-direction: column; gap: 2px; padding: 12px; border: 1px solid var(--color-empty-border); border-radius: 10px; text-align: center; }
.adfree-plan span { font-size: 13px; color: var(--color-absent); }
.adfree-plan .adfree-price { font-size: 18px; font-weight: 800; color: var(--color-text); }
.adfree-benefit { font-size: 14px; line-height: 1.6; margin: 0; }
.adfree-status { font-size: 14px; font-weight: 800; color: var(--color-correct); margin: 0; text-align: center; }
.adfree-fine { font-size: 11.5px; line-height: 1.6; color: var(--color-absent); margin: 0; }
.adfree-links { text-align: center; }
.adfree-links a { color: var(--color-absent); text-decoration: underline; }
.adfree [disabled] { opacity: .5; }
