:root {
  /* zeomada.studio 키컬러 */
  --bg: #f4f2ec;      /* paper */
  --paper-2: #ebe8df;
  --card: #fbfaf6;
  --ink: #141414;
  --muted: #4a4945;
  --faint: #85827a;   /* field */
  --line: #141414;
  --rule: #d9d5ca;
  --yellow: #dfd150;  /* sun */
  --sun-2: #f0e67c;
  --sky: #b9cfe8;
  --blue: #6f9be0;
  --red: 224, 72, 62;
  --navy: #2f4f8f;
  --dot: clamp(50px, 15.3vw, 65px);
  --gap: clamp(12.6px, 3.96vw, 18px);
  --page: clamp(190px, 54vw, 240px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); }
body {
  font-family: "Paperlogy", "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }

/* ───────── 입력 화면 ───────── */
/* 키보드가 올라와도 화면이 밀려 올라가지 않게 고정 */
html:has(body.app-page) { position: fixed; inset: 0; width: 100%; height: 100%; overflow: hidden; overscroll-behavior: none; }
body.app-page { position: fixed; inset: 0; width: 100%; height: 100%; overflow: hidden; overscroll-behavior: none; }
.app {
  height: 100dvh; max-width: 560px; margin: 0 auto;
  display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) 14px env(safe-area-inset-bottom);
}
.top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 14px 4px 15px; }
.top .info-btn { justify-self: end; }
.brand { font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.info-btn {
  width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--line); background: var(--card);
  display: grid; place-items: center; font-size: 17px; font-weight: 700;
  font-family: Georgia, "Times New Roman", serif; font-style: italic;
  box-shadow: 0 3px 0 var(--line); transition: transform .1s, box-shadow .1s;
}
.info-btn:active { transform: translateY(3px); box-shadow: 0 0 0 var(--line); }

