/* 허브 게임형 스타일 v3. 화면(UI)은 평평하고 깔끔하게, 입체감은 효과(떠오르는 숫자, 날아가는 조각, 레벨업)에만 쓴다.
   바탕과 카드는 단색 면, 구분은 색 차이와 얇은 선, 간격은 8px 격자(4, 8, 16, 24), 둥글기는 4, 8, 16, 24 만, 글자 크기는 12, 14, 16, 20, 28, 40 만 쓴다.
   색은 팬톤 올해의 색을 그대로 쓴다(단계마다 하나).
   관찰 Greenery 15-0343(2017), 가설 Turquoise 15-5519(2010), 실험 Classic Blue 19-4052(2020), 분석 Very Peri 17-3938(2022),
   논문 Ultra Violet 18-3838(2018), 학회 Radiant Orchid 18-3224(2014). 연구력은 Living Coral 16-1546(2019), 별과 보상은 Illuminating 13-0647(2021),
   위험은 Viva Magenta 18-1750(2023), 따뜻한 강조는 Peach Fuzz 13-1023(2024).
   베이지와 갈색 바탕, 알약 모양(완전히 둥근 끝), 상태 점, 이모지, 가운뎃점, 그림자와 광택은 UI에 쓰지 않는다. */
.hubpanel {
& {
  --bg: #0B1020; --card: #16203F; --card2: #212C54; --line: #3A4A80; --line-ui: #6677B0; --track: #0B1020;
  --text: #F2F5FC; --text2: #BAC5E0; --text3: #9AA8CC;
  --coral: #FF6F61; --magenta: #BB2649; --peach: #FFBE98; --lume: #F5DF4D; --lume-deep: #A8941A;
  /* 면 위 글자와 덮개, 연구방 벽과 바닥은 이름 붙인 값만 쓴다. line 은 구분선, line-ui 는 입력과 버튼처럼 눌러야 하는 것의 테두리 */
  --lume-ink: #2A2500; --coral-ink: #2B0B07; --warn-bg: #5A2230; --scrim: rgba(4,8,18,.7); --scrim-full: rgba(4,8,18,.97); --room-wall: #1B2547; --room-floor: #0F1730;
  /* 현재 단계의 색(app.js 가 html 에 tier-* 를 붙인다): tier 면(팬톤 그대로), deep 눌림과 그늘, glow 어두운 바탕 위의 글자와 선, ink 면 위 글자 */
  --tier: #88B04B; --tier-deep: #4F6E24; --tier-glow: #B5D57A; --tier-ink: #0F1A06; --tier-hi: #B5D57A;
  /* bar: 어두운 바탕 위에서 보여야 하는 선과 채움(게이지, 탭 표시, 마디 줄, 선택 테두리)용 밝은 단계색. 면과 버튼은 팬톤 그대로(--tier) */
  --bar: #88B04B;
  --r: 16px; --r2: 8px; --ease: cubic-bezier(.22,1,.36,1); --spring: cubic-bezier(.34,1.5,.5,1);
}
&.tier-observe, .lvl.t-observe, .stage.s-observe { --tier: #88B04B; --tier-deep: #4F6E24; --tier-glow: #B5D57A; --tier-ink: #0F1A06; --tier-hi: #B5D57A; --bar: #88B04B; }
&.tier-hypothesis, .lvl.t-hypothesis, .stage.s-hypothesis { --tier: #45B5AA; --tier-deep: #1E6F68; --tier-glow: #8EE0D6; --tier-ink: #03201D; --tier-hi: #8EE0D6; --bar: #45B5AA; }
&.tier-experiment, .lvl.t-experiment, .stage.s-experiment { --tier: #0F4C81; --tier-deep: #082C4D; --tier-glow: #86B8EE; --tier-ink: #FFFFFF; --tier-hi: #5A9BDC; --bar: #5A9BDC; }
&.tier-analysis, .lvl.t-analysis, .stage.s-analysis { --tier: #6667AB; --tier-deep: #3A3B78; --tier-glow: #B7B8F0; --tier-ink: #FFFFFF; --tier-hi: #A4A5E3; --bar: #A4A5E3; }
&.tier-paper, .lvl.t-paper, .stage.s-paper { --tier: #5F4B8B; --tier-deep: #382A5E; --tier-glow: #BEABEE; --tier-ink: #FFFFFF; --tier-hi: #9C86CC; --bar: #9C86CC; }
&.tier-stage, .lvl.t-stage, .stage.s-stage { --tier: #009473; --tier-deep: #00513F; --tier-glow: #7FE0C4; --tier-ink: #04170F; --tier-hi: #4FD1AC; --bar: #1FB58F; }
&.tier-honor, .lvl.t-honor, .stage.s-honor { --tier: #DD4124; --tier-deep: #8A2410; --tier-glow: #FFA48F; --tier-ink: #000000; --tier-hi: #FF7A5E; --bar: #F0674A; }
&.tier-society, .lvl.t-society, .stage.s-society { --tier: #B163A3; --tier-deep: #6C3263; --tier-glow: #EFB7E3; --tier-ink: #1A0716; --tier-hi: #E6A5DA; --bar: #B163A3; }
* { box-sizing: border-box; }
& { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font: 16px/1.55 "Pretendard Variable", Pretendard, "Malgun Gothic", system-ui, sans-serif; -webkit-text-size-adjust: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--tier-glow); }
h1, h2, h3 { margin: 0; letter-spacing: -.02em; }
h1 { font-size: 28px; font-weight: 800; margin-bottom: 4px; } h2 { font-size: 20px; font-weight: 800; } h3 { font-size: 16px; font-weight: 700; }
p { margin: 0; }
small { font-size: 14px; }
.mt { margin-top: 16px; }
.ml { margin-left: 8px; }
.name { font-weight: 700; }
.pre { white-space: pre-wrap; }
.wrap { max-width: 600px; margin: 0 auto; padding: 16px; }

a.small { display: inline-flex; align-items: center; min-height: 48px; padding: 8px 0; }

/* 레벨 방패: 육각형 한 면에 숫자. 평평하다. 테두리는 tier-deep 2px */
.lvl { position: relative; width: 48px; height: 56px; flex: none; display: grid; place-items: center; background: var(--tier); clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); }
.lvl::before { content: ""; position: absolute; inset: 0; background: var(--tier-deep); clip-path: inherit; }
.lvl::after { content: ""; position: absolute; inset: 2px; background: var(--tier); clip-path: inherit; }
.lvl span { position: relative; z-index: 1; text-align: center; line-height: 1; color: var(--tier-ink); font-weight: 800; }
.lvl small { display: block; font-size: 12px; letter-spacing: .1em; opacity: .85; margin-bottom: 4px; }
.lvl b { font-size: 20px; letter-spacing: -.04em; }
.lvl.big { width: 112px; height: 128px; }
.lvl.big small { font-size: 12px; } .lvl.big b { font-size: 40px; }
.lvl.mini { width: 40px; height: 48px; } .lvl.mini small { display: none; } .lvl.mini b { font-size: 16px; }

/* 게이지: 평평한 트랙에 단색으로 차오른다. 줄어들 때와 늘어날 때 부드럽게 튕긴다 */
.gauge { position: relative; height: 12px; border-radius: 4px; background: var(--track); overflow: hidden; }
.card .gauge, .quest .gauge { background: var(--bg); }
.gauge i { display: block; height: 100%; min-width: 0; border-radius: 4px; background: var(--bar); transition: width .8s var(--spring); }
.gauge.coral i { background: var(--coral); }
.gauge.lume i { background: var(--lume); }
.gauge.thin { height: 8px; border-radius: 2px; }
.gauge.thin i { border-radius: 2px; }

/* 패널: 단색 면. 안쪽 여백 16px(화면 여백과 같다), 카드끼리 간격 16px */
.card { background: var(--card); border-radius: var(--r); padding: 16px; margin-bottom: 16px; }
.card > h2, .card > h3 { margin-bottom: 8px; }
.card.hot { background: color-mix(in srgb, var(--tier) 22%, var(--card)); }
.stack > * + * { margin-top: 16px; }
.row { display: flex; align-items: center; gap: 16px; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--text3); font-size: 14px; }
.sub { color: var(--text2); font-size: 14px; }
.small { font-size: 14px; }
/* 빈 화면: 한 줄 글 */
.empty { color: var(--text3); font-size: 14px; padding: 16px 0; }
/* 불러오는 중: 단색 막대 세 개가 천천히 깜빡인다 */
.skel { height: 64px; border-radius: 8px; background: var(--card); animation: hb-skel 1.2s ease-in-out infinite alternate; }
.skel + .skel { margin-top: 8px; }
[data-loading] > :not(.skel) { display: none; }

.note { color: var(--text3); font-size: 14px; margin-top: 16px; }
.err { color: var(--coral); font-size: 14px; }
.label { font-size: 12px; font-weight: 700; color: var(--tier-glow); margin-bottom: 8px; }

/* 퀘스트: 표 모양 목록. 왼쪽 칸 24px, 가운데 글, 오른쪽 개수 */
.quest { display: flex; align-items: center; gap: 16px; width: 100%; min-height: 64px; padding: 8px 0; border: 0; background: none; text-align: left; cursor: pointer; border-top: 1px solid var(--line); }
.quest:first-of-type { border-top: 0; }
.quest .mark { width: 24px; height: 24px; flex: none; border: 2px solid var(--line-ui); border-radius: 8px; display: grid; place-items: center; color: transparent; }
.quest.done .mark { background: var(--tier); border-color: var(--tier); color: var(--tier-ink); }
.quest .mark svg { width: 16px; height: 16px; }
.quest .t { flex: 1; min-width: 0; }
.quest .t b { display: block; font-weight: 700; font-size: 16px; line-height: 1.4; margin-bottom: 8px; }
.quest .t small { display: block; color: var(--text3); font-size: 14px; margin: 0 0 8px; line-height: 1.4; }
.quest .n { flex: none; font-size: 12px; font-weight: 700; color: var(--text2); min-width: 40px; text-align: right; }
.quest.done .t b { color: var(--text3); }

/* 소식 줄 */
.line { display: flex; align-items: center; gap: 16px; width: 100%; min-height: 64px; border: 0; background: none; text-align: left; cursor: pointer; padding: 8px 0; border-top: 1px solid var(--line); }
.line:first-of-type { border-top: 0; }
a.line { text-decoration: none; color: inherit; }
div.line { cursor: default; }
.line .k { width: 48px; flex: none; font-size: 12px; font-weight: 700; color: var(--tier-glow); }
.line .v { flex: 1; min-width: 0; font-weight: 700; font-size: 16px; overflow-wrap: anywhere; }
.line .v small { display: block; margin-top: 4px; font-weight: 400; font-size: 14px; color: var(--text2); }
/* 오른쪽 화살표: 글자(›) 대신 2px 선 그림. 글자는 가려 두고 면을 마스크로 오려 낸다 */
.line .go { flex: none; width: 24px; height: 24px; font-size: 0; color: transparent; overflow: hidden; background: var(--text3); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 6l6 6-6 6' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 24px 24px no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 6l6 6-6 6' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 24px 24px no-repeat; }
.line .inline { display: flex; gap: 8px; margin-top: 8px; }

/* 버튼: 단색 면. 누르면 살짝 작아진다 */
.btn { white-space: nowrap; flex: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 16px; border: 0; border-radius: var(--r2); background: var(--tier); color: var(--tier-ink); font-weight: 700; font-size: 16px; cursor: pointer; text-decoration: none; transition: transform .12s var(--spring), filter .15s, background .15s; }
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(.97); }
.btn.alt { background: var(--card2); color: var(--text); border: 2px solid var(--line-ui); }
.btn.lume { background: var(--lume); color: var(--lume-ink); }
.btn.danger { background: var(--magenta); color: #fff; }
.btn.ghost { background: none; color: var(--tier-glow); padding: 0 8px; min-height: 48px; }
.btn.ghost:active { opacity: .7; }
.btn.small { min-height: 48px; padding: 0 16px; font-size: 14px; }
.btn.block { display: flex; width: 100%; }
.btn[disabled], .btn.locked { background: var(--card2); color: var(--text3); border-color: transparent; opacity: 1; filter: none; cursor: default; }
.btn[disabled]:active, .btn.locked:active { transform: none; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }
.row > .btn { flex: none; white-space: nowrap; }
.row > input, .row > select { flex: 1; min-width: 0; }

/* 입력 */
.field { display: block; }
.field > span { display: block; margin-bottom: 8px; font-size: 12px; font-weight: 700; color: var(--text2); }
input[type=text], input[type=search], input[type=number], input:not([type]), textarea, select { width: 100%; min-height: 48px; padding: 8px 16px; border: 2px solid var(--line-ui); border-radius: var(--r2); background: var(--bg); outline: none; color: var(--text); transition: border-color .15s; }
.card input, .card textarea, .card select { background: var(--bg); }
textarea { resize: vertical; min-height: 96px; padding: 16px; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: var(--text3); }
input:focus, textarea:focus, select:focus { border-color: var(--bar); }
.check { display: flex; gap: 16px; align-items: flex-start; min-height: 48px; padding: 8px 0; cursor: pointer; }
.check input { width: 24px; height: 24px; margin: 0; accent-color: var(--tier); flex: none; }
.check b { display: block; font-weight: 700; }
.check small { display: block; color: var(--text3); font-size: 14px; }

/* 아래 탭: 화면 아래에 붙은 평평한 막대. 다섯 칸이 같은 폭 */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--bg); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs button, .tabs a { min-height: 64px; border: 0; background: none; font-size: 12px; font-weight: 700; color: var(--text3); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; position: relative; }
.tabs a { text-decoration: none; }
.tabs button svg, .tabs a svg { width: 24px; height: 24px; transition: transform .3s var(--spring); }
.tabs button[aria-selected=true] { color: var(--tier-glow); }
.tabs button[aria-selected=true] svg { transform: translateY(-2px) scale(1.1); }
.tabs button[aria-selected=true]::before { content: ""; position: absolute; top: -1px; left: 28%; right: 28%; height: 4px; background: var(--bar); border-radius: 0 0 4px 4px; }
.tabs .badge { position: absolute; top: 8px; left: calc(50% + 8px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 4px; background: var(--coral); color: var(--coral-ink); font-size: 12px; line-height: 16px; font-weight: 800; text-align: center; }

/* 구간 선택 */
.seg { display: flex; gap: 8px; margin-bottom: 16px; }
.seg button { flex: 1; min-height: 48px; border: 2px solid var(--line-ui); background: var(--card); border-radius: var(--r2); font-weight: 700; font-size: 14px; color: var(--text2); cursor: pointer; }
.seg button[aria-selected=true] { border-color: var(--bar); background: var(--card2); color: var(--text); }

/* 접이식 */
details.fold { background: var(--card); border-radius: var(--r); margin-bottom: 16px; }
details.fold > summary { list-style: none; min-height: 56px; padding: 16px; font-weight: 700; cursor: pointer; display: flex; justify-content: space-between; align-items: center; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--text3); border-bottom: 2px solid var(--text3); transform: rotate(45deg); transition: transform .25s var(--spring); }
details.fold[open] > summary::after { transform: rotate(-135deg); }
details.fold > :not(summary) { padding: 0 16px 16px; }

/* 목록과 사람 */
.list > * { display: flex; align-items: center; gap: 16px; min-height: 64px; padding: 8px 0; }
.list > * + * { border-top: 1px solid var(--line); }
.tag { display: inline-block; padding: 4px 8px; border-radius: 4px; background: var(--card2); color: var(--text2); font-size: 12px; font-weight: 700; }
.tag.ok { background: var(--tier); color: var(--tier-ink); }
.tag.warn { background: var(--warn-bg); color: var(--peach); }
.tag.lock { background: var(--card2); color: var(--text3); }
.ava { width: 48px; height: 56px; flex: none; clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); background: var(--card2); display: grid; place-items: center; }
.ava svg { width: 100%; height: 100%; display: block; }
.ava.sm { width: 40px; height: 48px; }
.ava.lg { width: 96px; height: 112px; }

/* 대화 */
.chat { display: flex; flex-direction: column; height: calc(100vh - 312px); height: calc(100dvh - 312px); min-height: 344px; }
.msgs { flex: 1; overflow-y: auto; padding: 4px 0; display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 82%; padding: 8px 16px; border-radius: 16px 16px 16px 4px; background: var(--card2); align-self: flex-start; overflow-wrap: anywhere; white-space: pre-wrap; }
.msg.mine { align-self: flex-end; border-radius: 16px 16px 4px 16px; background: var(--tier); color: var(--tier-ink); }
.msg small { display: block; font-size: 12px; opacity: .78; margin-bottom: 4px; font-weight: 700; }
.msg.gone { color: var(--text3); background: none; border: 1px dashed var(--line); }
.compose { display: flex; gap: 8px; padding-top: 8px; }
.compose input { flex: 1; }

/* 게임 */
.arena { position: relative; width: 100%; aspect-ratio: 1; border-radius: var(--r); background: var(--card); overflow: hidden; touch-action: manipulation; user-select: none; }
.arena .rabi { position: absolute; transform: translate(-50%, -50%); cursor: pointer; }
.arena .rabi svg { display: block; width: 100%; height: 100%; }
.arena .hit { position: absolute; transform: translate(-50%, -50%); color: var(--lume); font-weight: 800; pointer-events: none; animation: hb-rise .7s var(--ease) forwards; }

.opt { display: block; width: 100%; text-align: left; min-height: 56px; padding: 8px 16px; margin-top: 8px; border: 0; border-radius: var(--r2); background: var(--card2); cursor: pointer; font-weight: 700; transition: transform .12s var(--spring), background .15s; }
.opt:active { transform: scale(.98); background: var(--line); }
.big { font-size: 40px; font-weight: 800; letter-spacing: -.03em; color: var(--tier-glow); }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; font-size: 14px; }
.kv span:nth-child(odd) { color: var(--text2); }

/* 시트(아래에서 올라오는 창) */
.sheet { position: fixed; inset: 0; z-index: 50; background: var(--scrim); display: flex; align-items: flex-end; justify-content: center; }
.sheet > div { width: 100%; max-width: 600px; max-height: 88vh; overflow-y: auto; background: var(--card); border-radius: 24px 24px 0 0; padding: 24px 24px calc(24px + env(safe-area-inset-bottom)); animation: hb-up .4s var(--spring); }

.sheet .labi { width: 96px; height: 72px; margin-bottom: 8px; }
.steps { display: flex; gap: 8px; margin-bottom: 16px; }
.steps i { flex: 1; height: 4px; border-radius: 2px; background: var(--card2); }
.steps i.on { background: var(--bar); }

/* 레벨업 연출(효과이므로 입체와 빛을 쓴다) */
.celebrate { position: fixed; inset: 0; z-index: 60; background: var(--scrim-full); display: flex; overflow-y: auto; text-align: center; padding: 24px; animation: hb-fade .4s var(--ease); }

.celebrate > div { max-width: 360px; width: 100%; position: relative; margin: auto; }
.celebrate .lvl { margin: 0 auto 24px; animation: hb-pop .8s var(--spring); filter: drop-shadow(0 0 24px var(--tier)); }

.celebrate h2 { font-size: 28px; font-weight: 900; color: #FFE45C; -webkit-text-stroke: 3px #4A3500; paint-order: stroke fill; text-shadow: 0 2px 0 #E0AE00, 0 4px 0 #BC8800, 0 6px 0 #946700, 0 10px 8px rgba(0,0,0,.5), 0 0 24px rgba(255,214,40,.7); }
.celebrate .got { margin: 16px 0; text-align: left; }
.celebrate .got div { padding: 16px; margin-top: 8px; border-radius: var(--r2); background: var(--card2); font-weight: 700; }
.celebrate .got small { display: block; font-weight: 400; font-size: 14px; color: var(--text2); }
.rays { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.rays i { position: absolute; width: 9px; height: 9px; background: var(--lume); border-radius: 2px; animation: hb-fall 2.6s var(--ease) forwards; opacity: 0; filter: drop-shadow(0 0 4px rgba(245,223,77,.8)); }


/* 레벨 길: 왼쪽 48px 마디, 줄은 가운데(left 23px, 폭 2px), 오른쪽에 열리는 것 */
.road { position: relative; }
.stage { margin-bottom: 24px; }
.stage .head { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; padding: 8px 16px; border-radius: var(--r2); background: var(--tier); color: var(--tier-ink); }
.stage .head .lvl { filter: none; }
.stage .head b { font-size: 16px; font-weight: 800; }
.stage .head small { display: block; opacity: .85; font-size: 12px; font-weight: 700; }
.node { display: flex; gap: 16px; position: relative; padding: 0 0 16px 0; }
.node::before { content: ""; position: absolute; left: 23px; top: 48px; bottom: 0; width: 2px; border-radius: 0; background: var(--line); }
.node:last-child::before { display: none; }
.node.past::before { background: var(--bar); }
.node .b { width: 48px; height: 48px; flex: none; border-radius: var(--r2); background: var(--card2); display: grid; place-items: center; font-weight: 800; font-size: 16px; color: var(--text3); position: relative; z-index: 1; }
.node.past .b { background: var(--tier); color: var(--tier-ink); }
.node.now .b { background: var(--lume); color: var(--lume-ink); animation: hb-beat 1.6s ease-in-out infinite; }

.node .c { flex: 1; min-width: 0; padding-top: 0; }
.node .c .it { padding: 8px 16px; margin-bottom: 8px; border-radius: var(--r2); background: var(--card); font-size: 16px; font-weight: 700; }
.node .c .it small { display: block; font-weight: 400; color: var(--text2); font-size: 14px; }
.node:not(.past):not(.now) .c .it { opacity: .7; }
.node .need { font-size: 14px; color: var(--text3); font-weight: 700; padding: 8px 0; }

/* 잠긴 기능 안내 */
.lockbox { display: flex; gap: 16px; align-items: center; padding: 16px; border-radius: var(--r2); background: var(--bg); }
.lockbox svg { width: 24px; height: 24px; flex: none; color: var(--text3); }
.lockbox b { display: block; }
.lockbox small { color: var(--text2); font-size: 14px; }

#toast { position: fixed; left: 50%; bottom: calc(80px + env(safe-area-inset-bottom)); z-index: 70; transform: translate(-50%, 16px); max-width: calc(100vw - 32px); min-height: 48px; padding: 8px 16px; display: flex; align-items: center; border-radius: var(--r2); background: var(--text); color: var(--bg); font-weight: 700; opacity: 0; pointer-events: none; transition: opacity .2s, transform .3s var(--spring); }
#toast.on { opacity: 1; transform: translate(-50%, 0); }

/* 연구방: 벽과 바닥은 단색 두 면(var), 사이에 2px 선. 소품 터치 영역은 사방 8px 넓다 */
.room { position: relative; width: 100%; aspect-ratio: 1; border-radius: var(--r); background: var(--room-floor); overflow: hidden; }
.room::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 56%; background: var(--room-wall); }
.room::after { content: ""; position: absolute; left: 0; right: 0; top: 56%; height: 2px; background: var(--line); }
.room .item { position: absolute; width: 10%; height: 10%; transform: translate(-50%, -50%); }
.room .item::after { content: ""; position: absolute; inset: -8px; }
.room .item svg { width: 100%; height: 100%; display: block; }
.room .me { position: absolute; width: 14%; transform: translate(-50%, -88%); left: 78%; top: 86%; pointer-events: none; }
.room .me svg { position: relative; width: 100%; display: block; }
.room .me::before { content: ""; position: absolute; left: -12%; right: -12%; top: 88%; height: 8px; margin-top: -4px; border: 2px solid var(--line); border-radius: 50%; }
.room.edit .item { cursor: pointer; outline: 2px dashed var(--line); }
.room.edit .item.sel { outline: 2px solid var(--lume); }
.palette { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; }
.palette button { min-height: 72px; border: 0; border-radius: var(--r2); background: var(--card2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 12px; font-weight: 700; cursor: pointer; }
.palette button svg { width: 32px; height: 32px; }
.palette button[disabled] { opacity: .45; }
.seat { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.seat > div { min-height: 80px; padding: 16px; border-radius: var(--r2); background: var(--card2); font-size: 14px; }
.seat > div b { display: block; font-size: 16px; }

.top { display: flex; align-items: center; justify-content: space-between; padding: 4px 0 16px; }
.top .brand { display: flex; align-items: center; gap: 8px; font-weight: 800; text-decoration: none; color: var(--text); }
.top img { width: 32px; height: 32px; border-radius: 8px; }
.top a.back { display: inline-flex; align-items: center; min-height: 48px; font-size: 14px; color: var(--text3); text-decoration: none; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media (min-width: 720px) { .wrap { padding: 24px 16px; } .tabs { padding-inline: calc(50% - 300px); } }

/* ---- 참여가 쌓이는 연출(fx.js): 입체 글자와 날아가는 조각. 입체는 여기에만 쓴다 */
#fx { position: fixed; inset: 0; z-index: 55; pointer-events: none; overflow: hidden; }
.fx-note { position: absolute; left: 0; right: 0; bottom: 26vh; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.fx-num { position: absolute; left: 50%; top: 50%; display: flex; flex-direction: column; align-items: center; transform: translate(-50%, -50%); will-change: transform, opacity; opacity: 0; white-space: nowrap; }
.fx-num.calm { position: static; opacity: 1; transform: none; }
.fx-num b { font-size: calc(58px * var(--k, 1)); line-height: 1; font-weight: 900; letter-spacing: -.03em; color: #FFE45C; -webkit-text-stroke: 4px #4A3500; paint-order: stroke fill;
  text-shadow: 0 1px 0 #F2C400, 0 2px 0 #E0AE00, 0 3px 0 #CE9A00, 0 4px 0 #BC8800, 0 5px 0 #A87700, 0 6px 0 #946700, 0 7px 0 #7D5600, 0 8px 0 #5E4100, 0 13px 10px rgba(0,0,0,.55), 0 0 28px rgba(255, 214, 40, .85); }
.fx-num span { margin-top: 8px; font-size: 16px; font-weight: 800; color: #fff; -webkit-text-stroke: 4px #0A1020; paint-order: stroke fill; text-shadow: 0 2px 0 #0A1020, 0 0 12px rgba(10,16,32,.9); }
.fx-num.badge b { color: #FFC4EC; -webkit-text-stroke-color: #4D1240; text-shadow: 0 1px 0 #F28CD0, 0 2px 0 #E070BC, 0 3px 0 #C856A4, 0 4px 0 #AE4090, 0 5px 0 #922E78, 0 6px 0 #751F60, 0 7px 0 #5C154A, 0 8px 0 #430E36, 0 13px 10px rgba(0,0,0,.55), 0 0 28px rgba(255, 140, 220, .85); }
.fx-num.ghost { opacity: .55; }
.fx-num.ghost b { font-size: calc(40px * var(--k, 1)); }
.orb, .spark, .star { position: absolute; left: 0; top: 0; will-change: transform; }
.orb { width: 16px; height: 16px; margin: -8px 0 0 -8px; background: radial-gradient(circle at 35% 30%, #fff, var(--lume) 45%, var(--lume-deep)); clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); filter: drop-shadow(0 0 6px rgba(245, 223, 77, .95)); }
.orb.alt { background: radial-gradient(circle at 35% 30%, #fff, var(--tier-hi) 45%, var(--tier)); filter: drop-shadow(0 0 6px var(--tier-glow)); }
.spark { width: 7px; height: 7px; margin: -3px 0 0 -3px; border-radius: 2px; }
.star { width: 20px; height: 20px; margin: -10px 0 0 -10px; background: #FFF6B0; clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); filter: drop-shadow(0 0 7px #FFE45C); }
/* 조각이 닿을 때 게이지가 한 번 출렁이고 방패가 튄다(UI 는 평평한 채로 움직임만 더한다) */
.gauge.filling i { filter: brightness(1.15); }
.gauge.hit { animation: hb-squish .4s cubic-bezier(.3, 1.6, .5, 1); }
.gauge.hit i { filter: brightness(1.4); }

.lvl.bump { animation: hb-bump .4s cubic-bezier(.3, 1.6, .5, 1); }

.lvl.flash { animation: hb-flashy .6s ease-out; }

.quest.ping { animation: hb-ping .9s ease-out; }


.labi-s { width: 64px; height: 48px; flex: none; }

[hidden] { display: none !important; }
.tag.streak { background: var(--lume); color: var(--lume-ink); }
.chest { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; padding: 16px; border: 2px dashed var(--line); border-radius: 8px; color: var(--text2); font-weight: 700; }
.chest b { color: var(--lume); font-size: 20px; }
.chest.open { border-style: solid; border-color: var(--lume); }
.chest.pop { animation: hb-chestpop .6s var(--spring); }

.quest.cleared { animation: hb-cleared .9s ease-out; }

.list > .off .grow { opacity: .55; }
.sheet.first > div { text-align: center; }
.sheet.first .labi { width: 144px; height: 108px; margin: 0 auto 16px; }
.sheet.first .btns { margin-top: 24px; justify-content: center; }
.inline { display: flex; gap: 8px; align-items: center; }
.inline input { flex: 1; min-width: 0; }

/* 상태 표시판: 화면 위에 작게 떠 있는 한 덩어리(다른 화면에는 같은 값을 다시 그리지 않는다) */
/* 상태 표시판: 화면 위에 작게 떠 있는 한 덩어리. 아래로 지나가는 카드와 겹쳐 보이지 않게 한 단계 밝은 바탕과 단계색 테두리 */
.hud { position: fixed; top: calc(env(safe-area-inset-top, 0px) + 8px); left: max(16px, env(safe-area-inset-left)); z-index: 30; width: min(248px, calc(100% - 32px)); background: var(--card2); border: 1px solid var(--bar); border-radius: 8px; contain: layout paint; }
@media (min-width: 720px) { .hud { left: calc(50% - 284px); } }
.hud button.hit { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 54px; padding: 4px 8px; border: 0; background: none; color: inherit; text-align: left; cursor: pointer; }
.hud .lvl { width: 32px; height: 38px; }
.hud .lvl small { display: none; }
.hud .lvl b { font-size: 14px; }
.hud .who { flex: 1; min-width: 0; display: grid; gap: 4px; }
.hud .row1 { overflow: hidden; text-overflow: ellipsis; display: flex; align-items: baseline; gap: 8px; font-size: 12px; font-weight: 700; line-height: 16px; white-space: nowrap; }
.hud .tier { color: var(--tier-glow); }
.hud .streak { color: var(--lume); }
.hud .en { margin-left: auto; color: var(--coral); }
.hud .gauge { height: 8px; background: var(--bg); }
.hud .gauge.mini { height: 4px; }
.wrap.hubview { padding-top: calc(72px + env(safe-area-inset-top, 0px)); }

/* ---- 대학 안의 창으로 들어오면서: 밝은 바탕과 가운데 하나의 상태 칩 ---- */
& { --bg: #FFFFFF; --card: #F2F4F6; --card2: #E5E8EB; --line: #E5E8EB; --line-ui: #B0B8C1; --track: #E5E8EB;
  --text: #191F28; --text2: #4E5968; --text3: #6B7684; --scrim: rgba(15,36,39,.5); --lume-text: #7A6A00; --coral-text: #C7352A;
  --room-wall: #DDE3EA; --room-floor: #C9D1DA; --warn-bg: #FFE3E8;
  color-scheme: light; letter-spacing: -.01em; }
&.tier-observe, &.tier-hypothesis, &.tier-experiment, &.tier-analysis, &.tier-paper, &.tier-stage, &.tier-honor, &.tier-society { }
.lvl.t-observe, &.tier-observe { --tier-glow: #4F6E24; } .lvl.t-hypothesis, &.tier-hypothesis { --tier-glow: #1E6F68; }
.lvl.t-experiment, &.tier-experiment { --tier-glow: #0F4C81; } .lvl.t-analysis, &.tier-analysis { --tier-glow: #3A3B78; }
.lvl.t-paper, &.tier-paper { --tier-glow: #382A5E; } .lvl.t-stage, &.tier-stage { --tier-glow: #00513F; }
.lvl.t-honor, &.tier-honor { --tier-glow: #8A2410; } .lvl.t-society, &.tier-society { --tier-glow: #6C3263; }
.hud .streak, .chest b { color: var(--lume-text); } .hud .en { color: var(--coral-text); }
.btn.danger { color: #fff; } .btn.lume { color: var(--lume-ink); }
.tag.warn { color: #B3203F; }
.wrap { padding-bottom: 24px; } .wrap.hubview { padding-top: 16px; }
.tabs { position: relative; z-index: 1; flex: none; } 
/* 상태 칩 자리: 폰은 위쪽 제목 줄 바로 아래 왼쪽(아래는 탭 줄과 입력창이 쓴다), 넓은 화면은 왼쪽 아래 */
.hud { position: fixed; top: calc(env(safe-area-inset-top, 0px) + 64px); bottom: auto; left: max(8px, env(safe-area-inset-left)); z-index: 20; width: 168px; background: var(--bg); border: 2px solid var(--bar); border-radius: 12px; pointer-events: auto; }
@media (min-width: 900px) { .hud { top: auto; bottom: max(16px, env(safe-area-inset-bottom)); left: 16px; } .tabs { padding-inline: 0; } }
.hud .gauge { background: var(--track); }
.slot .hud { position: static; width: auto; }
.sheet, .celebrate, .sheet *, .celebrate * { pointer-events: auto; }
.celebrate { --text: #F2F5FC; --text2: #BAC5E0; --text3: #9AA8CC; --card2: #212C54; --tier-glow: var(--tier-hi); color: var(--text); }
.sheet > div { background: var(--bg); }
#toast { background: #191F28; color: #fff; bottom: calc(24px + env(safe-area-inset-bottom)); }
.chat { height: calc(100dvh - 360px); }
}
@keyframes hb-skel { from { opacity: .55; } to { opacity: 1; } }
@keyframes hb-rise { to { transform: translate(-50%, -150%); opacity: 0; } }
@keyframes hb-up { from { transform: translateY(48px); opacity: 0; } }
@keyframes hb-fade { from { opacity: 0; } }
@keyframes hb-pop { 0% { transform: scale(.2) rotate(-16deg); opacity: 0; } 60% { transform: scale(1.14) rotate(4deg); opacity: 1; } 100% { transform: scale(1); } }
@keyframes hb-fall { 0% { transform: translateY(-20px) rotate(0); opacity: 1; } 100% { transform: translateY(110vh) rotate(540deg); opacity: 0; } }
@keyframes hb-beat { 50% { transform: scale(1.08); } }
@keyframes hb-squish { 0% { transform: scale(1); } 30% { transform: scaleY(1.6) scaleX(1.01); } 62% { transform: scaleY(.85); } 100% { transform: scale(1); } }
@keyframes hb-bump { 0% { transform: scale(1); } 35% { transform: scale(1.17, .88) rotate(-5deg); } 70% { transform: scale(.96, 1.07) rotate(2deg); } 100% { transform: scale(1); } }
@keyframes hb-flashy { 0% { filter: brightness(1); transform: scale(1); } 40% { filter: brightness(2) drop-shadow(0 0 16px var(--lume)); transform: scale(1.3); } 100% { filter: brightness(1); transform: scale(1); } }
@keyframes hb-ping { 0% { background: rgba(245, 223, 77, .22); } 100% { background: transparent; } }
@keyframes hb-chestpop { 0% { transform: scale(1); } 40% { transform: scale(1.06, .94); } 70% { transform: scale(.98, 1.04); } 100% { transform: scale(1); } }
@keyframes hb-cleared { 0% { background: rgba(245, 223, 77, .35); transform: scale(1.02); } 100% { background: transparent; transform: scale(1); } }
.hubpanel.hubhost { position: fixed; inset: 0; z-index: 150; min-height: 0; background: none; pointer-events: none; }
/* 공고와 게시판 창 위에서도 칩이 보인다(+N 이 게이지로 날아가야 하므로). 창 모서리를 가리지 않게 작게 둔다. */
body:has(.ui-modal:not([hidden])) .hubhost .hud { top: auto; bottom: max(12px, env(safe-area-inset-bottom)); left: 12px; width: 148px; box-shadow: 0 2px 8px #0003; }
.hubpanel.hubbody { display: flex; flex-direction: column; flex: 1; min-height: 0; background: var(--bg); }
.hubbody > .slot { flex: none; padding: 0 16px; }
.hubbody > .slot:empty { display: none; }
.hubbody > .slot .chip { padding: 8px 0 0; }
.hubbody .hubscroll { flex: 1; min-height: 0; overflow-y: auto; }
.hubbody .tabs { border-top: 1px solid var(--line); }
