/* ==================== 라무와 토리들 디자인 ====================
   왼쪽 니트 분홍 메뉴(레이스 테두리) + 오른쪽 내용. 휴대폰에서는 메뉴가 위쪽 가로줄.
   색은 모두 아래 토큰으로만 씁니다. 어두운 화면 설정이면 코코아색으로 바뀝니다. */
:root {
  --cream: #fff8f3;
  --surface: #ffffff;
  --knit: #f9dde1;
  --knit-deep: #e9a3b1;
  --rose: #c95c78;
  --honey: #f3c66f;
  --honey-soft: #fdf0d2;
  --cocoa: #4f3328;
  --cocoa-soft: #8a6659;
  --pearl: #efebf4;
  --line: #f0d8d4;
  --danger: #b4233f;
  --sat: #4a6fa5;
  --t-broadcast: #f9dde1; --t-broadcast-ink: #a83e5b;
  --t-collab: #fdf0d2;    --t-collab-ink: #7d5414;
  --t-off: #efebf4;       --t-off-ink: #6b5f73;
  --t-event: #dff0e6;     --t-event-ink: #2f6b4f;
  --t-etc: #e8eef7;       --t-etc-ink: #3d5a80;
  --font-display: "Jua", "Gowun Dodum", system-ui, sans-serif;
  --font-body: "Gowun Dodum", system-ui, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --cream: #261b18; --surface: #33251f; --knit: #4a2c33; --knit-deep: #b46e7f; --rose: #f2a3b6;
    --honey: #f2c879; --honey-soft: #3d2f1e; --cocoa: #fbeee6; --cocoa-soft: #d4b8ab; --pearl: #3a2e35; --line: #4d3a35;
    --danger: #ff8fa3;
    --sat: #9dbbe8;
    --t-broadcast: #5a3240; --t-broadcast-ink: #ffc2d1;
    --t-collab: #4a3a20;    --t-collab-ink: #f8d999;
    --t-off: #3d3442;       --t-off-ink: #d6cbe0;
    --t-event: #24402f;     --t-event-ink: #b5e3c6;
    --t-etc: #2a3646;       --t-etc-ink: #bcd0ea;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --cream: #261b18; --surface: #33251f; --knit: #4a2c33; --knit-deep: #b46e7f; --rose: #f2a3b6;
  --honey: #f2c879; --honey-soft: #3d2f1e; --cocoa: #fbeee6; --cocoa-soft: #d4b8ab; --pearl: #3a2e35; --line: #4d3a35;
  --danger: #ff8fa3;
  --sat: #9dbbe8;
  --t-broadcast: #5a3240; --t-broadcast-ink: #ffc2d1;
  --t-collab: #4a3a20;    --t-collab-ink: #f8d999;
  --t-off: #3d3442;       --t-off-ink: #d6cbe0;
  --t-event: #24402f;     --t-event-ink: #b5e3c6;
  --t-etc: #2a3646;       --t-etc-ink: #bcd0ea;
  color-scheme: dark;
}

/* ==================== 기본 ==================== */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--cream); color: var(--cocoa); font-family: var(--font-body); font-size: 15px; line-height: 1.65; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 400; line-height: 1.2; text-wrap: balance; margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--rose); outline-offset: 2px; }
.sr-only, .visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--cocoa-soft); }
.small { font-size: 13px; }
.empty { color: var(--cocoa-soft); padding: 18px 0; margin: 0; }
body:not(.is-admin) .admin-only { display: none !important; }

.demo-banner { margin: 0; padding: 8px max(16px, env(safe-area-inset-left, 0px)); background: var(--honey-soft); color: var(--cocoa); font-size: 13px; text-align: center; border-bottom: 1px solid var(--line); }

/* ==================== 전체 배치 ==================== */
.app { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100vh; background: linear-gradient(90deg, var(--knit) 220px, transparent 220px); }
.main { padding: 34px clamp(18px, 4vw, 48px) 48px clamp(26px, 4vw, 52px); display: flex; flex-direction: column; gap: 22px; max-width: 980px; width: 100%; min-width: 0; outline: none; }

/* 왼쪽 메뉴: 니트 분홍 + 레이스 가장자리 */
.side { position: sticky; top: 0; height: 100vh; z-index: 5; background: var(--knit); padding: 28px 16px 22px; display: flex; flex-direction: column; gap: 22px; }
.side::after { content: ""; position: absolute; top: 0; right: -17px; width: 18px; height: 100%; pointer-events: none;
  background: radial-gradient(circle at 0 9px, var(--knit) 8px, transparent 8.5px) 0 0 / 18px 18px repeat-y; }
