/* ═══════════════════════════════════════════════════════
   2026 부락 타임테이블 — 파스텔 / 포스터 무드
   ═══════════════════════════════════════════════════════ */

:root {
  /* 포스터의 하늘 → 벚꽃 그라데이션 */
  --sky-1: #cfe9f5;
  --sky-2: #e8e2f3;
  --sky-3: #fadfe6;
  --panel: #ffffff;
  --panel-2: #f7fafc;
  --ink: #2b3642;
  --ink-2: #74848f;
  --ink-3: #9fb0ba;
  --line: #e6edf2;
  --line-2: #f1f6f9;
  --accent: #ff7a9c;
  --accent-2: #5ec4d8;
  --shadow-s: 0 1px 2px rgba(43,54,66,.05);
  --shadow-m: 0 2px 6px rgba(43,54,66,.06), 0 10px 26px rgba(43,54,66,.07);
  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;
  --ppm: 2.15;                 /* 1분당 px */
  --axis-w: 48px;
  --col-min: 132px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --sky-1: #16212b; --sky-2: #1b2029; --sky-3: #241d26;
    --panel: #1b242c; --panel-2: #222d36;
    --ink: #e9f1f6; --ink-2: #9aabb6; --ink-3: #6d7e89;
    --line: #2d3a44; --line-2: #26313a;
    --shadow-s: 0 1px 2px rgba(0,0,0,.35);
    --shadow-m: 0 2px 6px rgba(0,0,0,.35), 0 10px 26px rgba(0,0,0,.3);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
/* 더블탭 확대 끄기 (핀치 확대는 접근성 위해 그대로 둔다).
   무대를 연속으로 탭해 순위를 돌릴 때 화면이 확대되던 문제를 막아준다. */
html, body { touch-action: manipulation; }
body {
  margin: 0; color: var(--ink); font-family: var(--font-body); font-size: 15px; line-height: 1.4;
  background: linear-gradient(160deg, var(--sky-1) 0%, var(--sky-2) 45%, var(--sky-3) 100%);
  background-attachment: fixed;
  overflow: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; border: none; background: none; }
h1, h2, h3, .display { font-family: var(--font-display); font-weight: 700; letter-spacing: 0; }

/* ═══════ 레이아웃 ═══════ */
.app {
  display: grid; gap: 12px; padding: 12px;
  grid-template-columns: 226px minmax(0, 1fr) 312px;
  height: 100dvh;
}
.sidebar, .main, .rail {
  background: var(--panel); border-radius: var(--r-lg); box-shadow: var(--shadow-m);
  min-height: 0; display: flex; flex-direction: column; overflow: hidden;
}
.sidebar { padding: 18px 16px; gap: 20px; overflow-y: auto; }
.rail { padding: 16px 14px; overflow-y: auto; gap: 12px; }
.drawer-mask, .tabbar { display: none; }

@media (max-width: 1179px) {
  .app { grid-template-columns: minmax(0, 1fr); padding: 8px 8px 0; gap: 8px;
         height: calc(100dvh - 60px - var(--safe-b)); }
  .rail { display: none; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: 268px; z-index: 90; border-radius: 0 var(--r-lg) var(--r-lg) 0;
    transform: translateX(-102%); transition: transform .24s cubic-bezier(.32,.72,0,1);
    padding-top: calc(18px + var(--safe-t));
  }
  .sidebar.open { transform: none; }
  .drawer-mask { display: block; position: fixed; inset: 0; background: rgba(30,42,52,.45);
    opacity: 0; pointer-events: none; transition: opacity .24s; z-index: 89; backdrop-filter: blur(2px); }
  .drawer-mask.open { opacity: 1; pointer-events: auto; }
}

/* ═══════ 브랜드 ═══════ */
.brand { position: relative; display: flex; align-items: center; gap: 9px; padding: 2px 0 4px; }
.brand .bolt { width: 20px; flex: none; fill: #ffd233; filter: drop-shadow(0 1.5px 0 rgba(0,0,0,.14)); }
.brand-type { display: flex; flex-direction: column; line-height: 1; font-family: var(--font-display); font-weight: 700; }
.brand-type .b1 { font-size: 10px; color: var(--ink-2); letter-spacing: .14em; }
.brand-type .b2 { font-size: 17px; letter-spacing: 0; }
.brand-type .b3 { font-size: 21px; letter-spacing: 0; display: flex; align-items: baseline; gap: 5px; }
.brand-type .b3 em { font-style: normal; font-size: 8.5px; letter-spacing: .1em; color: var(--ink-3); }
.brand .sticker { position: absolute; font-size: 12px; opacity: .85; }
.brand .sticker.s1 { top: -2px; right: 16px; transform: rotate(14deg); }
.brand .sticker.s2 { bottom: -2px; right: 0; transform: rotate(-10deg); font-size: 13px; }

/* ═══════ 사이드바 섹션 ═══════ */
.side-sec { display: flex; flex-direction: column; gap: 8px; }
.side-ttl { font-size: 10px; font-weight: 800; letter-spacing: .13em; color: var(--ink-3);
  display: flex; align-items: center; justify-content: space-between; }
.mini { font-size: 11px; font-weight: 800; color: var(--ink-2); background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 999px; padding: 3px 9px; letter-spacing: 0; }
.mini:active { transform: scale(.95); }

.daylist { display: flex; flex-direction: column; gap: 5px; }
.dayitem {
  display: flex; align-items: center; gap: 8px; border-radius: var(--r-md); padding: 9px 11px;
  background: var(--panel-2); text-align: left; font-family: var(--font-display); font-size: 14px; font-weight: 700;
  border: 1.5px solid transparent; transition: .14s;
}
.dayitem b { font-size: 10.5px; font-weight: 400; color: var(--ink-2); margin-left: auto; font-family: var(--font-body); }
.dayitem .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); flex: none; }
.dayitem[aria-selected='true'] { background: #fff0f4; border-color: var(--accent); color: #c43a62; }
.dayitem[aria-selected='true'] .dot { background: var(--accent); }
.dayitem[aria-selected='true'] b { color: #d2809a; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .dayitem[aria-selected='true'] { background: #3a2530; color: #ffb0c6; }
}

.menu { display: flex; flex-direction: column; gap: 3px; }
.menu-item { display: flex; align-items: center; gap: 9px; padding: 9px 11px; border-radius: var(--r-md);
  font-family: var(--font-display); font-size: 14px; font-weight: 700; color: var(--ink-2); text-align: left; }
.menu-item .e { font-size: 14px; }
.menu-item[aria-current='true'] { background: var(--panel-2); color: var(--ink); }

.who-chips { display: flex; flex-direction: column; gap: 5px; }
.who {
  display: flex; align-items: center; gap: 8px; border-radius: var(--r-md); padding: 7px 10px;
  background: var(--panel-2); border: 1.5px solid transparent; font-size: 13px; font-weight: 700;
  text-align: left; transition: .14s; width: 100%;
}
.who .dot { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  font-size: 12.5px; flex: none; box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.7); }
.who .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who .cnt { font-size: 10.5px; font-weight: 800; color: var(--ink-3); flex: none; }
.who[aria-pressed='true'] { border-color: var(--wc); background: var(--wbg); }
.who[aria-pressed='true'] .nm { color: var(--wink); }

