/* T-Minus — app chrome (home, view controls, sheets, form controls). Dark by design. */
:root {
  --bg: #07070c;
  --bg-elev: #15151f;
  --fill: rgba(255, 255, 255, 0.06);
  --fill-2: rgba(255, 255, 255, 0.1);
  --fill-3: rgba(255, 255, 255, 0.16);
  --line: rgba(255, 255, 255, 0.09);
  --line-2: rgba(255, 255, 255, 0.16);
  --text: #f5f5f8;
  --muted: rgba(245, 245, 248, 0.64);
  --faint: rgba(245, 245, 248, 0.42);
  --accent: #a78bfa;
  --accent-strong: #8b5cf6;
  --brand: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%);
  --ok: #34d399;
  --danger: #fb7185;
  --r: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; background: var(--bg); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 var(--ui);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
  touch-action: manipulation;
}
html.modal-open body { overflow: hidden; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; -webkit-user-select: none; user-select: none; }
a { color: inherit; }
img, svg, canvas, video { display: block; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ic { flex: none; }
.spacer { flex: 1; }

#app { position: relative; min-height: 100vh; min-height: 100dvh; }

/* ------------------------------------------------------------------ splash */
.splash { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); }
.splash-mark { width: 84px; height: 84px; border-radius: 24px; background: var(--brand); box-shadow: 0 20px 60px rgba(139, 92, 246, 0.45); animation: splash 1.4s var(--ease) infinite alternate; }
@keyframes splash { from { transform: scale(0.94); opacity: 0.75; } to { transform: scale(1); opacity: 1; } }

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 18px; border-radius: 999px;
  font-weight: 650; font-size: 16px; white-space: nowrap;
  background: var(--fill-2); border: 1px solid var(--line);
  transition: transform 0.15s var(--spring), background 0.2s, opacity 0.2s;
}
.btn:active { transform: scale(0.97); }
.btn.sm { min-height: 36px; padding: 0 14px; font-size: 15px; }
.btn.full { width: 100%; }
.btn.primary { background: var(--brand); border-color: transparent; color: #fff; box-shadow: 0 8px 22px rgba(139, 92, 246, 0.35); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.glass, .icon-btn.glass {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.18);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  backdrop-filter: blur(16px) saturate(160%);
  color: #fff;
}
.btn.danger { background: #e11d48; border-color: transparent; color: #fff; }
.btn.danger-ghost { background: rgba(244, 63, 94, 0.1); border-color: rgba(244, 63, 94, 0.28); color: var(--danger); }
.icon-btn {
  width: 44px; height: 44px; flex: none;
  display: inline-grid; place-items: center; border-radius: 50%;
  transition: background 0.2s, transform 0.15s var(--spring);
}
.icon-btn:active { transform: scale(0.92); background: var(--fill-2); }
.icon-btn.sm { width: 34px; height: 34px; }
.icon-btn.glass.on { background: rgba(255, 255, 255, 0.24); }

/* ------------------------------------------------------------------ home */
.home {
  min-height: 100vh; min-height: 100dvh;
  max-width: 1120px; margin: 0 auto;
  padding: calc(var(--sat) + 6px) calc(var(--sar) + 16px) calc(var(--sab) + 112px) calc(var(--sal) + 16px);
}
.home::before {
  content: ""; position: fixed; inset: -20% -10% auto; height: 60vh; z-index: -1; pointer-events: none;
  background: radial-gradient(60% 60% at 30% 30%, rgba(139, 92, 246, 0.16), transparent 70%), radial-gradient(50% 50% at 80% 20%, rgba(236, 72, 153, 0.1), transparent 70%);
}
.home-head { display: flex; align-items: center; gap: 10px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 23px; letter-spacing: -0.02em; }

.cards { display: grid; grid-template-columns: 1fr; gap: 14px; margin-top: 6px; }
.cards.is-empty { display: block; }
@media (min-width: 700px) { .cards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1060px) { .cards { grid-template-columns: repeat(3, 1fr); } }

.card {
  position: relative; height: 172px; border-radius: var(--r-xl); overflow: hidden; isolation: isolate; cursor: pointer;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.38), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  transition: transform 0.25s var(--ease);
  -webkit-user-select: none; user-select: none;
  animation: rise 0.5s var(--ease) both;
}
.card:active { transform: scale(0.98); }
.card-bg { position: absolute; inset: -2px; z-index: -2; background-size: cover; background-position: center; }
.card-shade { position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(0, 0, 0, 0.4) 0%, rgba(0, 0, 0, 0.06) 45%, rgba(0, 0, 0, 0.58) 100%); }
.card-body { position: absolute; inset: 0; padding: 16px 14px 18px 18px; display: flex; flex-direction: column; justify-content: space-between; }
.card-top { display: flex; align-items: flex-start; gap: 12px; }
.card-emoji { font-size: 32px; line-height: 1; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.3)); }
.card-titles { flex: 1; min-width: 0; }
.card-name { font-weight: 750; font-size: 19px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 10px rgba(0, 0, 0, 0.4); }
.card-date { font-size: 13px; color: rgba(255, 255, 255, 0.8); margin-top: 3px; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.4); }
.card-pin { color: #fde68a; margin-top: 4px; }
.card-more { margin: -6px -4px 0 0; color: #fff; }
.card-time { display: flex; align-items: baseline; gap: 8px; text-shadow: 0 2px 16px rgba(0, 0, 0, 0.45); }
.ct-big { font-size: 46px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.ct-unit { font-size: 17px; font-weight: 650; color: rgba(255, 255, 255, 0.88); }
.ct-small {
  margin-left: auto; padding: 5px 11px; border-radius: 99px;
  font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums; color: #fff;
  background: rgba(0, 0, 0, 0.3); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.ct-small:empty { display: none; }
.card-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255, 255, 255, 0.14); }
.card-progress i { display: block; height: 100%; width: 0; background: rgba(255, 255, 255, 0.9); }

.fab {
  position: fixed; z-index: 20;
  right: calc(var(--sar) + 20px); bottom: calc(var(--sab) + 22px);
  height: 58px; padding: 0 24px 0 18px; border-radius: 29px;
  display: flex; align-items: center; gap: 8px;
  background: var(--brand); color: #fff; font-weight: 750; font-size: 17px;
  box-shadow: 0 14px 34px rgba(139, 92, 246, 0.45), 0 2px 6px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s var(--spring);
}
.fab:active { transform: scale(0.94); }

.install-banner {
  display: flex; align-items: center; gap: 12px; margin: 2px 0 14px; padding: 12px 10px 12px 14px; border-radius: var(--r-lg);
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(236, 72, 153, 0.14)); border: 1px solid rgba(167, 139, 250, 0.3);
}
.ib-icon { width: 42px; height: 42px; flex: none; display: grid; place-items: center; border-radius: 12px; background: rgba(255, 255, 255, 0.08); }
.ib-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; font-size: 14.5px; }
.ib-text span { color: var(--muted); font-size: 13px; }

