/* 내기 방 화면 — 방 · 내기 추가 · 도장 · 게임 중 · 결과 · 영수증. 부품은 ds/bundle.css 것을 써요 */
.rm { padding-left: 0; padding-right: 0; }
.rm a { color: inherit; text-decoration: none; }
.rm-view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.rm-top { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 52px; padding: 4px 16px; }
.rm-top__t { font-size: 15px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rm-top__gap { width: 44px; flex: none; }
.rm-ico { width: 44px; height: 44px; flex: none; display: grid; place-items: center; border: 0; border-radius: 50%; background: none; color: var(--ink); cursor: pointer; }
.rm-ico svg { width: 24px; height: 24px; }
.rm-ico:focus-visible, .rm-link:focus-visible, .rm-add:focus-visible, .rm-chip:focus-visible, .rm-seg button:focus-visible, .rm-in:focus-visible, .rm-x:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.rm-pill { display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: var(--radius-pill); background: var(--paper-raised); box-shadow: inset 0 0 0 1.5px var(--line); font: 600 13px/1 var(--font-mono); letter-spacing: 0.08em; }
.rm-body { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 20px 4px; display: flex; flex-direction: column; gap: 20px; }
.rm-body > * { flex-shrink: 0; }
.rm-foot { flex: none; padding: 12px 20px 8px; display: flex; flex-direction: column; gap: 8px; }
.rm-foot .mn-btn { width: 100%; box-sizing: border-box; }
.rm-note { margin: 0; text-align: center; font-size: 13px; line-height: 18px; color: var(--ink-muted); word-break: keep-all; }
.rm-link { align-self: center; padding: 8px 12px; border: 0; background: none; font: 600 14px/1 var(--font-sans); color: var(--ink-muted); cursor: pointer; border-radius: 8px; }
.rm-sec { display: flex; flex-direction: column; gap: 10px; }
.rm-sec h2 { margin: 0; font-size: 13px; line-height: 18px; font-weight: 600; color: var(--ink-muted); }
.rm-h1 { margin: 0; font: 400 28px/34px var(--font-display); letter-spacing: -0.02em; word-break: keep-all; }
.rm-p { margin: 0; font-size: 14px; line-height: 20px; color: var(--ink-muted); word-break: keep-all; }

/* 방 코드 */
.rm-code { background: var(--stage); color: var(--on-stage); border-radius: var(--radius-md); padding: 18px 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; box-shadow: var(--shadow-stage); }
.rm-code__k { display: block; font-size: 12px; font-weight: 600; color: var(--on-stage-muted); }
.rm-code__v { display: block; margin-top: 4px; font: 400 40px/40px var(--font-pixel); letter-spacing: 0.08em; }
.rm-code .mn-btn { height: 40px; padding: 0 16px; font-size: 14px; }
.rm-code .mn-btn svg { width: 16px; height: 16px; }

/* 들어온 사람 */
.rm-people { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.rm-person { display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 48px; box-sizing: border-box; padding: 12px; background: var(--paper-raised); border-radius: var(--radius-sm); box-shadow: inset 0 0 0 1.5px var(--line); }
.rm-person__n { min-width: 0; font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rm-person__tag { margin-left: auto; flex: none; font-size: 11px; font-weight: 700; color: var(--ink-muted); }
.rm-person.is-away .rm-person__n { opacity: 0.5; }
.rm-person--empty { background: none; box-shadow: none; outline: 1.5px dashed var(--line); outline-offset: -1.5px; color: var(--ink-muted); font-size: 14px; font-weight: 600; }
.rm-person--empty .mn-mark { opacity: 0.35; }
.rm-x { margin: -8px -6px -8px auto; width: 36px; height: 36px; flex: none; display: grid; place-items: center; border: 0; border-radius: 50%; background: none; color: var(--ink-muted); cursor: pointer; }
.rm-x svg { width: 16px; height: 16px; }

/* 게임 줄 · 내기 추가 */
.rm-row { display: flex; align-items: center; gap: 14px; padding: 12px 12px 12px 14px; background: var(--paper-raised); border-radius: var(--radius-sm); box-shadow: inset 0 0 0 1.5px var(--line); }
.rm-row__b { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rm-row__t { font-weight: 700; font-size: 16px; line-height: 22px; }
.rm-row__s { font-size: 13px; line-height: 18px; color: var(--ink-muted); word-break: keep-all; }
.rm-row .mn-btn { height: 36px; padding: 0 12px; font-size: 13px; }
.rm-glyph { width: 48px; height: 48px; flex: none; border-radius: 14px; background: var(--stage); color: var(--sprout); display: grid; place-items: center; font: 400 15px/1 var(--font-display); }
.rm-glyph--num { font: 400 20px/1 var(--font-pixel); }
.rm-add { display: flex; align-items: center; gap: 14px; width: 100%; box-sizing: border-box; padding: 16px; border: 0; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--grain) 14%, var(--paper)); outline: 2px dashed var(--grain); outline-offset: -2px; color: var(--ink); font-family: var(--font-sans); text-align: left; cursor: pointer; }
.rm-add__ico { width: 40px; height: 40px; flex: none; border-radius: 50%; background: var(--grain); color: var(--on-grain); display: grid; place-items: center; }
.rm-add__ico svg { width: 20px; height: 20px; }

/* 아래에서 올라오는 판 (내기 추가 · 게임 고르기 · 확인) */
.rs { position: fixed; inset: 0; z-index: 30; display: grid; align-items: end; justify-items: center; background: rgba(18, 22, 19, 0.48); animation: rs-bg 220ms ease-out; }
.rs__box { width: min(100%, 440px); max-height: 92dvh; overflow-y: auto; box-sizing: border-box; display: flex; flex-direction: column; gap: 22px; padding: 10px 20px calc(24px + env(safe-area-inset-bottom)); border-radius: var(--radius-lg) var(--radius-lg) 0 0; background: var(--paper); color: var(--ink); font-family: var(--font-sans); box-shadow: var(--shadow-lift); animation: rs-up 280ms var(--ease-out); }
.rs__grip { align-self: center; flex: none; width: 40px; height: 5px; border-radius: var(--radius-pill); background: var(--line); }
.rs__head { display: flex; align-items: center; justify-content: space-between; margin-top: -6px; }
.rs__head h1 { margin: 0; font: 400 24px/30px var(--font-display); }
.rs__head .rm-ico { margin-right: -10px; }
.rs__box .mn-btn--lg { width: 100%; box-sizing: border-box; }
.rs__end { display: flex; flex-direction: column; align-items: center; gap: 14px; padding-top: 4px; }
.rm-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.rm-chip { height: 40px; padding: 0 16px; font-size: 15px; }
.rm-chip[aria-pressed="true"] { background: var(--grain); color: var(--on-grain); box-shadow: none; }
.rm-chip svg { width: 16px; height: 16px; }
.rm-in { width: 100%; box-sizing: border-box; height: 52px; padding: 0 16px; border: 0; border-radius: var(--radius-sm); background: var(--paper-raised); box-shadow: inset 0 0 0 1.5px var(--line); color: var(--ink); font: 600 17px/1 var(--font-sans); }
.rm-in::placeholder { color: var(--ink-muted); font-weight: 500; opacity: 0.7; }
.rm-in--code { height: 72px; text-align: center; font: 400 40px/1 var(--font-pixel); letter-spacing: 0.3em; padding-left: 0.3em; }
.rm-seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 4px; background: var(--paper-raised); border-radius: var(--radius-pill); box-shadow: inset 0 0 0 1.5px var(--line); }
.rm-seg button { height: 40px; border: 0; border-radius: var(--radius-pill); background: transparent; color: var(--ink); font: 600 14px/1 var(--font-sans); cursor: pointer; }
.rm-seg button[aria-checked="true"] { background: var(--ink); color: var(--paper); }
.rm-games { display: grid; gap: 8px; }
.rm-games .rm-row { width: 100%; box-sizing: border-box; border: 0; font-family: var(--font-sans); color: var(--ink); text-align: left; cursor: pointer; }
.rm-games .rm-row[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--ink); }
.rm-games .rm-row:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* 들어가는 화면 */
.rm-form { display: flex; flex-direction: column; gap: 8px; }
.rm-form label { font-size: 13px; line-height: 18px; font-weight: 600; color: var(--ink-muted); }
.rm-err { margin: 0; min-height: 20px; font-size: 14px; line-height: 20px; font-weight: 600; color: var(--stamp-strong); word-break: keep-all; }