/* 모아보기: 가로로 계속 이어지고 가로 스크롤 (점 간격은 점자 규격 비례: 칸 간격 = 점 간격 × 2.4) */
@property --fl { syntax: '<length>'; inherits: false; initial-value: 0px; }
@property --fr { syntax: '<length>'; inherits: false; initial-value: 0px; }
.mini {
  --fl: 0px; --fr: 0px;
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 var(--fl), #000 calc(100% - var(--fr)), transparent 100%);
  mask-image: linear-gradient(to right, transparent 0, #000 var(--fl), #000 calc(100% - var(--fr)), transparent 100%);
  transition: --fl .25s, --fr .25s;
  --p: 13.5px; --d: 8.5px;
  position: relative; background: transparent; border: 0; border-radius: 0; padding: 4px 2px 8px;
  display: flex; flex-wrap: nowrap; align-items: flex-start; overflow-x: auto; overflow-y: hidden;
  min-height: 98px;
}
.mw {
  flex: none; width: calc(var(--p) * 2.4); display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 3px 0 4px; border-radius: 12px; cursor: pointer;
}
.mw.cur { background: var(--sky); }
.mw.sel { background: var(--yellow); }
.mw.bad .m i.on { background: rgb(var(--red)); }
.tok.bad { display: inline-block; min-width: .86em; padding: 0 .12em; margin: 0 .04em; border-radius: .26em; background: rgba(var(--red), .72); color: #fff; text-align: center; font-size: .82em; line-height: 1.25; vertical-align: .04em; }
.tok.pend { color: var(--faint); }
.m { display: inline-grid; grid-template-rows: repeat(3, var(--d)); grid-auto-flow: column; grid-template-columns: repeat(2, var(--d)); gap: calc(var(--p) - var(--d)); }
.m i { width: var(--d); height: var(--d); border-radius: 50%; background: transparent; }
.m i.on { background: var(--ink); }
.ml { font-size: 15px; font-weight: 800; line-height: 1.1; min-height: 17px; color: var(--ink); white-space: nowrap; }

/* 실시간 번역 */
.read { margin-top: 12px; padding: 16px 18px 17px; background: var(--card); border: 2px solid var(--line); border-radius: 26px; }
.out, .text-in {
  /* 묵자 칸: 한 줄은 똑바로, 다음 줄은 일부만 보이는 높이(1.6줄). 위아래로 밀어서 이동 */
  font-size: clamp(36px, 10.5vw, 52px); font-weight: 800; line-height: 1.25; letter-spacing: -.01em;
  height: 2em; overflow-y: auto; overflow-x: hidden;
  white-space: pre-wrap; word-break: keep-all; overflow-wrap: anywhere;
}
.out::after { content: ''; display: block; height: .75em; } /* 맨 끝 줄도 맨 위에 맞춰 설 수 있게 */
.tok { cursor: pointer; border-radius: 8px; transition: background .12s; }
.tok:hover { background: rgba(223, 209, 80, .35); }
.tok.sel { background: var(--yellow); }
.note { position: absolute; left: 8px; right: 8px; top: 100%; margin-top: 8px; font-size: 11.5px; color: var(--muted); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; pointer-events: none; }

/* 점 찍는 큰 화면 (칸이 자석처럼 가운데에 딱) */
.stage { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; margin: 0 -14px; /* 바깥 틀의 좌우 여백을 넘어 화면 끝까지 */ /* 위:아래 간격 1:0.95는 app.js(layoutPager)가 padding-top으로 맞춰요 */ }
.pager {
  width: 100%; display: flex; overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain;
  padding-inline: calc((100% - var(--page)) / 2);
  scrollbar-width: none; outline: none;
}
.pager::-webkit-scrollbar { display: none; }
.cell {
  flex: none; width: var(--page); scroll-snap-align: center; scroll-snap-stop: always;
  display: flex; justify-content: center; align-items: center; padding: 18px 0;
  opacity: .35; transform: scale(var(--inactive-scale, .5)); transition: opacity .35s ease, transform .35s cubic-bezier(.2, .8, .2, 1);
}
.cell.active { opacity: 1; transform: none; }
.dots {
  display: grid; grid-template-rows: repeat(3, var(--dot)); grid-auto-flow: column; grid-template-columns: repeat(2, var(--dot));
  gap: var(--gap); touch-action: pan-x;
}
.dot {
  position: relative; width: var(--dot); height: var(--dot); border-radius: 50%;
  border: 2px solid var(--line); background: var(--card);
  transition: background .18s, border-color .18s, transform .28s cubic-bezier(.3, 1.8, .5, 1), box-shadow .28s cubic-bezier(.3, 1.8, .5, 1);
  user-select: none; -webkit-user-select: none;
}
.dot.on { background: var(--blue); box-shadow: 0 7px 0 var(--line); transform: translateY(-5px); }
.drop-layer { position: fixed; inset: 0; pointer-events: none; z-index: 40; overflow: hidden; }
.drop { position: absolute; border-radius: 50%; pointer-events: none; will-change: transform, opacity; }
.dot.dip { animation: dip .28s ease-out; }
@keyframes dip { 0% { transform: translateY(-5px); } 55% { transform: translateY(2px); } 100% { transform: translateY(0); } }

.side {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 3; width: 36px; height: 56px;
  font-size: 28px; line-height: 1; color: var(--ink); display: none;
}
.side:hover { color: var(--ink); }
.side.prev { left: 6px; }
.side.next { right: 6px; }
@media (hover: hover) { .side { display: block; } }

.bar { display: flex; justify-content: space-between; gap: 6px; padding: 8px 0 20px; }
.ghost { font-size: 13px; font-weight: 700; padding: 12px 10px; border-radius: 999px; border: 2px solid var(--line); background: var(--card); box-shadow: 0 4px 0 var(--line); white-space: nowrap; flex: 0 1 auto; transition: transform .1s, box-shadow .1s, opacity .2s; }
.bar .ghost:nth-child(2) { flex: 1 1 auto; }
.ghost:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 0 0 var(--line); }
.ghost:disabled { opacity: .4; cursor: default; }

.modal { position: fixed; inset: 0; background: rgba(20, 20, 20, .45); display: grid; place-items: center; padding: 24px; z-index: 20; }
.modal[hidden] { display: none; }
.sheet { background: var(--card); border: 2px solid var(--line); border-radius: 26px; box-shadow: 0 6px 0 var(--line); padding: 24px 22px 20px; max-width: 340px; width: 100%; text-align: center; }
.sheet p { margin: 0 0 18px; font-size: 17px; font-weight: 700; line-height: 1.5; }
.sheet-btns { display: flex; gap: 10px; justify-content: center; }
.sheet .ghost.danger { background: var(--yellow); }
.sheet-btns .ghost { flex: 1; padding: 13px 10px; font-size: 15px; }

@media (max-height: 640px) {
  .out, .text-in, .mirror { font-size: 34px; }
  .mini { min-height: 70px; }
}

/* ───────── 정보 페이지 (점자표) ───────── */
.info-wrap { max-width: 720px; margin: 0 auto; padding: 0 20px 56px; }
.info-top { display: flex; align-items: center; justify-content: space-between; padding: 16px 0 8px; position: sticky; top: 0; background: linear-gradient(var(--bg) 70%, transparent); z-index: 5; }
.back { font-size: 14px; font-weight: 700; padding: 7px 14px; border: 2px solid var(--line); border-radius: 999px; background: var(--card); box-shadow: 0 3px 0 var(--line); }
.info-wrap h1 { font-size: 30px; margin: 22px 0 4px; letter-spacing: -.01em; font-weight: 800; }
.lead { color: var(--muted); font-size: 14px; margin: 0; }

.tabs { display: flex; gap: 22px; margin: 28px 0 8px; border-bottom: 1.5px solid var(--rule); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: 10px 0 11px; font-size: 15px; font-weight: 600; color: var(--faint); white-space: nowrap; border-bottom: 3px solid transparent; margin-bottom: -1.5px; }
.tab[aria-selected="true"] { color: var(--ink); font-weight: 800; border-bottom-color: var(--ink); }
.tab:active { opacity: .6; }

.ref-group { padding: 26px 0 4px; }
.ref-group h4 { margin: 0 0 14px; font-weight: 500; font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.ref-group h4 b { font-size: 17px; font-weight: 800; color: var(--ink); }
.ref-grid { display: flex; flex-wrap: wrap; gap: 20px 26px; }
.ref-item { display: flex; align-items: center; gap: 10px; }
/* 칸과 칸 사이: 점 간격(11px)의 2.4배 − 칸 너비(18px) ≈ 8.4px (점자 규격 비례) */
.ref-item .mc { display: flex; gap: 8.4px; }
.ref-item b { font-size: 18px; font-weight: 800; line-height: 1.2; display: block; }
.ref-item small { display: block; color: var(--muted); font-size: 11px; line-height: 1.3; margin-top: 1px; }
.mini-c { display: inline-grid; grid-template-rows: repeat(3, 7px); grid-auto-flow: column; grid-template-columns: repeat(2, 7px); gap: 4px; }
.mini-c i { width: 7px; height: 7px; border-radius: 50%; background: var(--rule); }
.mini-c i.on { background: var(--ink); }
.foot { margin-top: 48px; padding-top: 18px; border-top: 1.5px solid var(--rule); color: var(--faint); font-size: 12px; line-height: 1.65; }
.foot p { margin: 4px 0; }

/* 푸터 (저마다 휠맵 푸터와 같은 검정 바탕) */
.footer { background: var(--ink); color: rgba(244, 242, 236, .78); font-size: 13px; line-height: 1.7; padding: 28px 0 calc(40px + env(safe-area-inset-bottom, 0px)); box-shadow: 0 0 0 100vmax var(--ink); clip-path: inset(0 -100vmax); }
.footer-in { max-width: 720px; margin: 0 auto; padding: 0 20px; }
.footer a { color: var(--bg); text-decoration: underline; text-decoration-color: rgba(244, 242, 236, .4); text-underline-offset: 3px; }
.footer a:hover { text-decoration-color: var(--yellow); }
.footer-info { display: grid; grid-template-columns: 72px 1fr; gap: 10px 12px; margin: 0; }
.footer-info dt { font-weight: 700; color: var(--bg); }
.footer-info dd { margin: 0; }
.footer-copy { margin: 14px 0 0; }
.footer :focus-visible { outline-color: var(--yellow); }
body:has(.footer) { overflow-x: hidden; }

@media (prefers-reduced-motion: reduce) {
  .dot.dip { animation: none; }
  .cell { transition: none; }
}

/* 점자 ↔ 묵자 전환 버튼 */
.mode {
  display: inline-flex; align-items: center; gap: 4px; padding: 7px 14px; border-radius: 999px;
  border: 2px solid var(--line); background: var(--yellow); box-shadow: 0 3px 0 var(--line);
  font-size: 14px; font-weight: 800; transition: transform .1s, box-shadow .1s, background .15s;
}
@media (hover: hover) { .mode:hover { background: #fff; } }
.mode:active { transform: translateY(3px); box-shadow: 0 0 0 var(--line); }
.mode .w { display: inline-block; width: 2.1em; text-align: center; will-change: transform; }
.mode .arr { font-weight: 700; color: var(--muted); }

/* 아직 아무것도 안 찍었을 때 안내 */
.hint { position: absolute; top: calc((100% - (var(--dot) * 3 + var(--gap) * 2 + 36px)) / 4 + 9px + var(--hint-shift, 0px)); transform: translateY(-50%); left: 0; right: 0; margin: 0; text-align: center; font-size: 15px; font-weight: 600; color: var(--muted); pointer-events: none; }
.hint[hidden] { display: none; }

/* 묵자 → 점자 화면: 묵자 칸이 입력창이 되고, 점 입력부는 비워요 */
.text-in, .mirror {
  display: none; width: 100%; border: 0; outline: 0; background: transparent; resize: none; padding: 0; margin: 0;
  font: inherit; font-size: clamp(36px, 10.5vw, 52px); font-weight: 800; line-height: 1.25; letter-spacing: -.01em; color: var(--ink);
  caret-color: transparent; word-break: keep-all; overflow-wrap: anywhere;
}
.text-in { padding-bottom: .75em; }
body.mode-text .out, body.mode-text .stage { display: none; }
body.mode-text .text-in { display: block; }
body.mode-text .mirror { display: block; }
body.mode-text #clearDots, body.mode-text #delCell { display: none; }
body.mode-text .bar { justify-content: center; padding-top: 32px; }
body.mode-text .bar .ghost { padding: 12px 15px; }
body.mode-text .mw { cursor: default; }

/* 신호(수표·로마자표 등)는 점 위쪽, 자모음은 점 아래쪽 */
.ms { height: 13px; font-size: 10px; font-weight: 800; line-height: 13px; letter-spacing: -.02em; color: var(--muted); white-space: nowrap; overflow: visible; }
.ml { white-space: nowrap; }
.tok.has-note { border-bottom: 2px solid rgb(var(--red)); border-radius: 0; }
.note .star { display: inline-block; color: rgb(var(--red)); font-weight: 800; font-size: 17px; line-height: 1; margin-right: 3px; vertical-align: middle; transform: translateY(.22em); }

/* 스크롤바: 전체 톤에 맞춘 가는 알약 모양. 마우스를 올리거나 스크롤하는 동안만 보여요 */
.sb::-webkit-scrollbar { width: 10px; height: 10px; }
.sb::-webkit-scrollbar-track { background: transparent; }
.sb::-webkit-scrollbar-thumb { background-color: transparent; border: 3px solid transparent; background-clip: padding-box; border-radius: 999px; }
.sb:hover::-webkit-scrollbar-thumb, .sb.scrolling::-webkit-scrollbar-thumb { background-color: var(--ink); }
@supports not selector(::-webkit-scrollbar) {
  .sb { scrollbar-width: thin; scrollbar-color: transparent transparent; }
  .sb:hover, .sb.scrolling { scrollbar-color: var(--ink) transparent; }
}
@media (hover: none) { .sb:hover::-webkit-scrollbar-thumb { background-color: transparent; } .sb.scrolling::-webkit-scrollbar-thumb { background-color: var(--ink); } }

/* 묵자 입력칸의 깜박이는 커서 */
.read { position: relative; }
.fake-caret { position: absolute; display: none; width: 3px; border-radius: 2px; background: var(--ink); pointer-events: none; animation: blinkc 1.05s steps(1) infinite; }
body.mode-text .fake-caret.on { display: block; }
.mirror { position: absolute; visibility: hidden; pointer-events: none; height: auto; max-height: none; overflow: visible; display: block; border: 0; padding: 0; margin: 0; white-space: pre-wrap; }
@keyframes blinkc { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .fake-caret { animation: none; } }

/* 글자 입력(묵자 → 점자) 카드는 입력창이라 그림자를 유지해요 */
body.mode-text .read { box-shadow: 0 5px 0 var(--line); }

/* 눌림 효과: 그림자만큼 내려가며 그림자가 사라져요 */
.back, .chip, .tab, .info-btn, .mode, .ghost { transition: transform .1s, box-shadow .1s, background .15s, opacity .2s; }
.back:active, .chip:active { transform: translateY(3px); box-shadow: 0 0 0 var(--line); }
.tab:active { transform: translateY(2px); }
.tab[aria-selected="true"]:active { transform: translateY(3px); box-shadow: 0 0 0 var(--line); }
.side:active { transform: translateY(-50%) scale(.88); }
.mw { transition: transform .1s; }
.mw:active { transform: scale(.93); }
body.mode-text .mw:active { transform: none; }
.tok:active { background: rgba(223, 209, 80, .6); }

/* ───────── 첫 화면 스플래시 (splash.js) ─────────
   화면 가로를 2:3:2로 나눠 가운데 3에 모션 로고, 아래 5/6 지점에 저마다 로고(롤인맵과 같은 규칙) */
.splash {
  --w: min(100vw, 560px);
  position: fixed; inset: 0; z-index: 100; background: var(--bg);
  display: grid; place-items: center; overflow: hidden;
  transition: opacity .45s ease;
}
.splash.out { opacity: 0; pointer-events: none; }
.no-splash .splash { display: none; }
.splash-logo { width: calc(var(--w) * 3 / 7); height: auto; overflow: visible; fill: #000; }
.splash-by {
  /* 롤인맵(wheelmap-site) 스플래시와 같은 위치·크기: 로고+글씨 묶음의 가운데가 화면 5/6 지점 */
  position: absolute; left: 50%; top: calc(100% * 5 / 6);
  transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.splash-zm { width: calc(100vw * 3 / 7 / 6); min-width: 24px; height: auto; fill: #000; display: block; }
.splash-by p { margin: 0; font-size: 11px; font-weight: 600; line-height: 1.3; white-space: nowrap; color: #000; }
/* PC(가로 768px 이상): 저마다 로고만 0.6배, 로고 가운데를 기준으로 줄여요 (위치·글씨는 그대로) */
@media (min-width: 768px) { .splash-zm { transform: scale(.6); transform-origin: 50% 50%; } }
