/* 잔상 — 공용 셸.
   데스크톱에서도 모바일 폭의 세로 컬럼으로 보이고, 바깥은 주황 여백.
   영문·숫자는 Space Mono, 한글은 Orbit (Space Mono에 한글이 없어 자동으로 넘어간다). */

:root {
  --col: 700px;         /* 컬럼 폭 — 이 한 줄로 전체 비례가 정해진다 */
  --orange: #f26f21;
  --ink: #000;
  --paper: #fff;
  --gray: #d9d9d9;
  --field: #f2f2f2;
  --line: 1px solid var(--ink);
}

* { box-sizing: border-box; margin: 0; }
[hidden] { display: none !important; }

body {
  font-family: "Space Mono", "Orbit", ui-monospace, monospace;
  background: var(--orange);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.phone {
  width: 100%;
  max-width: var(--col);
  margin: 0 auto;
  min-height: 100vh;
  background: var(--paper);
  border-left: var(--line);
  border-right: var(--line);
  display: flex;
  flex-direction: column;
}
@media (max-width: 700px) {
  .phone { border-left: 0; border-right: 0; }
}

/* ── 흐르는 띠 ── */
.ticker {
  overflow: hidden; white-space: nowrap;
  background: var(--ink); color: var(--paper);
  border-bottom: var(--line);
  font-size: 15px; letter-spacing: 1px; padding: 7px 0;
}
.lead {
  text-align: center; font-size: 13px; line-height: 1.5;
  padding: 13px 14px; border-bottom: var(--line);
}
.ticker .track { display: inline-block; animation: slide 18s linear infinite; }
.ticker .track > span { padding-right: 34px; }
@keyframes slide { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .ticker .track { animation: none; } }

/* ── 표 형태의 행 ── */
.row { display: flex; border-bottom: var(--line); }
.row > * {
  flex: 1; min-width: 0; padding: 11px 8px;
  text-align: center; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
}
.row > * + * { border-left: var(--line); }
.row .k { flex: 0 0 26%; background: var(--field); font-size: 14px; }

/* 결과 행 — 항목:값 = 2:3.
   flex-grow 로 나누면 셀 경계선(1px)만큼 어긋나므로 폭을 직접 지정한다. */
#result .row > * { flex: 0 0 30%; }
#result .row .k { flex: 0 0 20%; }

/* ── 문제판 ── */
.stage { position: relative; line-height: 0; border-bottom: var(--line); background: var(--paper); }
#board { image-rendering: pixelated; display: block; margin: 0 auto; max-width: 100%; }
#start {
  position: absolute; inset: 0; margin: auto;
  width: 132px; height: 50px;
  background: var(--ink); color: var(--paper); border: var(--line);
  font-family: inherit; font-size: 16px; letter-spacing: 3px; cursor: pointer;
}

/* ── 입력 ── */
.answer-row { display: flex; border-bottom: var(--line); }
#guess {
  flex: 1; min-width: 0; border: 0; background: var(--field);
  font-family: inherit; font-size: 15px; text-align: center;
  padding: 14px 10px; color: var(--ink);
}
#guess::placeholder { color: #9a9a9a; }
#guess:focus { outline: 2px solid var(--orange); outline-offset: -2px; }
#submit {
  flex: 0 0 26%; border: 0; border-left: var(--line);
  background: var(--paper); font-family: inherit; font-size: 15px; cursor: pointer;
}
#submit:active { background: var(--gray); }

#message { padding: 12px 10px; text-align: center; font-size: 14px;
  border-bottom: var(--line); }
#message:empty { display: none; }   /* 내용 없을 때 빈 줄이 남지 않게 */
#message.lose { color: #c1361b; }

/* ── 결과 ── */
.bar { background: var(--gray); text-align: center; padding: 10px; font-size: 15px;
  border-bottom: var(--line); }
