/* =========================================================
 *  두손온누리약국 키오스크 디자인
 *  색상은 아래 :root 에서 한 번에 바꿀 수 있습니다.
 * ========================================================= */
:root {
  --blue: #1f6fe5;
  --blue-dark: #1556bd;
  --blue-soft: #e8f1fd;
  --pink: #e5007e;
  --green: #4caf2e;
  --gray: #6b6f76;
  --gray-light: #9aa1ab;
  --ink: #1e2533;
  --bg: #f3f6fb;
  --card: #ffffff;
  --line: #e3e9f2;
  --warn-bg: #fff6dc;
  --warn-line: #f3cf6b;
  --warn-ink: #7a4b00;
  --lv1: #4caf2e;
  --lv2: #f2b400;
  --lv3: #f57c00;
  --lv4: #e0342f;
  --radius: 22px;
  --shadow: 0 6px 22px rgba(31, 111, 229, .10), 0 1px 3px rgba(30, 37, 51, .06);
}

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

/* 글자 기본 크기: 화면 가로·세로 중 작은 쪽에 맞춰 자동 조절 */
html { font-size: clamp(11px, min(1.45vw, 2.25vh), 22px); }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Pretendard", "Noto Sans KR", "Malgun Gothic", "Apple SD Gothic Neo",
    "Noto Sans", "Nirmala UI", "Leelawadee UI", "Myanmar Text", "Noto Sans Myanmar", "Khmer UI",
    "Noto Sans Khmer", "Noto Sans Sinhala", "Iskoola Pota", "Noto Sans Bengali", system-ui, sans-serif;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

input, textarea, select { user-select: text; -webkit-user-select: text; font: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }

/* ---------- 배경 물결 (첨부 사진의 하늘색 곡선 느낌) ---------- */
.bg-wave { position: fixed; left: 0; right: 0; pointer-events: none; z-index: 0; background-repeat: no-repeat; background-size: 100% 100%; }
.bg-wave-top {
  top: 0; height: 30vh;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 320' preserveAspectRatio='none'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='1' y2='.3'%3E%3Cstop offset='0' stop-color='%232f7cf0' stop-opacity='.55'/%3E%3Cstop offset='.55' stop-color='%2389b8f7' stop-opacity='.28'/%3E%3Cstop offset='1' stop-color='%23cfe1fb' stop-opacity='.15'/%3E%3C/linearGradient%3E%3ClinearGradient id='h' x1='0' y1='0' x2='1' y2='0'%3E%3Cstop offset='0' stop-color='%23ffffff' stop-opacity='.0'/%3E%3Cstop offset='1' stop-color='%23ffffff' stop-opacity='.75'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath d='M0 0H1440V90C1180 190 930 60 680 120C430 180 220 250 0 190Z' fill='url(%23g)'/%3E%3Cpath d='M0 150C260 230 520 120 760 95C1000 70 1220 140 1440 60' fill='none' stroke='url(%23h)' stroke-width='26'/%3E%3C/svg%3E");
}
.bg-wave-bottom {
  bottom: 0; height: 26vh;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 320' preserveAspectRatio='none'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='1' y2='0'%3E%3Cstop offset='0' stop-color='%23cfe1fb' stop-opacity='.1'/%3E%3Cstop offset='1' stop-color='%232f7cf0' stop-opacity='.35'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath d='M0 260C300 200 520 300 820 220C1080 150 1260 120 1440 60V320H0Z' fill='url(%23g)'/%3E%3C/svg%3E");
}

