:root {
  --navy: #14213d; --cream: #fdf8ef; --gold: #f6c453; --coral: #ef6f5e; --sky: #7cc4f5;
  --ink: #1b1f2a; --mute: #6b7385; --line: #e4e0d6; --ok: #2e9d6b; --mid: #d99a1e; --bad: #d4534a;
  --glass: rgba(22, 28, 44, .62);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--navy); color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", sans-serif; }
button { font: inherit; cursor: pointer; border: 0; }
.hidden { display: none !important; }
.screen { position: fixed; inset: 0; }

/* 입장 */
#entry { overflow-y: auto; background: radial-gradient(circle at 50% -10%, #2c4a86, var(--navy) 60%); padding: 32px 16px; }
.entry-box { max-width: 520px; margin: 0 auto; background: var(--cream); border-radius: 20px; padding: 28px 22px; }
.brand { font-weight: 800; letter-spacing: .25em; color: var(--coral); font-size: 13px; }
h1 { margin: 4px 0 6px; font-size: 26px; }
.sub { margin: 0 0 18px; color: var(--mute); }
h2 { font-size: 14px; color: var(--mute); margin: 20px 0 8px; font-weight: 600; }
.routes, .roles { display: grid; gap: 10px; }
.roles { grid-template-columns: 1fr 1fr; }
.route, .role { text-align: left; background: #fff; border: 2px solid var(--line); border-radius: 14px; padding: 14px; color: var(--ink); }
.route.on, .role.on { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(20,33,61,.12); }
.route .rt { display: flex; justify-content: space-between; align-items: baseline; }
.route .rt b { font-size: 17px; }
.route .code { font-weight: 800; color: var(--coral); letter-spacing: .08em; }
.route .ac { color: var(--mute); font-size: 13px; margin-top: 4px; }
.route .ac b { color: var(--ink); }
.route .fl { margin-top: 6px; font-size: 12.5px; color: var(--mute); }
.route .fl-tag { font-size: 12px; font-weight: 700; color: var(--navy); background: rgba(20,33,61,.08); border-radius: 6px; padding: 2px 7px; }
.route.pick { padding: 11px 14px; }
.fl.note { color: var(--mute); font-size: 12.5px; }
.badge { display: inline-block; background: var(--coral); color: #fff; border-radius: 6px; padding: 1px 6px; font-size: 12px; margin-left: 4px; }
.role { display: flex; flex-direction: column; gap: 4px; }
.role-ic { font-size: 26px; }
.role small { color: var(--mute); font-size: 12.5px; line-height: 1.4; }
.primary { margin-top: 20px; width: 100%; background: var(--navy); color: #fff; border-radius: 12px; padding: 14px; font-size: 16px; font-weight: 700; }
.primary:disabled { opacity: .4; }
.msg { color: var(--bad); min-height: 1em; margin: 10px 0 0; font-size: 14px; }

/* 기내 */
#game { background: #0d1830; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
#cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.pill { background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); color: #fff; border-radius: 14px; padding: 8px 12px; font-size: 14px; }
.hud { position: absolute; top: 12px; left: 12px; right: 12px; display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; pointer-events: none; }
.hud > * { pointer-events: auto; }
.flight b { color: var(--sky); margin-right: 4px; }
.flight .small { font-size: 12.5px; color: #cfd6e6; margin-top: 2px; }
.flight .bar { height: 3px; background: rgba(255,255,255,.18); border-radius: 2px; margin-top: 6px; overflow: hidden; }
.flight .bar i { display: block; height: 100%; background: var(--sky); }
.hud-right { display: flex; gap: 6px; align-items: flex-start; }
.belt { color: #8d95a8; font-weight: 700; }
.belt.on { background: var(--gold); color: var(--navy); }
.seat { text-align: center; line-height: 1.1; }
.seat b { display: block; font-size: 20px; }
.seat small { font-size: 11px; color: #cfd6e6; }
.icon { font-size: 16px; }
.people { position: absolute; top: 84px; left: 12px; font-size: 13px; }

.tags { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.tag { position: absolute; left: 0; top: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; white-space: nowrap; transform-origin: 50% 100%; }
.tag span { background: var(--glass); color: #fff; font-size: 13px; padding: 3px 9px; border-radius: 99px; }
.tag.me span { background: var(--gold); color: var(--navy); font-weight: 700; }
.bubble { background: #fff; color: var(--ink); font-size: 13px; padding: 6px 10px; border-radius: 12px; max-width: 220px; white-space: normal; text-align: center; box-shadow: 0 4px 12px rgba(0,0,0,.25); }

.banner { position: absolute; top: 120px; left: 50%; transform: translateX(-50%); width: min(92vw, 480px); background: var(--glass); backdrop-filter: blur(10px); color: #fff; border-radius: 14px; padding: 12px 16px; font-size: 14.5px; text-align: center; }
.feedbox { position: absolute; top: 172px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
.feed { background: var(--glass); color: #fff; font-size: 13.5px; padding: 8px 14px; border-radius: 99px; animation: up .25s ease; }
.toasts { position: absolute; left: 50%; transform: translateX(-50%); bottom: 96px; display: flex; flex-direction: column; gap: 6px; width: min(92vw, 420px); pointer-events: none; }
.toast { background: rgba(255,255,255,.95); border-radius: 12px; padding: 10px 14px; font-size: 14px; box-shadow: 0 4px 14px rgba(0,0,0,.25); animation: up .25s ease; text-align: center; }
@keyframes up { from { transform: translateY(8px); opacity: 0; } }

.actions { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(12px + env(safe-area-inset-bottom)); display: flex; gap: 2px; padding: 6px; background: var(--glass); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-radius: 20px; max-width: calc(100vw - 24px); overflow-x: auto; scrollbar-width: none; }
.actions::-webkit-scrollbar { display: none; }
.actions button { flex: 0 0 auto; background: none; color: #fff; border-radius: 14px; padding: 6px 10px; font-size: 12.5px; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 58px; }
.actions button i { font-style: normal; font-size: 20px; }
.actions button.on { background: rgba(246,196,83,.25); box-shadow: inset 0 0 0 1.5px var(--gold); }
.actions button:disabled { opacity: .45; }

.joy { position: absolute; left: 20px; bottom: 96px; width: 104px; height: 104px; border-radius: 50%; background: rgba(22,28,44,.35); border: 2px solid rgba(255,255,255,.25); display: none; touch-action: none; }
.joy i { position: absolute; left: 32px; top: 32px; width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,.7); }
@media (pointer: coarse) { .joy { display: block; } }

.sit { position: absolute; left: 50%; transform: translateX(-50%); bottom: 100px; width: min(92vw, 460px); background: var(--cream); border-radius: 18px; padding: 16px; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.sit h3 { margin: 0 0 8px; font-size: 15px; color: var(--navy); }
.sit h3 small { font-weight: 500; color: var(--mute); font-size: 12px; margin-left: 4px; }
.sit.svc { border-top: 5px solid var(--sky); }
.sit.svc.biz { border-top-color: var(--gold); background: #fffaf0; }
.sit p { margin: 0 0 12px; font-size: 15.5px; line-height: 1.5; font-weight: 600; }
.sit .opts, .task .opts { display: grid; gap: 6px; }
.sit .opts button, .task .opts button { text-align: left; background: #fff; border: 1.5px solid var(--line); border-radius: 10px; padding: 9px 12px; font-size: 14px; color: var(--ink); }
.sit .opts button:hover, .task .opts button:not(:disabled):hover { border-color: var(--navy); }
.task .opts button:disabled { opacity: .45; cursor: not-allowed; }
.timer { height: 3px; background: var(--line); border-radius: 2px; margin-top: 10px; overflow: hidden; }
.timer i { display: block; height: 100%; background: var(--coral); }

.tasks { position: absolute; right: 12px; top: 84px; width: min(360px, calc(100vw - 24px)); max-height: calc(100vh - 200px); overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.task { background: var(--cream); border-radius: 14px; padding: 12px; box-shadow: 0 6px 20px rgba(0,0,0,.35); }
.task h3 { margin: 0 0 4px; font-size: 14px; color: var(--coral); }
.task p { margin: 0 0 8px; font-size: 14.5px; font-weight: 600; line-height: 1.45; }
.task p.fb { font-weight: 400; font-size: 13.5px; }
.task .go { width: 100%; background: var(--navy); color: #fff; border-radius: 10px; padding: 8px; font-size: 13.5px; margin-bottom: 6px; }
.task.near .go { background: var(--ok); }
.task.todo { border-left: 5px solid var(--gold); }
.task.todo h3 { color: var(--navy); }
.task .due, .duty .due { display: block; color: var(--mute); font-size: 12px; margin-top: 2px; }
.g-good, .task h3.g-good { color: var(--ok); } .g-ok, .task h3.g-ok { color: var(--mid); } .g-bad, .g-miss, .task h3.g-bad, .task h3.g-miss { color: var(--bad); }

.work { position: absolute; left: 50%; transform: translateX(-50%); bottom: 100px; background: var(--glass); backdrop-filter: blur(10px); color: #fff; border-radius: 14px; padding: 10px 16px; min-width: 240px; text-align: center; font-size: 14px; }
.work .bar { height: 4px; background: rgba(255,255,255,.2); border-radius: 2px; margin-top: 8px; overflow: hidden; }
.work .bar i { display: block; height: 100%; background: var(--gold); transition: width .1s linear; }
.work .bar i.indet { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }

.duties { position: absolute; left: 50%; transform: translateX(-50%); bottom: 96px; width: min(94vw, 460px); max-height: 66vh; overflow-y: auto; background: var(--cream); border-radius: 18px; padding: 14px; box-shadow: 0 12px 34px rgba(0,0,0,.45); }
.sheet-head { display: flex; justify-content: space-between; align-items: center; }
.sheet-head .x { background: none; color: var(--mute); }
.duties h4 { margin: 14px 0 6px; font-size: 13px; color: var(--mute); }
.duties .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.duty { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; background: #fff; border: 1.5px solid var(--line); border-radius: 12px; padding: 10px; margin-bottom: 6px; color: var(--ink); }
.duty i { font-style: normal; font-size: 22px; }
.duty b { display: block; font-size: 14px; }
.duty small { display: block; font-size: 12.5px; color: var(--mute); line-height: 1.4; }
.duty.hot { border-color: var(--gold); background: #fffaf0; }
.duty.pa small { color: var(--ink); }

@media (max-width: 760px) {
  .tasks { top: auto; bottom: 96px; max-height: 42vh; }
  .people { top: 80px; }
  .banner { top: 112px; }
}

/* 도착: 도시 풍경과 내 뒷모습(3D)을 화면 가득, 위에 제목, 아래에 버튼 */
#arrive { background: #2e2a5c; }
#a-cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.arrive-top { position: absolute; top: max(28px, env(safe-area-inset-top)); left: 0; right: 0; text-align: center; color: #fff; text-shadow: 0 2px 12px rgba(0,0,0,.45); pointer-events: none; }
.arrive-top h1 { font-size: 30px; margin: 0; }
.arrive-top p { margin: 6px 0 0; font-size: 14px; opacity: .9; }
.arrive-btns { position: absolute; left: 50%; transform: translateX(-50%); bottom: max(24px, env(safe-area-inset-bottom)); width: min(420px, calc(100% - 32px)); display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.arrive-btns button { margin-top: 0; border-radius: 12px; padding: 14px; font-size: 15px; font-weight: 700; }
#a-share { background: rgba(255,255,255,.92); color: var(--navy); border: 2px solid var(--navy); }

/* 탑승할 때 내 역할 소개 */
.role-card { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(88vw, 340px); background: var(--cream); border-radius: 22px; padding: 22px 20px; text-align: center; box-shadow: 0 16px 40px rgba(0,0,0,.5); }
.role-card small { color: var(--mute); }
.role-card .big { font-size: 56px; margin: 6px 0 2px; }
.role-card h2 { color: var(--ink); font-size: 20px; margin: 0 0 6px; }
.role-card p { margin: 0 0 12px; line-height: 1.5; }
.role-card .meta { display: flex; gap: 10px; justify-content: center; font-size: 14px; color: var(--mute); margin-bottom: 14px; }
.role-card .meta b { color: var(--ink); }
.role-card button { width: 100%; background: var(--navy); color: #fff; border-radius: 12px; padding: 12px; font-weight: 700; }

/* 좌석 등급 선택 */
.cls-row { display: flex; gap: 6px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.cls-row span { font-size: 13px; color: var(--mute); margin-right: 4px; }
.cls-row button { background: #fff; border: 2px solid var(--line); border-radius: 99px; padding: 6px 12px; font-size: 13.5px; }
.cls-row button.on { border-color: var(--navy); background: var(--navy); color: #fff; }
.toast.greet { pointer-events: auto; display: flex; align-items: center; justify-content: center; gap: 10px; }
.toast.greet button { background: var(--navy); color: #fff; border-radius: 8px; padding: 5px 10px; font-size: 13px; }

/* 크루 벙커 */
#bunk { background: #1a1f2e; }
#b-cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.bunk-top { position: absolute; top: max(24px, env(safe-area-inset-top)); left: 0; right: 0; text-align: center; color: #fff; text-shadow: 0 2px 10px rgba(0,0,0,.5); pointer-events: none; }
.bunk-top h2 { margin: 0; font-size: 18px; opacity: .9; }
.bunk-top .clock { font-size: 54px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: 1px; }
.bunk-top p { margin: 0; font-size: 14px; opacity: .85; }

/* 스크린샷 찍을 때 화면이 잠깐 하얗게 번쩍인다 */
.shot-flash { position: fixed; inset: 0; background: #fff; opacity: .7; pointer-events: none; z-index: 999; animation: shotflash .35s ease-out forwards; }
@keyframes shotflash { to { opacity: 0; } }