.note { padding: 14px 10px; text-align: center; font-size: 15px; border-bottom: var(--line); }
.cta {
  display: block; width: 100%; border: 0; padding: 18px 10px;
  background: var(--ink); color: var(--orange);
  font-family: inherit; font-size: 16px; letter-spacing: 1px; cursor: pointer;
}
.cta:active { color: var(--paper); }
#copied { text-align: center; font-size: 12px; height: 0; overflow: hidden;
  opacity: 0; transition: opacity .2s, height .2s; }
#copied.on { opacity: .65; height: 30px; padding-top: 8px; }

.nav { display: block; text-align: center; padding: 14px; font-size: 13px;
  color: var(--ink); opacity: .55; }

/* ── 확대 모드 ── */
/* 흰 판 위 — 반투명 검은 원 + 흰 선 아이콘 */
#zoomBtn {
  position: absolute; right: 10px; bottom: 10px;
  width: 44px; height: 44px; padding: 0; z-index: 3;
  border: 0; border-radius: 50%; cursor: pointer;
  background: rgba(0,0,0,.42);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  color: #fff;
  display: grid; place-items: center;
}
#zoomBtn:active { background: rgba(0,0,0,.62); }
#zoomOverlay { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.92); overflow: hidden; }
/* 회전 전 크기가 화면 폭보다 넓으므로 절대 배치로 중앙에 두고 돌린다.
   max-width를 풀지 않으면 캔버스가 가로로 눌려 칸이 정사각형이 아니게 된다. */
#zoomInner {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%) rotate(90deg); line-height: 0;
}
#zoomInner canvas { max-width: none; outline: 1px solid #000; }
/* 어두운 오버레이 위 — 반투명 흰 원 + 흰 선 아이콘 */
#zoomClose {
  position: fixed; right: 16px; bottom: 16px;
  width: 52px; height: 52px; padding: 0;
  border: 1.5px solid rgba(255,255,255,.55); border-radius: 50%;
  background: rgba(255,255,255,.16);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  color: #fff; cursor: pointer; display: grid; place-items: center;
}
#zoomClose:active { background: rgba(255,255,255,.3); }

/* 돋보기 아이콘 — 선만 있는 형태 */
#zoomBtn svg, #zoomClose svg {
  width: 22px; height: 22px;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}
#zoomClose svg { width: 24px; height: 24px; }

button { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

/* ── 잔상 보내기 개별 보정 ── */
#word {
  flex: 1; width: 100%; border: 0; background: var(--field);
  font-family: inherit; font-size: 19px; letter-spacing: 3px; text-align: center;
  padding: 15px 10px; color: var(--ink);
}
#word::placeholder { color: #9a9a9a; letter-spacing: 3px; }
#word:focus { outline: 2px solid var(--orange); outline-offset: -2px; }
#word.bad { background: #ffe9e5; }
#examples > button {
  border: 0; background: var(--paper); font-family: inherit;
  font-size: 13px; cursor: pointer; padding: 12px 4px;
}
#examples > button:active { background: var(--gray); }
#link { font-size: 12px; word-break: break-all; line-height: 1.6; }
#hint.bad { color: #c1361b; }

/* ── 하단 블록 ── */
.steps { list-style: none; padding: 0; margin: 0; border-bottom: var(--line); }
.steps li {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px; font-size: 13px; line-height: 1.4;
}
.steps li + li { border-top: 1px solid rgba(0,0,0,.14); }
.steps b { font-size: 13px; opacity: .38; flex: none; }

#histRows { border-bottom: var(--line); }
.hrow { display: flex; font-size: 13px; }
.hrow + .hrow { border-top: 1px solid rgba(0,0,0,.14); }
.hrow > * { padding: 11px 8px; text-align: center; }
.hrow .d { flex: 1; opacity: .6; }
.hrow .w { flex: 1; }
.hrow .t { flex: 1; }
.hrow.today { background: var(--field); }

.row.next .k { flex: 0 0 40%; }
#nextIn { font-variant-numeric: tabular-nums; letter-spacing: 1px; }

/* 상단 머리행 — 날짜 쪽을 넓게 */
#today { flex: 1.5; }

a.cta { text-decoration: none; text-align: center; }
