/* maRme — 공통 스타일 */

/* ---------- 글꼴: 에스코어드림 ---------- */
@font-face { font-family: 'SCoreDream'; font-weight: 400; font-display: swap;
  src: url('https://fastly.jsdelivr.net/gh/projectnoonnu/noonfonts_six@1.2/S-CoreDream-4Regular.woff') format('woff'); }
@font-face { font-family: 'SCoreDream'; font-weight: 700; font-display: swap;
  src: url('https://fastly.jsdelivr.net/gh/projectnoonnu/noonfonts_six@1.2/S-CoreDream-6Bold.woff') format('woff'); }

/* ---------- 테마 (노션 브랜딩 기준) ---------- */
:root { --red: #E24B4A; --rec: #F0453F; --amber: #c98a12; }
/* 공개 전: 아이보리 */
[data-theme="before"] {
  --bg: #F7EFE3; --surface: #FFFCF7; --line: #E6D6C4; --text: #2A1A24; --muted: #6E5663;
  --accent: #E58AA8; --accent-ink: #2A1020; --accent-text: #B8577A;
  --pill: #F4C0D1; --pill-ink: #2A1A24; --screen: #FBE3EA; --input: #fff;
  --chip: #2A1A24; --chip-ink: #F7EFE3; --chip-lt: #fff; --chip-lt-ink: #2A1A24;
  --off-bg: #EADBCB; --off-ink: #6E5663; --dim: #2A1A2466;
  --ok-bg: #d6f2e4; --ok-ink: #1d6b4a; --no-bg: #fbdcdc; --no-ink: #9b2a2a; --wait-bg: #fbedc8; --wait-ink: #7a5600;
}
/* 공개 후: 짙은 자주 */
[data-theme="after"] {
  --bg: #1C1220; --surface: #2a1d30; --line: #3d2c44; --text: #f6eef3; --muted: #b9a6b6;
  --accent: #E58AA8; --accent-ink: #2A1020; --accent-text: #F4C0D1;
  --pill: #9B5C74; --pill-ink: #fff; --screen: #2a1d30; --input: #241829;
  --chip: #F4C0D1; --chip-ink: #2A1020; --chip-lt: #3d2c44; --chip-lt-ink: #f6eef3;
  --off-bg: #3d2c44; --off-ink: #b9a6b6; --dim: #000a;
  --ok-bg: #064e3b; --ok-ink: #a7f3d0; --no-bg: #4c1d1d; --no-ink: #fecaca; --wait-bg: #4a3a10; --wait-ink: #fde68a;
}

/* ---------- 기본 ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font-family: 'SCoreDream', -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  -webkit-text-size-adjust: 100%; }
body { min-height: 100dvh; }
a { color: inherit; }
h1 { font-size: 22px; margin: 6px 0 0; letter-spacing: -0.02em; }
h2 { font-size: 17px; margin: 0; }
h3 { font-size: 15px; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
p { line-height: 1.55; margin: 6px 0; }
.small { font-size: 13px; }
.muted { color: var(--muted); }
.mono { font-family: 'D2Coding', ui-monospace, Menlo, monospace; font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }

svg { fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; }

.card { background: var(--surface); border-radius: 16px; padding: 16px; }
.tag { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 6px; background: var(--off-bg); color: var(--off-ink); white-space: nowrap; }
.tag:empty { display: none; }
.tag.ok { background: var(--ok-bg); color: var(--ok-ink); }
.tag.no { background: var(--no-bg); color: var(--no-ink); }
.tag.wait { background: var(--wait-bg); color: var(--wait-ink); }

/* ---------- 버튼·입력 ---------- */
.btn { display: block; text-align: center; text-decoration: none; font: inherit; font-weight: 700; font-size: 15px; border: 0;
  border-radius: 14px; padding: 13px 14px; width: 100%; margin-top: 10px; cursor: pointer; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.danger { background: transparent; color: var(--red); border: 1px solid var(--line); }
.btn.red { background: var(--red); color: #fff; }
.btn:disabled { opacity: .45; cursor: default; }
input, select { font: inherit; font-size: 16px; width: 100%; padding: 11px 12px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--input); color: var(--text); min-width: 0; }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 6px; }

/* ---------- 로딩 ---------- */
.boot { position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; gap: 4px; background: var(--bg); z-index: 50; }

/* ---------- 메인: 한 화면 안에 ---------- */
.main { position: relative; max-width: 560px; margin: 0 auto; height: 100dvh; display: flex; flex-direction: column;
  padding: calc(env(safe-area-inset-top) + 20px) 20px calc(env(safe-area-inset-bottom) + 16px); overflow-y: auto; }

.ic { position: relative; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; color: var(--text); text-decoration: none; }
.ic svg { width: 22px; height: 22px; stroke-width: 1.8; }
.ic .bd { position: absolute; top: 9px; right: 9px; width: 7px; height: 7px; border-radius: 50%; background: var(--rec); }

.lcol { position: absolute; left: 12px; top: calc(env(safe-area-inset-top) + 16px); display: flex; flex-direction: column; align-items: flex-start; gap: 6px; z-index: 3; }
.cast { display: flex; flex-direction: column; gap: 6px; margin-left: 4px; }
.chip { height: 30px; padding: 0 11px; border-radius: 999px; border: 0; font: inherit; font-size: 11px; font-weight: 700;
  background: var(--chip); color: var(--chip-ink); text-align: left; }
.chip.lt { background: var(--chip-lt); color: var(--chip-lt-ink); }
.chip:disabled { opacity: .4; }

.topc { position: absolute; left: 0; right: 0; top: calc(env(safe-area-inset-top) + 16px); display: flex; justify-content: center; z-index: 2; pointer-events: none; }
.ans { pointer-events: auto; display: inline-flex; align-items: center; gap: 6px; height: 44px; padding: 0 16px; border-radius: 999px;
  background: var(--pill); color: var(--pill-ink); font-size: 13px; font-weight: 700; text-decoration: none; }
.ans svg { width: 14px; height: 14px; stroke-width: 2.2; }
.rd { width: 7px; height: 7px; border-radius: 50%; background: var(--red); }

.rail { position: absolute; right: 12px; top: calc(env(safe-area-inset-top) + 16px); display: flex; flex-direction: column; gap: 2px; z-index: 3; }

.hero { display: flex; flex-direction: column; align-items: center; text-align: center; margin-top: 84px; gap: 8px; flex: none; }
.air { display: inline-flex; align-items: center; gap: 7px; font: inherit; font-size: 12px; font-weight: 800; letter-spacing: .14em;
  padding: 6px 14px; border-radius: 999px; border: 0; }
.air .d { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.air.off { background: var(--off-bg); color: var(--off-ink); }
.air.on { background: var(--red); color: #fff; }
.air.on .d { animation: blink 1s infinite; }
.air.tap { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px var(--red); cursor: pointer; }
@keyframes blink { 50% { opacity: .2; } }
.meta { margin: 0; font-size: 13px; color: var(--muted); }

.scr { position: relative; margin-top: 22px; aspect-ratio: 16 / 9; border-radius: 16px; background: var(--screen);
  display: flex; justify-content: center; align-items: center; flex: none; padding: 12px; }
/* 가운데 기준은 숫자/멘트만. 라벨은 위에 따로 얹어서 숫자가 정중앙에 오게 */
.center { position: relative; max-width: 100%; display: flex; flex-direction: column; align-items: center; }
.lbl { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); margin-bottom: 8px; white-space: nowrap;
  font-size: 12px; color: var(--muted); letter-spacing: .04em; }
.cd { font-size: 30px; line-height: 1.1; }
.host-line { margin: 0; padding: 0 20px; font-size: 15px; font-weight: 700; line-height: 1.5; text-align: center;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.nx { position: absolute; left: 12px; right: 12px; bottom: 10px; margin: 0; font-size: 12px; line-height: 1.45; text-align: left;
  background: var(--surface); border-radius: 10px; padding: 7px 10px; opacity: .92;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.nx b { color: var(--accent-text); margin-right: 4px; }
.rep { position: absolute; left: 14px; right: 62px; bottom: 14px; font-size: 12px; color: var(--muted); }
.mpc { position: absolute; right: 10px; bottom: 8px; width: 44px; height: 44px; border-radius: 50%; border: 0;
  background: var(--surface); color: var(--accent-text); display: flex; align-items: center; justify-content: center; padding: 0; }
.mpc svg { width: 18px; height: 18px; stroke-width: 1.8; }
.mpc:disabled { opacity: .7; }
[data-theme="after"] .mpc { background: var(--bg); }

.chat { flex: 1; min-height: 160px; display: flex; flex-direction: column; margin-top: 22px; border-top: 1px solid var(--line); padding-top: 14px; }
.log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.empty { margin: auto; font-size: 13px; color: var(--muted); text-align: center; }
.inp { display: flex; gap: 8px; margin-top: 12px; }
.inp input { flex: 1; height: 44px; border-radius: 999px; border: 0; padding: 0 16px; font-size: 15px; }
.inp button { height: 44px; padding: 0 18px; border-radius: 999px; border: 0; background: var(--accent); color: var(--accent-ink);
  font: inherit; font-weight: 700; font-size: 14px; white-space: nowrap; flex: none; }
.inp input:disabled, .inp button:disabled { opacity: .5; }
.m { font-size: 14px; line-height: 1.5; word-break: break-word; }
.m .nm { font-weight: 700; margin-right: 6px; }
.m .pr { font-size: 11px; color: var(--muted); margin-right: 6px; }
.host { background: var(--chip); color: var(--chip-ink); border-radius: 14px; padding: 10px 14px; font-size: 14px; line-height: 1.5; word-break: break-word; }
.host .lb { display: flex; gap: 6px; align-items: center; font-size: 11px; font-weight: 800; letter-spacing: .08em; margin-bottom: 2px; opacity: .85; }
.host .ct { font-size: 10px; font-weight: 700; letter-spacing: 0; padding: 1px 6px; border-radius: 5px; background: #ffffff33; }
textarea { font: inherit; font-size: 16px; width: 100%; padding: 11px 12px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--input); color: var(--text); resize: vertical; min-width: 0; line-height: 1.5; }
.dlg textarea { margin-top: 10px; text-align: left; }

/* ---------- 오늘의 응답 서랍 ---------- */
.dim { position: fixed; inset: 0; background: var(--dim); z-index: 30; }
.drawer { position: fixed; left: 0; right: 0; top: 0; z-index: 31; max-height: 25dvh; overflow-y: auto; background: var(--surface);
  border-radius: 0 0 22px 22px; padding: calc(env(safe-area-inset-top) + 12px) 16px 0; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 0; overflow: hidden; transform: translateY(-105%); transition: transform .25s ease, visibility .25s;
  visibility: hidden; }
.drawer.open { transform: none; visibility: visible; box-shadow: 0 10px 30px #0003; }
.qlist { width: 100%; max-width: 520px; flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding-bottom: 4px; }
.qitem { display: flex; flex-direction: column; align-items: center; gap: 5px; width: 100%; }
.qitem + .qitem { border-top: 1px solid var(--line); padding-top: 10px; }
.qitem .q { font-size: 14px; font-weight: 700; margin: 0; line-height: 1.4; }
.qitem .due { font-size: 11px; color: var(--accent-text); margin: 0; }
.qitem .qrow { display: flex; align-items: stretch; gap: 8px; width: 100%; }
.qitem textarea { flex: 1; height: 52px; min-height: 52px; resize: none; font-size: 15px; text-align: left; padding: 8px 12px; }
.qitem .qrow .btn { width: auto; margin: 0; padding: 0 16px; min-height: 44px; flex: none; }
.qitem .state { font-size: 12px; color: var(--muted); }
.qempty { font-size: 14px; color: var(--muted); margin: 8px 0; }
.fold { flex: none; width: 100%; height: 26px; display: flex; align-items: center; justify-content: center; }
.fold .handle { width: 44px; height: 5px; border-radius: 3px; background: var(--line); }

/* ---------- 확인 팝업 ---------- */
.dlg-wrap { position: fixed; inset: 0; z-index: 40; background: var(--dim); display: grid; place-items: center; padding: 24px; }
.dlg { width: min(100%, 320px); background: var(--surface); border-radius: 20px; padding: 24px 20px 16px; text-align: center; }
.dlg-t { font-size: 17px; font-weight: 700; margin: 0 0 4px; }
.dlg-b { display: flex; gap: 8px; margin-top: 10px; }

/* ---------- 서브 페이지 ---------- */
.page { position: fixed; inset: 0; z-index: 20; background: var(--bg); overflow-y: auto;
  padding: calc(env(safe-area-inset-top) + 12px) 16px calc(env(safe-area-inset-bottom) + 24px); }
.page > * { max-width: 560px; margin-left: auto; margin-right: auto; }
.page .card { margin-bottom: 12px; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; min-height: 44px; }
.back { text-decoration: none; font-weight: 700; color: var(--accent-text); font-size: 15px; min-height: 44px; display: flex; align-items: center; }
.sub-time { margin: -6px auto 12px; }
.step { width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 12px;
  background: var(--accent); color: var(--accent-ink); }
.guide { margin: 6px 0 0; padding-left: 20px; line-height: 1.7; }
.test-login { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 10px; }
.test-login summary { cursor: pointer; color: var(--muted); }
.char-card { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.char-swatch { width: 14px; height: 14px; border-radius: 50%; flex: none; }

/* 관리자 */
.seg { display: flex; gap: 6px; background: var(--bg); padding: 4px; border-radius: 14px; }
.seg-b { flex: 1; min-height: 44px; border: 0; border-radius: 10px; background: transparent; color: var(--muted);
  font: inherit; font-size: 13px; font-weight: 700; }
.seg-b.on { background: var(--accent); color: var(--accent-ink); }
.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.two > div { min-width: 0; }
/* iOS 사파리: 시각 입력칸이 칸 너비를 넘어 옆 칸과 겹치는 문제 */
input[type="time"] { -webkit-appearance: none; appearance: none; display: block; max-width: 100%; min-height: 46px; text-align: left; }
input[type="time"]::-webkit-date-and-time-value { text-align: left; }
.row-btns { display: flex; gap: 8px; }
.row-btns .btn { flex: 1; }
.q-admin { margin-top: 14px; }
.q-admin li { gap: 6px; }
.q-admin .qtext { font-size: 14px; font-weight: 700; line-height: 1.45; word-break: break-word; }
.q-admin .acts { display: flex; gap: 6px; flex-wrap: wrap; }
.q-admin .acts button { font: inherit; font-size: 12px; font-weight: 700; min-height: 36px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--line); background: transparent; color: var(--text); }
.q-admin .acts .del { color: var(--red); }
.ans-list { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; padding-left: 10px; border-left: 2px solid var(--line); }
.ans-list .who { font-size: 13px; font-weight: 700; }
.ans-list .txt { font-size: 14px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
input[type="datetime-local"] { -webkit-appearance: none; appearance: none; display: block; max-width: 100%; min-height: 46px; text-align: left; font-size: 14px; }
.three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.three .btn { margin-top: 4px; padding: 12px 4px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 12px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.list li:first-child { border-top: 0; padding-top: 0; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.name { font-weight: 700; font-size: 14px; }
.log-item { padding: 12px 0; border-top: 1px solid var(--line); }
.log-item:first-child { border-top: 0; padding-top: 4px; }
.log-dev { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; padding-left: 10px; border-left: 2px solid var(--line); }
.log-dev .row { justify-content: flex-start; }

/* ---------- 단서함 슬라이드 ---------- */
.backdrop { position: fixed; inset: 0; background: var(--dim); z-index: 30; }
.side { position: fixed; top: 0; right: 0; height: 100%; width: min(86vw, 380px); z-index: 31; background: var(--surface);
  transform: translateX(100%); transition: transform .22s ease, visibility .22s; visibility: hidden;
  padding: calc(env(safe-area-inset-top) + 16px) 16px 16px; overflow-y: auto; }
.side.open { transform: none; visibility: visible; }
.tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.tab { font: inherit; font-size: 13px; font-weight: 700; min-height: 40px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line); background: transparent; color: var(--muted); }
.tab.on { background: var(--accent); color: var(--accent-ink); border-color: transparent; }

/* ---------- 기타 ---------- */
.env-tag { position: fixed; left: 8px; bottom: calc(env(safe-area-inset-bottom) + 6px); z-index: 60; font-size: 10px; font-weight: 800;
  letter-spacing: .08em; padding: 3px 7px; border-radius: 6px; background: var(--amber); color: #fff; opacity: .8; pointer-events: none; }
.toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 24px); transform: translateX(-50%); z-index: 70;
  background: #000c; color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 14px; max-width: 90vw; text-align: center; }
