/* 틀 — 위쪽 줄, 제목 줄 + 실시간 띠, PC 메뉴, 폰 아래 칸과 작은 탭, 전체 메뉴, 무전 서랍. PC·폰은 여기 미디어 질의로만 나눈다. */
.frame { min-height: calc(100 * var(--vh)); padding-bottom: calc(var(--dock-h) + env(safe-area-inset-bottom)); }
.frame.in-combat { padding-bottom: 0; }
.content { width: min(100%, var(--content-max)); margin: 0 auto; padding: 12px 16px 24px; min-width: 0; }
/* 전투 화면 — 넓은 화면에서 본문(1440)보다 조금 넓게 */
.frame.in-combat .content { width: min(100%, 1680px); padding-top: 8px; }

/* 위쪽 줄 */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; min-height: var(--topbar-h); padding: 6px 12px; background: var(--bg-2); border-bottom: 1px solid var(--line); }
.tb-who { min-height: var(--tap); display: flex; align-items: center; gap: 8px; min-width: 0; background: transparent; border: 0; color: inherit; cursor: pointer; padding: 0; text-align: left; }
.tb-face { width: 34px; height: 34px; object-fit: cover; object-position: top; border: 1px solid var(--line); flex: 0 0 auto; }
.tb-id { display: grid; line-height: 1.25; min-width: 0; }
.tb-id b { font-weight: 400; color: var(--ink-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 14ch; }
.tb-id .champ { font-style: normal; color: var(--gold-pale); margin-right: 3px; }
.tb-ttl { display: none; }
.tb-sub { font-size: var(--fs-xs); color: var(--ink-dim); white-space: nowrap; }
.tb-sub em { font-style: normal; }
.tb-stat { display: grid; line-height: 1.2; min-width: 0; }
.tb-label { font-size: var(--fs-xs); color: var(--ink-dim); white-space: nowrap; }
.tb-hp .tb-label { color: var(--green); }
.tb-val { color: var(--ink-strong); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tb-hp .bar, .tb-xp .bar { width: 90px; margin-top: 3px; }
.tb-res { display: flex; gap: 10px; }
.tb-r { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-sm); color: var(--ink-strong); white-space: nowrap; }
.tb-r img { width: 22px; height: 22px; object-fit: contain; }
.tb-btns { display: flex; gap: 6px; margin-left: auto; align-items: center; }
.tb-btn { position: relative; }
.tb-btn .badge { position: absolute; top: -6px; right: -6px; }
.livedot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--line); vertical-align: middle; margin-left: 3px; }
.livedot.on { background: var(--green); }
.pc { display: none; }

/* 제목 줄 + 실시간 띠 — PC 는 한 줄(제목 왼쪽, 띠가 남은 폭을 채움). 폰은 띠가 위, 제목이 아래 */
.topline { display: flex; flex-direction: column; min-width: 0; }
.topline > .livestrip { order: -1; }
.livestrip { display: flex; align-items: stretch; gap: 8px; margin-bottom: 10px; min-width: 0; }
.ls-urg, .ls-wb { display: flex; align-items: center; gap: 6px; padding: 4px 10px; min-height: var(--tap); background: var(--panel); border: 1px solid var(--line); color: var(--ink); cursor: pointer; font-size: var(--fs-sm); flex: 0 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; }
.ls-urg { border-color: var(--red); }
.ls-urg b { color: var(--red); font-weight: 400; }
.ls-wb { border-color: var(--amber-line); }
.ls-wb img { width: 26px; height: 26px; object-fit: cover; }
.ls-wb .bar { width: 70px; }
.ls-wb .wb-n em { font-style: normal; color: var(--ink-dim); }
.ls-wb .wb-go { margin-left: auto; padding-left: 6px; color: var(--amber); }
.livestrip.solo .ls-wb { flex: 1 1 auto; }
.livestrip.solo .ls-wb .bar { flex: 1 1 auto; width: auto; min-width: 70px; }
.livestrip:not(.solo) .wb-go { display: none; }
.ticker { flex: 1 1 0; min-width: 0; overflow: hidden; border: 1px solid var(--line-soft); background: var(--panel); display: flex; align-items: center; }
.tk-track { display: inline-flex; gap: 24px; white-space: nowrap; animation: tk var(--dur, 40s) linear infinite; padding-left: 100%; }
.tk { font-size: var(--fs-sm); color: var(--ink); }
.tk i { font-style: normal; color: var(--amber); margin-right: 4px; }
.tk em { font-style: normal; color: var(--ink-dim); margin-left: 6px; font-size: var(--fs-xs); }
.tk.new { color: var(--ink-strong); }
@keyframes tk { to { transform: translateX(-100%); } }
@media (prefers-reduced-motion: reduce) { .tk-track { animation: none; padding-left: 0; } }