.side-note { font-size: 10.5px; color: var(--ink-3); line-height: 1.6; margin: 2px 0 0; }
.side-note b { color: var(--ink-2); }
.side-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line-2);
  display: flex; align-items: center; gap: 8px; }
.sync { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--panel-2); border: 1px solid var(--line); font-size: 12px; flex: none; }
.sync[hidden] { display: none; }
.sync[data-kind='err'] { border-color: #f08c8c; }
.sync[data-kind='busy'] { opacity: .55; }

/* ═══════ 모바일 부락 배너 ═══════ */
.mo-brand {
  display: flex; align-items: center; gap: 12px; flex: none;
  padding: 14px 16px 10px; max-height: 88px; overflow: hidden;
  transition: max-height .26s cubic-bezier(.32,.72,0,1), opacity .2s ease, padding .26s cubic-bezier(.32,.72,0,1);
}
.mo-brand.hide { max-height: 0; opacity: 0; padding-top: 0; padding-bottom: 0; }
.mo-brand-meta {
  margin-left: auto; text-align: right; font-size: 10.5px; font-weight: 800;
  color: var(--ink-3); letter-spacing: .04em; line-height: 1.45; flex: none;
}
.mo-brand-meta i { font-style: normal; color: var(--accent); }
.brand.big .bolt { width: 26px; }
.brand.big .brand-type .b1 { font-size: 11px; }
.brand.big .brand-type .b2 { font-size: 21px; }
.brand.big .brand-type .b3 { font-size: 26px; }
.brand.big .brand-type .b3 em { font-size: 10px; }
.brand.big .sticker { font-size: 14px; }
.brand.big .sticker.s1 { top: 1px; right: -3px; transform: rotate(18deg); }
.brand.big .sticker.s2 { bottom: 1px; right: -20px; font-size: 15px; }

/* ═══════ 메인 헤더 ═══════ */
.mainbar { display: flex; align-items: center; gap: 10px; padding: 14px 16px 12px; flex: none;
  border-bottom: 1px solid var(--line-2); }
.icon-btn { width: 34px; height: 34px; border-radius: var(--r-sm); background: var(--panel-2);
  display: grid; place-items: center; flex: none; color: var(--ink-2); }
.icon-btn svg { width: 17px; height: auto; display: block; fill: currentColor; }

/* 이모지 정렬: CSS 는 줄 박스 높이를 "스택의 첫 폰트"(본문 서체) 기준으로 잡는데
   실제 글리프는 폴백된 이모지 폰트에서 나와서 원 안에서 위아래로 어긋난다.
   → 이모지 폰트를 1순위로 두고 line-height:1 로 고정하면 정확히 중앙에 온다. */
:root { --emo-y: 0em; }   /* 실측: 이모지 폰트를 1순위로 두면 쏠림 0.005em → 보정 불필요 */
.e {
  display: block; line-height: 1; font-style: normal;
  font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji',
               'Twemoji Mozilla', 'EmojiOne Color', sans-serif;
  transform: translateY(var(--emo-y));
}
.mainbar-title { min-width: 0; }
.mainbar-title h1 { font-size: 19px; margin: 0; line-height: 1.15; }
.mainbar-title p { font-size: 11.5px; color: var(--ink-2); margin: 1px 0 0; font-weight: 600; }
.mainbar-tools { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.mainbar-tools[hidden] { display: none; }

.seg-toggle { display: flex; background: var(--panel-2); border-radius: 999px; padding: 3px; gap: 2px; }
.seg-toggle button { border-radius: 999px; padding: 5px 12px; font-size: 12px; font-weight: 800; color: var(--ink-2); }
.seg-toggle button[aria-pressed='true'] { background: var(--panel); color: var(--ink); box-shadow: var(--shadow-s); }

.who-mini { display: flex; align-items: center; margin-left: auto; gap: 5px; }
.who-mini button { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  font-size: 14.5px; border: 2.5px solid transparent; background: var(--wm); opacity: .45; transition: .14s; }
.who-mini button[aria-pressed='true'] { opacity: 1; border-color: var(--wmi); }

.daystrip { display: none; gap: 5px; margin-left: auto; overflow-x: auto; }
@media (max-width: 1179px) {
  .daystrip { display: flex; }
  .mainbar-title h1 { font-size: 16px; }
  .mainbar-title p { display: none; }
  .mainbar-tools { width: 100%; margin: 0; order: 9; }
  .mainbar { flex-wrap: wrap; padding: 10px 12px; }
}
.daychip { border-radius: 999px; padding: 5px 11px; font-size: 12px; font-weight: 800;
  background: var(--panel-2); color: var(--ink-2); white-space: nowrap; }
.daychip[aria-selected='true'] { background: var(--accent); color: #fff; }

/* 스테이지 필터 */
.stagebar { display: flex; gap: 5px; padding: 9px 16px; flex: none; overflow-x: auto;
  border-bottom: 1px solid var(--line-2); }
.stagebar::-webkit-scrollbar { display: none; }
.stagechip { border-radius: 999px; padding: 4px 11px; font-size: 11.5px; font-weight: 800;
  white-space: nowrap; border: 1.5px solid transparent; background: var(--panel-2); color: var(--ink-3); }
.stagechip[aria-pressed='true'] { background: var(--sc); color: var(--si); border-color: var(--sc); }
.stagebar[hidden] { display: none; }

/* ═══════ 보드 ═══════ */
.board { flex: 1; overflow: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.grid { min-width: max-content; padding: 0 10px calc(30px + var(--safe-b)); position: relative; }
@media (min-width: 1180px) { .grid { min-width: 0; } }

.grid-head { display: flex; position: sticky; top: 0; z-index: 30; background: var(--panel); padding-top: 8px; }
.grid-head .corner { width: var(--axis-w); flex: none; position: sticky; left: 0; z-index: 2; background: var(--panel); }
.stage-head { flex: 1 0 var(--col-min); min-width: var(--col-min); margin: 0 3px 8px; padding: 7px 4px;
  border-radius: var(--r-md); text-align: center; font-family: var(--font-display); font-size: 14px; font-weight: 700; }
.stage-head small { display: block; font-size: 9px; letter-spacing: .12em; opacity: .65; font-family: var(--font-body); font-weight: 700; }

.gatebar { margin: 0 3px 10px; height: 26px; border-radius: 8px; background: var(--ink); color: var(--panel);
  display: grid; place-items: center; font-size: 10.5px; font-weight: 800; letter-spacing: .1em; }

.grid-body { display: flex; position: relative; }
.axis { width: var(--axis-w); flex: none; position: sticky; left: 0; z-index: 20; background: var(--panel); }
.axis .tick { position: absolute; left: 0; width: var(--axis-w); font-size: 11px; font-weight: 800;
  color: var(--ink-3); transform: translateY(-50%); font-variant-numeric: tabular-nums; }
.rules { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.rules i { position: absolute; left: var(--axis-w); right: 0; height: 0; border-top: 1px dashed var(--line-2); }
.rules i.hour { border-top: 1px solid var(--line); }
.col { flex: 1 0 var(--col-min); min-width: var(--col-min); position: relative; margin: 0 3px; }

/* 무대 카드 */
.slot {
  position: absolute; left: 0; right: 0; border-radius: var(--r-md); padding: 6px 8px;
  overflow: hidden; text-align: left; width: 100%; display: flex; flex-direction: column;
  justify-content: center; gap: 1px; background: var(--s-bg); color: var(--s-ink);
  box-shadow: var(--shadow-s); transition: transform .1s, box-shadow .1s;
  border: 1.5px solid transparent;
}
.slot:active { transform: scale(.985); }
.slot .nm { font-family: var(--font-display); font-size: 13px; font-weight: 700; line-height: 1.2;
  word-break: keep-all; overflow-wrap: anywhere; }
.slot .en { font-size: 9.5px; font-weight: 700; opacity: .64; line-height: 1.15; }
.slot .tm { font-size: 9.5px; font-weight: 700; opacity: .58; font-variant-numeric: tabular-nums; margin-top: 1px; }
.slot .tag { font-size: 8.5px; font-weight: 800; opacity: .72; font-family: var(--font-hand); }
.slot.headliner { background: var(--s-bg); border-color: var(--s-edge); }
.slot.headliner .nm { font-size: 16px; }
.slot.short { padding: 4px 7px; gap: 0; }
.slot.short .en, .slot.short .tag { display: none; }
.slot.picked { box-shadow: var(--shadow-m); border-color: var(--s-edge); }
.slot.mine { border-color: var(--mine); border-width: 2px; }

.marks { position: absolute; top: 5px; right: 5px; display: flex; gap: 2px; z-index: 3; }
.mark { width: 20px; height: 20px; position: relative; display: grid; place-items: center; }
.mark::before { content: ''; position: absolute; inset: 0; background: var(--mc);
  box-shadow: 0 0 0 1.5px #fff, 0 1px 2px rgba(0,0,0,.16); }
.mark.p1::before { border-radius: 50%; }
.mark.p2::before { clip-path: polygon(50% 4%, 97% 96%, 3% 96%); box-shadow: none;
  filter: drop-shadow(0 0 1px #fff) drop-shadow(0 0 1px #fff) drop-shadow(0 1px 1px rgba(0,0,0,.2)); }
.mark .e { position: relative; font-size: 10.5px; }
.mark.p2 .e { font-size: 9px; transform: translateY(calc(var(--emo-y) + 3px)); }
.bars { position: absolute; left: 0; top: 0; bottom: 0; display: flex; z-index: 2; border-radius: var(--r-md) 0 0 var(--r-md); overflow: hidden; }
.bars i { width: 4px; }

/* ═══════ 리스트 모드 ═══════ */
.list { padding: 8px 14px calc(30px + var(--safe-b)); }
.list-hour { position: sticky; top: 0; z-index: 5; background: var(--panel);
  margin: 0 -14px; padding: 9px 14px 5px;
  font-family: var(--font-display); font-size: 13px; color: var(--ink-2);
  display: flex; align-items: center; gap: 8px; }
.list-hour::after { content: ''; flex: 1; border-top: 1px dashed var(--line); }
.litem {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 9px 11px; border-radius: var(--r-md); margin-bottom: 5px; background: var(--panel-2);
  border: 1.5px solid transparent; position: relative; overflow: hidden;
}
.litem:active { transform: scale(.99); }
.litem .sc { width: 4px; align-self: stretch; border-radius: 4px; background: var(--s-edge); flex: none; }
.litem .t { font-size: 11px; font-weight: 800; color: var(--ink-2); font-variant-numeric: tabular-nums;
  flex: none; width: 42px; line-height: 1.3; }
.litem .t small { display: block; font-size: 9.5px; color: var(--ink-3); font-weight: 700; }
.litem .body { flex: 1; min-width: 0; }
.litem .nm { font-family: var(--font-display); font-size: 14px; font-weight: 700; line-height: 1.2; }
.litem .meta { font-size: 10.5px; color: var(--ink-3); font-weight: 700; margin-top: 1px;
  display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.litem .badge { font-size: 9px; font-weight: 800; padding: 1px 6px; border-radius: 5px;
  background: var(--s-bg); color: var(--s-ink); }
.litem .marks { position: static; flex: none; }
.litem.picked { background: var(--s-bg); border-color: var(--s-edge); }
.litem.mine { border-color: var(--mine); border-width: 2px; }

/* ═══════ 요약 뷰 ═══════ */
.sum { padding: 4px 14px calc(30px + var(--safe-b)); }
.sum-band {
  background: linear-gradient(135deg, #fff4d6, #ffe3ec); border-radius: var(--r-lg); padding: 13px 15px;
  margin: 8px 0 16px; position: relative; overflow: hidden;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .sum-band { background: linear-gradient(135deg,#3a3320,#3a2630); } }
.sum-band h3 { margin: 0 0 3px; font-size: 15px; color: #8a5a20; }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .sum-band h3 { color: #ffd9a0; } }
.sum-band p { margin: 0 0 9px; font-size: 11px; color: #b08a5a; font-weight: 700; }
.band-items { display: flex; gap: 7px; flex-wrap: wrap; }
.band-card { background: rgba(255,255,255,.82); border-radius: var(--r-md); padding: 7px 11px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .band-card { background: rgba(255,255,255,.1); } }
.band-card .t { font-size: 10.5px; font-weight: 800; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.band-card .n { font-family: var(--font-display); font-size: 14px; line-height: 1.2; }
.band-card .s { font-size: 9px; font-weight: 800; opacity: .7; }
.band-empty { font-size: 12px; color: #b08a5a; font-weight: 700; }

.sum-sec-ttl { font-family: var(--font-display); font-size: 14px; margin: 0 0 8px;
  display: flex; align-items: center; gap: 7px; }
.sum-sec-ttl small { font-size: 11px; color: var(--ink-3); font-family: var(--font-body); font-weight: 700; }

/* 사람별 컬럼 타임라인 */
.pcol-head { display: flex; position: sticky; top: 0; z-index: 10; background: var(--panel); padding-bottom: 8px; }
.pcol-head .corner { width: var(--axis-w); flex: none; }
.pcol-head .ph { flex: 1 1 0; min-width: 0; margin: 0 3px; padding: 8px 6px; border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center; gap: 6px; background: var(--phbg); }
.pcol-head .ph .av { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12.5px; flex: none; }
.pcol-head .ph .nm { font-family: var(--font-display); font-size: 13px; color: var(--phink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pgrid { display: flex; position: relative; }
.pcol { flex: 1 1 0; min-width: 0; position: relative; margin: 0 3px; }
.pslot { position: absolute; left: 0; right: 0; border-radius: var(--r-sm); padding: 5px 7px;
  overflow: hidden; background: var(--s-bg); border-left: 4px solid var(--s-edge); }
.pslot .nm { font-family: var(--font-display); font-size: 11.5px; font-weight: 700; line-height: 1.18; color: var(--s-ink);
  word-break: keep-all; overflow-wrap: anywhere; }
.pslot .tm { font-size: 9px; font-weight: 700; color: var(--s-ink); opacity: .62; font-variant-numeric: tabular-nums; }
.pslot .rk { position: absolute; top: 3px; right: 4px; font-size: 9.5px; font-weight: 800; opacity: .75; }
.pslot.p2 { opacity: .8; border-left-style: dashed; }
.pslot.clash { box-shadow: inset 0 0 0 2px #ff8fa3; }
.pcol-empty { position: absolute; top: 40px; left: 0; right: 0; text-align: center;
  font-size: 11px; color: var(--ink-3); font-weight: 700; }

.clash-note { background: #fff0f3; border: 1px solid #ffd4de; border-radius: var(--r-md);
  padding: 10px 12px; margin: 14px 0 0; font-size: 12px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .clash-note { background: #3a2129; border-color: #5c2f3b; } }
.clash-note b { color: #d13f63; }
.clash-note ul { margin: 6px 0 0; padding-left: 16px; }
.clash-note li { margin-bottom: 2px; }

/* ═══════ 우측 레일 ═══════ */
.rail-ttl { font-family: var(--font-display); font-size: 15px; margin: 0; }
.rail-sub { font-size: 11px; color: var(--ink-2); font-weight: 700; margin: -8px 0 0; }
.rail-card { border-radius: var(--r-md); padding: 11px 12px; background: var(--panel-2); }
.rail-card .hd { display: flex; align-items: center; gap: 7px; margin-bottom: 7px; }
.rail-card .hd .av { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; flex: none; }
.rail-card .hd .nm { font-family: var(--font-display); font-size: 13.5px; flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-card .hd .cnt { font-size: 10px; font-weight: 800; color: var(--ink-3); }
.ragenda { display: flex; flex-direction: column; gap: 3px; }
.ritem { display: flex; gap: 7px; align-items: baseline; font-size: 11.5px; padding: 4px 7px;
  border-radius: 8px; background: var(--panel); }
.ritem .t { font-size: 10px; font-weight: 800; color: var(--ink-2); font-variant-numeric: tabular-nums; flex: none; }
.ritem .rk { flex: none; font-weight: 800; }
.ritem .n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ritem .sq { width: 6px; height: 6px; border-radius: 2px; flex: none; }
.ritem.clash { background: #fff0f3; }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .ritem.clash { background: #3a2129; } }
.rail-empty { font-size: 11px; color: var(--ink-3); font-weight: 700; padding: 2px 7px; }

/* ═══════ 하단 탭 ═══════ */
@media (max-width: 1179px) {
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    background: color-mix(in srgb, var(--panel) 92%, transparent); backdrop-filter: blur(12px);
    border-top: 1px solid var(--line); padding: 6px 8px calc(6px + var(--safe-b));
  }
  .tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 5px 0; font-size: 10.5px; font-weight: 800; color: var(--ink-3); border-radius: var(--r-sm); }
  .tabbar button .e { font-size: 17px; }
  .tabbar button[aria-current='true'] { color: var(--accent); }
}

/* ═══════ 모달 ═══════ */
.mask { position: fixed; inset: 0; background: rgba(30,42,52,.5); display: none; z-index: 100;
  align-items: flex-end; justify-content: center; backdrop-filter: blur(3px); }
.mask.open { display: flex; }
.sheet { background: var(--panel); width: 100%; max-width: 540px; border-radius: 22px 22px 0 0;
  padding: 18px 18px calc(22px + var(--safe-b)); max-height: 88dvh; overflow: auto; box-shadow: var(--shadow-m); }
@media (min-width: 620px) { .mask { align-items: center; } .sheet { border-radius: 22px; } }
.sheet h2 { margin: 0 0 4px; font-size: 18px; }
.sheet .sub { margin: 0 0 14px; font-size: 12.5px; color: var(--ink-2); }
.sheet .close { position: sticky; top: 0; float: right; font-size: 22px; line-height: 1; padding: 0 2px; color: var(--ink-3); }

.mrow { border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px; margin-bottom: 10px; }
.mrow .top { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.mrow input[type='text'] { flex: 1; font: inherit; font-weight: 700; padding: 8px 11px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--panel-2); color: var(--ink); min-width: 0; }
.mrow .avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  font-size: 16px; flex: none; box-shadow: inset 0 0 0 2px rgba(255,255,255,.75); }
.picker { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.picker .ttl { width: 100%; font-size: 10px; font-weight: 800; color: var(--ink-3); letter-spacing: .1em; }
.opt { width: 32px; height: 32px; border-radius: 10px; border: 2px solid var(--line);
  background: var(--panel-2); display: grid; place-items: center; font-size: 15px; padding: 0; }
.opt[aria-pressed='true'] { border-color: var(--ink); transform: scale(1.08); }
.opt:disabled { opacity: .25; cursor: not-allowed; }
.opt.color { border-radius: 50%; }

.pin-input {
  width: 100%; font: inherit; font-size: 20px; font-weight: 700; letter-spacing: .35em;
  text-align: center; padding: 13px 10px; border-radius: var(--r-md);
  border: 2px solid var(--line); background: var(--panel-2); color: var(--ink); margin-bottom: 12px;
}
.pin-input:focus { outline: none; border-color: var(--accent); }

.lockrow { display: flex; align-items: center; gap: 6px; margin-top: 10px;
  padding-top: 10px; border-top: 1px dashed var(--line); }
.lockrow .lbl { font-size: 10.5px; font-weight: 800; color: var(--ink-3); letter-spacing: .06em; margin-right: auto; }
.mrow.locked { opacity: .72; }
.mrow.locked .picker .opt, .mrow.locked input[type='text'] { pointer-events: none; }
.who .lk { font-size: 10px; flex: none; opacity: .75; }
.seg-lock { border: 1.5px solid var(--line); background: var(--panel-2); border-radius: var(--r-sm);
  padding: 7px 13px; font-size: 12px; font-weight: 800; color: var(--ink-2); }

.field { display: flex; gap: 8px; margin: 10px 0; }
.field input, .field textarea { flex: 1; font: inherit; font-size: 12.5px; padding: 9px 11px;
  border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--panel-2); color: var(--ink);
  min-width: 0; resize: vertical; }
.btn { border: 1px solid var(--line); background: var(--panel-2); border-radius: var(--r-sm);
  padding: 9px 15px; font-weight: 800; font-size: 13px; white-space: nowrap; }
.btn.primary { background: var(--ink); color: var(--panel); border-color: var(--ink); }
.btn.danger { color: #e0576f; }
.note { font-size: 11.5px; color: var(--ink-2); line-height: 1.6; }
.note b { color: var(--ink); }

.detail .who-row { display: flex; align-items: center; gap: 9px; padding: 10px 0; border-top: 1px solid var(--line-2); }
.detail .who-row .avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  font-size: 15px; flex: none; box-shadow: inset 0 0 0 2px rgba(255,255,255,.75); }
.detail .who-row .nm { font-weight: 800; font-size: 13.5px; flex: 1; min-width: 0; }
.seg { display: flex; gap: 4px; }
.seg button { border: 1.5px solid var(--line); background: var(--panel-2); border-radius: var(--r-sm);
  padding: 7px 11px; font-size: 12px; font-weight: 800; }
.seg button[aria-pressed='true'] { border-color: var(--sel); background: var(--selbg); color: var(--sel); }

.toast { position: fixed; left: 50%; bottom: calc(76px + var(--safe-b)); transform: translateX(-50%) translateY(10px);
  background: var(--ink); color: var(--panel); padding: 10px 18px; border-radius: 999px; font-size: 13px;
  font-weight: 700; opacity: 0; pointer-events: none; transition: .18s; z-index: 200; }
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

.slot, .who, .dayitem, .litem, .daychip, .stagechip, .mark, .who-mini button, .seg button, .opt,
.tabbar button, .menu-item, .icon-btn, .btn, .mini {
  -webkit-touch-callout: none; -webkit-user-select: none; user-select: none;
  touch-action: manipulation;
}

/* iOS 는 글자 16px 미만 입력창에 포커스하면 자동으로 확대해버린다 */
@media (max-width: 1179px) {
  .mrow input[type='text'], .field input, .field textarea { font-size: 16px; }
}
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 9px; border: 2px solid var(--panel); }
::-webkit-scrollbar-track { background: transparent; }

/* 넓은 화면: 모바일 전용 요소 감추기 (icon-btn 등 이후 규칙을 이기려면 여기 있어야 함) */
@media (min-width: 1180px) { .only-narrow { display: none; } }
