/* Brand from cuevy.work: ink, violet, cream, lime. The theme is the account's choice on <html>
   (data-theme light or dark). Without one, home and result follow the system and the live
   screen is dark ink, with the answer card the brightest thing on it, so a laptop on a meeting
   table reads at a glance and draws little attention from across it. */
@font-face {
  font-family: "Pretendard Variable"; font-weight: 45 920; font-style: normal; font-display: swap;
  src: url("/fonts/PretendardVariable-1.3.9.woff2") format("woff2-variations");
}
:root {
  --bg: #f7f6ff; --surface: #ffffff; --raised: #fbfaff; --text: #191b2e; --muted: #5a5c73; --line: #e3e0f5;
  --accent: #7456f6; --accent-strong: #4b30d6; --accent-text: #ffffff; --chip: #eeeafe; --chip-text: #4b30d6;
  --lime: #c9f36b; --lime-text: #191b2e; --good: #2f7d32; --warn: #a15c00; --danger: #c62828;
  --shadow: 0 1px 2px rgb(25 27 46 / 0.04), 0 4px 16px rgb(25 27 46 / 0.04);
  --card-bg: #ffffff; --answer: #191b2e; --signal: #2f7d32; --meter: #7456f6; --hover: #4b30d6; --radius: 14px; --gap: 16px;
  font-family: "Pretendard Variable", Pretendard, system-ui, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  color-scheme: light;
}
/* The same dark tokens twice: a media query cannot share a rule with a selector. */
:root[data-theme=dark], :root:not([data-theme]):has(> body > #live:not([hidden])) {
  --bg: #14152a; --surface: #1c1d36; --raised: #22244a; --text: #ecebf7; --muted: #a6a8c4; --line: #2f3156;
  --accent: #7456f6; --accent-strong: #b9a8ff; --chip: #2a2a52; --chip-text: #d4cbff; --good: #c9f36b;
  --warn: #ffb74d; --danger: #ff8a80; --shadow: none; --card-bg: #1f2045; --answer: #ffffff; --signal: #c9f36b;
  --meter: #c9f36b; --hover: #8a70ff; color-scheme: dark; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #14152a; --surface: #1c1d36; --raised: #22244a; --text: #ecebf7; --muted: #a6a8c4; --line: #2f3156;
    --accent: #7456f6; --accent-strong: #b9a8ff; --chip: #2a2a52; --chip-text: #d4cbff; --good: #c9f36b;
    --warn: #ffb74d; --danger: #ff8a80; --shadow: none; --card-bg: #1f2045; --answer: #ffffff; --signal: #c9f36b;
    --meter: #c9f36b; --hover: #8a70ff; color-scheme: dark; }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }  /* button and label rules below must not bring hidden things back */
body { margin: 0; background: var(--bg); color: var(--text); font-size: 16px; line-height: 1.55;
  letter-spacing: -0.01em; word-break: keep-all; overflow-wrap: anywhere; -webkit-font-smoothing: antialiased; }
h1 { font-size: 1.2rem; margin: 0; letter-spacing: -0.03em; }
h2 { font-size: 1rem; margin: 0 0 10px; letter-spacing: -0.02em; }
p { margin: 0 0 6px; }
a { color: var(--accent-strong); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
time, .gauge-text, #live-elapsed, .event-time { font-variant-numeric: tabular-nums; }
.screen { padding: 16px 20px 24px; max-width: 1400px; margin: 0 auto; }
.narrow { max-width: 420px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.warning { color: var(--warn); }

/* Controls */
button, .button { font: inherit; font-weight: 600; padding: 9px 16px; border-radius: 10px; border: 1px solid var(--accent);
  background: var(--accent); color: var(--accent-text); cursor: pointer; display: inline-block; text-decoration: none; line-height: 1.3; }
button:hover, .button:hover { background: var(--hover); border-color: var(--hover); }
button.danger { background: transparent; color: var(--danger); border-color: currentColor; }
button.danger:hover { background: transparent; opacity: 0.8; }
button.link { background: none; border: none; color: var(--accent-strong); padding: 0 4px; font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }
button.link:hover { background: none; }
button.link.danger-link { color: var(--danger); }
/* A button with a menu of other ways to do it (미팅 종료 ▾ › 미팅 취소) */
.split { position: relative; display: inline-flex; }
.split > button:first-child { border-radius: 10px 0 0 10px; }
.split > button:nth-child(2) { border-radius: 0 10px 10px 0; border-left-width: 0; padding: 9px 10px; }
.split-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 10; min-width: 240px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 24px rgb(20 21 42 / 0.25); }
.split-menu button { display: block; width: 100%; text-align: left; background: none; border: none; color: var(--danger); padding: 9px 10px; border-radius: 8px; }
.split-menu button:hover { background: var(--chip); border: none; }
.split-menu button span { display: block; color: var(--muted); font-size: 0.8rem; font-weight: 400; margin-top: 2px; }
button:disabled { opacity: 0.5; cursor: default; }
input, select, textarea { font: inherit; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); width: 100%; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
label { display: block; font-size: 0.92rem; }
label > input, label > select { margin-top: 4px; }
.check { display: flex; gap: 8px; align-items: center; }
.check > input { margin-top: 0; }
.stack > * + * { margin-top: 14px; }
.chip { display: inline-block; background: var(--chip); color: var(--chip-text); border: none; border-radius: 999px; padding: 3px 11px; font-size: 0.85rem; font-weight: 500; }
button.chip:hover { background: var(--chip); filter: brightness(0.96); }
a.chip { text-decoration: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.badge { display: inline-block; margin-left: 6px; font-size: 0.72rem; font-weight: 500; border: 1px solid var(--line); border-radius: 999px; padding: 0 7px; vertical-align: 1px; }
.hint { color: var(--accent-strong); font-weight: 500; font-size: 0.85rem; }

/* Top bar with the brand */
.topbar { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; margin-bottom: var(--gap); min-height: 44px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.1rem; letter-spacing: -0.04em; color: var(--text); text-decoration: none; }
.brand img { width: 30px; height: 30px; border-radius: 9px; }
.topbar .controls { margin-left: auto; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.theme-button { margin-left: auto; text-decoration: none; font-size: 1.15rem; padding: 2px 6px; }
.controls .theme-button { margin-left: 0; }
.theme-button + .menu-button { margin-left: 4px; }
.menu-button { margin-left: auto; }
.topbar .controls + .menu-button { margin-left: 8px; }
.status { font-weight: 600; font-size: 0.85rem; padding: 3px 10px; border-radius: 999px; background: var(--chip); color: var(--chip-text); }
.status:empty { display: none; }
.status[data-state=listening] { background: var(--lime); color: var(--lime-text); }
.status[data-state=error], .status[data-state=reconnecting] { background: transparent; color: var(--warn); border: 1px solid currentColor; }

/* Sign-in */
#login { padding-top: 14vh; text-align: center; }
#login .brand { justify-content: center; font-size: 1.6rem; margin-bottom: 6px; }
#login .brand img { width: 52px; height: 52px; border-radius: 14px; }
#login > .muted { margin-bottom: 28px; }
#login .button { display: block; text-align: center; margin-bottom: 16px; padding: 12px; }
#login form { text-align: left; }

/* Screen 1: home */
.home-grid { display: grid; gap: var(--gap); grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); align-items: start; }
.deck-list { list-style: none; padding: 0; margin: 12px 0 0; }
.deck-list li { padding: 10px 0; border-top: 1px solid var(--line); }
.events { list-style: none; margin: 0 0 8px; padding: 0; }
.event { display: grid; grid-template-columns: 110px 1fr; gap: 2px 10px; width: 100%; text-align: left; font-weight: 500;
  background: var(--surface); color: var(--text); border: 1px solid var(--line); margin-bottom: 6px; }
.event:hover { background: var(--raised); border-color: var(--accent); }
.event .muted { grid-column: 2; font-weight: 400; }
.event.picked { border-color: var(--accent); background: var(--chip); }
.event-time { color: var(--muted); font-size: 0.9rem; }
.brief { margin: 6px 0; }
.brief summary { cursor: pointer; color: var(--accent-strong); font-size: 0.9rem; }
.brief h3 { font-size: 0.85rem; margin: 10px 0 4px; color: var(--muted); }
.brief ul { margin: 0; padding-left: 18px; font-size: 0.9rem; }
.brief .chip, .brief .badge { margin-left: 6px; }
.past { list-style: none; margin: 0; padding: 0; }
.past li { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); }
.past-actions { margin-left: auto; display: flex; gap: 2px; flex: none; }
.past-actions .link { font-size: 0.85rem; }
.past a { color: var(--text); text-decoration: none; font-weight: 500; }
.past a:hover { color: var(--accent-strong); }
.row { display: grid; grid-template-columns: 2fr 1fr; gap: 10px; }
button.primary { width: 100%; padding: 13px; font-size: 1.02rem; }
.goal-editor { border: 1px solid var(--line); border-radius: 12px; padding: 8px 14px 12px; background: var(--raised); }
.goal-editor legend { font-weight: 600; font-size: 0.92rem; padding: 0 4px; }
.goal-rows { list-style: none; margin: 0; padding: 0; }
.goal-rows > li + li { border-top: 1px solid var(--line); }
.goal-row { display: grid; grid-template-columns: minmax(80px, 1fr) 3fr auto; gap: 6px; padding: 6px 0; }
.goal-row input { padding: 7px 9px; font-size: 0.9rem; }
.goal-row input[name=goal-done] { grid-column: 2 / 3; font-size: 0.85rem; color: var(--muted); }
.goal-row > button { grid-column: 3; grid-row: 1; }
.goal-row .goal-source { grid-column: 2 / 3; justify-self: start; margin-left: 0; }
.mic-check { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.meter { width: 160px; height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.meter-fill { height: 100%; width: 0; background: var(--accent); transition: width 0.1s linear; }
.notice summary { cursor: pointer; color: var(--muted); font-size: 0.9rem; }
.notice p { background: var(--chip); border-radius: 10px; padding: 10px 12px; margin-top: 6px; }

/* Screen 2: live. Laptop: answer card large on the left with captions under it, goal board on
   the right. Phone and iPad portrait: goals fold into one strip above the card (02 3.2). */
/* The screen fills the window; captions take what the card leaves. */
.live { display: flex; flex-direction: column; height: 100vh; height: 100dvh; min-height: 560px; }
.live-grid { flex: 1; min-height: 0; display: grid; gap: var(--gap); grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
  grid-template-areas: "card board" "captions board"; grid-template-rows: minmax(min(46vh, 420px), auto) minmax(0, 1fr); }
.live > .warning { background: rgb(255 183 77 / 0.12); border-radius: 10px; padding: 8px 12px; }
.live .topbar h1 { font-size: 1.15rem; }
#live-elapsed { font-size: 0.95rem; }
.live .controls .check { font-size: 0.88rem; color: var(--muted); }
.card { grid-area: card; display: flex; flex-direction: column; justify-content: center; padding: 26px 30px;
  background: var(--card-bg); border: 2px solid var(--accent); box-shadow: 0 0 0 6px rgb(116 86 246 / 0.12); overflow-y: auto; }
.captions { grid-area: captions; display: flex; flex-direction: column; min-height: 0; padding: 12px 16px; }
.board { grid-area: board; overflow-y: auto; }
.live.lite .live-grid { grid-template-columns: 1fr; grid-template-areas: "captions"; grid-template-rows: minmax(0, 1fr); }
.live.lite .card, .live.lite .board, .live.lite .caption .ask { display: none; }
.card-kind { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.02em; color: var(--accent-strong); margin-bottom: 4px; }
.card.suggest .card-kind { color: var(--signal); }
.card.emphasis .card-kind { color: var(--warn); }
.card-heard { color: var(--muted); font-size: 0.95rem; margin-bottom: 10px; }
.card-answer p { font-size: clamp(1.4rem, 1.1rem + 0.9vw, 1.75rem); line-height: 1.4; font-weight: 650; letter-spacing: -0.025em; margin: 4px 0; color: var(--answer); }
.card-answer p.muted { color: var(--muted); font-weight: 500; font-size: 1.1rem; }
.card-source { margin-top: 14px; }
.card-source .quote { color: var(--muted); font-size: 0.85rem; }
.card-follow { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 1.08rem; }
.card-follow strong { color: var(--signal); margin-right: 4px; }
.card-empty { color: var(--muted); font-size: 1.05rem; text-align: center; }
.card .chips { justify-content: flex-start; }
.captions h2 { margin: 0 0 4px; font-size: 0.85rem; color: var(--muted); }
.captions-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.caption { display: grid; grid-template-columns: 48px 1fr auto; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.caption time { color: var(--muted); font-size: 0.78rem; padding-top: 3px; }
.caption .original { margin: 0; }
.caption .translation { color: var(--accent-strong); font-size: 0.93rem; margin: 2px 0 0; }
.caption .ask { background: none; color: var(--muted); border: 1px solid var(--line); padding: 2px 8px; font-size: 0.78rem; font-weight: 500; align-self: start; }
.caption .ask:hover { color: var(--text); border-color: var(--accent); background: none; }
.caption.interim { color: var(--muted); font-style: italic; display: block; padding: 6px 0; }
.caption.note p, .caption.gap p { color: var(--muted); grid-column: 2 / 4; }
.caption.jumped { background: var(--chip); border-radius: 6px; }
.memo { margin-top: 8px; }

/* Goal board (01 기능 3) */
.board h2 { display: flex; align-items: baseline; gap: 6px; }
.gauge { position: relative; height: 10px; border-radius: 999px; background: var(--line); overflow: hidden; margin: 4px 0 8px; }
.gauge-fill { position: absolute; inset: 0 auto 0 0; background: var(--meter); z-index: 1; }
.gauge-partial { position: absolute; top: 0; bottom: 0; left: 0; background: var(--meter); opacity: 0.3; }
.gauge-text { margin-bottom: 4px; }
.gauge-text strong { font-size: 1.6rem; letter-spacing: -0.03em; margin-right: 4px; }
.goals { list-style: none; margin: 8px 0 0; padding: 0; }
.goal { display: grid; grid-template-columns: 30px 1fr; gap: 6px; padding: 10px 4px; border-top: 1px solid var(--line); }
.goal .mark { background: none; border: none; color: var(--muted); font-size: 1.25rem; padding: 0; line-height: 1.2; font-weight: 400; }
.goal.secured .mark, .goal.partial .mark { color: var(--good); }
.goal-label { font-weight: 600; margin: 0; }
.goal .summary { display: block; text-align: left; color: var(--text); text-decoration: none; padding: 0; font-size: 0.93rem; font-weight: 400; }
.goal.open .goal-label { color: var(--muted); }
.goal.suggested { background: rgb(116 86 246 / 0.16); border-radius: 10px; border-top-color: transparent; }
.keypoints { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.keypoints h3 { font-size: 0.88rem; margin: 0 0 6px; }
.chip.covered { background: var(--lime); color: var(--lime-text); }
.goal-strip { display: none; }

/* Screen 3: result */
#result { max-width: 1040px; }
.result-body { display: grid; gap: var(--gap); }
#result .brand + h1 { padding-left: 14px; border-left: 1px solid var(--line); }
.brand-mark { border-radius: 8px; }
.result-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.result-actions .danger { margin-left: auto; }
.goal-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.goal-table th, .goal-table td { text-align: left; padding: 10px 8px; border-top: 1px solid var(--line); vertical-align: top; }
.goal-table th { color: var(--muted); font-weight: 500; font-size: 0.82rem; border-top: none; }
.goal-table tr.secured td:nth-child(2) { color: var(--good); font-weight: 600; }
.goal-table .link { text-align: left; text-decoration: none; color: var(--muted); }
.result-transcript { max-height: 60vh; margin-top: 8px; }
.copy-box { width: 100%; min-height: 200px; font: 0.85rem/1.4 ui-monospace, monospace; }

/* Settings dialog */
dialog { max-width: 420px; width: calc(100% - 32px); color: var(--text); background: var(--surface); }
dialog::backdrop { background: rgb(20 21 42 / 0.45); }
dialog > * + * { margin-top: 10px; }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; flex-wrap: wrap; }

@media (max-width: 1023px) {
  /* Phone and iPad portrait: a goal strip, the card, then captions in the space left. */
  .live-grid { grid-template-columns: 1fr; grid-template-areas: "board" "card" "captions";
    grid-template-rows: auto auto minmax(180px, 1fr); }
  .card { min-height: 38vh; padding: 20px; }
  .board { padding: 10px 14px; }
  .board:not(.open) .board-full { display: none; }
  .goal-strip { display: flex; align-items: center; gap: 8px; width: 100%; background: none; border: none; padding: 2px 0;
    color: var(--text); font-weight: 500; text-align: left; overflow-x: auto; scrollbar-width: none; }
  .goal-strip:hover { background: none; }
  .goal-strip strong { font-size: 1.05rem; color: var(--signal); white-space: nowrap; }
  .goal-strip .chip { white-space: nowrap; flex: none; background: var(--raised); color: var(--muted); }
  .goal-strip .chip.secured, .goal-strip .chip.partial { color: var(--good); }
  .board.open .goal-strip { margin-bottom: 8px; }
}
@media (max-width: 767px) {
  .screen { padding: 12px 14px 20px; }
  .home-grid { grid-template-columns: 1fr; }
  .home-grid > article { order: -1; }  /* on a phone the new meeting comes first */
  .row { grid-template-columns: 1fr; }
  .topbar .controls { margin-left: 0; width: 100%; }
  .live .topbar .controls { width: auto; margin-left: auto; }
  .card { padding: 18px; }
  .goal-row { grid-template-columns: 1fr auto; }
  .goal-row input[name=goal-label] { grid-column: 1; grid-row: 1; }
  .goal-row > button { grid-column: 2; grid-row: 1; }
  .goal-row input[name=goal-question], .goal-row input[name=goal-done], .goal-row .goal-source { grid-column: 1 / -1; }
  .goal-table thead { display: none; }
  .goal-table td { display: block; border: none; padding: 2px 0; }
  .goal-table tr { display: block; border-top: 1px solid var(--line); padding: 8px 0; }
}
