/* PLAYORA 해님 달님 */
:root {
  --night: #1d2345; --paper: #f6efe1; --paper-2: #ece2cd; --paper-3: #e2d5ba; --ink: #2b2233; --ink-2: #5d5466; --ink-3: #8b8292;
  --red: #c9483f; --red-2: #a8382f; --indigo: #3b5596; --indigo-2: #2d4277; --gold: #e3b23c; --line: rgba(43, 34, 51, 0.22);
  --page: #f8f4ec; --page-ink: #2b2233; --page-2: #5d5466; --page-line: #e3d9c8;
  --f-disp: "Song Myung", "Gowun Batang", serif;
  --f-body: "Gowun Dodum", "IBM Plex Sans KR", system-ui, -apple-system, "Malgun Gothic", sans-serif;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --r1: 6px; --r2: 10px; --r3: 14px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}
@supports (color: oklch(0 0 0)) {
  :root {
    --night: oklch(0.27 0.07 278); --paper: oklch(0.96 0.02 85); --paper-2: oklch(0.92 0.028 85); --paper-3: oklch(0.87 0.035 85);
    --ink: oklch(0.27 0.03 310); --ink-2: oklch(0.47 0.025 310); --ink-3: oklch(0.63 0.02 310);
    --red: oklch(0.57 0.16 28); --red-2: oklch(0.5 0.15 28); --indigo: oklch(0.46 0.11 268); --indigo-2: oklch(0.39 0.1 268); --gold: oklch(0.79 0.14 85);
    --page: oklch(0.975 0.01 85); --page-ink: oklch(0.27 0.03 310); --page-2: oklch(0.47 0.025 310); --page-line: oklch(0.9 0.02 85);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; }
body { margin: 0; background: var(--page); color: var(--page-ink); font: 400 16px/1.75 var(--f-body); word-break: keep-all; overflow-wrap: anywhere; }
button { font: inherit; color: inherit; cursor: pointer; white-space: nowrap; }
a { color: inherit; }

/* ---------------------------------------------------------------- 페이지 머리 */
.mast { display: flex; align-items: baseline; gap: var(--s4); padding: var(--s3) clamp(var(--s4), 3vw, var(--s6)); border-bottom: 1px solid var(--page-line); }
.mast-brand { text-decoration: none; font-size: 14px; color: var(--page-2); white-space: nowrap; }
.mast-brand b { font-weight: 700; letter-spacing: 0.08em; color: var(--page-ink); margin-right: 6px; }
.mast-more { margin-left: auto; font-size: 14px; color: var(--page-2); white-space: nowrap; }
.head { max-width: 1240px; margin: 0 auto; padding: var(--s3) clamp(var(--s3), 3vw, var(--s6)) var(--s2); display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 var(--s4); }
.head h1 { margin: 0; font: 400 clamp(36px, 4.6vw, 50px)/1.1 var(--f-disp); letter-spacing: 0.02em; }
.head h1 small { font: 400 0.42em/1 var(--f-body); color: var(--page-2); margin-left: var(--s2); letter-spacing: 0; }
.head p { margin: 0; color: var(--page-2); font-size: 15px; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 clamp(0px, 2vw, var(--s5)); }

/* ---------------------------------------------------------------- 무대 */
.sm { position: relative; width: 100%; height: clamp(440px, calc(100svh - 140px), 780px); background: var(--night); color: var(--ink); overflow: hidden; border-radius: var(--r2);
  touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; font-family: var(--f-body); outline: none; }
.sm > canvas.cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.sm.fs { border-radius: 0; height: 100%; }
@media (max-width: 640px) { .sm { border-radius: 0; height: min(82svh, 760px); min-height: 520px; } .head { padding-top: var(--s2); } .head p { display: none; } }
html.embed, html.embed body { height: 100%; overflow: hidden; background: var(--night); }
html.embed .mast, html.embed .head, html.embed .about, html.embed .foot { display: none !important; }
html.embed .wrap { padding: 0; max-width: none; }
html.embed .sm { position: fixed; inset: 0; width: auto; height: auto; min-height: 0; border-radius: 0; }
.nojs { color: #fff; padding: var(--s5); }
[hidden] { display: none !important; }

/* 공통 단추 */
.btn { height: 42px; padding: 0 var(--s4); border-radius: var(--r2); border: 1.5px solid var(--ink); background: var(--paper); color: var(--ink); font: 600 15px/1 var(--f-body); transition: transform 0.15s var(--ease), background 0.15s; }
.btn:hover { background: #fff; }
.btn:active { transform: translateY(1px); }
.btn.main { background: var(--red); color: #fff; border-color: var(--red-2); }
.btn.main:hover { background: var(--red-2); }
.btn.small { height: 34px; font-size: 14px; }
.sm button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------------------------------------------------------------- 머리 줄 (놀이 중) */
.bar { position: absolute; top: 0; left: 0; right: 0; height: 44px; display: flex; align-items: center; gap: var(--s2); padding: 0 var(--s2); z-index: 8; pointer-events: none; }
.bar > div { display: flex; align-items: center; gap: var(--s1); pointer-events: auto; min-width: 0; }
.bar-l { flex: 1 1 auto; overflow: hidden; }
.bar-m { flex: none; }
.bar-r { flex: none; }
.tb { height: 32px; padding: 0 var(--s3); border-radius: 999px; border: 1px solid rgba(43, 34, 51, 0.35); background: rgba(246, 239, 225, 0.92); color: var(--ink); font: 600 13px/1 var(--f-body); flex: none; }
.tb:hover { background: #fff; }
.tb[aria-pressed="false"] { color: var(--ink-3); }
.lvname { color: #f6efe1; font: 400 16px/1 var(--f-disp); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-left: var(--s1); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5); }
.hp, .ht { height: 32px; display: inline-flex; align-items: center; gap: 6px; padding: 0 var(--s3); border-radius: 999px; background: rgba(29, 35, 69, 0.72); color: #f6efe1; font: 600 13px/1 var(--f-body); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ic-s { width: 12px; height: 12px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 2px rgba(227, 178, 60, 0.35); display: inline-block; }
.sm.narrow .tb { padding: 0 var(--s2); font-size: 12px; }
.sm.narrow .lvname { font-size: 15px; }
.sm.narrow .lvn-t { display: none; }
.lvname b { font-weight: 400; color: var(--gold); }
.sm.narrow #bFull { display: none; }

/* ---------------------------------------------------------------- 화면 공통 */
.scr { position: absolute; inset: 0; z-index: 5; display: flex; overflow: hidden; }
.scr h2, .scr h3 { font-style: normal; }

/* 첫 화면: 왼쪽에 종이 패널, 오른쪽엔 그림 */
.title { align-items: center; padding: var(--s5) clamp(var(--s4), 5vw, var(--s7)); }
.t-box { width: min(440px, 100%); background: rgba(246, 239, 225, 0.94); border: 1.5px solid var(--ink); border-radius: var(--r3); padding: var(--s5); box-shadow: 0 10px 30px rgba(10, 8, 30, 0.35); }
.t-kicker { margin: 0; color: var(--ink-2); font-size: 14px; }
.t-name { margin: var(--s1) 0 0; font: 400 clamp(44px, 6.4vw, 64px)/1.05 var(--f-disp); letter-spacing: 0.04em; }
.t-sub { margin: var(--s2) 0 var(--s4); color: var(--ink-2); font-size: 15px; line-height: 1.5; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); margin-bottom: var(--s4); }
.segb { text-align: left; border: 1.5px solid var(--line); background: var(--paper-2); border-radius: var(--r2); padding: var(--s2) var(--s3); white-space: normal; line-height: 1.35; }
.segb b { display: block; font: 400 20px/1.2 var(--f-disp); }
.segb span { display: block; font-size: 12px; color: var(--ink-2); margin-top: 2px; }
.segb.on { border-color: var(--indigo); background: #fff; box-shadow: inset 0 0 0 1.5px var(--indigo); }
.t-act { display: flex; gap: var(--s2); flex-wrap: wrap; }
.t-act .btn.main { min-width: 150px; }
.t-links { margin: var(--s3) 0 0; display: flex; gap: var(--s4); flex-wrap: wrap; }
.lk { border: 0; background: none; padding: var(--s1) 0; color: var(--ink-2); font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }
.lk:hover { color: var(--ink); }

/* 레벨 고르기 */
.select { flex-direction: column; background: rgba(20, 18, 40, 0.55); }
.sel-head { flex: none; display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s4); background: var(--paper); border-bottom: 1.5px solid var(--ink); }
.sel-head h2 { margin: 0; font: 400 24px/1 var(--f-disp); }
.sel-head .btn { height: 34px; font-size: 14px; }
.sel-mode { margin-left: auto; font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.sel-body { flex: 1 1 auto; overflow-y: auto; padding: var(--s3) var(--s4) var(--s5); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); align-content: start; overscroll-behavior: contain; touch-action: pan-y; }
.chap { background: var(--paper); border: 1.5px solid var(--ink); border-radius: var(--r3); padding: var(--s3); border-top-width: 6px; }
.chap.c1 { border-top-color: #c9a25a; } .chap.c2 { border-top-color: #4f6b4a; } .chap.c3 { border-top-color: #8d93c9; } .chap.c4 { border-top-color: #e39a6a; }
.chap-h { display: flex; align-items: baseline; gap: var(--s2); margin-bottom: var(--s2); }
.chap-n { font-size: 13px; color: var(--ink-2); }
.chap-h h3 { margin: 0; font: 400 21px/1.1 var(--f-disp); }
.chap-s { margin-left: auto; font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.lvs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.lvb { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; gap: 0 6px; align-items: center; text-align: left; padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--r1); background: var(--paper-2); min-height: 48px; white-space: normal; }
.lvb:hover:not(:disabled) { background: #fff; border-color: var(--ink); }
.lvb-n { grid-row: 1 / 3; font: 400 17px/1 var(--f-disp); color: var(--indigo); }
.lvb-t { font-size: 13px; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lvb-s { font-size: 12px; color: var(--gold); letter-spacing: 1px; line-height: 1.2; }
.lvb.chase .lvb-n { color: var(--red); }
.lvb:disabled { opacity: 0.5; cursor: default; }
.lvb:disabled .lvb-s { color: var(--ink-3); letter-spacing: 0; }
.lvb.done { background: #fff; }

/* 이야기 */
.story { align-items: center; padding: var(--s4) clamp(var(--s4), 6vw, var(--s7)); }
.st-box { width: min(560px, 100%); max-height: 100%; overflow-y: auto; background: rgba(246, 239, 225, 0.95); border: 1.5px solid var(--ink); border-radius: var(--r3); padding: var(--s5); box-shadow: 0 10px 30px rgba(10, 8, 30, 0.35); }
.st-ch { margin: 0; font-size: 14px; color: var(--red); }
.st-box h2 { margin: var(--s1) 0 var(--s3); font: 400 34px/1.15 var(--f-disp); }
.st-text p { margin: 0 0 var(--s3); font-size: 16px; line-height: 1.8; }
.st-act { margin-top: var(--s2); }

/* 깬 화면 */
.clear { align-items: center; justify-content: flex-start; padding: var(--s4) clamp(var(--s4), 6vw, var(--s7)); background: rgba(20, 18, 40, 0.35); }
.cl-box { width: min(420px, 100%); max-height: 100%; overflow-y: auto; background: var(--paper); border: 1.5px solid var(--ink); border-radius: var(--r3); padding: var(--s5); box-shadow: 0 10px 30px rgba(10, 8, 30, 0.4); }
.cl-lv { margin: 0; font-size: 14px; color: var(--ink-2); }
.cl-title { margin: var(--s1) 0 var(--s3); font: 400 40px/1 var(--f-disp); }
.cl-stars { list-style: none; margin: 0 0 var(--s3); padding: 0; display: grid; gap: 6px; }
.cl-stars li { display: flex; align-items: center; gap: var(--s2); font-size: 15px; color: var(--ink-3); }
.cl-stars li.on { color: var(--ink); }
.cl-stars .star { font-size: 24px; line-height: 1; color: var(--ink-3); width: 26px; }
.cl-stars li.on .star { color: var(--gold); animation: pop 0.5s var(--ease) both; }
.cl-stars li:nth-child(2) .star { animation-delay: 0.22s; } .cl-stars li:nth-child(3) .star { animation-delay: 0.44s; }
@keyframes pop { from { transform: scale(0.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.cl-rec { margin: 0 0 var(--s4); font-size: 14px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.cl-act { display: flex; gap: var(--s2); flex-wrap: wrap; }

/* 창 */
.modal { position: absolute; inset: 0; z-index: 20; background: rgba(15, 12, 30, 0.55); display: flex; align-items: center; justify-content: center; padding: var(--s3); }
.mbox { width: min(560px, 100%); max-height: 100%; display: flex; flex-direction: column; background: var(--paper); border: 1.5px solid var(--ink); border-radius: var(--r3); box-shadow: 0 12px 34px rgba(0, 0, 0, 0.4); }
.mhead { display: flex; align-items: center; padding: var(--s3) var(--s4); border-bottom: 1px solid var(--line); }
.mtitle { margin: 0; font: 400 22px/1 var(--f-disp); }
.x { margin-left: auto; height: 32px; padding: 0 var(--s3); border-radius: 999px; border: 1px solid var(--line); background: var(--paper-2); font-size: 13px; }
.mbody { overflow-y: auto; padding: var(--s3) var(--s4) var(--s4); overscroll-behavior: contain; touch-action: pan-y; }
.p-act { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); }
.p-act .btn { width: 100%; }
.p-set { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--s3); }
.chip { height: 32px; padding: 0 var(--s3); border-radius: 999px; border: 1px solid var(--line); background: var(--paper-2); font-size: 13px; }
.chip[aria-pressed="true"] { border-color: var(--indigo); color: var(--indigo-2); }
.help h3, .rec h3 { margin: var(--s3) 0 var(--s1); font: 400 18px/1.2 var(--f-disp); }
.help h3:first-child, .rec h3:first-child { margin-top: 0; }
.help p { margin: 0 0 var(--s2); font-size: 14px; line-height: 1.65; }
.help table, .rec table { width: 100%; border-collapse: collapse; font-size: 14px; }
.help th, .help td, .rec th, .rec td { text-align: left; vertical-align: top; padding: 5px 6px; border-bottom: 1px solid var(--line); line-height: 1.5; }
.help th, .rec th { width: 34%; font-weight: 600; white-space: normal; }
.rec-sum { margin: 0 0 var(--s1); font-size: 13px; color: var(--ink-2); }
.rec-note { font-size: 13px; color: var(--ink-2); margin: var(--s3) 0 var(--s2); }

/* 알림 */
.toast { position: absolute; left: 50%; top: 54px; transform: translateX(-50%); z-index: 12; max-width: calc(100% - 24px); padding: 8px 14px; border-radius: 999px; background: rgba(246, 239, 225, 0.95); border: 1px solid var(--ink); font-size: 13px; line-height: 1.4; text-align: center; white-space: normal; pointer-events: none; }
.msg { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); z-index: 9; padding: 12px 18px; border-radius: var(--r2); background: rgba(246, 239, 225, 0.95); border: 1.5px solid var(--ink); font: 400 20px/1.3 var(--f-disp); text-align: center; max-width: calc(100% - 32px); pointer-events: none; }
.focus-hint { position: absolute; inset: auto 0 0 0; margin: auto; top: 0; width: max-content; height: 48px; z-index: 30; padding: 0 var(--s5); border-radius: 999px; border: 1.5px solid var(--ink); background: var(--paper); font: 600 15px/1 var(--f-body); }

/* ---------------------------------------------------------------- 화면 단추 (터치) */
.pad { position: absolute; left: 0; right: 0; bottom: 0; z-index: 7; display: flex; justify-content: space-between; align-items: flex-end; padding: 0 max(var(--s3), env(safe-area-inset-left)) max(var(--s3), env(safe-area-inset-bottom)) max(var(--s3), env(safe-area-inset-right)); pointer-events: none; touch-action: none; }
.pg { display: flex; gap: var(--s2); align-items: flex-end; pointer-events: auto; }
.pgn { align-self: center; color: #f6efe1; font: 400 14px/1 var(--f-disp); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); }
.pb { width: 64px; height: 64px; border-radius: 50%; border: 2px solid rgba(246, 239, 225, 0.85); background: rgba(29, 35, 69, 0.45); color: #f6efe1; font: 600 18px/1 var(--f-body); touch-action: none; display: flex; align-items: center; justify-content: center; }
.pb.j { width: 74px; height: 74px; font-size: 16px; background: rgba(201, 72, 63, 0.55); }
.pb.sw { width: 58px; height: 58px; font-size: 13px; background: rgba(59, 85, 150, 0.6); }
.pb.on { background: rgba(246, 239, 225, 0.85); color: var(--ink); }
.sm.portrait .pad { height: 150px; align-items: center; background: rgba(20, 18, 40, 0.92); border-top: 1px solid rgba(246, 239, 225, 0.25); padding-bottom: max(var(--s2), env(safe-area-inset-bottom)); }
.sm.portrait .pb { width: 70px; height: 70px; }
.sm.portrait .pb.j { width: 80px; height: 80px; }
.pad[data-two="true"] .pb { width: 58px; height: 58px; font-size: 16px; }
.pad[data-two="true"] .pb.j { width: 64px; height: 64px; font-size: 14px; }
@media (max-height: 420px) { .pb { width: 54px; height: 54px; font-size: 16px; } .pb.j { width: 60px; height: 60px; } .pb.sw { width: 50px; height: 50px; font-size: 12px; } }

/* 좁고 낮은 화면 */
@media (max-width: 560px) {
  .seg { grid-template-columns: 1fr; }
  .sel-body { grid-template-columns: 1fr; }
  .t-box { padding: var(--s4); }
}
.sm.portrait .title { align-items: flex-start; padding-top: var(--s4); }
.sm.portrait .t-box { width: 100%; }
@media (max-height: 520px) {
  .t-box { padding: var(--s3) var(--s4); }
  .t-name { font-size: 40px; }
  .t-sub { margin-bottom: var(--s2); font-size: 14px; }
  .segb span { display: none; }
  .seg { margin-bottom: var(--s2); }
  .st-box, .cl-box { padding: var(--s3) var(--s4); }
  .st-box h2 { font-size: 26px; margin-bottom: var(--s2); }
  .st-text p { font-size: 14px; line-height: 1.6; margin-bottom: var(--s2); }
  .cl-title { font-size: 30px; margin-bottom: var(--s2); }
  .cl-stars li { font-size: 13px; } .cl-stars .star { font-size: 20px; }
  .lvb { min-height: 42px; }
}
@media (max-height: 420px) {
  .t-kicker, .t-links { display: none; }
  .t-name { font-size: 32px; }
  .btn { height: 36px; font-size: 14px; }
  .sel-head { padding: 6px var(--s3); }
  .sel-head h2 { font-size: 20px; }
}
@media (prefers-reduced-motion: reduce) { .cl-stars li.on .star { animation: none; } .btn { transition: none; } }

/* ---------------------------------------------------------------- 소개 글 */
.about { max-width: 1240px; margin: var(--s6) auto 0; padding: 0 clamp(var(--s4), 3vw, var(--s6)); display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: var(--s6); align-items: start; }
.about-main { max-width: 760px; }
.about h2 { margin: var(--s6) 0 var(--s3); font: 400 28px/1.3 var(--f-disp); letter-spacing: 0.01em; }
.about h2:first-child { margin-top: 0; }
.about h3 { margin: var(--s4) 0 var(--s2); font: 600 17px/1.4 var(--f-body); }
.about p, .about li { font-size: 16px; line-height: 1.85; }
.about ul, .about ol { padding-left: 1.3em; }
.about li { margin-bottom: 6px; }
.about-side { position: sticky; top: var(--s4); background: var(--paper); border: 1px solid var(--page-line); border-radius: var(--r3); padding: var(--s4); }
.about-side h3 { margin: 0 0 var(--s2); font: 400 19px/1.2 var(--f-disp); }
.about-side h3 + table { margin-bottom: var(--s4); }
.keytab { width: 100%; border-collapse: collapse; font-size: 14px; }
.keytab th, .keytab td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--page-line); vertical-align: top; line-height: 1.5; }
.keytab th { font-weight: 600; width: 42%; }
.chtab-wrap { overflow-x: auto; }
.chtab { width: 100%; border-collapse: collapse; font-size: 15px; min-width: 480px; }
.chtab th, .chtab td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--page-line); vertical-align: top; line-height: 1.55; }
.chtab thead th { font-size: 13px; color: var(--page-2); font-weight: 600; }
.chtab tbody th { font: 400 18px/1.3 var(--f-disp); white-space: nowrap; }
.tale { border-left: 4px solid var(--red); padding: var(--s1) 0 var(--s1) var(--s4); margin: var(--s4) 0; }
.tale p { margin: 0 0 var(--s2); }
.about dl dt { font-weight: 700; margin-top: var(--s4); }
.about dl dd { margin: var(--s1) 0 0; }
.more { margin-top: var(--s6); font-size: 14px; line-height: 2; color: var(--page-2); }
.more a { white-space: nowrap; }
.foot { max-width: 1240px; margin: var(--s7) auto 0; padding: var(--s5) clamp(var(--s4), 3vw, var(--s6)) var(--s6); border-top: 1px solid var(--page-line); font-size: 14px; color: var(--page-2); }
.foot a { margin-right: var(--s4); white-space: nowrap; }
.foot p { margin: var(--s3) 0 0; line-height: 1.7; }
@media (max-width: 900px) { .about { grid-template-columns: minmax(0, 1fr); } .about-side { position: static; } }
.about-main, .about-side { min-width: 0; }
