/* 포릿 화면. 서체: Pretendard(OFL, fonts/ 폴더에 둠). 색 시안 세 가지: a(잉크 파랑) b(따뜻한 흙빛) c(차분한 초록). 강조색은 하나만. */
@font-face {
  font-family: "Pretendard";
  src: url("/forit-assets/fonts/PretendardVariable.woff2") format("woff2-variations"),
       url("/forit-assets/fonts/PretendardVariable.woff2") format("woff2");
  font-weight: 45 920;
  font-style: normal;
  font-display: swap;
}

/* 공통 색: 종이, 글자, 선, 상태 점(세 상태 색은 시안과 상관없이 같음) */
:root {
  --paper: #fbfaf7; --ink: #26231f; --muted: #6f6a62; --line: #e4dfd6; --user: #f1ede6; --ai: #ffffff;
  --note: #fffdf8; --note-line: #e9e2d3;
  --guess: #a3782a; --grounded: #3b7d57; --confirmed: #2f5fa8; --pending: #b3ada4;
  --accent: #3a5ba0; --accent-ink: #ffffff;
}
:root[data-theme="a"] { --accent: #3a5ba0; --user: #e9eef8; --paper: #f8f9fb; --note: #fdfdfb; --note-line: #dfe4ee; }
:root[data-theme="b"] { --accent: #b5633a; --user: #f4e9df; --paper: #fbf7f1; --note: #fffbf4; --note-line: #ecdfcf; }
:root[data-theme="c"] { --accent: #4e7f66; --user: #e8efe9; --paper: #f7f9f6; --note: #fcfdf9; --note-line: #dde6dc; }
@media (prefers-color-scheme: dark) {
  :root { --paper: #16151a; --ink: #ece8e1; --muted: #a39d94; --line: #2d2b31; --user: #262a35; --ai: #1e1d22;
          --note: #1c1b1f; --note-line: #34323a; --guess: #e0b45b; --grounded: #7cc89a; --confirmed: #8fb3ff; --pending: #6e6a66; }
  :root[data-theme="a"] { --accent: #8aa6ea; --accent-ink: #10131b; --user: #222a3b; }
  :root[data-theme="b"] { --accent: #e0956e; --accent-ink: #1b120d; --user: #2f251e; }
  :root[data-theme="c"] { --accent: #8ec4a7; --accent-ink: #0f1a14; --user: #1f2b24; }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: "Pretendard", system-ui, -apple-system, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
       font-size: 16px; line-height: 1.6; color: var(--ink); background: var(--paper); word-break: keep-all; }
button { font: inherit; cursor: pointer; }
button:disabled { opacity: .45; cursor: default; }

/* S1 */
.s1 main { max-width: 440px; margin: 0 auto; padding: 36px 20px 48px; }
.s1 h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 28px; }
.s1 label { display: block; margin: 16px 0 6px; font-weight: 600; font-size: 15px; }
.s1 input { width: 100%; padding: 13px 14px; font: inherit; border: 1px solid var(--line); border-radius: 10px;
            background: var(--ai); color: var(--ink); }
.s1 input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.s1 .notices { margin: 22px 0 6px; padding-left: 18px; color: var(--muted); font-size: 14px; }
.s1 .notices li { margin-bottom: 6px; }
.s1 .more { text-align: right; font-size: 14px; margin: 0 0 18px; }
.s1 .more a { color: var(--accent); }
.s1 button[type=submit] { width: 100%; padding: 15px; border: 0; border-radius: 10px; background: var(--accent);
                          color: var(--accent-ink); font-weight: 700; font-size: 16px; }
.error { color: #b4443a; font-size: 14px; }
.notice { color: var(--muted); }

/* S2 */
.s2 header { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center;
             padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--paper); z-index: 3; }
.s2 .brand { font-weight: 700; letter-spacing: -0.01em; }
.notebtn { border: 1px solid var(--line); background: var(--note); color: var(--ink); border-radius: 18px;
           padding: 6px 12px; font-size: 14px; }
.notebtn .count { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 10px;
                  background: var(--accent); color: var(--accent-ink); font-size: 12px; text-align: center; }
.s2 main { max-width: 640px; margin: 0 auto; padding: 16px 16px 230px; }
.msg { margin: 10px 0; padding: 11px 15px; border-radius: 14px; white-space: pre-wrap; overflow-wrap: anywhere;
       max-width: 88%; font-size: 16px; }
.msg.ai { background: var(--ai); border: 1px solid var(--line); border-top-left-radius: 4px; }
.msg.user { background: var(--user); margin-left: auto; border-top-right-radius: 4px; }
.msg.system { color: var(--muted); font-size: 14px; background: none; border: 0; padding: 4px 0; }
.msg.pending { color: var(--muted); font-size: 14px; padding: 8px 14px; }
.msg.pending .dots::after { content: "…"; display: inline-block; width: 1.2em; text-align: left;
                            animation: dots 1.2s steps(3, end) infinite; }
@keyframes dots { 0% { content: "·"; } 33% { content: "··"; } 66% { content: "···"; } }

/* 노트 한 줄(대화 속) */
.note { margin: 10px 0; padding: 10px 14px; border: 1px solid var(--note-line); border-left: 3px solid var(--accent);
        border-radius: 10px; background: var(--note); font-size: 15px; cursor: default; }
.note.provisional { border-left-color: var(--pending); color: var(--muted); }
.note-head { display: flex; align-items: baseline; gap: 8px; }
.note .word, .nb-line .word { flex: none; font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: 0.02em; }
.note .sentence, .nb-line .sentence { font-weight: 600; }
.note.provisional .sentence { font-weight: 500; }
.note .change { margin-top: 6px; font-size: 14px; color: var(--accent); }
.note .why, .nb-row .why { margin-top: 6px; font-size: 13.5px; color: var(--muted); }
.note.open { background: var(--ai); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; position: relative; top: -1px;
       margin-right: 6px; }
.dot.guess { background: var(--guess); } .dot.grounded { background: var(--grounded); }
.dot.confirmed { background: var(--confirmed); } .dot.pending { background: var(--pending); }

/* 노트 서랍 */
.notebook { position: fixed; top: 0; right: 0; bottom: 0; width: min(92vw, 380px); background: var(--note);
            border-left: 1px solid var(--line); box-shadow: -8px 0 24px rgba(0,0,0,.08); z-index: 5; padding: 14px 16px;
            overflow-y: auto; }
.nb-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.nb-close { border: 1px solid var(--line); background: transparent; color: var(--ink); border-radius: 8px; padding: 4px 10px; font-size: 14px; }
.nb-conf { margin: 0 0 10px; font-size: 14px; color: var(--muted); }
.nb-rows { list-style: none; margin: 0; padding: 0; }
.nb-row { padding: 10px 0; border-bottom: 1px dashed var(--note-line); font-size: 15px; }
.nb-row.homework .sentence { color: var(--muted); font-weight: 500; }
.nb-line { display: flex; align-items: baseline; gap: 8px; }
.nb-empty { color: var(--muted); font-size: 14px; }
.nb-legend { margin-top: 16px; font-size: 12px; color: var(--muted); }
.nb-legend .dot { margin: 0 4px 0 8px; }
.nb-legend .dot:first-child { margin-left: 0; }

.s2 footer { position: fixed; bottom: 0; left: 0; right: 0; background: var(--paper); border-top: 1px solid var(--line);
             padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); z-index: 2; }
.s2 footer > * { max-width: 640px; margin-left: auto; margin-right: auto; }
.options { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.opt { padding: 8px 13px; border: 1px solid var(--line); border-radius: 18px; background: var(--ai); color: var(--ink); font-size: 15px; }
.opt.cal { min-width: 48px; }
#form { display: flex; gap: 8px; }
#input { flex: 1; padding: 10px 12px; font: inherit; border: 1px solid var(--line); border-radius: 10px; resize: none;
         background: var(--ai); color: var(--ink); }
#input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
#send { padding: 0 18px; border: 0; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.hint { color: var(--muted); font-size: 13px; margin: 6px 0 0; }
.helpers { display: flex; gap: 8px; margin-top: 8px; }
.helpers button { flex: 1; padding: 9px; border: 1px solid var(--line); border-radius: 10px; background: var(--ai);
                  color: var(--ink); font-size: 14px; }