.logo { display: flex; flex-direction: column; gap: 2px; text-decoration: none; padding: 0 6px; }
.logo b { font-family: var(--font-display); font-weight: 400; font-size: 27px; line-height: 1.15; color: var(--cocoa); }
.logo small { color: var(--cocoa-soft); font-size: 12px; letter-spacing: 0.04em; }

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 5px 12px 5px 6px; border-radius: 12px; color: var(--cocoa); text-decoration: none; font-family: var(--font-display); font-size: 17px; }
.nav a:hover { background: color-mix(in srgb, var(--surface) 55%, transparent); }
.nav a.on { background: var(--surface); box-shadow: 0 1px 0 var(--line); }
.tori { width: 36px; height: auto; flex: none; transition: transform 0.2s ease; }
.nav a:hover .tori { transform: rotate(-8deg); }
.nav a.on .tori { transform: scale(1.08); }
.ext { margin-left: auto; font-size: 13px; color: var(--cocoa-soft); }

.auth { margin-top: auto; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.lock { display: inline-flex; align-items: center; gap: 8px; border: 1.5px dashed var(--knit-deep); background: transparent; color: var(--cocoa-soft); border-radius: 12px; padding: 8px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.lock:hover { background: color-mix(in srgb, var(--surface) 55%, transparent); }
.lock svg { width: 16px; height: 16px; flex: none; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--rose); color: var(--surface); font-size: 12px; }

/* ==================== 공통 부품 ==================== */
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.page-head h2 { font-size: 30px; }
.count { font-family: var(--font-body); font-size: 15px; color: var(--cocoa-soft); margin-left: 4px; }
.tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 7px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--cocoa); font: inherit; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--knit-deep); }
.btn.primary { background: var(--rose); border-color: var(--rose); color: var(--surface); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { background: transparent; }
.btn.soft { background: var(--pearl); align-self: flex-start; }
.btn.icon { width: 38px; padding: 0; font-size: 20px; }
.btn.tiny { min-height: 30px; padding: 4px 10px; font-size: 13px; border-radius: 8px; }
.btn.danger { color: var(--danger); }
.btn.armed { background: var(--danger); border-color: var(--danger); color: var(--surface); }

input, select, textarea { font: inherit; color: var(--cocoa); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; min-height: 40px; min-width: 0; }
textarea { resize: vertical; line-height: 1.6; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--rose) 60%, transparent); outline-offset: 0; border-color: var(--knit-deep); }
input[type="range"] { padding: 0; min-height: 28px; accent-color: var(--rose); border: 0; background: transparent; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; color: var(--cocoa-soft); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.row-tools { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.form-label { font-size: 13px; color: var(--cocoa-soft); width: 100%; }

.add-box { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 14px 16px; border: 1.5px dashed var(--knit-deep); border-radius: 16px; background: color-mix(in srgb, var(--knit) 35%, var(--cream)); }
.add-box .grow { flex: 1 1 180px; }
.source-box { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.source-box .add-box { width: 100%; }
.search-bar input { width: 100%; min-height: 48px; border-radius: 14px; padding: 10px 16px; font-size: 16px; }

.block { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 18px 20px; }
.block-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 6px; }
.block-head h2 { font-size: 21px; }
.block-head a { color: var(--rose); font-size: 13px; text-decoration: none; }

.tag { justify-self: start; display: inline-block; font-size: 12px; padding: 2px 9px; border-radius: 999px; background: var(--t-etc); color: var(--t-etc-ink); white-space: nowrap; }
.t-방송 { --tb: var(--t-broadcast); --ti: var(--t-broadcast-ink); }
.t-합방 { --tb: var(--t-collab); --ti: var(--t-collab-ink); }
.t-휴방 { --tb: var(--t-off); --ti: var(--t-off-ink); }
.t-이벤트 { --tb: var(--t-event); --ti: var(--t-event-ink); }
.t-기타 { --tb: var(--t-etc); --ti: var(--t-etc-ink); }
.tag[class*="t-"] { background: var(--tb, var(--t-etc)); color: var(--ti, var(--t-etc-ink)); }

.note { margin: 0; padding: 10px 14px; border-radius: 12px; background: var(--honey-soft); font-size: 14px; }
.error-box { margin: 0; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--danger); color: var(--danger); background: var(--surface); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font: inherit; font-size: 14px; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--cocoa); cursor: pointer; }
.chip small { color: var(--cocoa-soft); font-size: 12px; }
.chip.on { background: var(--cocoa); border-color: var(--cocoa); color: var(--cream); }
.chip.on small { color: inherit; opacity: 0.8; }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 50; max-width: min(90vw, 460px); padding: 10px 18px; border-radius: 12px; background: var(--cocoa); color: var(--cream); font-size: 14px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18); }

