/* AGEHA Showcase — night design system (Figma "AGEHA Showcase UI", variables "Night" / "Size").
   No web fonts (the pages keep CSP default-src 'self'): Japanese uses the device's own sans (Hiragino / Noto Sans CJK),
   numbers use tabular figures. Every interactive target is at least 44 px. */
:root {
  --bg-base: #070B14; --bg-elevated: #0C1220; --surface-1: #111A2C; --surface-2: #18233A; --surface-3: #22304C;
  --line-subtle: #1E2A42; --line-strong: #33456A;
  --text-primary: #EEF3FB; --text-secondary: #A3B1C9; --text-tertiary: #8291AD; --text-on-accent: #04131A;
  --accent-glow: #7CF0E2; --accent-strong: #3FD9C8; --accent-soft: #123B3E;
  --star-on: #F7C25B; --star-off: #3A4763;
  --live: #FF5D73; --ok: #5AD6A0; --warn: #F2A44B; --info: #6FA8FF;
  --r-s: 8px; --r-m: 14px; --r-l: 20px; --r-xl: 28px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
  --font: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Noto Sans CJK JP", system-ui, sans-serif;
  --tabbar-h: 72px;
  color-scheme: dark; -webkit-text-size-adjust: 100%;
  font-family: var(--font); color: var(--text-primary); background: var(--bg-base);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: radial-gradient(1200px 600px at 70% -10%, #13203c 0%, var(--bg-base) 60%) fixed, var(--bg-base); min-height: 100vh; }
main { max-width: 1080px; margin: 0 auto; padding: 16px 16px 32px; }
body.app main { padding-bottom: calc(var(--tabbar-h) + 104px); }
h1 { font-size: 26px; line-height: 1.3; margin: 4px 0 2px; letter-spacing: -.01em; }
h2 { font-size: 17px; line-height: 1.4; margin: 0 0 10px; }
h3 { font-size: 14px; margin: 14px 0 6px; color: var(--text-secondary); font-weight: 600; }
p { margin: 0 0 8px; }
a { color: var(--accent-glow); }
.brand { letter-spacing: .22em; font-size: 12px; font-weight: 700; color: var(--accent-glow); margin: 0; }
.note { color: var(--text-secondary); font-size: 13px; line-height: 1.65; }
.muted { color: var(--text-tertiary); font-size: 12px; }
.num, .time { font-variant-numeric: tabular-nums; }
.time { font-size: 20px; font-weight: 600; }
.card { border: 1px solid var(--line-subtle); border-radius: var(--r-l); padding: 14px 16px; margin: 12px 0; background: var(--surface-1); }
.card > h2:first-child, .card > .label:first-child { margin-top: 0; }
.label { display: block; font-size: 11px; font-weight: 600; letter-spacing: .08em; color: var(--text-tertiary); margin: 0 0 8px; }

/* controls */
button, input, select, textarea { font: inherit; color: var(--text-primary); }
button { min-height: 44px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface-2); padding: 10px 16px; cursor: pointer; font-weight: 600; font-size: 14px; }
button:hover { background: var(--surface-3); }
button.primary { background: var(--accent-strong); border-color: transparent; color: var(--text-on-accent); }
button.primary:hover { background: var(--accent-glow); }
button.ghost { background: transparent; border-color: transparent; color: var(--text-secondary); }
button.danger { color: var(--live); }
button:disabled { opacity: .45; cursor: default; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--accent-glow); outline-offset: 2px; }
input, select, textarea { min-height: 44px; width: 100%; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--bg-elevated); padding: 10px 14px; }
input::placeholder, textarea::placeholder { color: var(--text-tertiary); }
label { display: block; font-size: 13px; color: var(--text-secondary); margin: 10px 0 6px; }
label > input, label > select { margin-top: 6px; }
input[type=range] { padding: 0; border: 0; background: transparent; accent-color: var(--accent-strong); min-height: 32px; }
input[type=checkbox] { width: 20px; height: 20px; min-height: 0; accent-color: var(--accent-strong); vertical-align: middle; }
.row { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; align-items: center; }
.row > * { flex: 1 1 auto; }
.row > .fixed { flex: 0 0 auto; }
.code { font-size: 32px; letter-spacing: .1em; font-weight: 700; margin: 6px 0; color: var(--accent-glow); font-variant-numeric: tabular-nums; }
.msg { min-height: 1.4em; color: var(--warn); font-size: 14px; }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 999px; color: var(--text-secondary); background: rgba(163, 177, 201, .14); white-space: nowrap; }
.badge.live { color: var(--live); background: rgba(255, 93, 115, .16); }
.badge.ok { color: var(--ok); background: rgba(90, 214, 160, .16); }
.badge.warn { color: var(--warn); background: rgba(242, 164, 75, .16); }
.badge.info { color: var(--accent-glow); background: rgba(124, 240, 226, .12); }