/* 폰 아래 칸 · 묶음 안의 작은 탭 */
.side-nav { display: none; }
.phone-subs { display: flex; gap: 6px; overflow-x: auto; margin: 0 -16px 12px; padding: 0 16px 2px; scrollbar-width: none; }
.phone-subs::-webkit-scrollbar { display: none; }
.phone-subs button { flex: 0 0 auto; min-height: var(--tap); padding: 6px 14px; background: var(--panel-2); border: 1px solid var(--line); color: var(--ink); cursor: pointer; white-space: nowrap; }
.phone-subs button.on { border-color: var(--amber); color: var(--amber); }
.dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(6, 1fr);
  height: calc(var(--dock-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--bg-2); border-top: 1px solid var(--line); }
.dock-btn { position: relative; display: grid; place-items: center; align-content: center; gap: 4px; background: transparent; border: 0; color: var(--ink); font-size: var(--fs-xs); cursor: pointer; min-width: 0; }
.dock-btn img { width: 24px; height: 24px; opacity: .85; }
.dock-btn .dot { position: absolute; top: 8px; right: calc(50% - 20px); }
.dock-btn.on { color: var(--ink-strong); background: var(--dock-on); }
.dock-btn:disabled { opacity: .35; cursor: default; }

/* 전체 메뉴 */
.sheet-back { position: fixed; inset: 0; z-index: 30; background: var(--shade-55); }
.sheet { position: fixed; z-index: 31; left: 0; right: 0; bottom: 0; max-height: calc(84 * var(--vh)); overflow-y: auto; background: var(--panel); border-top: 1px solid var(--line); padding: 0 16px calc(16px + env(safe-area-inset-bottom)); }
.sheet-head { position: sticky; top: 0; display: flex; align-items: center; gap: 10px; padding: 10px 0; background: var(--panel); }
.sheet-head b { font-weight: 400; color: var(--ink-strong); }
.sheet-head .btn { margin-left: auto; }
.sheet-group { padding: 8px 0; border-top: 1px solid var(--line-soft); }
.sheet-group h2 { font-size: var(--fs-xs); color: var(--ink-dim); font-weight: 400; margin-bottom: 8px; letter-spacing: 1px; }
.sheet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.sheet-item { display: flex; align-items: center; min-height: var(--tap); padding: 6px 10px; background: var(--panel-2); border: 1px solid var(--line); color: var(--ink); text-align: left; cursor: pointer; overflow-wrap: anywhere; text-decoration: none; font-size: var(--fs-sm); }
.sheet-item.on { border-color: var(--amber); color: var(--amber); }
.sheet-item.warn { border-color: var(--amber); }
.sheet-item.danger { color: var(--red); }
.sheet-item .badge { position: static; }

/* 무전 서랍 */
.drawer { position: fixed; z-index: 25; right: 0; top: var(--topbar-h); bottom: calc(var(--dock-h) + env(safe-area-inset-bottom)); width: min(100%, 420px); overflow-y: auto;
  background: var(--bg); border-left: 1px solid var(--line); padding: 10px; display: grid; gap: 10px; align-content: start; }
.drawer-x { justify-self: end; }

