@font-face { font-family: "Pretendard Variable"; font-weight: 45 920; font-style: normal; font-display: swap;
  src: url("/static/fonts/PretendardVariable.woff2") format("woff2-variations"); }
@font-face { font-family: "Jua"; font-weight: 400; font-display: swap; src: url("/static/fonts/Jua-Regular.ttf") format("truetype"); }
:root {
  --bg: #f6f5f2; --panel: #ffffff; --ink: #1d1d1f; --muted: #6e6e73; --line: #e4e2dd;
  --accent: #3b6cf6; --accent-soft: #e8eefe; --bot: #ffffff; --user: #3b6cf6; --user-ink: #fff;
  --err: #d64545; --err-soft: #fdecec; --ok: #1f9d55; --ok-soft: #e7f6ee; --tip: #fff7e0; --tip-line: #f1d48a;
  --nat: #eef6ff; --nat-line: #a9c8f5; --coach: #f3edff; --coach-line: #c7b2f5;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141416; --panel: #1e1e21; --ink: #ececef; --muted: #9a9aa2; --line: #2e2e33;
    --accent: #6e93ff; --accent-soft: #23293d; --bot: #232327; --user: #3b5fd0;
    --err: #ff7b7b; --err-soft: #3a2224; --ok: #4ccf86; --ok-soft: #1d3327; --tip: #2f2a1a; --tip-line: #6b5a26;
    --nat: #1b2738; --nat-line: #36557f; --coach: #2a2340; --coach-line: #55448a;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 15.5px/1.55 "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Segoe UI", sans-serif; letter-spacing: -0.01em; display: flex; flex-direction: column; }
button { font: inherit; cursor: pointer; border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 10px; padding: 8px 14px; }
button:hover { border-color: var(--accent); }
button.ghost { background: transparent; border-color: transparent; color: var(--muted); }
input, select { font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13px; }

.top { display: flex; align-items: center; gap: 16px; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; }
.tabs { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.tabs button { border: none; background: transparent; color: var(--muted); padding: 6px 12px; white-space: nowrap; }
.tabs button.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.icon { border: none; background: transparent; font-size: 18px; }

.tab { display: none; flex: 1; min-height: 0; }
.tab.active { display: flex; flex-direction: column; }

/* mode picker */
.mode-picker { max-width: 900px; margin: 0 auto; padding: 32px 16px; width: 100%; overflow-y: auto; }
.mode-picker h2 { margin: 0 0 18px; }
.mode-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.mode-card { text-align: left; padding: 18px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.mode-card .emoji { font-size: 30px; }
.mode-card b { font-size: 17px; }
.mode-card small { color: var(--muted); }

/* chat */
.chat-view { display: flex; flex-direction: column; flex: 1; min-height: 0; max-width: 860px; width: 100%; margin: 0 auto; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.chat-head .who { flex: 1; }
.chat-head small { color: var(--muted); margin-left: 4px; }
.chat-head select { max-width: 45%; }
.scene { margin: 10px 12px 0; padding: 10px 14px; border-radius: 12px; background: var(--accent-soft); font-size: 14px; }
.scene b { color: var(--accent); }
.scene .hint { margin-top: 6px; }
.scene .samples { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px; }
.scene .samples button { padding: 3px 10px; font-size: 13px; border-radius: 999px; }
.messages { flex: 1; overflow-y: auto; padding: 16px 12px 8px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 82%; display: flex; flex-direction: column; gap: 6px; }
.msg.bot { align-self: flex-start; }
.msg.user { align-self: flex-end; align-items: flex-end; }
.bubble { padding: 10px 14px; border-radius: 16px; background: var(--bot); border: 1px solid var(--line); position: relative; }
.msg.user .bubble { background: var(--user); color: var(--user-ink); border-color: transparent; }
.bubble .replay { border: none; background: transparent; padding: 0 0 0 6px; font-size: 13px; opacity: .6; color: inherit; }
.card { font-size: 13.5px; border-radius: 12px; padding: 9px 12px; border: 1px solid var(--line); background: var(--panel); max-width: 100%; }
.card h4 { margin: 0 0 4px; font-size: 12.5px; letter-spacing: .02em; }
.card.grammar { background: var(--err-soft); border-color: transparent; }
.card.grammar.ok { background: var(--ok-soft); }
.card.natural { background: var(--nat); border-color: var(--nat-line); }
.card.tip { background: var(--tip); border-color: var(--tip-line); }
.card.coach { background: var(--coach); border-color: var(--coach-line); }
.card ul { margin: 4px 0 0; padding-left: 18px; }
.card li { margin: 2px 0; }
.diff del { color: var(--err); text-decoration: line-through; }
.diff ins { color: var(--ok); text-decoration: none; font-weight: 600; }
.tip-item { display: flex; gap: 8px; align-items: baseline; margin: 3px 0; }
.tip-item .en { font-weight: 600; }
.tip-item .ex { color: var(--muted); font-style: italic; }
.save { border: none; background: transparent; padding: 0 4px; font-size: 13px; }
.composer { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); background: var(--bg); }
.composer input { flex: 1; }
.mic { font-size: 20px; width: 48px; height: 44px; padding: 0; border-radius: 12px; }
.mic.rec { background: var(--err); color: #fff; border-color: var(--err); animation: pulse 1s infinite; }
.mic.big { width: 64px; height: 56px; font-size: 26px; }
.send { background: var(--accent); color: #fff; border-color: var(--accent); }
.mic-status { padding: 0 14px 8px; min-height: 20px; color: var(--muted); font-size: 13px; }
@keyframes pulse { 50% { opacity: .65; } }
.typing { color: var(--muted); font-size: 13px; padding-left: 4px; }

/* quiz */
.quiz-wrap { max-width: 720px; width: 100%; margin: 0 auto; padding: 24px 16px; overflow-y: auto; }
.quiz-filters, .bank-filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.quiz-card { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 22px; display: flex; flex-direction: column; gap: 12px; }
.q-type { font-size: 12px; color: var(--accent); font-weight: 600; text-transform: uppercase; }
.q-situation { font-size: 18px; font-weight: 600; }
.q-actions { display: flex; gap: 8px; }
.q-actions input { flex: 1; }
.q-result .verdict { font-weight: 700; font-size: 16px; }
.q-result .good { color: var(--ok); }
.q-result .bad { color: var(--err); }
.q-nav { display: flex; justify-content: space-between; }

/* bank */
.bank-filters { padding: 16px 16px 0; max-width: 960px; width: 100%; margin: 0 auto; }
.bank-list { overflow-y: auto; padding: 0 16px 24px; max-width: 960px; width: 100%; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; align-content: start; }
.exp { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; font-size: 14px; }
.exp .head { display: flex; justify-content: space-between; gap: 6px; }
.exp .en { font-weight: 700; font-size: 15px; }
.exp .type { font-size: 11px; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 1px 8px; white-space: nowrap; align-self: start; }
.exp .note { color: var(--muted); font-size: 13px; margin-top: 4px; }
.exp .ex { margin-top: 6px; font-size: 13px; }
.exp .ex i { color: var(--muted); }

/* notes */
.notes { max-width: 860px; width: 100%; margin: 0 auto; padding: 20px 16px; overflow-y: auto; }
.stat-row { display: flex; gap: 10px; flex-wrap: wrap; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; min-width: 120px; }
.stat b { display: block; font-size: 22px; }
.mistake { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; margin-bottom: 8px; }
.mistake .cnt { float: right; color: var(--err); font-weight: 700; }
.mistake .ex { font-size: 13px; margin-top: 4px; }

dialog { border: 1px solid var(--line); border-radius: 16px; background: var(--panel); color: var(--ink); width: min(440px, 92vw); }
dialog form { display: flex; flex-direction: column; gap: 10px; }
dialog label { display: flex; gap: 8px; align-items: center; }
dialog select { flex: 1; min-width: 0; }

@media (max-width: 600px) {
  .msg { max-width: 94%; }
  .brand { display: none; }
  .chat-head select { max-width: 40%; }
}

.depth { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.depth.deep { background: #1f3b6b; color: #dbe7ff; }
.card.fact { background: var(--panel); border-style: dashed; color: var(--muted); }
.card.upgrade { background: #eefaf3; border-color: #9fd9b7; }
.card.news { background: var(--accent-soft); border-color: transparent; }
.card.news a { color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { font-size: 12.5px; border: 1px solid var(--line); border-radius: 999px; padding: 1px 9px; background: var(--panel); color: var(--ink); text-decoration: none; }
@media (prefers-color-scheme: dark) { .card.upgrade { background: #183325; border-color: #2f6b4b; } }

.acct { white-space: nowrap; font-size: 13px; }
.err { color: var(--err); font-size: 13px; min-height: 18px; }
.row { display: flex; gap: 8px; }
dialog input { width: 100%; }
.qr svg { width: 180px; height: 180px; background: #fff; padding: 6px; border-radius: 8px; }
#publicUrl { word-break: break-all; font-size: 13px; }
.history { font-size: 13.5px; }
.history .day { margin: 12px 0 4px; font-weight: 700; color: var(--muted); }
.history .turn { padding: 4px 0; border-bottom: 1px solid var(--line); }
.history .u { color: var(--accent); }
.history .c { color: var(--ok); font-size: 12.5px; }
/* exam */
.exam-wrap { max-width: 820px; width: 100%; margin: 0 auto; padding: 20px 16px 40px; overflow-y: auto; }
.exam-pick h2 { margin-top: 8px; }
.opic-setup { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.opic-setup .chip { cursor: pointer; }
.opic-setup .chip.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.exam-run { display: flex; flex-direction: column; gap: 12px; }
.exam-head { display: flex; gap: 8px; align-items: center; }
.exam-head #exQuit { margin-left: auto; }
.ex-dir { font-size: 13px; }
.ex-display { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; font-size: 17px; line-height: 1.7; white-space: pre-wrap; }
.ex-display:empty { display: none; }
.ex-display .emoji { font-size: 44px; display: block; }
.ex-prompt { font-size: 17px; font-weight: 600; }
.ex-timer { display: flex; align-items: center; gap: 10px; }
.ex-timer .bar { flex: 1; height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.ex-timer #exBar { height: 100%; width: 0; background: var(--accent); transition: width .25s linear; }
.ex-timer.rec #exBar { background: var(--err); }
#exPhase { font-weight: 700; min-width: 64px; }
.ex-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ex-feedback .score { font-size: 28px; font-weight: 800; }
.rubric { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 10px; align-items: center; font-size: 13.5px; margin: 8px 0; }
.rubric .rb { height: 7px; background: var(--line); border-radius: 99px; overflow: hidden; }
.rubric .rb i { display: block; height: 100%; background: var(--ok); }
.model-tabs { display: flex; gap: 6px; margin: 6px 0; }
.model-tabs button.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.ex-nav { display: flex; justify-content: flex-end; }

.gender label { display: flex; gap: 4px; align-items: center; }
.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); max-width: min(520px, 92vw); background: var(--ink); color: var(--bg);
  padding: 10px 14px; border-radius: 14px; box-shadow: 0 6px 24px rgba(0,0,0,.25); font-size: 14px; z-index: 50; cursor: pointer; }
.toast b { display: block; font-size: 12px; opacity: .7; }

dialog input[type=radio], dialog input[type=checkbox], dialog input[type=range] { width: auto; }
.gender { gap: 16px; }
@media (max-width: 600px) {
  .acct .lbl { display: none; }
  .top { gap: 6px; padding: 8px 10px; }
  .tabs button { padding: 6px 8px; }
  .chat-head { flex-wrap: wrap; }
  .chat-head select { max-width: 100%; flex: 1 1 100%; order: 5; }
}

/* ---------- pebble & town ---------- */
.pebble-home { display: flex; gap: 16px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 16px 18px; margin-bottom: 22px; }
.pebble-home .pb-say { flex: 1; min-width: 0; }
.pebble-home .bubble-say { background: var(--accent-soft); border-radius: 14px; padding: 10px 14px; position: relative; font-size: 15px; }
.pebble-home .meta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; font-size: 13px; color: var(--muted); }
.meter { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; min-width: 120px; }
.meter i { display: block; height: 100%; background: linear-gradient(90deg, #ffb3c4, #ff5f87); }
.meter.xp i { background: linear-gradient(90deg, #ffd66b, #ff9f43); }
.town { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-bottom: 26px; }
.place { padding: 0; overflow: hidden; border-radius: 16px; text-align: left; background: var(--panel); }
.place svg { display: block; width: 100%; height: 100px; }
.place b { display: block; padding: 8px 12px; font-size: 14px; }
.place:hover { transform: translateY(-2px); transition: transform .15s; }
.place-dlg { padding: 0; overflow: hidden; width: min(520px, 94vw); }
.place-dlg form { padding: 0 0 14px; gap: 8px; }
.place-scene svg { display: block; width: 100%; height: 200px; }
.place-dlg h3, .place-opts, .place-dlg .ghost { margin: 0 16px; }
.place-opts { display: flex; flex-direction: column; gap: 8px; }
.place-opts button { text-align: left; }
.scene-banner { position: relative; height: 120px; overflow: hidden; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.scene-banner svg:first-child { width: 100%; height: 100%; display: block; }
.scene-banner .pb { position: absolute; right: 14px; bottom: 2px; }
.scene-banner .pb-name { position: absolute; right: 86px; bottom: 14px; background: rgba(255,255,255,.88); color: #222; font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 99px; }
.scene-banner .place-name { position: absolute; left: 12px; top: 10px; background: rgba(0,0,0,.45); color: #fff; font-size: 12px; padding: 2px 10px; border-radius: 99px; }
.msg.bot { flex-direction: row; align-items: flex-start; gap: 6px; }
.msg.bot .avatar { flex-shrink: 0; margin-top: -4px; }
.msg.bot .col { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pebble-page { max-width: 900px; width: 100%; margin: 0 auto; padding: 20px 16px 40px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.pb-hero { display: flex; gap: 18px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 18px; }
.pb-hero .info { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.pb-hero .name { font-size: 22px; font-weight: 800; }
.pb-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.quest { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.quest.done { color: var(--ok); }
.week { display: flex; align-items: flex-end; gap: 8px; height: 90px; }
.week div { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); }
.week i { width: 100%; background: var(--accent); border-radius: 6px 6px 2px 2px; min-height: 3px; }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.badge { border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; font-size: 13px; }
.badge.off { opacity: .35; filter: grayscale(1); }
.stats { font-weight: 700; }
@keyframes pop { 0% { transform: translate(-50%, 20px) scale(.9); opacity: 0 } 100% { transform: translate(-50%, 0) scale(1); opacity: 1 } }
.toast.cele { background: linear-gradient(90deg, #ff9f43, #ff5f87); color: #fff; animation: pop .3s ease-out; }
@media (max-width: 600px) {
  .scene-banner { height: 92px; }
  .town { grid-template-columns: repeat(2, 1fr); }
  .place svg { height: 84px; }
  .pebble-home { padding: 12px; gap: 10px; }
}

.pron .w { display: inline-block; margin: 2px 3px; padding: 1px 6px; border-radius: 6px; font-weight: 600; }
.pron .w.g { background: var(--ok-soft); color: var(--ok); }
.pron .w.m { background: #fff1d6; color: #b7791f; }
.pron .w.b { background: var(--err-soft); color: var(--err); }
.pron .ipa { font-family: "Doulos SIL", "Charis SIL", "Lucida Grande", sans-serif; color: var(--muted); font-size: 12px; }
.pron .score { font-size: 22px; font-weight: 800; }
.replay.shadow.rec { color: var(--err); animation: pulse 1s infinite; }
dialog { position: fixed; }
dialog form { position: relative; }
.dlg-x { position: absolute; top: -4px; right: -4px; width: 34px; height: 34px; padding: 0; border: none; border-radius: 50%;
  background: transparent; color: var(--muted); font-size: 18px; line-height: 34px; }
.dlg-x:hover { background: var(--accent-soft); color: var(--ink); }

/* ---------- MZ touch: rounded display font for titles, names, chips ---------- */
.brand, h2, h3, .mode-card b, .place b, .pb-hero .name, .pebble-home .bubble-say b, #pName, .tabs button,
.scene-banner .pb-name, .scene-banner .place-name, .stats, .q-situation, .score, .toast, .dlg-x + h3 {
  font-family: "Jua", "Pretendard Variable", sans-serif; font-weight: 400; letter-spacing: 0;
}
h2 { font-size: 26px; }
.bubble { border-radius: 20px; padding: 11px 15px; }
.msg.user .bubble { border-bottom-right-radius: 6px; }
.msg.bot .bubble { border-bottom-left-radius: 6px; }
.mode-card, .place, .card, .quiz-card { border-radius: 20px; }
button { font-family: inherit; }

.place-desc { margin: 0 16px; color: var(--ink); font-size: 14px; line-height: 1.6; }
.place-opts button small.optd { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.mode-hero { display: flex; align-items: center; gap: 12px; padding: 18px 16px 0; font-size: 42px; }
.mode-topics { margin: 0 16px; max-height: 120px; overflow-y: auto; }
/* ---------- grammar correction: easy to spot ---------- */
.card.grammar .fixed { font-size: 16px; line-height: 1.8; margin: 4px 0 6px; }
.card.grammar del, .diff del { color: #c62828; background: #ffe1e1; text-decoration: line-through; text-decoration-thickness: 2px; border-radius: 4px; padding: 0 3px; }
.card.grammar ins, .diff ins { color: #0b7a3b; background: #d7f7e3; font-weight: 800; text-decoration: none; border-radius: 4px; padding: 0 3px; }
.card.grammar .arrow { color: var(--muted); margin: 0 4px; }
.card.grammar ul { list-style: none; padding-left: 0; }
.card.grammar li { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; padding: 4px 0; border-top: 1px dashed rgba(0,0,0,.08); }
.card.grammar .cat { font-size: 11px; font-weight: 700; color: #fff; background: #ef6c6c; border-radius: 99px; padding: 1px 8px; white-space: nowrap; }
.card.grammar .why { color: var(--ink); }
@media (prefers-color-scheme: dark) {
  .card.grammar del, .diff del { color: #ffb4b4; background: #4a1f22; }
  .card.grammar ins, .diff ins { color: #a6f0c2; background: #173a27; }
}

/* ---------- readability: comfortable text on phone and desktop ---------- */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { font-size: 16.5px; line-height: 1.6; letter-spacing: 0; }
input, select, textarea { font-size: 16px; }           /* < 16px makes iPhone Safari zoom in on focus */
.muted, .typing, .mic-status, .err, .acct { font-size: 14px; }
.bubble { font-size: 17px; line-height: 1.55; }
.card { font-size: 14.5px; }
.card h4 { font-size: 13.5px; }
.chip { font-size: 13.5px; padding: 2px 10px; }
.scene { font-size: 15px; }
.scene .samples button { font-size: 14px; }
.mode-card small, .place-opts button small.optd { font-size: 14px; }
.mode-card b { font-size: 19px; }
.place b { font-size: 16px; }
.place-desc { font-size: 15.5px; }
.tabs button { font-size: 16px; }
.pebble-home .bubble-say { font-size: 16px; }
.pebble-home .meta, .quest, .badge { font-size: 14px; }
.toast { font-family: inherit; font-size: 15px; }
.history, .exp { font-size: 15px; }
.exp .en { font-size: 16px; }
.exp .note, .exp .ex, .mistake .ex { font-size: 14px; }
h2 { font-size: 27px; }
h2 small { font-family: "Pretendard Variable", sans-serif; font-size: 14px; }
@media (max-width: 600px) {
  body { font-size: 16px; }
  .bubble { font-size: 16.5px; }
  h2 { font-size: 23px; }
  .top { gap: 8px; padding: 8px 10px; }
  .tabs button { font-size: 15.5px; padding: 6px 9px; }
  .tabs { -webkit-mask-image: linear-gradient(to right, #000 82%, transparent); mask-image: linear-gradient(to right, #000 82%, transparent); padding-right: 24px; }
}

/* ---------- getting to know each other inside the chat: quick-reply chips ---------- */
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 2px; }
.quick button { border-radius: 999px; padding: 8px 16px; font-size: 16px; background: var(--panel); border: 1.5px solid var(--accent); color: var(--accent); }
.quick button:hover, .quick button:active { background: var(--accent); color: #fff; }
.ob-hint { font-size: 14px; color: var(--muted); padding-left: 4px; }