/* chips & segmented */
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 0; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; min-height: 36px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line-subtle); background: var(--surface-1); color: var(--text-secondary); font-size: 13px; font-weight: 600; }
.chip[aria-pressed=true] { background: var(--accent-soft); border-color: transparent; color: var(--accent-glow); }
.seg + .empty, .seg + .card { margin-top: 12px; }
.seg { display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface-1); border: 1px solid var(--line-subtle); }
.seg > button { flex: 1; border: 0; background: transparent; color: var(--text-secondary); min-height: 40px; border-radius: 10px; }
.seg > button[aria-pressed=true] { background: var(--surface-3); color: var(--text-primary); }

/* lists */
ul { list-style: none; padding: 0; margin: 8px 0; }
li { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line-subtle); }
li:last-child { border-bottom: 0; }
li .title { font-weight: 650; flex: 1 1 40%; }

/* stars */
.stars { display: inline-flex; gap: 0; }
.stars button { min-height: 32px; min-width: 28px; padding: 0 2px; border: 0; background: transparent; color: var(--star-off); font-size: 18px; line-height: 1; }
.stars button.on { color: var(--star-on); }
.stars.big button { min-height: 44px; min-width: 40px; font-size: 28px; }

/* work rows (library) */
.worklist { display: grid; gap: 8px; margin: 10px 0; }
.worklist > li { display: grid; grid-template-columns: 76px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid transparent; border-radius: var(--r-m); background: var(--surface-1); cursor: pointer; }
.worklist > li:hover { background: var(--surface-2); }
.worklist > li.current { border-color: var(--accent-strong); background: var(--surface-2); }
.worklist > li.selected { border-color: var(--line-strong); }
.poster { width: 76px; aspect-ratio: 16 / 9; border-radius: 10px; object-fit: cover; background: radial-gradient(ellipse at 50% 45%, rgba(124, 240, 226, .55), #0A1122 70%); display: block; }
.worklist .info { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.worklist .info .title { font-size: 15px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.worklist .meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-secondary); flex-wrap: wrap; }
.worklist .side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.worklist .side button { min-height: 36px; padding: 6px 12px; font-size: 13px; }
.empty { padding: 28px 16px; text-align: center; color: var(--text-secondary); border: 1px dashed var(--line-strong); border-radius: var(--r-l); }
.skeleton { height: 76px; border-radius: var(--r-m); background: linear-gradient(90deg, var(--surface-1), var(--surface-2), var(--surface-1)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* app shell: top bar, tabs (phone: bottom bar; >= 900 px: left rail), panes */
.appbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 4px 0 12px; }
.pane { display: none; }
body[data-tab=works] #tab-works, body[data-tab=show] #tab-show, body[data-tab=invite] #tab-invite, body[data-tab=settings] #tab-settings { display: block; }
body.signed-out .tabbar, body.signed-out .pane, body.signed-out #mini { display: none !important; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(4, 1fr); height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: rgba(12, 18, 32, .94); backdrop-filter: blur(16px); border-top: 1px solid var(--line-subtle); }
.tabbar button { border: 0; border-radius: 0; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--text-tertiary); font-size: 11px; font-weight: 600; min-height: 56px; }
.tabbar button svg { width: 24px; height: 24px; }
.tabbar button[aria-current=page] { color: var(--accent-glow); }
.tabbar .dot { position: absolute; margin: -22px 0 0 22px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--live); color: #fff; font-size: 10px; line-height: 16px; }
@media (min-width: 900px) {
  :root { --tabbar-h: 0px; }
  body.app main { margin-left: 232px; max-width: none; padding: 24px 32px 120px; }
  .tabbar { top: 0; right: auto; width: 232px; height: auto; grid-template-columns: none; grid-auto-rows: min-content; gap: 4px; padding: 76px 14px 14px; border-top: 0; border-right: 1px solid var(--line-subtle); background: var(--bg-elevated); }
  .tabbar::before { content: "AGEHARIDE"; position: absolute; top: 28px; left: 26px; letter-spacing: .22em; font-size: 12px; font-weight: 700; color: var(--accent-glow); }
  .tabbar button { flex-direction: row; justify-content: flex-start; gap: 12px; padding: 0 14px; min-height: 46px; border-radius: 10px; font-size: 14px; color: var(--text-secondary); }
  .tabbar button[aria-current=page] { background: var(--accent-soft); color: var(--accent-glow); }
  .tabbar .dot { position: static; margin: 0 0 0 auto; }
  .split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 24px; align-items: start; }
  .split > .sticky { position: sticky; top: 24px; }
}

/* mini player */
body[data-tab=show] #mini { display: none; }
#mini { position: fixed; left: 8px; right: 8px; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 8px); z-index: 25; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--line-strong); box-shadow: var(--shadow); overflow: hidden; }
@media (min-width: 900px) { #mini { left: auto; right: 24px; bottom: 24px; width: 520px; } }
#mini .bar { height: 3px; background: var(--line-subtle); }
#mini .bar > span { display: block; height: 3px; width: 0; background: var(--accent-strong); }
#mini .in { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 10px; }
#mini .poster { width: 56px; }
#mini .t { flex: 1; min-width: 0; }
#mini .t strong { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#mini .t span { font-size: 12px; color: var(--text-secondary); }
.round { width: 44px; height: 44px; min-height: 44px; padding: 0; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.round.big { width: 64px; height: 64px; }
.round svg { width: 22px; height: 22px; }

/* now playing card */
.now { display: grid; gap: 12px; }
.now .art { width: 100%; aspect-ratio: 16 / 9; border-radius: var(--r-m); object-fit: cover; background: radial-gradient(ellipse at 50% 45%, rgba(124, 240, 226, .55), #0A1122 70%); }
.transport { display: flex; align-items: center; justify-content: center; gap: 22px; }

/* sheets & toasts */
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .55); }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-height: 88vh; overflow: auto; padding: 10px 16px calc(24px + env(safe-area-inset-bottom)); border-radius: var(--r-xl) var(--r-xl) 0 0; background: var(--surface-1); border-top: 1px solid var(--line-strong); box-shadow: var(--shadow); }
.sheet::before { content: ""; display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--line-strong); margin: 0 auto 12px; }
@media (min-width: 900px) { .sheet.side { left: auto; top: 0; width: 560px; max-height: none; border-radius: 0; border-top: 0; border-left: 1px solid var(--line-strong); } .sheet.side::before { display: none; } }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + 96px); z-index: 60; max-width: min(92vw, 560px); padding: 12px 16px; border-radius: 14px; background: rgba(34, 48, 76, .97); color: var(--text-primary); box-shadow: var(--shadow); font-size: 14px; pointer-events: none; }
.toast:empty { display: none; }
@media (min-width: 900px) { .toast { bottom: 110px; left: calc(50% + 116px); } }

