/* ============ テーマ (10種) ============
   --g1 → --g2 が主役のグラデーション、--c が差し色。背景の光もこの3色で描く。 */
:root, [data-theme="aurora"] {
  --bg:#161A2E; --bg2:#20264A; --card:#262C49; --ink:#EEF0FA; --muted:#8B93B5; --line:rgba(255,255,255,.08);
  --g1:#7C5CFF; --g2:#FF5CA8; --c:#3FD5E6; --on:#FFFFFF; --scheme:dark;
}
[data-theme="ocean"] {
  --bg:#0C1828; --bg2:#12304C; --card:#1A3150; --ink:#E8F4FF; --muted:#7F9BB8; --line:rgba(255,255,255,.08);
  --g1:#2F80FF; --g2:#2FE0D0; --c:#9BE15D; --on:#04182B; --scheme:dark;
}
[data-theme="sunset"] {
  --bg:#221424; --bg2:#3A2138; --card:#3A2640; --ink:#FFEFE8; --muted:#B594A8; --line:rgba(255,255,255,.08);
  --g1:#FF7A45; --g2:#FF4F8B; --c:#FFD166; --on:#FFFFFF; --scheme:dark;
}
[data-theme="forest"] {
  --bg:#0D1C19; --bg2:#17342D; --card:#1D3A33; --ink:#E9F7F0; --muted:#7FA89A; --line:rgba(255,255,255,.08);
  --g1:#18C29C; --g2:#A8E063; --c:#5CD6FF; --on:#082019; --scheme:dark;
}
[data-theme="sakura"] {
  --bg:#24182A; --bg2:#3A2540; --card:#3D2A43; --ink:#FFEFF6; --muted:#B79AB0; --line:rgba(255,255,255,.08);
  --g1:#FF8FB8; --g2:#B58CFF; --c:#FFD3A5; --on:#34122A; --scheme:dark;
}
[data-theme="gold"] {
  --bg:#1C1710; --bg2:#30271A; --card:#352C1E; --ink:#FBF1DC; --muted:#A8987A; --line:rgba(255,255,255,.08);
  --g1:#F5B041; --g2:#FF7E3D; --c:#FFE9A8; --on:#231807; --scheme:dark;
}
[data-theme="neon"] {
  --bg:#07080E; --bg2:#12142A; --card:#171A2A; --ink:#F2F5FF; --muted:#7C84A6; --line:rgba(255,255,255,.09);
  --g1:#00E5FF; --g2:#FF2BD6; --c:#B4FF39; --on:#05060C; --scheme:dark;
}
[data-theme="mono"] {
  --bg:#131417; --bg2:#22242A; --card:#26282E; --ink:#F0F1F3; --muted:#8C9099; --line:rgba(255,255,255,.08);
  --g1:#8E98AD; --g2:#EEF0F4; --c:#C9CED8; --on:#131417; --scheme:dark;
}
[data-theme="milk"] {
  --bg:#EEF0FA; --bg2:#DFE3F8; --card:#FFFFFF; --ink:#1F2440; --muted:#7078A0; --line:rgba(31,36,64,.10);
  --g1:#7C5CFF; --g2:#FF5CA8; --c:#19B8CC; --on:#FFFFFF; --scheme:light;
}
[data-theme="sky"] {
  --bg:#E8F4FB; --bg2:#D3E9F8; --card:#FFFFFF; --ink:#12304A; --muted:#6B88A0; --line:rgba(18,48,74,.10);
  --g1:#2F80FF; --g2:#2FD6C9; --c:#FF8A5C; --on:#FFFFFF; --scheme:light;
}

/* ============ 基本 ============ */
*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: var(--scheme); background: linear-gradient(160deg, var(--bg), var(--bg2)) fixed; min-height: 100%; }
body {
  margin: 0; color: var(--ink); min-height: 100dvh;
  font-family: "Outfit", "Zen Kaku Gothic New", "Yu Gothic UI", "Hiragino Sans", sans-serif;
  font-size: 15px; line-height: 1.6; -webkit-font-smoothing: antialiased;
  --row: 190px; --ease: cubic-bezier(.2,.8,.2,1);
  --grad: linear-gradient(120deg, var(--g1), var(--g2));
  --glass: color-mix(in srgb, var(--card) 76%, transparent);
  --shadow: 0 18px 40px -18px rgba(0,0,0,.55);
}
#fx { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; } /* 常に動く背景の光 */
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--c); outline-offset: 2px; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
h1, h2, h3, p, ul { margin: 0; }