@media (max-width: 600px) {
  .topbar { gap: 8px; padding: 6px 10px; }
  .tb-face { display: none; }
  .tb-rest { display: none; }
  .tb-btns .tb-btn { display: none; }
  .tb-hp .bar { width: 64px; }
  .ls-wb .wb-go, .ls-wb .wb-n em { display: none; }
}
@media (min-width: 601px) { .sheet-item.phone { display: none; } }
@media (min-width: 901px) {
  .frame { padding-bottom: 0; }
  .pc { display: initial; }
  .tb-res.pc { display: flex; }
  .tb-stat.pc { display: grid; }
  .tb-ttl { display: inline-block; }
  .dock, .phone-subs { display: none; }
  .frame:not(.in-combat) > .content { width: min(100% - var(--side-w), var(--content-max)); margin-left: calc(var(--side-w) + max(0px, (100% - var(--side-w) - var(--content-max)) / 2)); }
  .topline { flex-direction: row; align-items: center; gap: 14px; margin: 2px 0 12px; }
  .topline > .livestrip { order: 0; flex: 1 1 0; margin: 0; }
  .topline > .screen-title { margin: 0; flex: 0 1 auto; min-width: 0; }
  .side-nav { display: block; position: fixed; z-index: 15; left: 0; top: var(--topbar-h); height: calc(100 * var(--vh) - var(--topbar-h)); width: var(--side-w); overflow-y: auto;
    padding: 10px 8px 24px; background: var(--bg-2); border-right: 1px solid var(--line); scrollbar-width: thin; }
  .sn-group { padding: 6px 0 8px; border-bottom: 1px solid var(--line-soft); }
  .sn-group:last-child { border-bottom: 0; }
  .sn-group h2 { display: flex; align-items: center; gap: 8px; padding: 4px 8px 6px; font-size: var(--fs-xs); font-weight: 400; color: var(--ink-dim); letter-spacing: 1px; }
  .sn-group h2 img { width: 16px; height: 16px; opacity: .7; }
  .sn-group.on h2 { color: var(--amber); }
  .sn-item { position: relative; display: flex; align-items: center; gap: 6px; width: 100%; min-height: 34px; padding: 0 10px 0 32px; background: transparent; border: 0; border-left: 2px solid transparent;
    color: var(--ink); text-align: left; cursor: pointer; font: inherit; font-size: var(--fs-sm); }
  .sn-item:hover { background: var(--panel); color: var(--ink-strong); }
  .sn-item.on { background: var(--amber-bg); color: var(--ink-strong); border-left-color: var(--amber); }
  .sn-item .dot { margin-left: auto; }
  .sheet { left: auto; top: 0; width: 440px; max-height: none; height: calc(100 * var(--vh)); border-top: 0; border-left: 1px solid var(--line); }
  .drawer { bottom: auto; height: calc(100 * var(--vh) - var(--topbar-h)); }
  #toast { bottom: 24px; }
}
/* 메뉴 글자 옆 단축키 · 단축키 안내 단추 */
.sn-item .sn-k { margin-left: auto; opacity: .7; }
.sn-item .dot + .sn-k { margin-left: 6px; }
.sn-item:hover .sn-k, .sn-item.on .sn-k { opacity: 1; }
.sn-help { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 34px; margin-top: 8px; padding: 0 10px; background: transparent; border: 1px dashed var(--line); color: var(--ink-dim); cursor: pointer; font: inherit; font-size: var(--fs-xs); }
.sn-help:hover { color: var(--ink); border-color: var(--ink-dim); }
@media (min-width: 901px) and (max-width: 1180px) {
  .tb-res.pc, .tb-xp.pc { display: none; }
}
/* 폰 가로 — 위쪽 줄 · 아래 칸을 얇게 해 본문 보이는 칸을 늘린다(높이는 tokens.css) */
@media (max-height: 480px) and (orientation: landscape) {
  .topbar { min-height: 44px; padding-top: 2px; padding-bottom: 2px; }
  .dock-btn { gap: 2px; }
  .dock-btn img { width: 20px; height: 20px; }
}
