/* OPIc in the EUM Business English style: light grey page, white rounded cards, coral accent, Inter + Noto Sans KR.
   Replaces base.css / preview.css / readability.css (kept in the folder, no longer loaded). */
:root {
  --bg: #f5f6f9; --card: #ffffff; --card-hi: #fff6f3; --line: #dfe3ea; --line-soft: #eceff4;
  --ink: #1b2233; --dim: #5a6273; --muted: #8a91a0;
  --pen: #e8553f; --pen-soft: rgba(232, 85, 63, .10); --pen-line: rgba(232, 85, 63, .45);
  --ko: #b5730f; --ko-dim: #a08454; --warm: #fff8ec;
  --font: Inter, "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  --col: 760px; --gutter: max(16px, calc((100% - var(--col)) / 2));
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); font-weight: 500; word-break: keep-all; overflow-wrap: break-word; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { opacity: .45; cursor: default; }
a { color: inherit; -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--pen); outline-offset: 3px; }
[hidden] { display: none !important; }
p { line-height: 1.75; }

.pill { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-size: 14px; font-weight: 700; white-space: nowrap; text-decoration: none; }
.pill:hover { background: var(--bg); }
.eyebrow { font-size: 12px; font-weight: 800; letter-spacing: .14em; color: var(--pen); }