.mark { font-weight: 700; font-size: 19px; letter-spacing: .14em; }
.num { font-weight: 200; font-variant-numeric: tabular-nums; line-height: 1; letter-spacing: .01em; }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.glass { background: var(--glass); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); border: 1px solid var(--line); box-shadow: var(--shadow); }

.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; overflow: hidden;
  height: 40px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--glass); font-weight: 600; white-space: nowrap; text-decoration: none; color: var(--ink);
  transition: transform .15s var(--ease), border-color .15s, box-shadow .25s;
}
.btn:hover { border-color: color-mix(in srgb, var(--c) 60%, transparent); }
.btn:active { transform: scale(.96); }
.btn.primary { background: var(--grad); background-size: 180% 100%; color: var(--on); border-color: transparent;
  box-shadow: 0 8px 22px -8px var(--g2); animation: flow 6s ease-in-out infinite alternate; }
.btn.primary::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 35%, rgba(255,255,255,.35) 50%, transparent 65%);
  transform: translateX(-120%); animation: sweep 4.5s var(--ease) infinite; }
.btn.ghost { background: transparent; }
.btn.danger { color: #FF6B7A; }
.btn.wide { width: 100%; height: 48px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  border: 0; background: transparent; color: inherit; flex: none; transition: background .15s, transform .2s var(--ease);
}
.icon-btn:hover { background: color-mix(in srgb, currentColor 12%, transparent); transform: rotate(8deg); }
.icon-btn.small { width: 30px; height: 30px; }
.icon-btn.small svg { width: 16px; height: 16px; }

@keyframes flow { to { background-position: 100% 0; } }
@keyframes sweep { 0%, 55% { transform: translateX(-120%); } 100% { transform: translateX(120%); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }
@keyframes fade { from { opacity: 0; } }
@keyframes blink { 50% { opacity: .25; } }
@keyframes wave { to { transform: translateX(-50%); } }
@keyframes wave-narrow { to { transform: translateX(-25%); } }
@keyframes bob { 50% { transform: translateY(-6px); } }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--g2) 55%, transparent), 0 12px 30px -8px var(--g1); }
  50% { box-shadow: 0 0 0 14px transparent, 0 12px 30px -8px var(--g2); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes twinkle { to { background-position: 140px -220px, -180px -160px, 90px -260px; } }

/* 波 (ヒーローとログイン画面で共用) */
.waves { position: absolute; inset: auto 0 0 0; height: 62%; pointer-events: none; overflow: hidden; }
.waves svg { position: absolute; left: 0; bottom: 0; width: 200%; height: 100%; fill: rgba(255,255,255,.14); stroke: none; animation: wave 16s linear infinite; }
.waves svg:nth-child(2) { fill: rgba(255,255,255,.10); animation-duration: 26s; animation-direction: reverse; height: 80%; }
.waves svg:nth-child(3) { fill: none; stroke: rgba(255,255,255,.45); stroke-width: 1.2; animation-duration: 11s; height: 110%; }

/* ============ ログイン ============ */
.gate { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.gate-card { width: min(390px, 100%); border-radius: 26px; overflow: hidden; animation: rise .7s var(--ease) both; }
.gate-hero { position: relative; padding: 34px 28px 58px; background: var(--grad); color: var(--on); overflow: hidden; }
.gate-hero .mark { position: relative; font-size: 30px; }
.gate-hero p { position: relative; opacity: .85; margin-top: 6px; }
.gate-fields { display: grid; gap: 16px; padding: 24px 28px 28px; }
.field { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.field input, .field select {
  height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 70%, transparent); color: var(--ink); font-size: 16px; transition: border-color .2s, box-shadow .2s;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--c); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 22%, transparent); }
.form-error { color: #FF6B7A; font-size: 13px; min-height: 1.2em; }

/* ============ ヘッダー ============ */
.bar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: 10px clamp(16px, 3vw, 40px); padding-top: max(10px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 62%, transparent); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}
.filters { display: flex; gap: 6px; margin-left: auto; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.chip {
  height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--glass); color: var(--muted); font-weight: 500; white-space: nowrap; flex: none;
  transition: color .2s, border-color .2s, transform .2s var(--ease);
}
.chip:hover { color: var(--ink); transform: translateY(-1px); }
.chip.on { background: var(--grad); color: var(--on); border-color: transparent; box-shadow: 0 6px 16px -8px var(--g2); }
.chip.select { padding-right: 8px; max-width: 130px; }
.chip.select option { color: var(--ink); background: var(--card); }