/* ---------- 로고 ---------- */
.logo { position: relative; display: inline-flex; flex-direction: column; align-items: flex-end; line-height: 1; cursor: default; }
.logo-word { font-size: 2.1rem; font-weight: 800; letter-spacing: -.02em; white-space: nowrap; }
.logo-gray { color: #6b6b6b; font-weight: 700; }
.b-on, .b-nu, .b-ri { font-weight: 900; font-size: 1.12em; }
.b-on { color: var(--pink); }
.b-nu { color: var(--blue); }
.b-ri { color: var(--green); }
.logo-en { margin-top: .3em; font-size: .55rem; letter-spacing: .38em; color: #555; font-weight: 600; }
.logo-badge {
  position: absolute; right: -.4rem; top: -1.2rem;
  background: var(--blue); color: #fff; font-weight: 700; font-size: .6rem; letter-spacing: .05em;
  padding: .25em .9em; border-radius: 999px; box-shadow: 0 3px 8px rgba(31, 111, 229, .3);
}
.logo.big .logo-word { font-size: 3.6rem; }
.logo.big .logo-en { font-size: .8rem; }
.logo.big .logo-badge { font-size: .85rem; top: -1.6rem; }

/* ---------- 공통 화면 틀 ---------- */
#app { position: relative; z-index: 1; }
.screen {
  height: 100vh; height: 100dvh;
  display: flex; flex-direction: column;
  padding: 2.4vh 3vw 2.2vh;
  animation: fadeIn .25s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 4.2rem; }
.topbar .logo-word { font-size: 1.7rem; }
.topbar .logo-badge { display: none; }

.lang-chip {
  display: inline-flex; align-items: center; gap: .6rem;
  background: rgba(255, 255, 255, .9); border-radius: 999px; padding: .4rem 1.1rem .4rem .5rem;
  box-shadow: var(--shadow); font-weight: 700;
}
.lang-chip .flag { width: 2.2rem; height: 1.5rem; }

.steps { display: flex; gap: .5rem; }
.steps i { width: 2.4rem; height: .45rem; border-radius: 999px; background: #d4def0; }
.steps i.on { background: var(--blue); }

.title-block { text-align: center; margin: 1.4vh 0 2.2vh; }
.title-block .t-main { display: block; font-size: 2.2rem; font-weight: 800; letter-spacing: -.01em; }
.title-block .t-ko { display: block; margin-top: .35rem; font-size: 1rem; color: var(--gray); font-weight: 600; }
.title-sub { display: block; margin-top: .6rem; font-size: 1.05rem; color: var(--blue-dark); font-weight: 700; }

.content { flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: center; }

.t-main { display: block; }
.t-ko { display: block; color: var(--gray); font-size: .78em; font-weight: 600; margin-top: .25em; }

/* ---------- 타일 버튼 ---------- */
.tile {
  background: var(--card); border: 3px solid transparent; border-radius: var(--radius);
  box-shadow: var(--shadow); transition: transform .08s, border-color .15s, background .15s;
  text-align: center;
}
.tile:active, .tile.pressed { transform: scale(.97); border-color: var(--blue); background: #f7fbff; }

/* ---------- 1. 언어 선택 ---------- */
/* 첫 화면은 화면 "높이"에 맞춰 크기가 자동으로 줄어듭니다 (작은 태블릿에서도 잘리지 않게) */
.lang-screen { padding-top: 3.5vh; }
.lang-screen .hero { display: flex; flex-direction: column; align-items: center; margin-top: 1vh; }
.lang-screen .logo.big .logo-word { font-size: min(3.1rem, 6.5vh); }
.lang-screen .logo.big .logo-en { font-size: min(.8rem, 1.7vh); }
.lang-screen .logo.big .logo-badge { font-size: min(.85rem, 1.8vh); top: -1.3em; }
.lang-screen .title-block { margin: 1.2vh 0 1.8vh; }
.lang-screen .title-block .t-main { font-size: min(2.2rem, 4.6vh); }
.lang-screen .title-block .t-ko { font-size: min(1rem, 2.2vh); }
.rotating { min-height: 1.3em; transition: opacity .3s; }
.lang-grid {
  display: flex; flex-wrap: wrap; justify-content: center; align-content: stretch;
  gap: 1.6vh 1rem; flex: 1; min-height: 0;
}
.lang-btn {
  flex: 0 0 calc((100% - 5rem) / 6);       /* 한 줄에 6개, 16개 → 3줄 */
  height: calc((100% - 3.2vh) / 3);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1vh; padding: .5vh .4rem; min-height: 0;
}
.lang-btn .flag { width: min(4rem, 7.5vh); height: min(2.7rem, 5vh); }
.lang-btn .native { font-size: min(1.25rem, 3vh); font-weight: 800; line-height: 1.1; }
.lang-btn .ko { font-size: min(.85rem, 1.9vh); color: var(--gray); font-weight: 600; }

.flag { display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; overflow: hidden; flex: none; }
.flag:not(.flag-emoji) { box-shadow: 0 0 0 1px rgba(0, 0, 0, .12); }
.flag img { width: 100%; height: 100%; object-fit: cover; }
.flag.flag-emoji { font-size: 2.6rem; line-height: 1; overflow: visible; }
.lang-chip .flag.flag-emoji { font-size: 1.4rem; }

/* ---------- 2. 증상 분류 / 3. 세부 증상 ---------- */
.choice-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; grid-auto-rows: minmax(0, 1fr); flex: 1; min-height: 0; max-height: 64vh; }
.choice-grid.few { max-height: 46vh; }
.choice {
  display: flex; align-items: center; gap: 1.1rem; padding: .9rem 1.4rem; text-align: left; min-height: 0;
}
.choice .ico {
  flex: none; width: 4.6rem; height: 4.6rem; border-radius: 50%; background: var(--blue-soft);
  display: flex; align-items: center; justify-content: center; font-size: 2.5rem;
}
.choice .txt { flex: 1; min-width: 0; }
.choice .t-main { font-size: 1.45rem; font-weight: 800; line-height: 1.2; }
.choice .t-ko { font-size: .95rem; }
.choice.detail { justify-content: flex-start; }
.choice.detail .ico { width: 3.6rem; height: 3.6rem; font-size: 1.6rem; color: var(--blue); font-weight: 900; }
.choice.other { background: #f9fafc; border: 3px dashed #c9d5e8; box-shadow: none; }
.choice.other .ico { background: #eef1f6; }

/* ---------- 직접 입력 ---------- */
.other-box { width: min(58rem, 100%); margin: 0 auto; display: flex; flex-direction: column; gap: 1.2rem; }
.other-box textarea {
  width: 100%; min-height: 26vh; border-radius: var(--radius); border: 3px solid #cddaf0; background: #fff;
  padding: 1.2rem 1.4rem; font-size: 1.5rem; resize: none; outline: none; box-shadow: var(--shadow);
}
.other-box textarea:focus { border-color: var(--blue); }
.other-box .hint { text-align: center; color: var(--gray); }

/* ---------- 4. 단계(심한 정도) ---------- */
.level-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.1rem; flex: 1; min-height: 0; }
.content.fill { justify-content: stretch; }
.compact .title-block { margin: .6vh 0 1.4vh; }
.compact .title-block .t-main { font-size: 1.9rem; }
.compact .navbar { margin-top: 1.2vh; min-height: 3.6rem; }
.compact .topbar { min-height: 3.2rem; }
.compact .topbar .logo-word { font-size: 1.4rem; }
.compact .nav-btn { padding: .5rem 1.5rem; font-size: 1.15rem; }
.compact .nav-btn.big { padding: .65rem 2.4rem; font-size: 1.4rem; }
.compact .not-sure { padding: .5rem 1.4rem; font-size: 1rem; }
.summary-grid { grid-template-columns: 1.55fr 1fr !important; }
.level-card .med-photo { width: 2.7rem; height: 2.7rem; font-size: 1.3rem; border-radius: 10px; }
.level-card .med-row { padding: .22rem .1rem; gap: .55rem; }
.level-card .med-name { font-size: .95rem; }
.level-card .med-price { font-size: .95rem; }
.level-card {
  display: flex; flex-direction: column; padding: 0; overflow: hidden; text-align: left; min-height: 0;
}
.level-card .lv-head { padding: .7rem 1rem .65rem; color: #fff; }
.level-card[data-lv="1"] .lv-head { background: var(--lv1); }
.level-card[data-lv="2"] .lv-head { background: var(--lv2); }
.level-card[data-lv="3"] .lv-head { background: var(--lv3); }
.level-card[data-lv="4"] .lv-head { background: var(--lv4); }
.lv-head .lv-top { display: flex; align-items: center; justify-content: space-between; }
.lv-head .lv-num { font-size: 1.05rem; font-weight: 800; opacity: .95; }
.lv-head .lv-name { font-size: 1.4rem; font-weight: 900; line-height: 1.15; margin-top: .15rem; }
.lv-head .t-ko { color: rgba(255, 255, 255, .9); }
.bars { display: flex; gap: 3px; align-items: flex-end; }
.bars b { width: .5rem; border-radius: 2px; background: rgba(255, 255, 255, .35); }
.bars b:nth-child(1) { height: .55rem; } .bars b:nth-child(2) { height: .85rem; }
.bars b:nth-child(3) { height: 1.15rem; } .bars b:nth-child(4) { height: 1.45rem; }
.bars b.on { background: #fff; }

.lv-meds { flex: 1; min-height: 0; overflow: auto; padding: .4rem .7rem; display: flex; flex-direction: column; gap: .2rem; }
.med-row { display: flex; align-items: center; gap: .7rem; padding: .45rem .3rem; border-bottom: 1px dashed var(--line); }
.med-row:last-child { border-bottom: 0; }
.med-photo {
  flex: none; width: 3.3rem; height: 3.3rem; border-radius: 12px; background: var(--blue-soft);
  display: flex; align-items: center; justify-content: center; font-size: 1.6rem; overflow: hidden;
}
.med-photo img { width: 100%; height: 100%; object-fit: cover; }
.med-name { flex: 1; min-width: 0; font-weight: 700; font-size: 1rem; line-height: 1.2; }
.med-name .t-ko { font-size: .78rem; }
.med-price { font-weight: 800; color: var(--ink); white-space: nowrap; font-size: 1rem; }

.lv-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: .6rem; padding: 1rem; color: var(--gray); }
.lv-empty .em { font-size: 2.6rem; }
.lv-empty .t-main { font-size: 1.2rem; font-weight: 800; color: var(--ink); }

.lv-foot { border-top: 2px solid var(--line); padding: .55rem .7rem .65rem; display: flex; align-items: center; gap: .5rem; }
.lv-total { flex: 1; min-width: 0; display: flex; flex-direction: column; font-weight: 700; line-height: 1.1; }
.lv-total .lbl { font-size: .8rem; color: var(--gray); }
.lv-total .sum { font-size: 1.4rem; font-weight: 900; color: var(--blue-dark); }
.lv-select { background: var(--blue); color: #fff; border-radius: 14px; text-align: center; padding: .55rem .9rem; font-weight: 800; font-size: 1.05rem; flex: none; }
.level-card.empty .lv-select { flex: 1; }
.level-card .med-name .t-main { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.level-card .med-name .t-ko { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: .1em; }
.level-card.empty .lv-select { background: #8a94a6; }

.navbar .spacer { display: flex; justify-content: center; }
.not-sure {
  display: inline-flex; align-items: center; gap: .8rem; padding: .8rem 1.8rem;
  border-radius: 999px; background: #fff; border: 3px solid #cddaf0; font-weight: 700; font-size: 1.1rem; box-shadow: var(--shadow);
}
.not-sure .t-ko { display: inline; margin: 0 0 0 .4rem; }

/* ---------- 5. 약사에게 보여주기 ---------- */
.show-banner {
  display: flex; align-items: center; gap: 1.2rem; justify-content: center;
  background: linear-gradient(90deg, var(--blue), #3b8af5); color: #fff; border-radius: var(--radius);
  padding: .7rem 1.5rem; margin: .6vh 0 1.4vh; box-shadow: 0 10px 26px rgba(31, 111, 229, .3);
}
.show-banner .em { font-size: 2.4rem; }
.show-banner .t-main { font-size: 1.8rem; font-weight: 900; }
.show-banner .t-ko { color: rgba(255, 255, 255, .9); font-size: 1rem; }

.summary-grid { display: grid; grid-template-columns: 1.25fr 1fr; gap: 1.3rem; flex: 1; min-height: 0; }
.panel { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.2rem; overflow: auto; min-height: 0; display: flex; flex-direction: column; gap: .6rem; }
.panel h3 { margin: 0; font-size: 1.15rem; color: var(--blue-dark); display: flex; align-items: center; gap: .5rem; }
.panel h3 .t-ko { display: inline; font-size: .85rem; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: .45rem 1rem; align-items: baseline; }
.kv dt { color: var(--gray); font-weight: 700; font-size: .95rem; white-space: nowrap; }
.kv dd { margin: 0; font-weight: 800; font-size: 1.2rem; }
.kv dd .t-ko { font-size: .8rem; }
.sum-chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
.chip { background: #f3f7fd; border-radius: 14px; padding: .5rem .8rem; min-width: 0; }
.chip.wide { grid-column: 1 / -1; }
.chip .lbl { font-size: .78rem; color: var(--gray); font-weight: 700; margin-bottom: .15rem; }
.chip .val .t-main { display: inline; font-weight: 800; font-size: 1.1rem; line-height: 1.25; }
.chip .val .t-ko { font-size: .75rem; }
.sum-meds { display: grid; grid-template-columns: 1fr 1fr; gap: .1rem 1rem; }
.panel .med-photo { width: 2.6rem; height: 2.6rem; font-size: 1.3rem; border-radius: 10px; }
.panel .med-row { padding: .3rem 0; }
.panel .med-name { font-size: .95rem; }
.panel .med-name .t-ko { font-size: .75rem; }
.sum-total { display: flex; justify-content: space-between; align-items: baseline; border-top: 2px solid var(--line); padding-top: .4rem; font-weight: 800; font-size: 1.1rem; }
.sum-total .sum { font-size: 1.6rem; color: var(--blue-dark); font-weight: 900; }

.warn {
  display: flex; gap: .8rem; align-items: flex-start; background: var(--warn-bg); border: 2px solid var(--warn-line);
  color: var(--warn-ink); border-radius: 16px; padding: .65rem .9rem; font-weight: 700; font-size: 1rem; line-height: 1.35;
}
.warn .em { font-size: 1.6rem; line-height: 1; }
.screen > .warn { margin-top: 1.2vh; align-items: center; }
.banner-note { margin-left: auto; max-width: 32%; font-size: .9rem; font-weight: 600; opacity: .95; line-height: 1.35; }
.warn .t-ko { color: #8a6a2a; }

.pharm { background: #f5f9ff; border: 2px solid #cfe0fa; box-shadow: none; }
.pharm { gap: .35rem; }
.pharm .ko-line { font-size: 1rem; line-height: 1.45; }
.pharm .ko-line b { display: inline-block; min-width: 5.2em; color: var(--gray); }
.pharm .ko-meds { margin: .2rem 0 0 0; padding-left: 1.2rem; }
.pharm .ko-meds li { margin: .15rem 0; }
.pharm .ko-ingr { font-size: .78rem; color: var(--gray); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.med-item .ingr { color: var(--gray); font-size: 12px; margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.med-item .warn-txt { color: #b42318; font-size: 12px; font-weight: 700; }
.mfds-results .ing { color: var(--gray); font-size: 12px; }
.report { width: min(720px, 86vw); }
.report table { width: 100%; border-collapse: collapse; font-size: 14px; }
.report td, .report th { border-bottom: 1px solid var(--line); padding: 7px 6px; text-align: left; vertical-align: top; }
.report .ok { color: #2f7a17; font-weight: 700; }
.report .chk { color: #9a6200; font-weight: 700; }
.report .no { color: #b42318; font-weight: 700; }
.progress { height: 10px; background: #eef2f8; border-radius: 999px; overflow: hidden; margin: 12px 0; }
.progress i { display: block; height: 100%; background: var(--blue); width: 0; transition: width .2s; }
.pharm .ko-total { font-size: 1.35rem; font-weight: 900; color: var(--blue-dark); }
.pharm .ko-memo { background: #fff; border-radius: 12px; padding: .6rem .8rem; border: 1px solid var(--line); white-space: pre-wrap; user-select: text; }
.pharm .ko-time { color: var(--gray-light); font-size: .85rem; margin-top: auto; }
.consult-badge { display: inline-block; background: #eef1f6; color: var(--ink); border-radius: 10px; padding: .3rem .7rem; font-weight: 800; }

.countdown { text-align: center; color: var(--gray); font-weight: 600; font-size: .95rem; }

/* ---------- 하단 버튼 ---------- */
.navbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1.8vh; min-height: 4.6rem; }
.nav-btn {
  display: inline-flex; align-items: center; gap: .7rem; padding: .75rem 2rem; border-radius: 999px;
  font-size: 1.3rem; font-weight: 800; border: 3px solid var(--blue); background: #fff; color: var(--blue-dark);
  box-shadow: var(--shadow); transition: transform .08s;
}
.nav-btn:active { transform: scale(.96); }
.nav-btn .t-ko { display: inline; margin: 0; font-size: .8rem; color: inherit; opacity: .75; }
.nav-btn .arrow { font-size: 1.5rem; }
.nav-btn.primary { background: var(--blue); color: #fff; }
.nav-btn.big { padding: 1rem 3rem; font-size: 1.6rem; }
.nav-btn:disabled { opacity: .4; }
.spacer { flex: 1; }

/* =========================================================
 *  팝업 (비밀번호 / 편집창)
 * ========================================================= */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(20, 28, 45, .45); display: flex; align-items: center; justify-content: center; padding: 2vh 2vw; }
.modal[hidden] { display: none; }
.modal-box { background: #fff; border-radius: 24px; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); max-width: 92vw; max-height: 94vh; overflow: auto; padding: 1.6rem 1.8rem; }

.pin { width: 24rem; text-align: center; }
.pin h2 { margin: 0 0 .4rem; font-size: 1.4rem; }
.pin .pin-dots { display: flex; justify-content: center; gap: .8rem; margin: 1rem 0 .4rem; min-height: 1.4rem; }
.pin .pin-dots i { width: 1.1rem; height: 1.1rem; border-radius: 50%; background: #d6deea; }
.pin .pin-dots i.on { background: var(--blue); }
.pin .pin-msg { color: var(--lv4); min-height: 1.4rem; font-weight: 700; }
.pin .keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: .7rem; margin-top: .6rem; }
.pin .keys button { padding: 1rem 0; font-size: 1.6rem; font-weight: 800; border-radius: 16px; border: 0; background: #f0f4fa; }
.pin .keys button:active { background: #dce7f7; }
.pin .keys .k-ok { background: var(--blue); color: #fff; font-size: 1.15rem; }
.pin .keys .k-del { font-size: 1.15rem; }
.pin .cancel { margin-top: 1rem; background: none; border: 0; color: var(--gray); font-size: 1rem; }

/* =========================================================
 *  관리자 화면
 * ========================================================= */
#admin { position: fixed; inset: 0; z-index: 20; background: #f4f6fa; display: flex; flex-direction: column; font-size: 15px; user-select: text; -webkit-user-select: text; }
#admin[hidden] { display: none; }
.ad-head { display: flex; align-items: center; gap: 16px; padding: 12px 22px; background: #fff; border-bottom: 1px solid var(--line); }
.ad-head .logo-word { font-size: 22px; }
.ad-head .logo-en, .ad-head .logo-badge { display: none; }
.ad-head h1 { font-size: 18px; margin: 0; color: var(--gray); font-weight: 700; }
.ad-tabs { display: flex; gap: 6px; margin-left: 12px; flex-wrap: wrap; }
.ad-tabs button { border: 0; background: #eef2f8; padding: 10px 18px; border-radius: 999px; font-weight: 700; font-size: 15px; color: var(--ink); }
.ad-tabs button.on { background: var(--blue); color: #fff; }
.ad-body { flex: 1; overflow: auto; padding: 20px 24px 40px; }
.ad-card { background: #fff; border-radius: 16px; padding: 18px 20px; box-shadow: 0 2px 10px rgba(30, 37, 51, .06); margin-bottom: 16px; }
.ad-card h2 { margin: 0 0 6px; font-size: 18px; }
.ad-card p.desc { margin: 0 0 14px; color: var(--gray); line-height: 1.55; }

.btn { border: 0; border-radius: 10px; padding: 10px 16px; font-weight: 700; font-size: 15px; background: #eef2f8; color: var(--ink); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--blue); color: #fff; }
.btn.danger { background: #fde8e8; color: #b42318; }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.sm { padding: 6px 10px; font-size: 13px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.med-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.med-item { display: flex; gap: 12px; align-items: center; border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; background: #fff; }
.med-item .med-photo { width: 64px; height: 64px; }
.med-item .info { flex: 1; min-width: 0; }
.med-item .nm { font-weight: 800; }
.med-item .en { color: var(--gray); font-size: 13px; }
.med-item .pr { color: var(--blue-dark); font-weight: 800; margin-top: 2px; }
.med-item .acts { display: flex; flex-direction: column; gap: 6px; }

.form { display: grid; grid-template-columns: 150px 1fr; gap: 12px 14px; align-items: center; width: min(640px, 86vw); }
.form label { font-weight: 700; color: var(--gray); }
.form input[type=text], .form input[type=number], .form input[type=password], .form textarea, .form select {
  width: 100%; padding: 10px 12px; border: 1px solid #cdd6e3; border-radius: 10px; font-size: 16px; background: #fff;
}
.form textarea { min-height: 80px; resize: vertical; }
.form .full { grid-column: 1 / -1; }
.photo-edit { display: flex; gap: 12px; align-items: center; }
.photo-edit .med-photo { width: 96px; height: 96px; }
.modal-title { margin: 0 0 16px; font-size: 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.mfds-results { grid-column: 1 / -1; max-height: 240px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.mfds-results:empty { display: none; }
.mfds-results button { display: flex; gap: 10px; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: #fff; padding: 8px 10px; align-items: center; }
.mfds-results img { width: 48px; height: 48px; object-fit: cover; border-radius: 8px; }

/* 조합 편집 */
.combo-wrap { display: grid; grid-template-columns: 300px 1fr; gap: 16px; align-items: start; }
.combo-tree { background: #fff; border-radius: 16px; padding: 10px; box-shadow: 0 2px 10px rgba(30, 37, 51, .06); max-height: calc(100vh - 150px); overflow: auto; position: sticky; top: 0; }
.combo-tree button { display: flex; width: 100%; justify-content: space-between; align-items: center; border: 0; background: none; padding: 9px 10px; border-radius: 10px; text-align: left; font-size: 15px; }
.combo-tree button.cat { font-weight: 800; margin-top: 6px; }
.combo-tree button.sub { padding-left: 26px; color: #3a4252; }
.combo-tree button.on { background: var(--blue-soft); color: var(--blue-dark); }
.badge { font-size: 12px; font-weight: 800; border-radius: 999px; padding: 2px 8px; background: #eef1f6; color: var(--gray); }
.badge.ok { background: #e3f5dc; color: #2f7a17; }
.badge.part { background: #fff1d6; color: #9a6200; }
.combo-levels { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.combo-level { border: 2px solid var(--line); border-radius: 14px; padding: 12px 14px; background: #fff; }
.combo-level h3 { margin: 0 0 10px; font-size: 16px; display: flex; justify-content: space-between; align-items: center; }
.combo-level h3 .dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.combo-level select { width: 100%; padding: 9px 10px; border-radius: 10px; border: 1px solid #cdd6e3; margin-bottom: 8px; font-size: 15px; background: #fff; }
.combo-level .tot { display: flex; justify-content: space-between; font-weight: 800; border-top: 1px dashed var(--line); padding-top: 8px; }
.combo-level .inherit { font-size: 13px; color: #9a6200; background: #fff8e6; border-radius: 8px; padding: 6px 8px; margin-bottom: 8px; }
.combo-level .none { font-size: 13px; color: var(--gray); margin-bottom: 8px; }
.note { background: #f0f6ff; border: 1px solid #cfe0fa; color: #22427a; border-radius: 12px; padding: 10px 14px; line-height: 1.6; margin-bottom: 14px; }

@media (max-aspect-ratio: 1/1) {
  /* 세로로 돌렸을 때도 최소한 보이도록 */
  .lang-grid { grid-template-columns: repeat(3, 1fr); max-height: none; }
  .choice-grid, .level-grid { grid-template-columns: repeat(2, 1fr); max-height: none; }
  .summary-grid { grid-template-columns: 1fr; }
  .screen { overflow: auto; }
  .combo-wrap { grid-template-columns: 1fr; }
}