.empty { text-align: center; padding: 5vh 4px 20px; max-width: 580px; margin: 0 auto; }
.empty-art {
  width: 132px; height: 132px; margin: 0 auto 18px; display: grid; place-items: center; border-radius: 40px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.35), transparent 70%); animation: float 5s ease-in-out infinite;
}
.empty h2 { font-size: 30px; letter-spacing: -0.02em; margin: 0 0 8px; }
.empty p { color: var(--muted); margin: 0 auto 22px; max-width: 34ch; }

.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.tpl-grid.compact { margin-top: 30px; }
.tpl {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 6px 12px; border-radius: var(--r-lg);
  background: var(--fill); border: 1px solid var(--line); transition: background 0.2s, transform 0.2s var(--spring);
}
.tpl:active { transform: scale(0.96); background: var(--fill-2); }
.tpl-emoji { font-size: 30px; line-height: 1.15; }
.tpl-name { font-weight: 650; font-size: 14px; }
.tpl-when { font-size: 12px; color: var(--muted); }

/* ------------------------------------------------------------------ countdown view */
.view { position: fixed; inset: 0; overflow: hidden; background: #000; display: none; -webkit-user-select: none; user-select: none; }
.in-view .view { display: block; }
.in-view .home { display: none; }
.view.idle { cursor: none; }

.bg { position: absolute; inset: 0; overflow: hidden; }
.bg-media { position: absolute; inset: 0; transition: filter 0.3s, transform 0.3s; }
.bg-layer { position: absolute; inset: 0; opacity: 0; transition: opacity 0.8s var(--ease); }
.bg-layer.in { opacity: 1; }
.bg-fill { position: absolute; inset: 0; width: 100%; height: 100%; }
.bg-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 0.7s var(--ease); }
.bg-img.ready { opacity: 1; }
.bg-vignette { position: absolute; inset: 0; pointer-events: none; transition: opacity 0.3s; background: radial-gradient(125% 90% at 50% 45%, transparent 52%, rgba(0, 0, 0, 0.55) 100%); }
.bg-dim { position: absolute; inset: 0; pointer-events: none; background: #000; transition: opacity 0.25s; }

.topbar, .bottombar { position: absolute; left: 0; right: 0; z-index: 10; display: flex; align-items: center; gap: 10px; transition: opacity 0.35s, transform 0.35s var(--ease); }
.topbar { top: 0; padding: calc(var(--sat) + 12px) calc(var(--sar) + 14px) 12px calc(var(--sal) + 14px); }
.bottombar { bottom: 0; justify-content: center; padding: 12px 16px calc(var(--sab) + 20px); }
.view.idle .topbar { opacity: 0; transform: translateY(-10px); pointer-events: none; }
.view.idle .bottombar { opacity: 0; transform: translateY(10px); pointer-events: none; }
.view.editing .topbar, .view.editing .bottombar { opacity: 0; pointer-events: none; }
.view:not(.shared) [data-role="add"], .view.shared [data-role="customize"] { display: none; }

.music-hint {
  position: absolute; left: 50%; bottom: calc(var(--sab) + 86px); z-index: 11;
  display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 99px;
  background: rgba(0, 0, 0, 0.5); border: 1px solid rgba(255, 255, 255, 0.2); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  color: #fff; font-weight: 650; font-size: 14px;
  opacity: 0; pointer-events: none; transform: translate(-50%, 10px); transition: opacity 0.3s, transform 0.3s var(--ease);
}
.music-hint.show { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }
.view.editing .music-hint { bottom: auto; top: calc(var(--sat) + 14px); }

.final10 { position: absolute; inset: 0; z-index: 8; display: grid; place-items: center; pointer-events: none; }
.f-num {
  font-size: min(64vw, 56vh); line-height: 1; font-weight: 900; font-variant-numeric: tabular-nums;
  text-shadow: 0 0 40px rgba(255, 255, 255, 0.35), 0 12px 60px rgba(0, 0, 0, 0.45);
  animation: fpop 1s var(--ease) both;
}
.f-num.hot { color: #fde68a; text-shadow: 0 0 50px rgba(251, 191, 36, 0.65), 0 12px 60px rgba(0, 0, 0, 0.45); }
.view.editing .f-num { font-size: min(40vw, 30vh); }
@keyframes fpop {
  0% { transform: scale(1.7); opacity: 0; }
  16% { transform: scale(1); opacity: 1; }
  78% { opacity: 1; }
  100% { transform: scale(0.8); opacity: 0; }
}

.celebrate {
  position: absolute; inset: 0; z-index: 40; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(circle at 50% 45%, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.55));
  opacity: 0; transition: opacity 0.4s;
}
.celebrate.in { opacity: 1; }
.celebrate-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none; }
.celebrate-card {
  position: relative; z-index: 1; width: 100%; max-width: 420px; text-align: center; padding: 30px 24px 24px; border-radius: 30px;
  background: rgba(15, 15, 24, 0.55); border: 1px solid rgba(255, 255, 255, 0.16);
  -webkit-backdrop-filter: blur(22px) saturate(160%); backdrop-filter: blur(22px) saturate(160%);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
  transform: scale(0.85); transition: transform 0.6s var(--spring);
}
.celebrate.in .celebrate-card { transform: scale(1); }
.c-emoji { font-size: 68px; line-height: 1; animation: bounce 0.9s var(--ease) infinite alternate; }
.c-title { font-size: clamp(26px, 7.4vw, 40px); line-height: 1.12; letter-spacing: -0.02em; margin: 14px 0 6px; text-wrap: balance; }
.c-sub { color: var(--muted); margin: 0 0 20px; }
.celebrate-card .btn { min-width: 170px; margin-top: 8px; }