/* ============ ヒーロー (アルバムの今) ============ */
.hero { position: relative; margin: 22px clamp(16px, 3vw, 40px) 0; animation: rise .7s var(--ease) both; }
.hero-card {
  position: relative; overflow: hidden; border-radius: 26px; color: var(--on);
  background: var(--grad); background-size: 160% 160%; animation: flow 9s ease-in-out infinite alternate;
  box-shadow: 0 26px 60px -26px var(--g2), 0 10px 30px -18px var(--g1);
  display: grid; grid-template-columns: minmax(180px, 1.1fr) auto minmax(200px, 1fr); gap: clamp(20px, 4vw, 56px); align-items: center;
  padding: 30px clamp(22px, 4vw, 44px) 46px;
}
.hero-card::before { /* きらめき */
  content: ""; position: absolute; inset: 0; opacity: .7; pointer-events: none;
  background-image: radial-gradient(1.6px 1.6px at 20px 30px, #fff, transparent), radial-gradient(1.2px 1.2px at 90px 120px, #fff, transparent), radial-gradient(2px 2px at 150px 70px, rgba(255,255,255,.8), transparent);
  background-size: 190px 190px, 230px 230px, 310px 310px; animation: twinkle 22s linear infinite;
}
.hero-card > * { position: relative; }
.hero-card > .waves { position: absolute; }
.eyebrow { font-size: 12px; letter-spacing: .18em; opacity: .8; }
.hero-main .big { display: flex; align-items: baseline; gap: 6px; margin: 2px 0 10px; }
.hero-main .big b { font-size: clamp(54px, 8vw, 84px); font-weight: 200; line-height: 1; font-variant-numeric: tabular-nums; }
.hero-main .big small { font-size: 16px; opacity: .85; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 12px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: rgba(255,255,255,.2); backdrop-filter: blur(6px); }
.hero-ring { display: flex; align-items: center; gap: 16px; }
.hero-ring svg { width: 104px; height: 104px; stroke-width: 7; transform: rotate(-90deg); animation: bob 5s ease-in-out infinite; overflow: visible; }
.hero-ring circle { fill: none; transition: stroke-dasharray 1.2s var(--ease), stroke-dashoffset 1.2s var(--ease); }
.hero-ring .track { stroke: rgba(255,255,255,.2); }
.hero-ring .a { stroke: #fff; filter: drop-shadow(0 0 6px rgba(255,255,255,.7)); }
.hero-ring .b { stroke: var(--c); filter: drop-shadow(0 0 6px var(--c)); }
.legend { list-style: none; padding: 0; display: grid; gap: 4px; font-size: 13px; }
.legend li { display: flex; align-items: center; gap: 8px; }
.legend i { width: 8px; height: 8px; border-radius: 50%; background: #fff; }
.legend li:nth-child(2) i { background: var(--c); }
.legend b { font-weight: 600; font-variant-numeric: tabular-nums; }
.hero-people { list-style: none; padding: 0; display: grid; gap: 8px; font-size: 13px; }
.hero-people li { display: grid; grid-template-columns: 6.5em 1fr 2.2em; gap: 10px; align-items: center; }
.hero-people span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hero-people .track { height: 5px; border-radius: 9px; background: rgba(255,255,255,.2); overflow: hidden; }
.hero-people i { display: block; height: 100%; width: var(--w); border-radius: 9px; transition: width 1.2s var(--ease);
  background: linear-gradient(90deg, rgba(255,255,255,.6), #fff 50%, rgba(255,255,255,.6)); background-size: 200% 100%; animation: shimmer 2.8s linear infinite; }
.hero-people b { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }

/* カードの縁に乗る、回り続ける追加ボタン */
.orb { position: absolute; right: clamp(28px, 6vw, 72px); bottom: -30px; width: 64px; height: 64px; border-radius: 50%; border: 0; padding: 0;
  display: grid; place-items: center; color: var(--ink); background: transparent; animation: pulse 3s ease-in-out infinite; transition: transform .25s var(--ease); }
.orb::before { content: ""; position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(var(--c), var(--g1), var(--g2), var(--c)); animation: spin 3.5s linear infinite; }
.orb::after { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: var(--card); }
.orb svg { position: relative; z-index: 1; width: 26px; height: 26px; }
.orb:hover { transform: scale(1.1); }
.orb:active { transform: scale(.94); }

/* ============ タイムライン ============ */
.timeline { padding: 18px clamp(16px, 3vw, 40px) 140px; }
.month { padding-top: 40px; scroll-margin-top: 64px; }
.month > header { display: flex; align-items: baseline; gap: 14px; margin-bottom: 16px; }
.month .num { font-size: clamp(36px, 5.4vw, 56px); }
.month .num i { font-style: normal; opacity: .5; margin: 0 .08em; }
.month .jp { font-weight: 600; }
.month .count { color: var(--muted); font-size: 13px; }
.month .rule { flex: 1; height: 1px; align-self: center; border-radius: 1px;
  background: linear-gradient(90deg, var(--g1), var(--c), transparent 70%); background-size: 200% 100%; opacity: .7; animation: shimmer 7s linear infinite; }

/* 行の高さを揃え、幅は縦横比に応じて伸ばす */
.grid { display: flex; flex-wrap: wrap; gap: 8px; }
.grid::after { content: ""; flex-grow: 1000; }
.tile {
  position: relative; height: var(--row); flex: var(--r) 1 calc(var(--r) * var(--row));
  padding: 0; border: 0; border-radius: 14px; overflow: hidden;
  background: linear-gradient(100deg, var(--card) 30%, color-mix(in srgb, var(--card) 70%, var(--g1)) 50%, var(--card) 70%); background-size: 200% 100%;
  box-shadow: 0 10px 24px -14px rgba(0,0,0,.6);
  animation: rise .55s var(--ease) both, shimmer 1.8s linear infinite; animation-delay: calc(var(--i, 0) * 22ms), 0s;
  transition: transform .35s var(--ease), box-shadow .35s;
}
.tile.ready { animation: rise .55s var(--ease) both; animation-delay: calc(var(--i, 0) * 22ms); }
.tile:hover { transform: translateY(-5px) scale(1.012); box-shadow: 0 20px 36px -14px color-mix(in srgb, var(--g1) 75%, transparent); z-index: 1; }
.tile::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,.28) 50%, transparent 60%); transform: translateX(-130%); }
.tile:hover::after { transform: translateX(130%); transition: transform .8s var(--ease); }
.tile img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  opacity: 0; filter: saturate(0) brightness(1.5) blur(8px); transform: scale(1.06);
  transition: opacity .5s, filter .9s var(--ease), transform .9s var(--ease);
}
.tile img.in { opacity: 1; filter: none; transform: none; }
.tile:hover img.in { transform: scale(1.06); transition-duration: .5s; }
.tile .badge {
  position: absolute; left: 8px; bottom: 8px; display: flex; align-items: center; gap: 5px;
  padding: 3px 9px 3px 7px; border-radius: 999px; background: rgba(12,14,28,.55); backdrop-filter: blur(8px); color: #fff; font-size: 12px;
  border: 1px solid rgba(255,255,255,.18);
}
.tile .badge svg { width: 11px; height: 11px; fill: currentColor; stroke: none; }
.tile .noimg { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }
.tile .noimg svg { width: 34px; height: 34px; }
.tile .sending { position: absolute; right: 9px; top: 9px; width: 9px; height: 9px; border-radius: 50%; background: var(--c); box-shadow: 0 0 10px var(--c); animation: blink 1.2s infinite; }

.empty { display: grid; justify-items: center; gap: 14px; text-align: center; padding: 9vh 24px; }
.empty h2 { font-weight: 600; }
.empty p { color: var(--muted); max-width: 30em; }

/* 年月ジャンプ */
.rail {
  position: fixed; right: 6px; top: 50%; transform: translateY(-50%); z-index: 10;
  display: flex; flex-direction: column; gap: 1px; max-height: 76vh; overflow-y: auto; scrollbar-width: none;
}
.rail a { font-size: 12px; font-variant-numeric: tabular-nums; text-decoration: none; color: var(--muted); padding: 2px 10px; border-radius: 6px; text-align: right;
  transition: color .2s, transform .2s var(--ease); }
.rail a.year { color: var(--ink); font-weight: 600; margin-top: 8px; }
.rail a:hover, .rail a.on { color: var(--c); transform: translateX(-4px); text-shadow: 0 0 10px var(--c); }
@media (min-width: 761px) { .timeline { padding-right: 68px; } }

.fab {
  display: none; position: fixed; right: 18px; bottom: max(18px, env(safe-area-inset-bottom)); z-index: 15;
  width: 58px; height: 58px; border-radius: 50%; border: 0; background: var(--grad); color: var(--on);
  place-items: center; animation: pulse 3s ease-in-out infinite;
}
.fab svg { width: 26px; height: 26px; }
.fab:active { transform: scale(.92); }

/* ============ アップロードトレイ ============ */
.tray { position: fixed; right: 18px; bottom: 18px; z-index: 30; width: min(360px, calc(100vw - 24px)); border-radius: 18px; overflow: hidden; animation: rise .35s var(--ease) both; }
.tray header { display: flex; align-items: center; justify-content: space-between; padding: 10px 10px 8px 16px; }
.tray-meter { height: 4px; background: color-mix(in srgb, var(--ink) 10%, transparent); }
.tray-meter i { display: block; height: 100%; width: 0; transition: width .3s; border-radius: 0 4px 4px 0; box-shadow: 0 0 12px var(--g2);
  background: linear-gradient(90deg, var(--g1), var(--g2), var(--c), var(--g1)); background-size: 200% 100%; animation: shimmer 1.6s linear infinite; }
.tray ul { list-style: none; padding: 6px; max-height: 260px; overflow-y: auto; }
.tray li { display: grid; grid-template-columns: 40px 1fr auto; gap: 10px; align-items: center; padding: 6px 8px; font-size: 13px; animation: rise .3s var(--ease) both; }
.tray li .th { width: 40px; height: 40px; border-radius: 10px; background: color-mix(in srgb, var(--ink) 10%, transparent) center/cover; }
.tray li .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tray li .st { color: var(--muted); font-size: 12px; }
.tray li .pc { font-weight: 600; color: var(--c); font-variant-numeric: tabular-nums; }
.tray li.error .st { color: #FF6B7A; white-space: normal; }
.tray li.done .pc { color: var(--muted); }

.drop { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; text-align: center;
  background: color-mix(in srgb, var(--bg) 70%, transparent); backdrop-filter: blur(10px); animation: fade .2s both; }
.drop > div { padding: 44px 64px; border-radius: 28px; background: var(--grad); color: var(--on); animation: bob 1.6s ease-in-out infinite, pulse 2s ease-in-out infinite; }
.drop svg { width: 48px; height: 48px; }
.drop p { margin-top: 6px; font-weight: 600; }

/* ============ ビューア (常に暗い) ============ */
.viewer { position: fixed; inset: 0; z-index: 50; color: #F2F2F2; animation: fade .25s both;
  background: radial-gradient(90% 70% at 50% 40%, color-mix(in srgb, var(--g1) 22%, rgba(8,9,18,.97)), rgba(6,7,14,.98)); }
.v-top { position: absolute; inset: 0 0 auto 0; z-index: 2; display: flex; align-items: center; gap: 4px;
  padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top)); background: linear-gradient(rgba(0,0,0,.5), transparent); }