/* ==================== 프로필 ==================== */
.hero { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 230px; align-items: end; background: var(--surface); border-radius: 22px; border: 1px solid var(--line); overflow: hidden; }
.hero-text { padding: 30px 8px 28px 30px; display: flex; flex-direction: column; gap: 12px; align-self: center; min-width: 0; }
.eyebrow { margin: 0; font-size: 12px; letter-spacing: 0.14em; color: var(--rose); }
.hero h1 { font-size: clamp(42px, 6vw, 60px); line-height: 1; }
.desc { margin: 0; max-width: 34ch; color: var(--cocoa-soft); }
.links { display: flex; flex-wrap: wrap; gap: 8px; }
.links a { padding: 6px 12px; border-radius: 999px; background: var(--honey-soft); color: var(--cocoa); text-decoration: none; font-size: 13px; border: 1px solid color-mix(in srgb, var(--honey) 60%, transparent); }

/* 사진 칸: 크기 비율을 고정해서, 편집 화면에서 맞춘 위치가 그대로 보이게 함 */
.hero-art, .avatar-stage { position: relative; width: 230px; aspect-ratio: 230 / 340; overflow: hidden; }
.avatar-img { position: absolute; transform: translate(-50%, -50%); max-width: none; height: auto; user-select: none; -webkit-user-drag: none; }