/* 3D views */
#scene, .preview3d { display: block; width: 100%; height: 60vh; min-height: 280px; background: #050a14; border-radius: var(--r-m); touch-action: none; }
.preview3d { height: auto; aspect-ratio: 16 / 9; min-height: 0; }
@media (min-width: 900px) { .two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; } }
 #tab-invite[data-sub=co] #passes, #tab-invite[data-sub=pass] #invite, #tab-invite[data-sub=pass] #invite-empty { display: none; }
details > summary::-webkit-details-marker { display: none; }
.auto-w { width: auto; }
.grow { flex: 1 1 200px; }
.now-title { font-size: 20px; }
.row.spread { justify-content: space-between; margin: 0; }
.row.center { align-items: center; }
details > summary.summary { display: inline-flex; align-items: center; min-height: 44px; list-style: none; cursor: pointer; }
#mini-open { text-align: left; padding: 0; }
#lib-side:empty { display: none; }
@media (max-width: 899px) { #lib-side { display: none; } }
.mt8 { margin-top: 8px; }
.pvctl { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; margin: 10px 0 4px; }
/* viewer (guest / holder / owner watching) */
body.viewer { min-height: 100svh; }
body.viewer .stage { position: relative; height: 62svh; min-height: 300px; }
body.viewer #scene { height: 100%; min-height: 0; border-radius: 0; }
.ov-top { position: absolute; left: 12px; right: 12px; top: calc(10px + env(safe-area-inset-top)); display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-radius: 999px;
  background: rgba(17, 26, 44, .72); backdrop-filter: blur(14px); border: 1px solid rgba(255, 255, 255, .08); font-size: 14px; }
.ov-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ov-time { color: var(--text-secondary); flex: 0 0 auto; }
.ov-guide { position: absolute; left: 12px; top: 64px; }
.ov-actions { position: absolute; right: 12px; bottom: 34px; display: flex; gap: 8px; }
.ov-btn { border-radius: 999px; padding: 10px 18px; background: rgba(17, 26, 44, .78); backdrop-filter: blur(14px); }
.ov-btn.primary { background: var(--accent-strong); }
.panel { position: relative; margin-top: -22px; border-radius: var(--r-xl) var(--r-xl) 0 0; background: var(--bg-elevated); border-top: 1px solid var(--line-strong); padding: 14px 16px calc(24px + env(safe-area-inset-bottom)); }
.panel-nav { margin-bottom: 4px; }
.panel-nav .chip { text-decoration: none; display: inline-flex; align-items: center; }
.views { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.views button[data-height] { grid-column: span 1; }
.views button[aria-pressed=true] { background: var(--accent-soft); border-color: transparent; color: var(--accent-glow); }
.panel .card { scroll-margin-top: 12px; }
@media (min-width: 900px) {
  body.viewer { display: grid; grid-template-columns: minmax(0, 1fr) 400px; height: 100vh; overflow: hidden; }
  body.viewer .stage { height: 100vh; }
  .panel { margin: 0; border-radius: 0; border-top: 0; border-left: 1px solid var(--line-strong); overflow: auto; height: 100vh; }
  .ov-actions { bottom: 24px; right: 24px; }
}
/* small pages (join / pass / headset number) */
.narrow { max-width: 520px; }
.pin-big { font-size: 72px; text-align: center; letter-spacing: .18em; margin: 12px 0; color: var(--accent-glow); font-weight: 700; font-variant-numeric: tabular-nums; }
.center { text-align: center; }
.hero { position: relative; height: 220px; margin: -16px -16px 8px; background: radial-gradient(ellipse at 50% 60%, rgba(124, 240, 226, .35), rgba(63, 89, 179, .22) 40%, transparent 70%), linear-gradient(180deg, #03050c, var(--bg-base)); }
.passcard { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 12px; align-items: center; }
.passcard .poster { width: 120px; }
.bignum { font-size: 44px; font-weight: 700; color: var(--accent-glow); font-variant-numeric: tabular-nums; line-height: 1; }
.hidden-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* your own Quest on the phone / PC: mic, sound, music and voice volumes (stable rows; owner report 2026-11-19) */
.questctl { display: grid; gap: 8px; padding: 8px 0; }
.questctl .row { align-items: center; flex-wrap: wrap; gap: 8px; }
.questctl .row .note { min-width: 5.5em; }

/* legal / support pages (store P2) */
.legalpage h2 { margin-top: 24px; }
.legalpage table.legal { width: 100%; border-collapse: collapse; font-size: 14px; }
.legalpage table.legal th, .legalpage table.legal td { border-bottom: 1px solid var(--line, #2a3550); padding: 6px 4px; text-align: left; vertical-align: top; }
.legalpage textarea { width: 100%; }

/* team member mode (P5): owner-only parts hidden (the server refuses them anyway) */
body.staff-mode .owner-only, body.staff-mode .stars { display: none !important; }
