@font-face {
  font-family: "Noto Sans TC";
  src: url("fonts/NotoSansTC-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Noto Sans TC";
  src: url("fonts/NotoSansTC-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-display: swap;
}

@font-face {
  font-family: "Noto Sans TC";
  src: url("fonts/NotoSansTC-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}

:root {
  --ink: #121418;
  --ink-raised: #1c1f26;
  --line: #f4f1ea;
  --gold: #f0c14a;
  --rose: #e25b78;
  --mist: rgba(255, 255, 255, 0.7);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #000;
  color: var(--line);
  font-family: "Noto Sans TC", "PingFang HK", "Noto Sans CJK TC", sans-serif;
  font-weight: 400;
}

button, input { font: inherit; color: inherit; }

button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

button:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

#app { height: 100%; }

.screen { height: 100%; }

#boot, #intro {
  background: var(--ink);
  display: flex;
  flex-direction: column;
}

#boot { align-items: center; justify-content: center; gap: 16px; }

#boot p, .muted { color: var(--mist); font-size: 12px; line-height: 1.35; margin: 0; }

#intro { min-height: 100%; }

.intro-scroll {
  flex: 1;
  overflow: auto;
  padding: calc(8px + var(--safe-top)) 24px 12px;
}

.lang-row { display: flex; justify-content: flex-end; }

.text-button {
  color: var(--gold);
  font-weight: 700;
  padding: 8px 4px;
}

.mark-wrap { display: flex; justify-content: center; }

.intro-title {
  margin: 8px 0 0;
  text-align: center;
  font-size: 32px;
  line-height: 1.15;
  font-weight: 700;
}

.intro-en {
  margin: 0;
  text-align: center;
  color: var(--gold);
  font-size: 16px;
  font-weight: 700;
}

.intro-tag, .intro-tag-2 { text-align: center; margin: 4px 0 0; }

.intro-tag-2 { color: var(--mist); font-size: 12px; }

.intro-preview {
  height: 220px;
  margin-top: 16px;
  border-radius: 28px;
  overflow: hidden;
  position: relative;
  background: #000;
}

.intro-preview canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.step { display: flex; gap: 12px; margin-top: 14px; }

.step-index {
  width: 28px;
  height: 28px;
  flex: none;
  border: 1px solid var(--gold);
  border-radius: 50%;
  color: var(--gold);
  font-weight: 700;
  display: grid;
  place-items: center;
}

.step h2 { margin: 0; font-size: 16px; font-weight: 600; }

.step p { margin: 2px 0 0; }

.intro-start {
  margin: 8px 24px calc(16px + var(--safe-bottom));
  height: 52px;
  border-radius: 14px;
  background: var(--gold);
  color: var(--ink);
  font-weight: 700;
  font-size: 16px;
}

#finder { position: relative; height: 100%; background: #000; overflow: hidden; }

#stage, #media, #ghost, #sample, #studio, #video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#video {
  object-fit: cover;
  background: #000;
}

#media { transform-origin: center center; }

#ghost, #sample { pointer-events: none; }

#sample { object-fit: cover; z-index: 1; }

#ghost { z-index: 2; }

.hint.missing { color: var(--gold); }

.custom-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin: 0 24px 8px;
}

.custom-actions .text-button { color: var(--gold); font-weight: 700; }

.scrim {
  position: absolute;
  left: 0;
  right: 0;
  pointer-events: none;
}

.scrim.top {
  top: 0;
  height: 128px;
  background: linear-gradient(#07080acc, #07080a00);
}

.scrim.bottom {
  bottom: 0;
  height: 340px;
  background: linear-gradient(#07080a00, #07080af2);
}

#blink {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.93);
  pointer-events: none;
}

#chrome {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.column {
  width: min(560px, 100%);
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: var(--safe-top) 0 var(--safe-bottom);
  pointer-events: none;
}

.column > * { pointer-events: auto; }

.top {
  display: flex;
  align-items: flex-start;
  padding: 4px 4px 0 16px;
  gap: 0;
}

.titles { flex: 1; min-width: 0; padding-top: 6px; }

.titles h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  text-shadow: 0 0 8px #000c;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.subline { display: flex; align-items: center; gap: 6px; min-width: 0; }

.subline span, .suggest {
  text-shadow: 0 0 8px #000c;
}

#secondary {
  color: rgba(255, 255, 255, 0.85);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  flex: none;
  border: 1px solid var(--gold);
  color: var(--gold);
  border-radius: 99px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
}

.suggest {
  margin: 0;
  color: var(--gold);
  font-size: 11px;
  font-weight: 600;
}

.icon-row { display: flex; }

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
}

.icon-btn svg { width: 22px; height: 22px; filter: drop-shadow(0 0 4px #000a); }

.icon-btn[aria-pressed="true"] { color: var(--gold); }

.icon-btn.heart[aria-pressed="true"] { color: var(--rose); }

.mid { flex: 1; position: relative; min-height: 0; pointer-events: none; }

.mid .icon-btn, .denied { pointer-events: auto; }

#favorite {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
}

.denied {
  position: absolute;
  left: 28px;
  right: 28px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--ink-raised);
  border-radius: 20px;
  padding: 20px 20px 12px;
  text-align: center;
}

.denied h2 { margin: 0; font-size: 16px; font-weight: 600; }

.denied p { margin: 8px 0 0; }

.denied .stack { display: flex; flex-direction: column; align-items: center; margin-top: 12px; }

.filled {
  background: var(--gold);
  color: var(--ink);
  font-weight: 700;
  border-radius: 12px;
  padding: 10px 18px;
}