/* ---------- first page ---------- */
.app-header { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 68px;
  padding: calc(12px + env(safe-area-inset-top)) var(--gutter) 12px; background: rgba(255, 255, 255, .96); box-shadow: 0 1px 0 var(--line), 0 6px 18px rgba(27, 34, 51, .05); }
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; color: var(--ink); }
.brand img { border-radius: 11px; box-shadow: 0 4px 10px rgba(27, 34, 51, .15); }
.brand strong { display: block; font-size: 19px; line-height: 1; font-weight: 800; letter-spacing: .06em; }
.brand small { display: block; margin-top: 5px; color: var(--dim); font-size: 10.5px; font-weight: 700; letter-spacing: .22em; }
.library { padding: 28px var(--gutter) 56px; }
.hero { position: relative; overflow: hidden; padding: 30px 32px; border-radius: 24px; border: 1px solid var(--line);
  background: linear-gradient(125deg, #fff 0%, #fff4ef 60%, #ffe7de 100%); box-shadow: 0 10px 28px rgba(27, 34, 51, .06); }
.hero:after { content: ""; position: absolute; right: -70px; bottom: -95px; width: 240px; height: 240px; border-radius: 50%; border: 42px solid rgba(232, 85, 63, .14); pointer-events: none; }
.studio { position: relative; color: var(--pen); font-size: 11px; letter-spacing: .21em; font-weight: 800; }
.hero h1 { position: relative; margin: 10px 0 0; font-size: clamp(27px, 3.6vw, 36px); line-height: 1.16; font-weight: 800; letter-spacing: -.035em; }
.hero p { position: relative; margin: 8px 0 0; color: var(--dim); font-size: 15px; }
.books-list { display: grid; gap: 12px; margin-top: 16px; }
.book-card { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 20px; padding: 22px 24px 22px 84px;
  border-radius: 20px; background: var(--card); border: 1px solid var(--line); text-decoration: none; color: var(--ink); box-shadow: 0 4px 14px rgba(27, 34, 51, .04); transition: border-color .18s, transform .18s, background .18s; }
.book-card:hover { border-color: var(--pen-line); background: var(--card-hi); transform: translateY(-2px); }
.book-n { position: absolute; left: 22px; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px;
  background: var(--pen-soft); border: 1px solid var(--pen-line); color: var(--pen); font-size: 15px; font-weight: 800; }
.book-card h2 { margin: 0 0 4px; font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.book-card p { margin: 0; color: var(--dim); font-size: 14.5px; line-height: 1.5; }
.open { padding: 8px 16px; border-radius: 999px; border: 1px solid var(--pen); color: var(--pen); font-size: 13px; font-weight: 800; white-space: nowrap; }
.units { margin-top: 16px; padding: 20px; border-radius: 22px; background: var(--card); border: 1px solid var(--line); box-shadow: 0 4px 14px rgba(27, 34, 51, .04); }
.unit-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.unit { display: block; min-height: 84px; padding: 14px 15px; border-radius: 14px; background: var(--bg); border: 1px solid var(--line-soft); text-decoration: none; color: var(--ink); transition: border-color .15s, background .15s; }
.unit:hover { border-color: var(--pen-line); background: var(--card-hi); }
.unit span { display: block; margin-bottom: 6px; color: var(--pen); font-size: 12px; font-weight: 800; letter-spacing: .05em; }
.unit strong { display: block; font-size: 16px; line-height: 1.38; font-weight: 700; }
.copyright { margin: 26px 4px 0; color: var(--muted); font-size: 12px; text-align: center; }

/* ---------- unit ---------- */
.stage { position: sticky; top: 0; z-index: 5; padding: calc(12px + env(safe-area-inset-top)) var(--gutter) 0; background: #fff; box-shadow: 0 1px 0 var(--line), 0 6px 18px rgba(27, 34, 51, .05); }
.stage-top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; min-height: 40px; }
.stage-top .pill:first-child { justify-self: start; }
.stage-top .pill:last-child { justify-self: end; }
.kicker { color: var(--pen); font-size: 11.5px; font-weight: 800; letter-spacing: .14em; white-space: nowrap; text-transform: uppercase; }
.title { margin: 8px 0 0; padding-bottom: 14px; text-align: center; font-size: clamp(21px, 2.4vw, 26px); line-height: 1.25; font-weight: 800; letter-spacing: -.025em; }
.tabs { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; padding: 0 0 14px; }
.tabs button { min-height: 36px; padding: 7px 15px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--dim); font-size: 14px; font-weight: 700; }
.tabs button:hover { color: var(--ink); background: var(--bg); }
.tabs button.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.content { padding: 20px var(--gutter) 110px; outline: none; }
#loading { color: var(--dim); }
.sec-h { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; margin: 4px 2px 12px; font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.sec-h small { color: var(--muted); font-size: 13px; font-weight: 600; letter-spacing: 0; }
.card { padding: 22px 24px; border-radius: 20px; background: var(--card); border: 1px solid var(--line); box-shadow: 0 4px 14px rgba(27, 34, 51, .04); }
.card + .card { margin-top: 14px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 10px 18px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-size: 15px; font-weight: 700; }
.btn:hover:not(:disabled) { background: var(--bg); }
.btn.primary { background: var(--pen); border-color: var(--pen); color: #fff; }
.btn.primary:hover:not(:disabled) { background: #f06a55; }
.link { padding: 6px 2px; border: 0; background: none; color: var(--dim); font-size: 14px; font-weight: 600; text-decoration: underline; text-underline-offset: 4px; }
.danger { color: #b8432f; }
.inline-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

/* tips */
.tips-paper p { margin: 0 0 16px; color: var(--ink); font-size: 16px; line-height: 1.9; }
.tips-paper p:last-child { margin-bottom: 0; }

/* key expressions */
.expression-paper { padding: 6px 22px; }
.expression-table { width: 100%; border-collapse: collapse; }
.expression-table th { padding: 14px 0 10px; border-bottom: 1px solid var(--line); text-align: left; color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: .1em; }
.expression-table th:first-child { width: 38%; }
.expression-table td { padding: 14px 0; border-bottom: 1px solid var(--line-soft); vertical-align: middle; line-height: 1.6; }
.expression-table tr:last-child td { border-bottom: 0; }
.expression-table td:first-child { padding-right: 16px; color: var(--ko); font-family: "Noto Sans KR", var(--font); font-size: 15px; font-weight: 700; }
.expression-en { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.expression-en span { font-size: 17px; font-weight: 600; }
.listen-small { flex-shrink: 0; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--pen-soft); color: var(--pen); font-size: 13px; }
.listen-small:hover { border-color: var(--pen-line); }

/* sentence expansion */
.studio-top { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 13px; font-weight: 700; }
.stage-tabs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin: 18px 0 20px; }
.stage-tabs button { padding: 10px 4px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg); color: var(--dim); text-align: center; line-height: 1.4; }
.stage-tabs button b { display: block; font-size: 15px; color: var(--ink); }
.stage-tabs button small { display: block; font-size: 11.5px; }
.stage-tabs button[aria-selected=true] { background: var(--ink); border-color: var(--ink); color: #dfe3ea; }
.stage-tabs button[aria-selected=true] b { color: #fff; }
.stage-tabs button.visited:not([aria-selected=true]) { border-color: var(--pen-line); }
#stage-label { color: var(--pen); font-size: 13px; font-weight: 800; }
#stage-text { min-height: 110px; margin: 10px 0 20px; font-size: 22px; line-height: 1.75; font-weight: 600; letter-spacing: -.01em; white-space: pre-wrap; }
#stage-text .new-chunk { background: var(--warm); box-shadow: inset 0 -3px 0 #f6d58f; border-radius: 4px; padding: 1px 3px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.studio-actions { display: flex; justify-content: space-between; gap: 10px; }
.studio-bottom { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line-soft); }

/* reading (full example, samples) */
.read-paragraph { margin: 4px 0 20px; font-size: 19px; line-height: 1.95; color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; }
.read-paragraph .reading { background: #fdeccf; border-radius: 4px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.persona-tabs { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid var(--line-soft); }
.persona-tabs button { min-height: 38px; padding: 8px 15px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--dim); font-size: 14px; font-weight: 700; }
.persona-tabs button[aria-selected=true] { background: var(--pen); border-color: var(--pen); color: #fff; }

/* your turn */
.turn-top { display: flex; justify-content: space-between; align-items: center; }
#fill-count { color: var(--pen); font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; }
.blank-template { margin: 16px 0 8px; font-size: 19px; line-height: 2.9; overflow-wrap: anywhere; }
.blank-input { display: inline-block; width: 11ch; max-width: 100%; margin: 0 3px; padding: 4px 9px; border: 0; border-bottom: 2px solid var(--pen); border-radius: 6px 6px 0 0; background: var(--card-hi); color: #b8432f; font-size: 18px; line-height: 1.6; vertical-align: baseline; box-sizing: content-box; }
.blank-input::placeholder { color: #c98a7c; font-size: 14px; }
.save-note { min-height: 20px; margin: 4px 0 14px; color: var(--muted); font-size: 13px; }
.answer-preview { padding: 16px 18px; margin-bottom: 16px; border-radius: 14px; background: var(--warm); border-left: 3px solid #f6d58f; }
.answer-preview p { margin: 6px 0 0; font-size: 17px; line-height: 1.85; white-space: pre-wrap; overflow-wrap: anywhere; }
.record-title { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.record-title h3 { margin: 0; font-size: 18px; font-weight: 800; }
#timer { color: var(--pen); font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.record-button { background: var(--pen); border-color: var(--pen); color: #fff; }
.record-button.recording { background: #b8432f; animation: pulse 1.5s infinite; }
#record-status { margin: 12px 0 0; color: var(--dim); font-size: 14px; }
#recording audio { width: 100%; margin-top: 14px; }
.saved-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 8px; font-size: 13px; color: var(--muted); }
.saved-actions > span { flex: 1; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(232, 85, 63, .18); } }

/* audio bar and settings */
.audio-bar { position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 20; display: flex; align-items: center; gap: 14px;
  max-width: calc(100vw - 24px); padding: 10px 12px 10px 18px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 14px; font-weight: 600; box-shadow: 0 10px 30px rgba(27, 34, 51, .25); }
.audio-bar button { padding: 8px 14px; border: 0; border-radius: 999px; background: #fff; color: var(--ink); font-size: 13px; font-weight: 800; white-space: nowrap; }
dialog { width: calc(100% - 32px); max-width: 560px; padding: 24px 26px; border: 1px solid var(--line); border-radius: 24px; background: #fff; color: var(--ink); box-shadow: 0 20px 60px rgba(27, 34, 51, .22); }
dialog::backdrop { background: rgba(27, 34, 51, .35); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.dialog-head h2 { margin: 0; font-size: 22px; font-weight: 800; }
dialog p { color: var(--dim); font-size: 15px; }
.voice-options { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 18px; }
.voice-options label { flex: 1; min-width: 180px; font-size: 14px; font-weight: 700; }
.voice-options select { display: block; width: 100%; margin-top: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; font-size: 14px; }

/* ---------- phone ---------- */
@media (max-width: 600px) {
  .app-header { min-height: 62px; }
  .brand img { width: 34px; height: 34px; }
  .library { padding-top: 18px; }
  .hero { padding: 24px 22px; border-radius: 20px; }
  .hero h1 { font-size: 28px; }
  .hero:after { right: -110px; bottom: -130px; width: 220px; height: 220px; border-width: 36px; }
  .book-card { grid-template-columns: 1fr; row-gap: 10px; padding: 18px 18px 18px 74px; }
  .book-n { left: 16px; top: 24px; transform: none; width: 42px; height: 42px; }
  .book-card h2 { font-size: 20px; }
  .open { justify-self: start; padding: 6px 13px; font-size: 12.5px; }
  .units { padding: 14px; border-radius: 18px; }
  .unit-grid { grid-template-columns: 1fr; gap: 8px; }
  .unit { min-height: 0; display: flex; align-items: baseline; gap: 12px; padding: 13px 14px; }
  .unit span { margin: 0; min-width: 62px; white-space: nowrap; }
  .stage-top { grid-template-columns: auto 1fr auto; }
  .kicker { display: none; }
  .pill { min-height: 34px; padding: 6px 12px; font-size: 13px; }
  .title { font-size: 20px; padding-bottom: 12px; margin-top: 6px; }
  .tabs { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; margin: 0 -16px; padding: 0 16px 12px; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs button { flex: 0 0 auto; font-size: 13.5px; padding: 6px 13px; }
  .content { padding-top: 16px; }
  .card { padding: 18px 16px; border-radius: 18px; }
  .expression-paper { padding: 4px 14px; }
  .expression-table td:first-child { font-size: 14px; }
  .expression-en span { font-size: 15.5px; }
  .stage-tabs { gap: 4px; }
  .stage-tabs button { padding: 8px 2px; border-radius: 12px; }
  .stage-tabs button b { font-size: 13.5px; }
  .stage-tabs button small { font-size: 10px; }
  #stage-text { font-size: 19px; min-height: 130px; }
  .read-paragraph { font-size: 17.5px; }
  .blank-template { font-size: 17px; line-height: 3.1; }
  .blank-input { font-size: 16px; width: 9ch; }
  .btn { font-size: 14px; padding: 10px 15px; }
}
@media (prefers-reduced-motion: reduce) { *, *:before, *:after { animation: none !important; transition: none !important; } }

/* speed buttons in the unit header (same look as Business English) */
.speeds { justify-self: end; display: flex; gap: 2px; padding: 3px; border-radius: 999px; border: 1px solid var(--line); background: #fff; }
.speeds button { min-height: 30px; padding: 4px 10px; border: 0; border-radius: 999px; background: none; color: var(--dim); font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.speeds button:hover { color: var(--ink); }
.speeds button.on { background: #f6d58f; color: #3b2a05; }
.record-note { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
@media (max-width: 600px) { .speeds button { padding: 4px 7px; font-size: 12px; } }