.facts { display: grid; grid-template-columns: minmax(0, 1.6fr) repeat(2, minmax(0, 1fr)); gap: 12px; }
.fact { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: var(--cocoa); }
a.fact:hover { border-color: var(--knit-deep); }
.fact span { font-size: 12px; color: var(--cocoa-soft); letter-spacing: 0.04em; }
.fact b { font-family: var(--font-display); font-weight: 400; font-size: 26px; font-variant-numeric: tabular-nums; }
.fact.fan { flex-direction: row; align-items: center; gap: 14px; background: var(--honey-soft); border-color: color-mix(in srgb, var(--honey) 55%, transparent); }
.fact.fan img { width: 58px; height: auto; flex: none; transform: rotate(-6deg); }
.fact.fan div { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.fact.fan small { font-size: 12px; color: var(--cocoa-soft); line-height: 1.4; }

.up { list-style: none; margin: 0; padding: 0; }
.up li { display: grid; grid-template-columns: 64px 58px minmax(0, 1fr) auto auto; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px dashed var(--line); }
.up li:first-child { border-top: 0; }
.d { font-family: var(--font-display); font-size: 18px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.d small { font-family: var(--font-body); font-size: 12px; color: var(--cocoa-soft); }
.t { min-width: 0; overflow-wrap: anywhere; }
.tm { color: var(--cocoa-soft); font-size: 13px; font-variant-numeric: tabular-nums; }

/* 프로필 편집 */
.panel-form { display: flex; flex-direction: column; gap: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 24px; }
.avatar-editor { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 20px; align-items: start; }
.avatar-stage { border-radius: 16px; border: 1.5px dashed var(--knit-deep); cursor: grab; touch-action: none;
  background: repeating-conic-gradient(var(--pearl) 0 25%, var(--surface) 0 50%) 0 0 / 20px 20px; }
.avatar-stage.dragging { cursor: grabbing; }
.hint { margin: 0; color: var(--cocoa-soft); }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ==================== 달력 ==================== */
.month-nav { display: flex; align-items: center; gap: 6px; }
.month-title { font-family: var(--font-display); font-size: 20px; min-width: 112px; text-align: center; font-variant-numeric: tabular-nums; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 14px; }
.dow { text-align: center; font-size: 13px; color: var(--cocoa-soft); padding-bottom: 4px; }
.dow.sun, .cell.sun .num { color: var(--danger); }
.dow.sat, .cell.sat .num { color: var(--sat); }
.cell { min-height: 92px; min-width: 0; display: flex; flex-direction: column; align-items: stretch; gap: 3px; padding: 6px; border-radius: 12px; border: 1px solid transparent; background: var(--cream); color: var(--cocoa); font: inherit; text-align: left; cursor: pointer; }
.cell.empty { background: transparent; cursor: default; }
.cell:hover { border-color: var(--knit-deep); }
.cell.selected { border-color: var(--rose); box-shadow: inset 0 0 0 1px var(--rose); }
.cell .num { font-size: 13px; font-variant-numeric: tabular-nums; }
.cell.today .num { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--rose); color: var(--surface); }
.ev { font-size: 11.5px; line-height: 1.35; padding: 2px 6px; border-radius: 6px; background: var(--tb, var(--t-etc)); color: var(--ti, var(--t-etc-ink)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-more { font-size: 11px; color: var(--cocoa-soft); }
.dots { display: none; gap: 3px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--ti, var(--t-etc-ink)); }
.event-list li.is-selected { background: color-mix(in srgb, var(--knit) 45%, transparent); border-radius: 10px; }
.event-list li.is-past { opacity: 0.6; }
.event-list li { padding-inline: 6px; }

/* ==================== 노래책 ==================== */
.song-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.song { display: grid; grid-template-columns: 40px minmax(0, 1.4fr) minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 18px; border-top: 1px dashed var(--line); }
.song:first-child { border-top: 0; }
.song-no { color: var(--cocoa-soft); font-size: 13px; font-variant-numeric: tabular-nums; }
.song-title { font-family: var(--font-display); font-size: 17px; min-width: 0; overflow-wrap: anywhere; }
.song-artist { color: var(--cocoa-soft); min-width: 0; overflow-wrap: anywhere; }
.song.editing { display: block; background: color-mix(in srgb, var(--knit) 35%, var(--surface)); }
.song-edit { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.song-edit input { flex: 1 1 160px; }

/* ==================== 업보 ==================== */
.notice { background: var(--honey-soft); border-radius: 14px; padding: 12px 16px; font-size: 14px; }
.notice p { margin: 0; }
.notice p + p { margin-top: 4px; }
.karma-list { list-style: none; margin: 0; padding: 0; display: grid; align-items: start; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 12px; }
.karma-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 16px 18px; min-width: 0; }
.karma-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.karma-name { font-size: 19px; overflow-wrap: anywhere; }
.rank { font-size: 12px; padding: 2px 9px; border-radius: 999px; background: var(--pearl); }
.rank.rank-1 { background: var(--honey); color: #4f3328; }
.rank.rank-2, .rank.rank-3 { background: var(--honey-soft); }
.karma-fields { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.karma-field { border-top: 1px dashed var(--line); padding-top: 8px; }
.karma-field dt { font-size: 12px; color: var(--rose); letter-spacing: 0.04em; margin-bottom: 2px; }
.karma-field dd { margin: 0; }
.lines { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.lines li { padding-left: 12px; position: relative; overflow-wrap: anywhere; }
.lines li::before { content: ""; position: absolute; left: 0; top: 0.75em; width: 5px; height: 5px; border-radius: 50%; background: var(--knit-deep); }

/* ==================== 룰렛 ==================== */
.prob-list { list-style: none; margin: 0; padding: 0; }
.prob-list li { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(60px, 1fr) 64px; gap: 12px; align-items: center; padding: 9px 0; border-top: 1px dashed var(--line); }
.prob-list li:first-child { border-top: 0; }
.prob-label { min-width: 0; overflow-wrap: anywhere; }
.prob-bar { height: 10px; border-radius: 999px; background: var(--pearl); overflow: hidden; }
.prob-bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--knit-deep), var(--rose)); }
.prob-num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--font-display); font-size: 16px; }