/* ------------------------------------------------------------------ editor sheet */
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  max-width: 760px; margin: 0 auto;
  display: flex; flex-direction: column;
  background: rgba(16, 16, 24, 0.88);
  -webkit-backdrop-filter: blur(28px) saturate(170%); backdrop-filter: blur(28px) saturate(170%);
  border-radius: 26px 26px 0 0;
  box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transform: translateY(105%);
  transition: transform 0.38s var(--ease);
  will-change: transform;
  -webkit-user-select: none; user-select: none;
}
.sheet-head { flex: none; padding: 4px 12px 0; touch-action: none; cursor: grab; }
.sheet-grab { height: 18px; display: grid; place-items: center; }
.sheet-grab i { width: 40px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.28); }
.sheet-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 0 8px; }
.sheet-title { font-weight: 700; font-size: 16px; }
.etabs {
  display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; touch-action: pan-x;
  margin: 0 -12px; padding: 0 12px 10px; border-bottom: 1px solid var(--line);
}
.etabs::-webkit-scrollbar { display: none; }
.etab {
  flex: 1 0 auto; min-width: 64px; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 7px 8px; border-radius: 14px; color: var(--muted); font-size: 12px; font-weight: 650;
  transition: background 0.2s, color 0.2s;
}
.etab.on { color: #fff; background: var(--fill-2); }
.sheet-body { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 4px 16px 28px; -webkit-user-select: text; user-select: text; }
.sheet.side {
  top: 0; left: auto; right: 0; width: min(410px, 48vw); max-width: none; margin: 0;
  height: 100% !important; transform: translateX(105%); border-radius: 0; border-left: 1px solid var(--line);
  padding-top: var(--sat); padding-right: var(--sar);
}
.sheet.side.open { transform: none !important; }
.sheet.side .sheet-grab { display: none; }
.sheet.side .sheet-head { cursor: default; padding-top: 10px; }

.pane > div { display: flex; flex-direction: column; }
.sec { padding: 14px 0 10px; border-bottom: 1px solid var(--line); }
.sec:last-child { border-bottom: 0; }
.sec-title { margin: 0 0 10px; font-size: 12px; font-weight: 750; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }
.sec > :not(.sec-title) + .field,
.sec > :not(.sec-title) + .grid2,
.sec > :not(.sec-title) + .btn { margin-top: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.field-hint { font-size: 13px; color: var(--muted); }
.field-hint.when { margin-top: 10px; color: var(--text); font-weight: 550; }
.input {
  width: 100%; min-width: 0; min-height: 48px; padding: 12px 14px; border-radius: var(--r);
  border: 1px solid var(--line-2); background: rgba(255, 255, 255, 0.06); color: var(--text);
  font: 16px/1.2 var(--ui); outline: none; -webkit-appearance: none; appearance: none;
  transition: border-color 0.2s, background 0.2s;
}
.input:focus { border-color: var(--accent); background: rgba(255, 255, 255, 0.09); }
.input::placeholder { color: var(--faint); }
input[type="date"].input, input[type="time"].input { display: block; }
.input::-webkit-date-and-time-value { text-align: left; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 50px; padding: 6px 0; }
.row.stacked, .row.slider, .row.color { flex-direction: column; align-items: stretch; gap: 8px; }
.row-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.row-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.row-label { font-size: 15px; font-weight: 550; }
.row-hint { font-size: 12.5px; color: var(--muted); }
.row-value { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.note { font-size: 13px; color: var(--muted); margin: 8px 0 4px; line-height: 1.45; }
.note.ok { color: var(--ok); display: flex; align-items: center; gap: 6px; }
.credit { font-size: 12.5px; color: var(--muted); margin: 10px 0 0; min-height: 1.2em; }
.credit a { color: #fff; }

.switch { position: relative; flex: none; width: 51px; height: 31px; }
.switch input { position: absolute; inset: 0; z-index: 1; margin: 0; opacity: 0; cursor: pointer; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: rgba(255, 255, 255, 0.16); transition: background 0.25s; }
.switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3); transition: transform 0.25s var(--spring); }
.switch input:checked + i { background: var(--accent-strong); }
.switch input:checked + i::after { transform: translateX(20px); }
.switch input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }

input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 32px; margin: 0; background: transparent; --p: 50%; }
input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--accent) var(--p), rgba(255, 255, 255, 0.14) var(--p)); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; margin-top: -10px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35); }
input[type="range"]::-moz-range-track { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.14); }
input[type="range"]::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--accent); }
input[type="range"]::-moz-range-thumb { width: 26px; height: 26px; border: 0; border-radius: 50%; background: #fff; }

.seg { display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg-btn { flex: 1 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 0 12px; border-radius: 10px; color: var(--muted); font-size: 14.5px; font-weight: 650; white-space: nowrap; transition: background 0.2s, color 0.2s; }
.seg-btn.on { background: rgba(255, 255, 255, 0.15); color: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); }
.seg.sm .seg-btn { min-height: 34px; padding: 0 10px; font-size: 13.5px; }
.sec > .seg + .tiles-wrap, .sec > .seg + .list, .sec > .seg + div { margin-top: 10px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.quick { margin-top: 12px; }
.chip { min-height: 36px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--line-2); background: rgba(255, 255, 255, 0.04); font-size: 14px; font-weight: 600; transition: background 0.2s, border-color 0.2s, transform 0.15s var(--spring); }
.chip:active { transform: scale(0.96); }
.chip.on { background: rgba(167, 139, 250, 0.22); border-color: rgba(167, 139, 250, 0.65); color: #fff; }

.strip { display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 2px 16px 6px; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; }
.strip::-webkit-scrollbar { display: none; }
.strip > * { flex: none; scroll-snap-align: start; }

.emoji-btn { width: 48px; height: 48px; border-radius: 14px; font-size: 26px; line-height: 1; background: rgba(255, 255, 255, 0.05); border: 1.5px solid transparent; }
.emoji-btn.on { border-color: var(--accent); background: rgba(167, 139, 250, 0.2); }
.emoji-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; }
.emoji-input { width: 84px; min-height: 44px; padding: 6px; text-align: center; font-size: 22px; }

.tiles-wrap { margin-top: 10px; }
.tiles-label { margin: 14px 0 8px; font-size: 12px; font-weight: 750; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
@media (min-width: 560px) { .sheet:not(.side) .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile {
  position: relative; aspect-ratio: 3 / 4; border-radius: 14px; overflow: hidden;
  background-size: cover; background-position: center;
  transition: transform 0.15s var(--spring);
}
.tile::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: inherit; pointer-events: none; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1); transition: box-shadow 0.2s; }
.tile:active { transform: scale(0.96); }
.tile.on::after { box-shadow: inset 0 0 0 2.5px #fff, inset 0 0 0 4px rgba(0, 0, 0, 0.35); }
.tile-name, .tile-check, .tile-del { z-index: 2; }
.tile-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tile-name { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 8px 7px; font-size: 12px; font-weight: 650; text-align: left; color: #fff; background: linear-gradient(transparent, rgba(0, 0, 0, 0.66)); text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5); }
.tile-check { position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: #fff; color: #000; opacity: 0; transform: scale(0.6); transition: 0.2s var(--spring); }
.tile.on .tile-check { opacity: 1; transform: scale(1); }
.tiles.colors { grid-template-columns: repeat(4, 1fr); }
.tiles.colors .tile { aspect-ratio: 1; }
.upload-tile, .custom-color { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; background: rgba(255, 255, 255, 0.05); border: 1.5px dashed rgba(255, 255, 255, 0.25); color: var(--muted); cursor: pointer; }
.upload-tile::after, .custom-color::after { display: none; }
.upload-tile .tile-name, .custom-color .tile-name { position: static; padding: 0; background: none; text-align: center; color: var(--muted); text-shadow: none; }
.custom-color input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.tile-del { position: absolute; top: 6px; left: 6px; z-index: 2; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: rgba(0, 0, 0, 0.62); color: #fff; }

.preset-card { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 106px; padding: 14px 8px 10px; border-radius: 16px; background: radial-gradient(circle at 30% 20%, #2c2a48, #12121c); border: 1px solid var(--line); transition: transform 0.15s var(--spring); }
.preset-card:active { transform: scale(0.95); }
.pc-prev { display: flex; gap: 4px; font-size: 22px; line-height: 1; min-height: 34px; align-items: center; }
.pc-num { min-width: 1.5em; padding: 0.2em 0.22em; text-align: center; }
.pc-name { font-size: 12.5px; font-weight: 650; color: var(--muted); }

.layout-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.layout-btn { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 4px 10px; border-radius: 14px; background: rgba(255, 255, 255, 0.05); border: 1.5px solid transparent; color: var(--muted); font-size: 12.5px; font-weight: 650; }
.layout-btn svg { width: 44px; height: 32px; }
.layout-btn.on { border-color: var(--accent); background: rgba(167, 139, 250, 0.14); color: #fff; }

.font-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; width: 84px; height: 80px; border-radius: 14px; background: rgba(255, 255, 255, 0.05); border: 1.5px solid transparent; }
.font-btn b { font-size: 28px; line-height: 1; }
.font-btn small { max-width: 76px; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.font-btn.on { border-color: var(--accent); background: rgba(167, 139, 250, 0.14); }

.swatches { display: flex; flex-wrap: wrap; gap: 9px; }
.swatch { position: relative; width: 32px; height: 32px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25); transition: transform 0.15s var(--spring); }
.swatch:active { transform: scale(0.9); }
.swatch.on { box-shadow: 0 0 0 2px #16161f, 0 0 0 4px #fff; }
.swatch.custom { display: grid; place-items: center; overflow: hidden; color: #fff; background: conic-gradient(#f43f5e, #f59e0b, #84cc16, #06b6d4, #8b5cf6, #f43f5e); cursor: pointer; }
.swatch.custom.on { background: var(--c); }
.swatch.custom input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }

.list { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.ritem { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 10px 8px 12px; border-radius: 14px; background: rgba(255, 255, 255, 0.04); border: 1.5px solid transparent; cursor: pointer; transition: background 0.2s, border-color 0.2s; }
.ritem:active { background: rgba(255, 255, 255, 0.08); }
.ritem.on { border-color: rgba(167, 139, 250, 0.7); background: rgba(167, 139, 250, 0.12); }
.ritem-ic { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 10px; background: rgba(255, 255, 255, 0.08); color: var(--accent); }
.ritem-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ritem-title { font-size: 15px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ritem-sub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ritem-check { width: 24px; height: 24px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--accent-strong); color: #fff; opacity: 0; transform: scale(0.5); transition: 0.2s var(--spring); }
.ritem.on .ritem-check { opacity: 1; transform: scale(1); }
.list .list-label { margin: 10px 0 0 4px; }
.list .list-label:first-child { margin-top: 2px; }
.upload-btn { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 54px; border-radius: 14px; border: 1.5px dashed rgba(255, 255, 255, 0.26); font-weight: 650; }

/* ------------------------------------------------------------------ modal sheets */
.modal-root { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.55); opacity: 0; transition: opacity 0.3s; }
.modal {
  position: relative; width: 100%; max-width: 560px; max-height: 88vh; max-height: 88dvh;
  display: flex; flex-direction: column; padding-bottom: var(--sab);
  background: var(--bg-elev); border-radius: 26px 26px 0 0; box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.5);
  transform: translateY(100%); transition: transform 0.34s var(--ease);
}
.modal-wide { max-width: 720px; }
.modal-root.open .modal-backdrop { opacity: 1; }
.modal-root.open .modal { transform: translateY(0); }
.modal-head { position: relative; display: flex; align-items: center; gap: 8px; padding: 12px 10px 6px 20px; touch-action: none; }
.modal-grab { position: absolute; top: 7px; left: 50%; width: 40px; height: 5px; margin-left: -20px; border-radius: 3px; background: rgba(255, 255, 255, 0.25); }
.modal-title { flex: 1; margin: 12px 0 4px; font-size: 21px; letter-spacing: -0.01em; }
.modal-body { overflow-y: auto; overscroll-behavior: contain; padding: 4px 20px 24px; }
@media (min-width: 700px) {
  .modal-root { align-items: center; }
  .modal { border-radius: 26px; max-height: 84vh; opacity: 0; transform: translateY(24px) scale(0.97); transition: transform 0.3s var(--ease), opacity 0.3s; }
  .modal-root.open .modal { opacity: 1; transform: none; }
  .modal-grab { display: none; }
}
.action-list { display: flex; flex-direction: column; gap: 2px; }
.action-item { display: flex; align-items: center; gap: 14px; min-height: 52px; padding: 0 12px; border-radius: 14px; font-size: 16px; font-weight: 560; text-align: left; }
.action-item:active { background: var(--fill-2); }
.action-item.danger { color: var(--danger); }
.confirm-msg { margin: 0 0 18px; color: var(--muted); }
.confirm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.credits { margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.credits summary { cursor: pointer; padding: 8px 0; color: var(--text); font-weight: 600; font-size: 14px; }
.credits ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; line-height: 1.4; }
.credits a { color: #c4b5fd; }
.lead { margin: 4px 0 16px; color: var(--muted); font-size: 16px; line-height: 1.5; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.step { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 16px; background: var(--fill); }
.step-ic { width: 44px; height: 44px; flex: none; display: grid; place-items: center; border-radius: 12px; background: rgba(167, 139, 250, 0.16); color: #c4b5fd; }
.step-text { display: flex; flex-direction: column; gap: 2px; }
.step-text span { color: var(--muted); font-size: 14px; }
.url-box { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; padding: 10px 10px 10px 14px; border-radius: 14px; background: var(--fill); }
.url-box code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }

/* ------------------------------------------------------------------ toasts */
.toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--sab) + 96px); z-index: 80; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 0 16px; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px; max-width: 520px; padding: 12px 12px 12px 16px; border-radius: 16px;
  background: rgba(30, 30, 42, 0.94); border: 1px solid var(--line-2); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  color: #fff; font-size: 15px; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4); pointer-events: auto;
  opacity: 0; transform: translateY(12px) scale(0.98); transition: opacity 0.3s, transform 0.3s var(--ease);
}
.toast.in { opacity: 1; transform: none; }
.toast-msg { flex: 1; }
.toast-btn { padding: 6px 10px; border-radius: 10px; color: #c4b5fd; font-weight: 750; }

/* ------------------------------------------------------------------ motion */
@keyframes float { 50% { transform: translateY(-8px); } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
@keyframes bounce { from { transform: translateY(0) scale(1); } to { transform: translateY(-8px) scale(1.06); } }

@media (max-height: 520px) and (orientation: landscape) {
  .topbar { padding-top: calc(var(--sat) + 8px); padding-bottom: 6px; }
  .bottombar { padding-bottom: calc(var(--sab) + 10px); }
  .music-hint { bottom: calc(var(--sab) + 62px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