.v-meta { margin-right: auto; padding-left: 8px; display: grid; min-width: 0; }
.v-meta strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 600; }
.v-meta span { font-size: 12px; opacity: .7; }
.v-stage { position: absolute; inset: 0; display: grid; place-items: center; touch-action: pan-y; }
.v-frame { position: relative; border-radius: 16px; overflow: hidden; background: #111;
  box-shadow: 0 30px 90px -30px var(--g2), 0 0 0 1px rgba(255,255,255,.08); }
.v-frame img, .v-frame video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; }
.v-frame .full { opacity: 0; transition: opacity .3s; }
.v-frame .full.in { opacity: 1; }
.imprint { position: absolute; right: 14px; bottom: 14px; z-index: 1; pointer-events: none; padding: 3px 12px; border-radius: 999px;
  font-size: 13px; font-weight: 300; letter-spacing: .08em; color: #fff; background: rgba(12,14,28,.45); backdrop-filter: blur(8px); border: 1px solid rgba(255,255,255,.18); }
.v-nav { position: absolute; top: 50%; z-index: 2; width: 48px; height: 48px; margin-top: -24px; border: 1px solid rgba(255,255,255,.14); border-radius: 50%;
  background: rgba(255,255,255,.08); backdrop-filter: blur(8px); color: #fff; display: grid; place-items: center; transition: background .15s, transform .2s var(--ease); }
.v-nav:hover { background: rgba(255,255,255,.2); transform: scale(1.1); }
.v-nav.prev { left: 12px; } .v-nav.next { right: 12px; }
.v-nav[disabled] { opacity: 0; pointer-events: none; }

/* ============ 設定 ============ */
.sheet { width: min(560px, 100vw); max-height: 88dvh; padding: 0; border: 1px solid var(--line); border-radius: 24px;
  background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(24px); color: var(--ink); overflow: hidden; box-shadow: 0 40px 100px -30px rgba(0,0,0,.7); }
.sheet[open] { display: flex; flex-direction: column; animation: rise .3s var(--ease) both; }
.sheet::backdrop { background: rgba(6,7,14,.55); backdrop-filter: blur(4px); }
.sheet > header { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 10px 22px; }
.sheet h2 { font-size: 18px; font-weight: 600; }
.sheet-body { overflow-y: auto; padding: 0 22px 24px; display: grid; gap: 26px; }
.sheet h3 { font-size: 12px; color: var(--muted); letter-spacing: .14em; margin-bottom: 10px; font-weight: 500; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.themes { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.swatch { display: grid; gap: 8px; padding: 10px 6px 8px; border-radius: 14px; border: 2px solid transparent;
  background: linear-gradient(160deg, var(--bg), var(--bg2)); color: var(--ink); font-size: 11px; font-weight: 600; justify-items: center;
  transition: transform .25s var(--ease), box-shadow .25s; }
.swatch:hover { transform: translateY(-4px); box-shadow: 0 12px 22px -12px var(--g2); }
.swatch.on { border-color: var(--c); }
.swatch .dot { width: 100%; height: 22px; border-radius: 8px; background: linear-gradient(120deg, var(--g1), var(--g2)); background-size: 180% 100%; animation: flow 4s ease-in-out infinite alternate; }
.admin { display: grid; gap: 14px; }
.admin .card { border: 1px solid var(--line); border-radius: 16px; padding: 14px; display: grid; gap: 10px; background: color-mix(in srgb, var(--bg) 35%, transparent); }
.admin .card h4 { margin: 0; font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.admin .pill { background: color-mix(in srgb, var(--ink) 12%, transparent); font-size: 11px; padding: 1px 9px; }
.admin .pill.ok { background: var(--grad); color: var(--on); }
.admin .note { font-size: 12px; color: var(--muted); }
.admin .note code { user-select: all; background: color-mix(in srgb, var(--ink) 10%, transparent); padding: 1px 5px; border-radius: 4px; word-break: break-all; }
.admin .warn { font-size: 12px; color: #FF6B7A; }
.admin .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.admin .field input, .admin .field select { height: 40px; font-size: 14px; padding: 0 12px; border-radius: 10px; }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 70; max-width: calc(100vw - 32px);
  padding: 10px 20px; border-radius: 999px; background: var(--grad); color: var(--on); font-weight: 600; font-size: 14px;
  box-shadow: 0 14px 30px -12px var(--g2); animation: rise .3s var(--ease) both; }

/* テーマ切替: 押した位置から円形に広がる */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-new(root) { animation: reveal .6s var(--ease); }
@keyframes reveal { from { clip-path: circle(0 at var(--vx, 50%) var(--vy, 50%)); } to { clip-path: circle(150vmax at var(--vx, 50%) var(--vy, 50%)); } }

/* ============ スマートフォン ============ */
@media (max-width: 760px) {
  body { --row: 112px; }
  .bar { flex-wrap: wrap; row-gap: 8px; }
  .bar #btnAdd { display: none; }
  .bar .mark { margin-right: auto; }
  .filters { order: 3; width: 100%; margin-left: 0; }
  .hero { margin-top: 14px; }
  .hero-card { grid-template-columns: 1fr auto; gap: 18px 14px; padding: 22px 20px 44px; border-radius: 22px; }
  .hero-card > .waves { height: 34%; }
  .hero-card > .waves svg { width: 400%; animation-name: wave-narrow; }
  .hero-ring .legend { display: none; }
  .hero-ring svg { width: 84px; height: 84px; }
  .hero-people { grid-column: 1 / -1; }
  .orb { display: none; }
  .fab { display: grid; }
  .rail { display: none; }
  .grid { gap: 4px; }
  .tile { border-radius: 8px; }
  .tray { right: 12px; bottom: 88px; }
  .v-nav { display: none; }
  .v-frame { border-radius: 8px; }
  .themes { gap: 4px; }
  .swatch { font-size: 10px; padding: 8px 4px 6px; }
  .sheet { border-radius: 22px 22px 0 0; margin-bottom: 0; max-width: 100vw; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
  .tile img { filter: none; transform: none; }
}