/* ==================== 방셀 ==================== */
.photo-layout { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 18px; align-items: start; }
.group-list { display: flex; flex-direction: column; gap: 8px; position: sticky; top: 20px; }
.group-list ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.group-btn { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--cocoa); font: inherit; font-family: var(--font-display); font-size: 16px; cursor: pointer; text-align: left; }
.group-btn.on { background: var(--cocoa); border-color: var(--cocoa); color: var(--cream); }
.group-btn.on .muted { color: inherit; opacity: 0.75; }
.group-body { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.group-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.group-head h3 { font-size: 24px; }
.upload-box { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.photo-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 160px), 1fr)); gap: 14px; }
.photo { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 8px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.photo-thumb { display: block; padding: 0; border: 0; background: var(--pearl); border-radius: 10px; overflow: hidden; aspect-ratio: 3 / 4; cursor: zoom-in; }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-name { margin: 0; font-size: 14px; text-align: center; overflow-wrap: anywhere; }
.photo .row { justify-content: center; }
.photo-edit { display: flex; flex-direction: column; gap: 6px; }
.viewer { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: max(20px, env(safe-area-inset-top, 0px)) 20px max(20px, env(safe-area-inset-bottom, 0px)); }
.viewer-bg { position: absolute; inset: 0; border: 0; background: rgba(30, 20, 18, 0.82); cursor: zoom-out; }
.viewer figure { position: relative; margin: 0; display: flex; flex-direction: column; align-items: center; gap: 10px; max-height: 100%; }
.viewer img { max-height: calc(100vh - 120px); max-width: min(92vw, 900px); border-radius: 12px; object-fit: contain; }
.viewer figcaption { color: #fff8f3; font-family: var(--font-display); font-size: 18px; }
.viewer-close { position: absolute; top: max(16px, env(safe-area-inset-top, 0px)); right: max(16px, env(safe-area-inset-right, 0px)); }

/* ==================== 휴대폰 ==================== */
@media (max-width: 760px) {
  .app { grid-template-columns: minmax(0, 1fr); background: none; }
  .side { position: sticky; top: 0; height: auto; padding: 12px max(14px, env(safe-area-inset-right, 0px)) 12px max(14px, env(safe-area-inset-left, 0px)); gap: 8px; }
  .side::after { top: auto; bottom: -17px; right: 0; width: 100%; height: 18px; background: radial-gradient(circle at 9px 0, var(--knit) 8px, transparent 8.5px) 0 0 / 18px 18px repeat-x; }
  .logo { flex-direction: row; align-items: baseline; gap: 8px; padding: 0 2px; }
  .logo b { font-size: 22px; }
  .logo small { display: none; }
  .nav { flex-direction: row; overflow-x: auto; gap: 4px; scrollbar-width: none; margin: 0 -4px; padding: 0 4px; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { flex: none; padding: 3px 12px 3px 4px; font-size: 15px; gap: 6px; }
  .tori { width: 28px; }
  .ext { margin-left: 2px; }
  .auth { position: absolute; top: 10px; right: max(14px, env(safe-area-inset-right, 0px)); margin: 0; flex-direction: row; align-items: center; }
  .lock { padding: 5px 9px; font-size: 12px; }
  .main { padding: 26px max(14px, env(safe-area-inset-right, 0px)) 40px max(14px, env(safe-area-inset-left, 0px)); gap: 18px; }
  .page-head h2 { font-size: 26px; }

  .hero { grid-template-columns: minmax(0, 1fr) 150px; }
  .hero-text { padding: 22px 4px 22px 18px; gap: 10px; }
  .hero-art { width: 150px; }
  .avatar-editor { grid-template-columns: minmax(0, 1fr); justify-items: start; }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .fact.fan { grid-column: 1 / -1; }
  .fact.fan img { width: 48px; }
  .fact { padding: 10px 12px; }
  .fact b { font-size: 22px; }
  .up li { grid-template-columns: 76px 52px minmax(0, 1fr) auto; gap: 8px; }
  .up li .tm { display: none; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }

  .cal-grid { padding: 8px; gap: 3px; }
  .cell { min-height: 54px; padding: 4px; align-items: center; }
  .cell .ev, .cell .ev-more { display: none; }
  .dots { display: flex; }

  .song { grid-template-columns: 28px minmax(0, 1fr); row-gap: 0; padding: 10px 14px; }
  .song-artist { grid-column: 2; font-size: 14px; }
  .song .row-tools { grid-column: 2; margin-top: 4px; }

  .prob-list li { grid-template-columns: minmax(0, 1fr) 58px; }
  .prob-bar { grid-column: 1 / -1; grid-row: 2; height: 6px; }

  .photo-layout { grid-template-columns: minmax(0, 1fr); }
  .group-list { position: static; }
  .group-list ul { flex-direction: row; overflow-x: auto; }
  .group-btn { width: auto; flex: none; }
  .photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .tori { transition: none; }
}