.hint {
  margin: 0 24px 8px;
  background: #121418cc;
  border-radius: 16px;
  padding: 8px 14px;
  text-align: center;
  font-size: 13px;
  line-height: 1.3;
}

.note {
  margin: 0 24px 6px;
  text-align: center;
  color: var(--gold);
  font-size: 12px;
  font-weight: 600;
}

.zoom {
  display: flex;
  justify-content: center;
  gap: 4px;
}

.zoom button {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  font-weight: 500;
  text-shadow: 0 0 6px #000c;
}

.zoom button[aria-pressed="true"] {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
}

.shutter-bar {
  display: grid;
  grid-template-columns: 52px 1fr 52px;
  align-items: center;
  padding: 0 28px;
  margin-top: 2px;
}

.thumb, .flip {
  width: 52px;
  height: 52px;
  justify-self: center;
}

.thumb {
  border: 2px solid #fff;
  border-radius: 12px;
  overflow: hidden;
  background: var(--ink-raised);
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.7);
}

.thumb img { width: 100%; height: 100%; object-fit: cover; }

.shutter {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  border: 4px solid #fff;
  padding: 5px;
  justify-self: center;
}

.shutter span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #fff;
}

.shutter:disabled { opacity: 0.45; }

.shutter.busy span {
  background:
    radial-gradient(circle, transparent 58%, #fff 59%),
    conic-gradient(#121418, #121418);
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.cats, .strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 16px 0;
  scrollbar-width: none;
}

.cats::-webkit-scrollbar, .strip::-webkit-scrollbar { display: none; }

.cats { height: 42px; align-items: center; }

.cats button {
  flex: none;
  height: 34px;
  padding: 0 12px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.cats button[aria-pressed="true"] { background: #fff; color: var(--ink); }

.strip { gap: 10px; padding-bottom: 8px; }

.strip button { width: 84px; flex: none; color: rgba(255, 255, 255, 0.85); }

.strip .frame {
  width: 72px;
  height: 72px;
  margin: 0 auto;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 2px;
}

.strip button[aria-pressed="true"] .frame { border: 2.4px solid var(--gold); }

.strip button[aria-pressed="true"] { color: #fff; }

.strip canvas, .strip .frame {
  display: block;
}

.strip canvas, .strip .frame img {
  width: 100%;
  height: 100%;
  border-radius: 13px;
  background: #111;
  object-fit: cover;
  display: block;
}

.strip .upload-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold);
  font-size: 28px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.06);
}

.strip .name, .strip .sub {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.strip .sub { color: rgba(255, 255, 255, 0.6); font-weight: 400; margin-top: 0; }

.empty-fav {
  width: 100%;
  text-align: center;
  padding: 18px 8px 8px;
}

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + var(--safe-bottom));
  transform: translateX(-50%);
  background: var(--ink-raised);
  color: var(--line);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px;
  z-index: 20;
  max-width: min(420px, calc(100% - 32px));
}

.sheet-back, .page {
  position: fixed;
  inset: 0;
  z-index: 8;
}

.sheet-back { background: rgba(0, 0, 0, 0.45); }

.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: min(86vh, 720px);
  overflow: auto;
  background: var(--ink-raised);
  border-radius: 18px 18px 0 0;
  padding: 8px 20px calc(24px + var(--safe-bottom));
}

.handle {
  width: 36px;
  height: 4px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.28);
  margin: 6px auto 12px;
}

.sheet h2, .page h2 { margin: 0 0 16px; font-size: 16px; font-weight: 600; }

.choices { display: flex; gap: 8px; margin: 8px 0 12px; }

.choice {
  border-radius: 99px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.08);
  font-weight: 700;
}

.choice[aria-pressed="true"] { background: var(--gold); color: var(--ink); }

.switch {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
  padding: 10px 0;
}

.switch small { display: block; color: var(--mist); font-size: 12px; margin-top: 2px; }

.switch input { width: 18px; height: 18px; accent-color: var(--gold); margin-top: 4px; }

.opacity-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  align-items: center;
  padding: 4px 0 12px;
}

.opacity-row input[type="range"] {
  grid-column: 1 / -1;
  width: 100%;
  accent-color: var(--gold);
}

.row-btn, .page-bar button {
  width: 100%;
  text-align: left;
  padding: 12px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

hr { border: 0; border-top: 1px solid rgba(255, 255, 255, 0.13); margin: 8px 0; }

.about { color: var(--mist); font-size: 13px; line-height: 1.45; }

.about a { color: var(--gold); }

.page {
  background: var(--ink);
  z-index: 9;
  display: flex;
  flex-direction: column;
  padding: var(--safe-top) 0 var(--safe-bottom);
}

.page-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
}

.page-bar h2 { margin: 0; flex: 1; }

.page-bar button { width: auto; padding: 8px; }

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  padding: 2px;
  overflow: auto;
}

@media (min-width: 700px) {
  .grid { grid-template-columns: repeat(4, 1fr); }
}

.grid button { aspect-ratio: 1; background: #000; padding: 0; }

.grid img { width: 100%; height: 100%; object-fit: cover; display: block; }

.shot-view {
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  background: #000;
  overflow: auto;
}

.shot-view img { max-width: 100%; max-height: 100%; }

.shot-meta { padding: 8px 20px 20px; text-align: center; }

.shot-meta .gold { color: var(--gold); }

.empty {
  margin: auto;
  text-align: center;
  padding: 32px;
}

.pack-error { padding: 24px; background: var(--ink); height: 100%; }

[hidden] { display: none !important; }

body.compact .strip .frame { width: 58px; height: 58px; }
body.compact .strip button { width: 70px; }
body.compact .strip .sub { display: none; }
