:root {
  --bg: #0b0e14; --bg2: #11151d; --surface: #171c26; --surface2: #1f2532; --border: #2a3140;
  --text: #eef1f6; --muted: #8b94a7; --lc: #00a84d; --danger: #ff5c7a;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: 'Pretendard Variable', Pretendard, -apple-system, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif; touch-action: manipulation; -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
body { background-image: radial-gradient(900px 500px at 15% -10%, rgba(0, 168, 77, .10), transparent 60%), radial-gradient(800px 500px at 100% 0%, rgba(0, 82, 164, .14), transparent 60%); min-height: 100dvh; }
.hidden { display: none !important; }
button { font: inherit; cursor: pointer; color: inherit; }
kbd { font: 600 11px 'Pretendard Variable', Pretendard, sans-serif; padding: 1px 6px; border: 1px solid var(--border); border-radius: 5px; background: var(--surface2); color: var(--muted); }
small { color: var(--muted); font-weight: 400; }
code { background: var(--surface2); padding: 1px 5px; border-radius: 4px; font-size: 12px; }

/* 화면 전체 오버레이 (로비, 모달) */
.screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(5, 7, 12, .72); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); z-index: 10; overflow: auto; }
#lobby { background: var(--bg); background-image: radial-gradient(900px 500px at 15% -10%, rgba(0, 168, 77, .12), transparent 60%), radial-gradient(800px 500px at 100% 0%, rgba(0, 82, 164, .16), transparent 60%); }
.card { width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 28px; box-shadow: 0 30px 80px rgba(0, 0, 0, .5); max-height: calc(100dvh - 32px); overflow: auto; }
.card h1 { margin: 0 0 6px; font-size: 30px; font-weight: 800; letter-spacing: -1px; text-align: center; }
.card h1 span { color: var(--lc); }
.card h2 { margin: 0 0 6px; font-size: 18px; font-weight: 700; letter-spacing: -.3px; }
.sub, .muted { margin: 0 0 20px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.sub { text-align: center; }
.field { margin-bottom: 18px; min-width: 0; }
.field label, .field .lbl { display: block; font-size: 12px; font-weight: 600; margin-bottom: 8px; color: var(--muted); letter-spacing: .2px; }
input[type="text"], #name { width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg2); color: var(--text); font-size: 16px; outline: none; transition: border-color .15s, box-shadow .15s; }
input::placeholder { color: #566076; }
input:focus { border-color: var(--lc); box-shadow: 0 0 0 3px color-mix(in srgb, var(--lc) 25%, transparent); }
.primary { width: 100%; padding: 14px; border: 0; border-radius: 12px; background: var(--lc); color: #fff; font-size: 15px; font-weight: 700; letter-spacing: -.2px; transition: filter .15s, transform .05s; }
.primary:hover { filter: brightness(1.08); }
.primary:active { transform: translateY(1px); }
.ghost { padding: 8px 14px; border: 1px solid var(--border); border-radius: 10px; background: transparent; color: var(--muted); font-size: 13px; }
.ghost:hover { background: var(--surface2); color: var(--text); }
.row { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.hint { margin: 14px 0 0; text-align: center; font-size: 11px; color: var(--muted); }
.notice { margin-top: 8px; padding: 10px 12px; border-radius: 10px; background: rgba(255, 183, 3, .1); border: 1px solid rgba(255, 183, 3, .25); font-size: 12px; line-height: 1.5; color: #ffd166; }

/* 아바타 색 */

/* 책 검색 */
.search { position: relative; }
.results { position: absolute; left: 0; right: 0; top: calc(100% + 6px); max-height: 280px; overflow: auto; background: var(--surface2); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 16px 40px rgba(0, 0, 0, .5); z-index: 5; }
.results .hint { padding: 12px 14px; text-align: left; margin: 0; }
.results .hint.err { color: var(--danger); }
.results .row, .pick { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 12px; border: 0; background: transparent; text-align: left; color: var(--text); margin: 0; justify-content: flex-start; min-width: 0; }
.results .row:hover, .results .row.active { background: rgba(255, 255, 255, .06); }
.results img, .chip img, #btnBook img { width: 30px; height: 42px; object-fit: cover; border-radius: 3px; box-shadow: 0 2px 6px rgba(0, 0, 0, .5); flex: none; }
.pick img { width: 32px; height: 44px; object-fit: cover; border-radius: 3px; box-shadow: 0 2px 6px rgba(0, 0, 0, .3); flex: none; }
.nocover { width: 30px; height: 42px; display: inline-flex; align-items: center; justify-content: center; background: var(--bg2); border-radius: 3px; flex: none; }
.meta { display: flex; flex-direction: column; min-width: 0; }
.meta .t { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta .a { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pick { border: 1px solid var(--border); border-radius: 12px; background: var(--bg2); margin-bottom: 8px; }
.pick .clear { margin-left: auto; border: 0; background: transparent; color: var(--muted); font-size: 14px; }

/* 노선 선택 */
.lines { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.line { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg2); color: var(--text); font-size: 13px; white-space: nowrap; transition: border-color .15s, background .15s; }
.line:hover { border-color: #3a4256; }
.line b { display: inline-flex; width: 26px; height: 26px; align-items: center; justify-content: center; border-radius: 50%; background: var(--lc); color: #fff; font-size: 12px; font-weight: 800; flex: none; }
.line .txt { display: flex; flex-direction: column; line-height: 1.2; text-align: left; font-weight: 600; }
.line small { font-size: 10px; font-weight: 400; }
.line.active { border-color: var(--lc); background: color-mix(in srgb, var(--lc) 14%, var(--bg2)); box-shadow: 0 0 0 1px var(--lc); }

/* 객차 */
#app { max-width: 820px; margin: 16px auto; padding: 0 12px; }
.wrap { position: relative; width: 100%; border-radius: 20px; overflow: hidden; isolation: isolate; background: #0e1220; outline: none; box-shadow: 0 0 0 2px var(--lc), 0 30px 80px rgba(0, 0, 0, .5); } /* 노선색 테두리는 늘 (포커스와 상관없이 같은 모습) */
.wrap:focus { box-shadow: 0 0 0 2px var(--lc), 0 30px 80px rgba(0, 0, 0, .5); }
canvas { display: block; width: 100%; image-rendering: pixelated; image-rendering: crisp-edges; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; border-radius: inherit; }
body.touch #app { overflow-x: hidden; }
.pad { position: absolute; right: 10px; bottom: 10px; display: flex; gap: 6px; user-select: none; }
.pad button { height: 36px; min-width: 36px; padding: 0 12px; border: 1px solid rgba(255, 255, 255, .12); border-radius: 10px; background: rgba(11, 14, 20, .72); backdrop-filter: blur(6px); color: #fff; font-size: 13px; font-weight: 600; touch-action: none; }
.pad button:hover { background: rgba(11, 14, 20, .9); }
.banner { position: absolute; left: 0; right: 0; top: 0; padding: 6px; text-align: center; background: var(--danger); color: #fff; font-size: 12px; font-weight: 600; }
.bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 12px; font-size: 13px; }
.status { color: var(--muted); min-height: 18px; }
.btns { display: flex; gap: 6px; flex: none; }
.btns button { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font-size: 12px; font-weight: 600; white-space: nowrap; }
.btns button:hover { border-color: var(--lc); }
#btnBook img { width: 16px; height: 22px; }
#btnList { display: none; }
.cars { display: flex; gap: 4px; margin-top: 10px; overflow-x: auto; scrollbar-width: none; }
.cars::-webkit-scrollbar { display: none; }
.cars button { flex: 1 0 auto; min-width: 34px; padding: 4px 6px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--muted); font-size: 11px; line-height: 1.15; display: flex; flex-direction: column; align-items: center; gap: 1px; }
.cars button b { font-size: 12px; color: var(--text); }
.cars button.live { border-color: var(--lc); color: var(--text); }
.cars button.live b::after { content: ''; display: inline-block; width: 5px; height: 5px; margin-left: 3px; border-radius: 50%; background: var(--lc); vertical-align: 2px; }
.cars button.full { border-color: #d93a3a; color: #ff8a8a; background: rgba(217, 58, 58, .12); cursor: not-allowed; }
.cars button.full b { color: #ff8a8a; }
.cars button.full b::after { background: #d93a3a; }
.cars button.cur { background: var(--lc); border-color: var(--lc); color: #fff; }
.cars button.cur b { color: #fff; }
.cars button.cur b::after { background: #fff; }
.list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 4px 9px 4px 4px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); font-size: 12px; font-weight: 500; }
.chip.me { border-color: var(--lc); }
.chip img { width: 18px; height: 26px; }
.chip i { width: 10px; height: 14px; border-radius: 2px; display: inline-block; }
.chip small { font-size: 10px; }

/* ---------- 모바일 ---------- */
.mpad { display: none; }
.hint.tap { display: none; }
body.touch .hint.kb { display: none; }
body.touch kbd { display: none; }
body.touch .hint.tap { display: block; }
body.touch .pad { display: none; }
.pad, .mpad, .bar { display: none !important; }
body.touch .mpad { display: flex; justify-content: space-between; gap: 10px; margin-top: 10px; user-select: none; -webkit-user-select: none; }
.mpad .move, .mpad .act { display: flex; gap: 8px; }
.mpad .move { flex: 1; }
.mpad button { height: 48px; min-width: 44px; padding: 0 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); font-size: 14px; font-weight: 700; white-space: nowrap; touch-action: none; }
.mpad .act { min-width: 0; }
.mpad .act button { padding: 0 10px; }
.mpad .move button { min-width: 44px; padding: 0 8px; font-size: 20px; flex: 1; }
.mpad button:active { background: var(--surface2); transform: translateY(1px); }
@media (max-width: 600px) {
  .screen { padding: 8px; align-items: flex-start; }
  #lobby { padding-top: max(8px, env(safe-area-inset-top)); }
  .card { padding: 22px 18px; border-radius: 18px; max-height: none; }
  input[type="text"], #name { font-size: 16px; } /* iOS 자동 확대 방지 */
  #modal .card, #lineModal .card { margin-top: 8vh; max-height: calc(100dvh - 10vh - 16px); }
  .card h1 { font-size: 26px; }
  .results { position: static; margin-top: 6px; max-height: 45dvh; box-shadow: none; }
  #app { margin: 6px auto; padding: 0 6px max(6px, env(safe-area-inset-bottom)); }
  .wrap { border-radius: 12px; }
  .bar { flex-direction: column; align-items: stretch; gap: 6px; margin-top: 8px; }
  .status { min-height: 16px; font-size: 12px; line-height: 1.35; }
  .btns button { flex: 1; justify-content: center; padding: 9px 10px; font-size: 13px; }
  .chip { font-size: 11px; }
  .lines { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .line { padding: 6px 7px; gap: 6px; font-size: 12px; }
  .line b { width: 22px; height: 22px; font-size: 11px; }
  .line small { font-size: 9px; }
  body.touch .mpad { margin-top: 6px; gap: 6px; }
  body.touch .mpad button { height: 44px; border-radius: 10px; }
  body.touch .mpad .move button { font-size: 18px; }
  body.touch .mpad .act button { font-size: 13px; padding: 0 12px; }
  .status { padding: 0 4px; font-size: 12px; line-height: 1.35; }
  .btns { gap: 6px; }
  .btns button { padding: 8px 10px; font-size: 12px; min-height: 36px; }
  .btns #btnBook { flex: 1; min-width: 0; max-width: 100%; overflow: hidden; }
  .btns #btnBook img { width: 14px; height: 20px; }
  .btns #btnBook .label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; max-width: 160px; vertical-align: middle; }
  .btns #btnLine { flex: none; }
  .btns #btnLine .label { font-size: 0; }
  .btns #btnLine .label::before { content: '노선'; font-size: 12px; }
  .cars { margin-top: 6px; gap: 3px; }
  .cars button { min-width: 30px; padding: 3px 4px; font-size: 10px; border-radius: 6px; }
  .cars button b { font-size: 11px; }
  .list { margin-top: 6px; gap: 4px; }
  .chip { padding: 3px 7px 3px 3px; gap: 5px; }
  .chip img { width: 14px; height: 20px; }
  .hint { margin-top: 8px; font-size: 10px; line-height: 1.35; padding: 0 4px; opacity: .7; }
}

/* ---------- 가로 모드 (폰을 눕혔을 때) ---------- */
body.landscape { overflow: hidden; }
body.landscape #app { position: fixed; inset: 0; margin: 0; padding: 0; max-width: none; background: #05070c; }
body.landscape .wrap { position: absolute; inset: 0; border-radius: 0; box-shadow: none; display: flex; align-items: center; justify-content: center; background: #05070c; }
body.landscape .wrap:focus { box-shadow: none; }
body.landscape .bar { position: absolute; top: max(8px, env(safe-area-inset-top)); left: max(16px, env(safe-area-inset-left)); right: max(16px, env(safe-area-inset-right)); margin: 0; flex-direction: row; align-items: center; gap: 4px; pointer-events: none; z-index: 5; }
body.landscape .mpad { position: absolute; bottom: max(10px, env(safe-area-inset-bottom)); left: max(16px, env(safe-area-inset-left)); right: max(16px, env(safe-area-inset-right)); margin: 0; pointer-events: none; z-index: 5; }
body.landscape .status { flex: 1; min-width: 0; background: rgba(11, 14, 20, .78); backdrop-filter: blur(6px); color: var(--text); padding: 6px 10px; border-radius: 8px; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
body.landscape .btns { pointer-events: auto; }
body.landscape .btns { gap: 4px; flex: none; align-items: center; }
body.landscape .btns button { flex: none; padding: 5px 8px; font-size: 11px; line-height: 1.4; background: rgba(11, 14, 20, .8); backdrop-filter: blur(6px); border-radius: 8px; min-height: 28px; }
body.landscape .status { line-height: 1.4; min-height: 28px; display: flex; align-items: center; }
body.landscape #btnBook { max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 6px 8px; }
body.landscape #btnLine { font-size: 0; padding: 6px 10px; }
body.landscape #btnLine::before { content: '🚇'; font-size: 13px; }
body.landscape #btnList { display: inline-flex; padding: 6px 10px; font-size: 13px; }
/* mpad 위치는 bar와 함께 위에서 정의됨 */
body.landscape .mpad .move, body.landscape .mpad .act { pointer-events: auto; }
body.landscape .mpad .move { flex: none; }
body.landscape .mpad button { height: 42px; min-width: 42px; padding: 0 12px; font-size: 13px; background: rgba(11, 14, 20, .78); backdrop-filter: blur(6px); border-color: rgba(255, 255, 255, .12); border-radius: 10px; }
body.landscape .mpad .move button { min-width: 50px; font-size: 18px; }
body.landscape .hint, body.landscape .cars { display: none !important; }
body.landscape .list { display: none; position: absolute; right: max(10px, env(safe-area-inset-right)); top: 46px; max-width: 70%; max-height: calc(100% - 110px); overflow: auto; margin: 0; padding: 8px; border-radius: 12px; background: rgba(23, 28, 38, .96); border: 1px solid var(--border); box-shadow: 0 16px 40px rgba(0, 0, 0, .5); }
body.landscape .list.open { display: flex; }
body.landscape .banner { top: auto; bottom: 64px; }
body.landscape .screen .card { max-height: calc(100dvh - 16px); }

/* ---------- 첫 진입 랜딩 (밝은 톤) ---------- */
/* ---------- 첫 진입 랜딩: 로비의 '승차권 발급기' 패널과 같은 픽셀 패널을 출입구 장면 위에 띄운다 ---------- */
#landing { z-index: 20; align-items: center !important; background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; color: #1f2227; }
body.landing-on #lobbyForm { visibility: hidden; }
.land { --step: 4px; --p: 3px; --lc: #ffcf1f; --lc-ink: #1f2227; /* 랜딩은 특정 호선 색 대신 지하철 표지판 노랑 */ position: relative; isolation: isolate; width: 100%; max-width: 480px; margin: auto; padding: 14px 20px 22px; text-align: center; filter: drop-shadow(0 4px 0 rgba(30, 32, 38, .55)); }
.land::before, .land::after { content: ''; position: absolute; z-index: -1; pointer-events: none;
  clip-path: polygon(0 var(--step), var(--step) var(--step), var(--step) 0, calc(100% - var(--step)) 0, calc(100% - var(--step)) var(--step), 100% var(--step), 100% calc(100% - var(--step)), calc(100% - var(--step)) calc(100% - var(--step)), calc(100% - var(--step)) 100%, var(--step) 100%, var(--step) calc(100% - var(--step)), 0 calc(100% - var(--step))); }
.land::before { inset: 0; background: #1f2227; }
.land::after { inset: 2px; background: #e6e9ed; }
.land .tk-head { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; margin: 0 -18px 18px; padding: 0 18px 12px; border-bottom: 3px solid var(--lc); font-size: 17px; font-weight: 800; letter-spacing: -.2px; text-align: center; }
/* 카드 맨 위 가운데: 흰 원(짙은 테두리) 안에 노란 도트 지하철 아이콘. 원의 위 절반은 카드 테두리 밖으로 걸친다 */
.land .land-badge { display: flex; align-items: center; justify-content: center; width: 52px; height: 52px; margin-top: -42px; border-radius: 50%; background: #ffffff; border: 2px solid #1f2227; box-shadow: 0 3px 0 rgba(30, 32, 38, .45); }
.land .land-badge svg { display: block; image-rendering: pixelated; }
.land .tk-icon { flex: none; image-rendering: pixelated; }
.land .tag { margin: 0 0 8px; font-size: 16px; font-weight: 600; color: #4b5160; letter-spacing: -.3px; }
.land .headline { margin: 0 0 18px; font-size: 40px; line-height: 1.15; font-weight: 900; letter-spacing: -1.4px; color: #1f2227; -webkit-text-stroke: 0.5px #1f2227; paint-order: stroke fill; } /* 900에 얇은 외곽 획만 살짝 */
.land .headline span { color: #1f2227; background: linear-gradient(transparent 62%, #ffcf1f 62%); } /* 형광펜 밑줄 */
/* 미리보기: 픽셀 액자 (짙은 회색 2px 테두리, 모서리 한 칸 꺾음) */
.preview-frame { padding: 2px; margin: 0 0 20px; background: #1f2227; clip-path: polygon(0 var(--p), var(--p) var(--p), var(--p) 0, calc(100% - var(--p)) 0, calc(100% - var(--p)) var(--p), 100% var(--p), 100% calc(100% - var(--p)), calc(100% - var(--p)) calc(100% - var(--p)), calc(100% - var(--p)) 100%, var(--p) 100%, var(--p) calc(100% - var(--p)), 0 calc(100% - var(--p))); }
.preview { display: block; width: 100%; image-rendering: pixelated; image-rendering: crisp-edges; background: #e9eef8; }
/* 시작 버튼: 로비 탑승 버튼과 같은 픽셀 키 (선택 호선 색 바탕, 아래 남색 받침) */
.land .cta { --ol: #000000; --fill: #1f2227; display: block; width: 100%; min-height: 56px; padding: 0 0 6px; border: 0; border-radius: 0; color: #ffffff; font-size: 17px; font-weight: 800; cursor: pointer;
  clip-path: polygon(0 calc(var(--p) * 4), var(--p) calc(var(--p) * 4), var(--p) calc(var(--p) * 2), calc(var(--p) * 2) calc(var(--p) * 2), calc(var(--p) * 2) var(--p), calc(var(--p) * 4) var(--p), calc(var(--p) * 4) 0, calc(100% - var(--p) * 4) 0, calc(100% - var(--p) * 4) var(--p), calc(100% - var(--p) * 2) var(--p), calc(100% - var(--p) * 2) calc(var(--p) * 2), calc(100% - var(--p)) calc(var(--p) * 2), calc(100% - var(--p)) calc(var(--p) * 4), 100% calc(var(--p) * 4), 100% calc(100% - var(--p) * 4), calc(100% - var(--p)) calc(100% - var(--p) * 4), calc(100% - var(--p)) calc(100% - var(--p) * 2), calc(100% - var(--p) * 2) calc(100% - var(--p) * 2), calc(100% - var(--p) * 2) calc(100% - var(--p)), calc(100% - var(--p) * 4) calc(100% - var(--p)), calc(100% - var(--p) * 4) 100%, calc(var(--p) * 4) 100%, calc(var(--p) * 4) calc(100% - var(--p)), calc(var(--p) * 2) calc(100% - var(--p)), calc(var(--p) * 2) calc(100% - var(--p) * 2), var(--p) calc(100% - var(--p) * 2), var(--p) calc(100% - var(--p) * 4), 0 calc(100% - var(--p) * 4));
  background:
    linear-gradient(var(--ol), var(--ol)) calc(var(--p) * 2) var(--p) / calc(var(--p) * 2) var(--p) no-repeat,
    linear-gradient(var(--ol), var(--ol)) var(--p) calc(var(--p) * 2) / var(--p) calc(var(--p) * 2) no-repeat,
    linear-gradient(var(--ol), var(--ol)) calc(100% - var(--p) * 2) var(--p) / calc(var(--p) * 2) var(--p) no-repeat,
    linear-gradient(var(--ol), var(--ol)) calc(100% - var(--p)) calc(var(--p) * 2) / var(--p) calc(var(--p) * 2) no-repeat,
    linear-gradient(var(--ol), var(--ol)) calc(var(--p) * 2) calc(100% - var(--p)) / calc(var(--p) * 2) var(--p) no-repeat,
    linear-gradient(var(--ol), var(--ol)) var(--p) calc(100% - var(--p) * 2) / var(--p) calc(var(--p) * 2) no-repeat,
    linear-gradient(var(--ol), var(--ol)) calc(100% - var(--p) * 2) calc(100% - var(--p)) / calc(var(--p) * 2) var(--p) no-repeat,
    linear-gradient(var(--ol), var(--ol)) calc(100% - var(--p)) calc(100% - var(--p) * 2) / var(--p) calc(var(--p) * 2) no-repeat,
    var(--fill);
  box-shadow: inset 0 var(--p) 0 0 var(--ol), inset 0 calc(var(--p) * -1 - 5px) 0 0 var(--ol), inset var(--p) 0 0 0 var(--ol), inset calc(var(--p) * -1) 0 0 0 var(--ol); }
.land .cta:hover { filter: brightness(1.35); }
.land .cta:active { transform: translateY(3px); box-shadow: inset 0 var(--p) 0 0 var(--ol), inset 0 calc(var(--p) * -1 - 2px) 0 0 var(--ol), inset var(--p) 0 0 0 var(--ol), inset calc(var(--p) * -1) 0 0 0 var(--ol); }
.land .fine { margin: 14px 0 0; font-size: 13px; color: #5b6170; }
@media (max-width: 480px) { .land { padding: 12px 14px 20px; } .land .tk-head { margin: 0 -12px 16px; padding: 0 12px 10px; } .land .land-badge { margin-top: -40px; } .land .headline { font-size: 34px; } }

/* ---------- 로비: 랜딩과 같은 밝은 톤 (흰 카드 · 파란 포인트 · 노선색은 노선 버튼에만) ---------- */
#lobby { background: #f5f8ff; background-image: radial-gradient(700px 400px at 50% -10%, rgba(47, 107, 255, .10), transparent 60%); color: #1b1d26; backdrop-filter: none; -webkit-backdrop-filter: none; }
#lobby .card { background: #fff; border: 1px solid #e3e8f3; box-shadow: 0 18px 50px rgba(31, 60, 120, .14); color: #1b1d26; }
#lobby .card h1 { display: flex; align-items: center; justify-content: center; gap: 8px; color: #1b1d26; }
#lobby .card h1 b { font-weight: inherit; }
#lobby .card h1 span { color: #2f6bff; }
#lobby .sub { color: #4b5160; font-size: 14px; }
#lobby .field label, #lobby .field .lbl { color: #1b1d26; font-size: 13px; }
#lobby .field .lbl small { color: #6b7280; font-weight: 400; }
#lobby input[type="text"], #lobby #name { background: #f7f9ff; border-color: #d7deee; color: #1b1d26; box-sizing: border-box; height: 56px; padding: 0 14px; }
#lobby input::placeholder { color: #9aa3b5; }
#lobby input:focus { border-color: #2f6bff; box-shadow: 0 0 0 3px rgba(47, 107, 255, .18); }
#lobby .pick { background: #f7f9ff; border-color: #d7deee; color: #1b1d26; }
#lobby .pick .clear { color: #6b7280; }
#lobby .pick .a, #lobby .results .a { color: #6b7280; }
#lobby .results { background: #fff; border-color: #d7deee; box-shadow: 0 16px 40px rgba(31, 60, 120, .18); color: #1b1d26; }
#lobby .results .row { color: #1b1d26; }
#lobby .results .row:hover, #lobby .results .row.active { background: #f0f4ff; }
#lobby .results .hint { color: #6b7280; }
#lobby .nocover { background: #eef2fb; }
#lobby .notice { background: #fff8e1; border-color: #ffe08a; color: #7a5a00; }
#lobby .line { background: #f7f9ff; border-color: #d7deee; color: #1b1d26; }
#lobby .line small { color: #6b7280; }
#lobby .line.active { border-color: var(--lc); background: color-mix(in srgb, var(--lc) 10%, #fff); box-shadow: 0 0 0 1px var(--lc); }
#lobby .primary { background: #2f6bff; border-radius: 999px; box-shadow: 0 10px 24px rgba(47, 107, 255, .3); font-size: 16px; font-weight: 800; }
#lobby .primary:hover { background: #255fe8; filter: none; }
#lobby .hint { color: #6b7280; }

/* ---------- 로비: 서울 지하철 출입구 픽셀 장면(scene.js)을 배경으로, 입력은 입구 앞 보도블록 위 밝은 패널 ---------- */
#lobby { background: #9db3ae; background-image: none; overflow-x: hidden; align-items: flex-start; padding: 0; }
#lobby .lobby-scene { position: absolute; left: 0; top: 0; width: 100%; z-index: 0; overflow: hidden; pointer-events: none; }
/* 패널 위치: 입구 장면 바로 아래부터(--scene-top), 아래로는 자전거길 높이만큼 비운다(--lane-h). 값은 app.js가 장면을 그릴 때 정한다 */
#lobby .card { position: relative; z-index: 1; margin: var(--scene-top, 300px) auto var(--lane-h, 80px); padding: 18px 22px 22px; border: 0; border-radius: 14px; background: rgba(255, 255, 255, .94); box-shadow: 0 10px 30px rgba(30, 40, 72, .18); overflow: visible; max-height: none; }
#lobby input[type="text"], #lobby #name, #lobby .pick, #lobby .line { background: #fff; }
#lobby .card h1, #lobby .sub { display: none; }
#lobby input[type="text"], #lobby #name { border: 0; border-radius: 6px; background: #fff; box-shadow: 3px 3px 0 rgba(27, 29, 38, .12); }
#lobby input:focus { box-shadow: 3px 3px 0 rgba(31, 58, 104, .45), 0 0 0 2px rgba(31, 58, 104, .25); }
#lobby .pick { border: 0; border-radius: 6px; background: #fff; box-shadow: 3px 3px 0 rgba(27, 29, 38, .12); height: 56px; box-sizing: border-box; padding: 6px 12px; }
#lobby .results { border: 2px solid #1b1d26; border-radius: 6px; box-shadow: 6px 6px 0 rgba(27, 29, 38, .15); }
#lobby .line { border: 0; border-radius: 6px; background: #fff; box-shadow: 3px 3px 0 rgba(27, 29, 38, .12); }
#lobby .line.active { background: color-mix(in srgb, var(--lc) 14%, #fff); box-shadow: 3px 3px 0 var(--lc); }
#lobby .primary { border: 3px solid #1b1d26; border-radius: 8px; background: #1f3a68; box-shadow: 5px 5px 0 rgba(27, 29, 38, .25); }
#lobby .primary:hover { background: #27498a; }
#lobby .primary:active { transform: translate(3px, 3px); box-shadow: 2px 2px 0 rgba(27, 29, 38, .25); }
#lobby .field label, #lobby .field .lbl { color: #1f3a68; }
@media (max-width: 480px) { #lobby .card { width: calc(100% - 24px); padding: 16px 14px 18px; } }

/* ---------- 모바일 세로 전용 2줄 버튼 ---------- */
.mrows { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.mrow { display: flex; gap: 8px; }
.mrow button { flex: 1; height: 48px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); font-size: 14px; font-weight: 700; white-space: nowrap; touch-action: none; }
.mrow button:active { background: var(--surface2); transform: translateY(1px); }
.mrow-move button[data-k="arrowleft"], .mrow-move button[data-k="arrowright"] { flex: 1; font-size: 20px; }
.mrow-book .rbook { flex: 1; min-width: 0; overflow: hidden; }
.mrow-book .rbook .label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; max-width: 100%; }
.mrow-book .rbook img { width: 16px; height: 22px; vertical-align: middle; margin-right: 4px; }
.mrow-read button { flex: 1; width: 100%; height: 56px; font-size: 16px; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 12px; }
.mrow-read .rpause { flex: 1; width: auto; background: var(--surface); color: var(--text); border: 1px solid var(--border); }
canvas.mclock { display: none; }
.mrow-invite .rinvite { flex: 1; height: 48px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: transparent; color: var(--muted, #aab); border-style: dashed; }
.mrow-invite .rinvite:hover { color: var(--text); border-color: var(--lc); }
@media (max-width: 600px) {
  body.touch .mrows { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
  body.touch .mrows ~ .mpad, body.touch .mrows ~ .bar .btns { display: none; }
  body.touch .mrows ~ .bar { margin-top: 10px; }
  .mrow { display: flex; gap: 8px; }
  .mrow button { flex: 1; height: 48px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); font-size: 14px; font-weight: 700; white-space: nowrap; touch-action: none; }
  .mrow button:active { background: var(--surface2); transform: translateY(1px); }
  .mrow-move button[data-k="arrowleft"], .mrow-move button[data-k="arrowright"] { flex: 0 0 56px; font-size: 20px; }
  .mrow-move .rline { flex: 1; }
  .mrow-book .rbook { flex: 1; min-width: 0; overflow: hidden; }
  .mrow-book .rbook .label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; max-width: 100%; }
  .mrow-book .rbook img { width: 16px; height: 22px; vertical-align: middle; margin-right: 4px; }
  .mrow-book .rread { flex: 0 0 140px; background: var(--lc); color: #fff; border-color: var(--lc); }
}

/* 모바일 세로: 독서 버튼 아래 큰 디지털 시계 배지 */
.mclock { display: none; }
@media (max-width: 600px) {
  body.touch canvas.mclock { display: block; margin: 10px auto 0; image-rendering: pixelated; image-rendering: crisp-edges; }
}

/* 로비 필드 가로 배치 (닉네임 + 지금 읽는 책) */
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; min-width: 0; }
.field-row .field { margin-bottom: 18px; min-width: 0; }
@media (max-width: 600px) {
  .field-row { grid-template-columns: 1fr; gap: 0; }
}

/* ---------- 로비 카드: 지하철역 앞 '승차권 발급기' 패널 (배경 픽셀 장면과 같은 게임 요소처럼) ----------
   모서리는 한 칸(4px)씩 꺾인 사각, 짙은 남색 2px 테두리, 불투명 밝은 회색, 아래로 4px 떨어진 단단한 그림자.
   픽셀 표현은 패널 모서리·테두리·아이콘에만, 한글은 일반 고딕(Pretendard) 그대로 */
#lobby .card { --step: 4px; isolation: isolate; background: none; border-radius: 0; box-shadow: none; padding: 14px 20px 22px; filter: drop-shadow(0 4px 0 rgba(30, 32, 38, .55)); }
#lobby .card::before, #lobby .card::after { content: ''; position: absolute; z-index: -1; pointer-events: none;
  clip-path: polygon(0 var(--step), var(--step) var(--step), var(--step) 0, calc(100% - var(--step)) 0, calc(100% - var(--step)) var(--step), 100% var(--step), 100% calc(100% - var(--step)), calc(100% - var(--step)) calc(100% - var(--step)), calc(100% - var(--step)) 100%, var(--step) 100%, var(--step) calc(100% - var(--step)), 0 calc(100% - var(--step))); }
#lobby .card::before { inset: 0; background: #1f2227; }
#lobby .card::after { inset: 2px; background: #e6e9ed; }
/* 상단: 도트 지하철 아이콘 + '독서행 승차권 발급', 아래에 선택한 호선 색 띠 */
#lobby .tk-head { display: flex; align-items: center; gap: 8px; margin: 0 -18px 16px; padding: 2px 18px 10px; border-bottom: 3px solid var(--lc); color: #1f2227; font-size: 16px; font-weight: 800; letter-spacing: -.2px; }
#lobby .tk-icon { flex: none; image-rendering: pixelated; }
#lobby .field label, #lobby .field .lbl { color: #1f2227; font-weight: 700; }
/* 입력창·책 선택: 개별 그림자 없이 얇은 테두리 */
#lobby input[type="text"], #lobby #name { min-height: 48px; border: 2px solid #aeb6c2; border-radius: 0; background: #fff; box-shadow: none; }
#lobby input:focus { border-color: #1f2227; box-shadow: none; outline: none; }
#lobby .pick { min-height: 56px; border: 2px solid #aeb6c2; border-radius: 0; background: #fff; box-shadow: none; }
#lobby .results { border: 2px solid #1f2227; border-radius: 0; box-shadow: 0 4px 0 rgba(20, 30, 52, .35); }
/* 호선 선택: 같은 크기 3×3 타일. 기본은 밝은 회색, 선택한 타일만 그 호선 색 테두리 + 체크 */
#lobby .lines { grid-template-columns: repeat(3, 1fr); gap: 8px; }
#lobby .line { position: relative; min-height: 52px; border: 2px solid #c3c9d2; border-radius: 0; background: #f3f4f6; box-shadow: none; }
#lobby .line.active { border-color: var(--lc); background: #fff; box-shadow: none; }
#lobby .line.active::after { content: '✓'; position: absolute; top: -2px; right: -2px; width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; background: var(--lc); color: var(--lc-ink, #fff); font-size: 12px; font-weight: 900; line-height: 1; }
/* 탑승 버튼: 선택한 호선 색 바탕, 글자색은 대비가 큰 쪽(짙은 남색/흰색) */
#lobby .primary { min-height: 54px; border: 2px solid #1f2227; border-radius: 0; background: var(--lc); color: var(--lc-ink, #fff); box-shadow: 0 4px 0 #1f2227; font-size: 16px; font-weight: 800; }
#lobby .primary:hover { background: var(--lc); filter: brightness(1.06); }
#lobby .primary:active { transform: translateY(3px); box-shadow: 0 1px 0 #1f2227; }
@media (max-width: 600px) { #lobby .card { padding: 12px 14px 20px; } #lobby .tk-head { margin: 0 -12px 14px; padding: 2px 12px 10px; } #lobby .lines { gap: 6px; } }
/* 입력·버튼·호선 타일: 픽셀아트식 둥근 끝 — 칸 자체를 모서리마다 4·2·1·1칸 들이는 계단으로 깎고(clip-path, 반지름 약 4칸),
   테두리는 안쪽 그림자 4변 + 모서리 계단 한 칸(작은 사각 4개)으로 그려 선이 대각선으로 이어지게 한다 */
#lobby .card { --p: 3px; }
#lobby input[type="text"], #lobby #name, #lobby .pick, #lobby .line, #lobby .line.active, #lobby .primary {
  --ol: #aeb6c2; --fill: #fff; border: 0; border-radius: 0; margin: 0;
  clip-path: polygon(0 calc(var(--p) * 4), var(--p) calc(var(--p) * 4), var(--p) calc(var(--p) * 2), calc(var(--p) * 2) calc(var(--p) * 2), calc(var(--p) * 2) var(--p), calc(var(--p) * 4) var(--p), calc(var(--p) * 4) 0, calc(100% - var(--p) * 4) 0, calc(100% - var(--p) * 4) var(--p), calc(100% - var(--p) * 2) var(--p), calc(100% - var(--p) * 2) calc(var(--p) * 2), calc(100% - var(--p)) calc(var(--p) * 2), calc(100% - var(--p)) calc(var(--p) * 4), 100% calc(var(--p) * 4), 100% calc(100% - var(--p) * 4), calc(100% - var(--p)) calc(100% - var(--p) * 4), calc(100% - var(--p)) calc(100% - var(--p) * 2), calc(100% - var(--p) * 2) calc(100% - var(--p) * 2), calc(100% - var(--p) * 2) calc(100% - var(--p)), calc(100% - var(--p) * 4) calc(100% - var(--p)), calc(100% - var(--p) * 4) 100%, calc(var(--p) * 4) 100%, calc(var(--p) * 4) calc(100% - var(--p)), calc(var(--p) * 2) calc(100% - var(--p)), calc(var(--p) * 2) calc(100% - var(--p) * 2), var(--p) calc(100% - var(--p) * 2), var(--p) calc(100% - var(--p) * 4), 0 calc(100% - var(--p) * 4));
  background:
    linear-gradient(var(--ol), var(--ol)) calc(var(--p) * 2) var(--p) / calc(var(--p) * 2) var(--p) no-repeat,
    linear-gradient(var(--ol), var(--ol)) var(--p) calc(var(--p) * 2) / var(--p) calc(var(--p) * 2) no-repeat,
    linear-gradient(var(--ol), var(--ol)) calc(100% - var(--p) * 2) var(--p) / calc(var(--p) * 2) var(--p) no-repeat,
    linear-gradient(var(--ol), var(--ol)) calc(100% - var(--p)) calc(var(--p) * 2) / var(--p) calc(var(--p) * 2) no-repeat,
    linear-gradient(var(--ol), var(--ol)) calc(var(--p) * 2) calc(100% - var(--p)) / calc(var(--p) * 2) var(--p) no-repeat,
    linear-gradient(var(--ol), var(--ol)) var(--p) calc(100% - var(--p) * 2) / var(--p) calc(var(--p) * 2) no-repeat,
    linear-gradient(var(--ol), var(--ol)) calc(100% - var(--p) * 2) calc(100% - var(--p)) / calc(var(--p) * 2) var(--p) no-repeat,
    linear-gradient(var(--ol), var(--ol)) calc(100% - var(--p)) calc(100% - var(--p) * 2) / var(--p) calc(var(--p) * 2) no-repeat,
    var(--fill);
  box-shadow: inset 0 var(--p) 0 0 var(--ol), inset 0 calc(var(--p) * -1) 0 0 var(--ol), inset var(--p) 0 0 0 var(--ol), inset calc(var(--p) * -1) 0 0 0 var(--ol);
}
#lobby input[type="text"], #lobby #name, #lobby .pick { width: 100%; box-sizing: border-box; padding-left: 16px; padding-right: 16px; }
#lobby input:focus { --ol: #1f2227; outline: none; }
#lobby .lines { gap: 8px; padding: 0; }
#lobby .lines .line { --ol: #c3c9d2; --fill: #f3f4f6; }
#lobby .lines .line.active { --ol: var(--lc); --fill: #fff; }
#lobby .line.active::after { top: var(--p); right: var(--p); clip-path: polygon(0 0, calc(100% - var(--p) * 2) 0, calc(100% - var(--p) * 2) var(--p), calc(100% - var(--p)) var(--p), calc(100% - var(--p)) calc(var(--p) * 2), 100% calc(var(--p) * 2), 100% 100%, 0 100%); } /* 체크 칸도 바깥 모서리를 계단에 맞춘다 */
/* 탑승 버튼: 남색 픽셀 테두리 + 아래쪽 남색 받침(눌리는 키 느낌). 누르면 받침이 얇아진다 */
#lobby .primary { --ol: #1f2227; --fill: var(--lc); width: 100%; padding-bottom: 18px;
  box-shadow: inset 0 var(--p) 0 0 var(--ol), inset 0 calc(var(--p) * -1 - 5px) 0 0 var(--ol), inset var(--p) 0 0 0 var(--ol), inset calc(var(--p) * -1) 0 0 0 var(--ol); }
#lobby .primary:hover { filter: brightness(1.06); }
#lobby .primary:active { transform: translateY(3px); box-shadow: inset 0 var(--p) 0 0 var(--ol), inset 0 calc(var(--p) * -1 - 2px) 0 0 var(--ol), inset var(--p) 0 0 0 var(--ol), inset calc(var(--p) * -1) 0 0 0 var(--ol); }

/* 모바일 세로 최상단 노선 버튼 */
.rline-top { display: flex; align-items: center; gap: 12px; width: 100%; margin-bottom: 8px; padding: 16px 18px; min-height: 60px; border: 0; border-radius: 14px; overflow: hidden; background: var(--rl-bg, var(--surface)); color: var(--rl-ink, var(--text)); text-align: left; box-shadow: inset 0 -3px 0 #1b1d26; } /* 노선색 띠 (독서 완료 티켓 머리와 같은 모양) */
.rl-ic { flex: none; display: flex; }
.rl-ic svg { display: block; image-rendering: pixelated; image-rendering: crisp-edges; }
.rl-title { flex: 1; min-width: 0; font-size: 17px; font-weight: 800; letter-spacing: -.2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rl-chev { flex: none; color: currentColor; image-rendering: pixelated; }

/* 모바일 세로: 독서 버튼 혼자 한 줄 */
@media (max-width: 600px) {
  body.touch .mrow-read button { flex: 1; width: 100%; height: 56px; font-size: 16px; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 12px; }
  body.touch canvas.mclock { margin-top: 10px; margin-bottom: 6px; }
}

/* 게임 화면 아래 상태 문구는 숨긴다 (지금 읽는 책·시간·인원은 캔버스와 칸 띠로 충분) */
#status, body.landscape .status { display: none; }

/* 일시정지 버튼 (모바일 세로) */
@media (max-width: 600px) {
  body.touch .mrow-read { display: flex; gap: 8px; }
  body.touch .mrow-read .rpause { flex: 1; padding: 0; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 12px; height: 56px; font-size: 14px; font-weight: 700; }
  body.touch .mrow-read .rread { flex: 1; }
}
/* 데스크톱 .pad 안의 일시정지 버튼 */
.pad #btnPause2 { padding: 0 10px; }

/* 임산부 배려석 안내: 핑크카펫 배지 모양(도트 원 + 분홍 체크무늬 + 흰 P 사람 + 아래 리본 띠). 그림은 SVG 도트, 글자는 Pretendard */
.pinkseat { position: fixed; left: 50%; top: 50%; z-index: 40; width: min(220px, calc(100% - 96px)); aspect-ratio: 1; transform: translateX(-50%); translate: 0 -50%; /* 위치는 app.js가 객차 화면 한가운데로 */ color: #fff; cursor: pointer; filter: drop-shadow(0 4px 0 rgba(31, 34, 39, .45)); animation: psIn .25s steps(3) both; }
.pinkseat.hidden { display: none; }
.pinkseat .ps-art { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; }
.pinkseat p { position: absolute; left: 0; right: 0; margin: 0; text-align: center; white-space: nowrap; }
.pinkseat .ps-msg { top: 62.5%; height: 25%; display: flex; align-items: center; justify-content: center; line-height: 1.3; font-size: clamp(12px, 3.6vw, 14px); font-weight: 800; letter-spacing: -.3px; }
@keyframes psIn { from { transform: translate(-50%, 8px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

/* 픽셀 아이콘 버튼 */
.ic-btn { display: inline-flex; align-items: center; justify-content: center; }
.ic-btn svg { image-rendering: pixelated; image-rendering: crisp-edges; }

/* ---------- 리딩 티켓 (픽셀 스타일) ---------- */
#ticketModal { background: rgba(0, 0, 0, .78); backdrop-filter: blur(8px); align-items: safe center; overflow-y: auto; overscroll-behavior: contain; justify-content: center; z-index: 50; padding: 16px; }
.ticket-card { position: relative; flex: none; margin: auto 0; width: 320px; max-width: 92vw; background: #faf7ef; color: #1f2227; border: 3px solid #1f2227; border-radius: 16px; box-shadow: 8px 8px 0 #1f2227; font-family: 'Pretendard Variable', Pretendard, system-ui, sans-serif; font-variant-numeric: tabular-nums; image-rendering: pixelated; overflow: hidden; }
.ticket-notch { position: absolute; width: 20px; height: 20px; background: #0b0e14; border: 3px solid #1f2227; border-radius: 50%; top: -14px; } /* 절취선 양 끝 펀치 구멍 */
.ticket-notch-l { left: -16px; }
.ticket-notch-r { right: -16px; }
.ticket-head { display: flex; align-items: center; gap: 12px; padding: 4px 18px; background: var(--tc, #1f3a68); color: var(--tc-ink, #fff); border-bottom: 3px solid #1f2227; }
.ticket-icon { image-rendering: pixelated; image-rendering: crisp-edges; flex: none; }
.ticket-x { margin-left: auto; flex: none; width: 44px; height: 32px; margin-right: -10px; display: grid; place-items: center; padding: 0; border: 0; background: none; color: inherit; cursor: pointer; } /* 머리 띠 오른쪽 도트 ×, 색은 띠 글자색 */
.ticket-x svg { image-rendering: pixelated; }
.ticket-x:active { transform: translate(1px, 1px); }
.ticket-title { display: flex; flex-direction: column; line-height: 1.2; }
.ticket-logo { font-size: 17px; font-weight: 800; letter-spacing: 0; font-family: 'Pretendard Variable', Pretendard, system-ui, sans-serif; } /* 'N호선 독서행 M번째 칸' */
.ticket-body { padding: 18px 20px 12px; background:
  linear-gradient(0deg, rgba(27, 29, 38, .05) 1px, transparent 1px) 0 0 / 100% 14px,
  #faf7ef;
}
/* 정보 줄: 모두 '왼쪽 라벨 / 오른쪽 값' 한 형식 */
.ticket-row { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 9px 0; }
.ticket-row span { flex: none; color: #7a6d4f; font-size: 11px; font-weight: 700; letter-spacing: 1px; }
.ticket-row strong { min-width: 0; color: #1f2227; font: 800 15px/1.35 'Pretendard Variable', Pretendard, system-ui, sans-serif; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ticket-book { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; min-width: 0; }
.ticket-row-book strong { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: keep-all; } /* 긴 제목은 두 줄까지 */
.ticket-book em { max-width: 100%; font: 600 12px/1.3 'Pretendard Variable', Pretendard, system-ui, sans-serif; font-style: normal; color: #7a6d4f; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ticket-book em:empty { display: none; }
/* 독서 시간: '오늘은 N호선에서 M명과 함께 / 23분, 책과 동승했어요' 두 줄 문장 */
.ticket-total { padding: 10px 0 6px; text-align: center; font-family: 'Pretendard Variable', Pretendard, system-ui, sans-serif; letter-spacing: 0; }
.ticket-total p { margin: 0; }
.tt-with { font-size: 13px; font-weight: 700; color: #7a6d4f; }
.tt-time { margin-top: 4px !important; font-size: 17px; font-weight: 800; color: #1f2227; }
.tt-time strong { font-size: 26px; font-weight: 900; }
.tt-cheer { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px !important; padding: 5px 12px; border-radius: 999px; background: #ffe4ea; color: #1f2227; font-size: 13px; font-weight: 800; }
.tt-cheer.hidden { display: none; }
.tt-cheer .ht-heart { width: 14px; height: 12px; animation: none; }
.ticket-sep { position: relative; height: 0; border-top: 3px dashed #1f2227; margin: 12px -20px; }
.ticket-foot { padding: 4px 18px 16px; background: #faf7ef; }
.ticket-photo { display: block; width: 100%; height: auto; margin: 0 0 16px; border: 3px solid #1f2227; box-shadow: 4px 4px 0 #1f2227; image-rendering: auto; background: #1f2227; } /* 화면 해상도 원본을 줄여 보여 준다 */
.ticket-photo.hidden { display: none; }
.ticket-actions { display: flex; gap: 8px; margin-bottom: 10px; }
.ticket-actions button { flex: 1; min-height: 44px; padding: 10px 6px; background: #faf7ef; color: #1f2227; border: 3px solid #1f2227; border-radius: 10px; box-shadow: 3px 3px 0 #1f2227; font: 800 13px 'Pretendard Variable', Pretendard, system-ui, sans-serif; cursor: pointer; }
.ticket-actions button:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 #1f2227; }
.ticket-actions button:disabled { opacity: .5; cursor: progress; }
.ticket-msg { min-height: 0; margin: 0 0 8px; font: 600 12px 'Pretendard Variable', Pretendard, system-ui, sans-serif; color: #7a6d4f; text-align: center; }
.ticket-msg:empty { display: none; }

/* 티켓 책 커버 */

/* 독서 티켓 팝업: 배경이 먼저 천천히 어두워지고, 티켓이 아래에서 천천히 떠오른다 */
#ticketModal { animation: tkFade .6s ease-out both; }
#ticketModal .ticket-card { animation: tkRise .8s cubic-bezier(.2, .8, .25, 1) .2s both; }
@keyframes tkFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes tkRise { from { opacity: 0; transform: translateY(28px) scale(.97); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { #ticketModal, #ticketModal .ticket-card { animation-duration: .2s; animation-delay: 0s; } }

/* 로비 책 카드 긴 제목 ellipsis */
.pick .meta { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.pick .meta .t, .pick .meta .a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; display: block; }
.pick .clear { flex: none; }

/* 다른 사람 책 정보 카드: 티켓과 같은 종이·짙은 테두리·단단한 그림자 */
.bookpeek { position: fixed; left: 50%; top: 14%; z-index: 45; width: min(320px, calc(100% - 32px)); transform: translateX(-50%); display: flex; gap: 14px; align-items: center; padding: 14px 40px 14px 14px; background: #faf7ef; color: #1b1d26; border: 3px solid #1b1d26; box-shadow: 6px 6px 0 #1b1d26; animation: bpIn .25s ease-out both; }
.bookpeek.hidden { display: none; }
.bp-cover { position: relative; flex: none; width: 64px; height: 92px; border: 2px solid #1b1d26; box-shadow: 3px 3px 0 #1b1d26; overflow: hidden; }
.bp-cover::before { content: attr(data-t); position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; font: 800 14px 'Pretendard Variable', Pretendard, system-ui, sans-serif; } /* 표지가 없을 때 */
.bp-cover img { position: relative; width: 100%; height: 100%; object-fit: cover; display: block; }
.bp-cover img[hidden] { display: none; }
.bp-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; font-family: 'Pretendard Variable', Pretendard, system-ui, sans-serif; }
.bp-title { font-size: 16px; font-weight: 800; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bp-meta { font-size: 12px; font-weight: 600; color: #7a6d4f; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bp-meta:empty { display: none; }
.bp-who { margin-top: 4px; font-size: 12px; font-weight: 700; color: #1b1d26; }
.bp-close { position: absolute; top: 2px; right: 2px; width: 40px; height: 40px; border: 0; background: none; color: #1b1d26; font-size: 22px; line-height: 1; cursor: pointer; }
@keyframes bpIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* 픽셀 책 아이콘 버튼 */
.mrow-book .rbook, .mrow-read .rread, [data-k="x"] { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.ic-book, .ic-book-closed { flex: none; image-rendering: pixelated; image-rendering: crisp-edges; vertical-align: middle; }

/* 양옆 ◀ ▶ 버튼 전부 숨김 — 캔버스 양쪽 탭으로 조작 */
.mrow-move, .move { display: none !important; }

/* 캔버스 위 양옆 탭 가이드 (처음 진입 시 몇 초 깜빡임) */
.walk-hint { position: absolute; top: 50%; transform: translateY(-50%); display: flex; align-items: center; gap: 6px; padding: 10px 14px; background: rgba(11, 14, 20, .72); color: #fff; font-size: 13px; font-weight: 700; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .15); pointer-events: none; animation: walkHintBlink 1s ease-in-out infinite; }
.walk-hint.left { left: 12px; }
.walk-hint.right { right: 12px; }
.walk-hint::before { content: ''; display: inline-block; width: 10px; height: 10px; background: currentColor; clip-path: polygon(100% 0, 100% 100%, 0 50%); }
.walk-hint.right::before { clip-path: polygon(0 0, 0 100%, 100% 50%); order: 2; }
@keyframes walkHintBlink { 0%, 100% { opacity: .95; } 50% { opacity: .35; } }

/* 첫 fit 전까지 로비 폼/배경이 깜빡이지 않게 (scene이 준비되면 app.js가 html.no-scene 제거) */
html.no-scene #lobby { visibility: hidden; }

.land .tk-head small, #lobbyForm h1 small { margin-left: 4px; font-size: 12px; font-weight: 700; color: #6b7280; letter-spacing: 0; } /* 이름 옆 보조 글자는 작게 */

/* 하트 받음 알림: 티켓·책 정보 카드와 같은 종이 카드, 화면 아래 가운데 (아래에서 올라온다) */
.hearttoast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 46; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; max-width: calc(100% - 32px); padding: 10px 16px 10px 12px; background: #faf7ef; color: #1f2227; border: 3px solid #1f2227; border-radius: 12px; box-shadow: 4px 4px 0 #1f2227; font: 800 14px 'Pretendard Variable', Pretendard, system-ui, sans-serif; white-space: nowrap; cursor: pointer; animation: htIn .35s cubic-bezier(.2, .9, .3, 1.3) both; }
.hearttoast.hidden { display: none; }
.ht-msg { overflow: hidden; text-overflow: ellipsis; }
/* 도트 하트 (7×6) */
.ht-heart { flex: none; width: 21px; height: 18px; background: #ff4d6d; clip-path: polygon(14% 0, 43% 0, 43% 17%, 57% 17%, 57% 0, 86% 0, 86% 17%, 100% 17%, 100% 50%, 86% 50%, 86% 67%, 71% 67%, 71% 83%, 57% 83%, 57% 100%, 43% 100%, 43% 83%, 29% 83%, 29% 67%, 14% 67%, 14% 50%, 0 50%, 0 17%, 14% 17%); animation: htBeat .6s steps(2) 2; }
@keyframes htIn { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes htBeat { 50% { transform: scale(1.2); } }

/* 상단 노선 버튼의 노선 숫자 픽셀 배지 */
.rl-badge { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; font-size: 14px; font-weight: 900; margin-right: 8px; vertical-align: middle; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .25), inset 2px 0 0 rgba(255, 255, 255, .15); image-rendering: pixelated; font-family: 'Pretendard Variable', Pretendard, system-ui, sans-serif; }
.rl-text { vertical-align: middle; }

.rl-badge-svg { vertical-align: middle; margin-right: 8px; image-rendering: pixelated; image-rendering: crisp-edges; }

/* ---------- 객차 안내방송 (announce.js): 객차 아래에 흐르는 LED 글자 띠 + 오른쪽 아래 소리 버튼 ---------- */
.ann { position: absolute; left: 8px; right: 50px; bottom: 6px; z-index: 4; display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 10px; background: #14161b; box-shadow: inset 0 0 0 2px #3a3f48, 0 3px 0 rgba(0, 0, 0, .35); pointer-events: none;
  clip-path: polygon(0 3px, 3px 3px, 3px 0, calc(100% - 3px) 0, calc(100% - 3px) 3px, 100% 3px, 100% calc(100% - 3px), calc(100% - 3px) calc(100% - 3px), calc(100% - 3px) 100%, 3px 100%, 3px calc(100% - 3px), 0 calc(100% - 3px));
  transition: opacity .3s, transform .3s; }
.ann.hidden { display: flex !important; opacity: 0; transform: translateY(6px); }
.ann-ic { flex: none; width: 8px; height: 8px; background: #ff9a1f; box-shadow: 0 0 6px #ff9a1f; animation: ann-blink 1s steps(2) infinite; }
.ann-view { position: relative; flex: 1; min-width: 0; height: 100%; overflow: hidden; }
.ann-track { position: absolute; left: 0; top: 50%; white-space: nowrap; color: #ffb547; font-size: 15px; font-weight: 700; letter-spacing: -.2px; text-shadow: 0 0 6px rgba(255, 154, 31, .55); transform: translate(var(--from, 100%), -50%); }
@keyframes ann-scroll { from { transform: translate(var(--from), -50%); } to { transform: translate(var(--to), -50%); } }
@keyframes ann-blink { 50% { opacity: .25; } }
.ann-sound { position: absolute; right: 8px; bottom: 6px; z-index: 4; width: 36px; height: 30px; display: flex; align-items: center; justify-content: center; padding: 0; border: 0; border-radius: 0; background: rgba(20, 22, 27, .82); color: #9aa3b2; cursor: pointer; box-shadow: inset 0 0 0 2px #3a3f48;
  clip-path: polygon(0 3px, 3px 3px, 3px 0, calc(100% - 3px) 0, calc(100% - 3px) 3px, 100% 3px, 100% calc(100% - 3px), calc(100% - 3px) calc(100% - 3px), calc(100% - 3px) 100%, 3px 100%, 3px calc(100% - 3px), 0 calc(100% - 3px)); }
.ann-sound.on { color: #ffb547; }
.ann-sound svg { image-rendering: pixelated; }
/* 휴대폰 세로: 객차 밖, 바로 아래 한 줄로 (방송이 없을 땐 꺼진 전광판처럼 어둡게 자리만 지킨다) */
.ann-row { display: contents; }
.ann-row.out { display: flex; gap: 6px; margin-top: 8px; }
.ann-row.out .ann { position: relative; left: auto; right: auto; bottom: auto; flex: 1; height: 34px; }
.ann-row.out .ann.hidden { opacity: 1; transform: none; }
.ann-row.out .ann.hidden .ann-ic { background: #4a3a24; box-shadow: none; animation: none; }
.ann-row.out .ann-sound { position: relative; right: auto; bottom: auto; flex: none; width: 40px; height: 34px; }
.ann-row.out .ann-track { font-size: 14px; }

/* 독서 완료 버튼 안 시간 */
.rread-time, [data-k="x"] .rread-time { margin-left: 8px; font-family: 'Pretendard Variable', Pretendard, system-ui, sans-serif; font-variant-numeric: tabular-nums; font-weight: 900; font-variant-numeric: tabular-nums; opacity: .9; }
/* 방송 중인데 소리가 꺼져 있으면 버튼 옆에 '소리 켜기'가 깜빡인다 */
.ann-sound.nudge { color: #ffb547; animation: ann-nudge 1.2s steps(2) infinite; }
.ann-row.out .ann-sound.nudge { width: auto; padding: 0 10px; gap: 4px; }
.ann-row.out .ann-sound.nudge::after { content: '소리 켜기'; font-size: 12px; font-weight: 800; white-space: nowrap; }
@keyframes ann-nudge { 50% { box-shadow: inset 0 0 0 2px #ffb547; } }

/* 로비 탑승하기 버튼 플로팅 (하단 고정) */







/* 플로팅 바는 로비가 열려 있을 때만 보인다. 랜딩/객차에선 숨김 */


/* 탑승하기 버튼 — 로비 스크롤에 sticky로 하단 고정, 스타일은 그대로 */
#lobby #boardBtn { position: sticky; bottom: max(12px, env(safe-area-inset-bottom)); z-index: 25; margin-top: 8px; }
body.landing-on #boardBtn, body:has(#lobby.hidden) #boardBtn { display: none !important; }

#landing { padding-top: 40px; } /* 카드 위로 걸친 원 배지 자리 */


/* 친구 초대 미리보기 */
#inviteModal { z-index: 50; }
.invite-card { width: 340px; }
.invite-body { padding: 14px 14px 4px; background: #faf7ef; }
.invite-img { display: block; width: 100%; min-height: 200px; border-radius: 10px; background: #1b1f2e; object-fit: contain; }
.invite-img:not(.loading) { min-height: 0; }
.invite-img.loading { animation: ivPulse 1s ease-in-out infinite alternate; }
@keyframes ivPulse { from { opacity: .45; } to { opacity: .8; } }
.invite-card .ticket-head { padding: 6px 16px; gap: 10px; }
.invite-card .ticket-head .ticket-icon { width: 30px; height: 30px; }