/* 도장 */
.rm-seal { align-items: center; gap: 24px; padding-top: 12px; }
.rm-seal__head { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.rm-seal__ticket { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.rm-seal__ticket .mn-ticket { transform: scale(1.12); margin: 8px 0; }
.rm-seal__pads { width: 100%; display: flex; flex-direction: column; gap: 12px; }
.rm-seal__pads .mn-seal { grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); }
.rm-seal__pads .mn-seal__slot { touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; min-width: 0; overflow-wrap: anywhere; }
.rm-seal__pads .mn-seal__slot[disabled] { cursor: default; }
.rm-seal__pads .mn-seal__slot.is-me:not(.is-sealed) .mn-seal__pad { color: var(--ink); font-weight: 700; animation: rm-nudge 1.6s var(--ease-out) infinite; }
.rm-seal__pads .mn-seal__slot.is-sealed .mn-seal__pad { animation: rm-stamp var(--dur-stamp) var(--ease-pop); }
.rm-seal__pads .mn-seal__status { margin: 0; }
.rm-seal .rm-row { width: 100%; box-sizing: border-box; }
.rm-glyph--sm { width: 40px; height: 40px; border-radius: 10px; font-size: 13px; }
@keyframes rm-nudge { 50% { transform: scale(1.06); } }
@keyframes rm-stamp { from { transform: scale(1.3); } }

/* 게임 중 */
.rm-chips-top { flex: 1; min-width: 0; display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.rm-chips-top .mn-player { height: 36px; padding: 0 12px 0 6px; font-size: 14px; }
.rm-play { padding: 4px 12px 0; }
.rm-play .mn-stage { max-width: none; aspect-ratio: auto; flex: 1; min-height: 320px; }
.rm-play__big { display: grid; justify-items: center; gap: 10px; text-align: center; }
.rm-play__n { font: 400 88px/80px var(--font-pixel); letter-spacing: -0.02em; }
.rm-play__k { font: 500 15px/22px var(--font-sans); color: var(--on-stage-muted); }
.rm-play .mn-stage__word { font-size: 40px; line-height: 44px; word-break: keep-all; }
.rm-play .mn-stage__bottom { flex-wrap: wrap; }
/* 좁은 폰: 게임 설명과 내기 표가 한 줄에 안 들어가면 표가 아랫줄로 내려가요 */
.rm-play .mn-stage__top { flex-wrap: wrap; row-gap: 10px; }
.rm-play .mn-stage__round { white-space: nowrap; line-height: 18px; }
.rm .mn-ticket--compact { flex: none; max-width: 100%; }
.rm .mn-ticket--compact .mn-ticket__stub { white-space: nowrap; }
.rm .mn-ticket--compact .mn-ticket__stake { word-break: keep-all; overflow-wrap: break-word; }

/* 결과 */
.rm-rank .mn-reveal { max-width: none; }
.rm-rank .mn-reveal__target { font-size: 32px; }
.rm-rank .mn-rank__row { grid-template-columns: 20px 24px minmax(0, 1fr) auto 6ch; }
.rm-rank .mn-line__dot { transition: none; }
.rm-pick { display: grid; gap: 10px; }
.rm-pick__btns { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 8px; }
.rm-pick__btns .mn-btn { height: 52px; padding: 0 8px; gap: 6px; min-width: 0; }
.rm-pick__btns .mn-btn span:last-child { overflow: hidden; text-overflow: ellipsis; }

/* 영수증: 출력구에서 지익- 나와요 */
.rm-rc { position: fixed; inset: 0; z-index: 20; display: flex; justify-content: center; background: var(--paper); }
.rm-rc__in { width: min(100%, 440px); display: flex; flex-direction: column; padding: calc(8px + env(safe-area-inset-top)) 0 calc(16px + env(safe-area-inset-bottom)); box-sizing: border-box; }
.rm-rc__body { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 20px 0; }
.pr-printer { position: relative; width: min(350px, 100%); margin: 0 auto; }
.pr-lip { position: relative; z-index: 2; height: 28px; border-radius: 14px; background: var(--stage); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 10px 16px -8px rgba(18, 22, 19, .55); animation: pr-buzz 80ms linear 300ms 20; }
.pr-slit { position: absolute; left: 16px; right: 16px; bottom: 7px; height: 4px; border-radius: 2px; background: #000; box-shadow: 0 1px 0 rgba(255, 255, 255, .10); }
.pr-led { position: absolute; right: 14px; top: 8px; width: 6px; height: 6px; border-radius: 50%; background: var(--sprout); box-shadow: 0 0 6px var(--sprout); animation: pr-led 200ms steps(2, jump-none) 300ms 8; }
.pr-feed { position: relative; z-index: 1; margin-top: -11px; padding: 0 15px 32px; overflow: hidden; display: flex; justify-content: center; }
.pr-shade { position: absolute; z-index: 2; left: 15px; right: 15px; top: 0; height: 40px; pointer-events: none; background: linear-gradient(rgba(18, 22, 19, .30), rgba(18, 22, 19, .10) 35%, rgba(18, 22, 19, 0)); }
.pr-paper { display: flex; justify-content: center; width: 100%; filter: none; animation: pr-print 1.6s steps(16, end) 300ms both, pr-lift 400ms var(--ease-out) 1.95s both; }
.pr-paper .mn-receipt { transform-origin: 50% 0; animation: pr-drop 420ms var(--ease-pop) 1.95s both; }
.pr-after { animation: pr-fade 320ms var(--ease-out) 2.5s both; }
.rm-rc.is-still .pr-lip, .rm-rc.is-still .pr-led, .rm-rc.is-still .pr-paper, .rm-rc.is-still .pr-paper .mn-receipt, .rm-rc.is-still .pr-after, .rm-rc.is-still .mn-stamp--slam { animation: none !important; }
.rm-rc.is-still .pr-paper { filter: drop-shadow(0 16px 18px rgba(18, 22, 19, .20)); }
.rm-rc .mn-receipt__what { overflow-wrap: anywhere; word-break: keep-all; }
.rm-rc .mn-receipt__row span:last-child { text-align: right; overflow-wrap: anywhere; }
.rm-rc__sealed { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; }
.rm-rc__sealed > span:first-child { font: 500 12px/16px var(--font-mono); color: var(--receipt-ink); opacity: 0.6; }
.rm-rc__sealed > span:last-child { display: flex; gap: 6px; }
.rm-rc__sealed .mn-mark { width: 20px; height: 20px; }
.rm-rc__btns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.rm-rc__btns .mn-btn { box-sizing: border-box; padding: 0 8px; }
@keyframes pr-print { from { transform: translateY(-101%); } to { transform: translateY(0); } }
@keyframes pr-lift { from { filter: drop-shadow(0 1px 1px rgba(18, 22, 19, .10)); } to { filter: drop-shadow(0 16px 18px rgba(18, 22, 19, .20)) drop-shadow(0 2px 3px rgba(18, 22, 19, .10)); } }
@keyframes pr-drop { 0% { transform: translateY(-4px) rotate(0); } 60% { transform: translateY(3px) rotate(-1deg); } 100% { transform: translateY(2px) rotate(-.6deg); } }
@keyframes pr-buzz { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(.6px); } }
@keyframes pr-led { from { opacity: 1; } to { opacity: .25; } }
@keyframes pr-fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.rm-toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 70; margin: 0; padding: 12px 18px; border-radius: 999px; background: var(--ink); color: var(--paper); font: 600 14px/1 var(--font-sans); white-space: nowrap; max-width: calc(100vw - 32px); overflow: hidden; text-overflow: ellipsis; }
@keyframes rs-bg { from { background: rgba(18, 22, 19, 0); } }
@keyframes rs-up { from { transform: translateY(40px); opacity: 0; } }
@media (min-width: 960px) { .rs { align-items: center; } .rs__box { border-radius: var(--radius-lg); padding-bottom: 24px; } .rs__grip { visibility: hidden; } }
@media (max-height: 700px) { .rm-body { gap: 14px; } .rm-seal { gap: 16px; } .rm-play__n { font-size: 64px; line-height: 60px; } }
@media (prefers-reduced-motion: reduce) {
  .rs, .rs__box, .pr-lip, .pr-led, .pr-paper, .pr-paper .mn-receipt, .pr-after, .rm-seal__pads .mn-seal__pad { animation: none !important; }
  .pr-paper { filter: drop-shadow(0 16px 18px rgba(18, 22, 19, .20)); }
}
