:root {
  color-scheme: dark;
  --bg: #111012;
  --panel: rgba(32, 28, 30, 0.86);
  --panel-strong: #211d1f;
  --line: rgba(255, 255, 255, 0.095);
  --text: #f7f0ea;
  --muted: #b4a8a2;
  --amber: #efb66e;
  --amber-soft: rgba(239, 182, 110, 0.14);
  --blue: #83aeca;
  --blue-soft: rgba(91, 139, 169, 0.18);
  --wine: #6f3345;
  --good: #99c6a3;
  --pending: #d9b783;
  --blocked: #bb8f95;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 8% 0%, rgba(111, 51, 69, 0.25), transparent 31rem),
    radial-gradient(circle at 96% 18%, rgba(66, 112, 143, 0.19), transparent 28rem),
    linear-gradient(180deg, #121012 0%, #0c0c0e 100%);
}

button, textarea, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.shell {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: max(22px, env(safe-area-inset-top)) 18px max(32px, env(safe-area-inset-bottom));
}

.hero { padding: 8px 2px 20px; }
.eyebrow {
  color: var(--amber);
  font-size: 0.69rem;
  font-weight: 750;
  letter-spacing: 0.17em;
}
.hero-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-top: 8px;
}
h1, h2, p { margin: 0; }
h1 {
  font-family: Georgia, "Noto Serif TC", serif;
  font-size: clamp(2.15rem, 8vw, 3.25rem);
  font-weight: 500;
  letter-spacing: -0.04em;
}
.hero p { color: var(--muted); margin-top: 7px; font-size: 0.95rem; }

.room-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin: 0 0 15px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(14, 13, 15, 0.76);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.16);
}
.room-tab {
  min-width: 0;
  min-height: 58px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease;
}
.room-tab span,
.room-tab small { display: block; }
.room-tab span { font-size: 0.86rem; font-weight: 760; }
.room-tab small { margin-top: 3px; color: #817672; font-size: 0.66rem; }
.room-tab[aria-selected="true"] {
  border-color: rgba(239, 182, 110, 0.35);
  background: linear-gradient(135deg, rgba(111, 51, 69, 0.3), rgba(239, 182, 110, 0.09));
  color: var(--text);
}
.room-tab[aria-selected="true"] small { color: var(--amber); }

.status-button,
.icon-button,
.link-button,
.choice,
.primary-button {
  border: 0;
  color: inherit;
  cursor: pointer;
}
.status-button {
  min-height: 44px;
  flex: 0 0 auto;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--muted);
}
.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--pending);
  box-shadow: 0 0 12px rgba(217, 183, 131, 0.6);
}

.panel,
.recommendation,
.museum-room,
.all-models {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: 0 18px 65px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(18px);
}
.panel { padding: 18px; }
.section-heading {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 15px;
}
.section-heading h2,
.all-models h2 { font-size: 1.03rem; font-weight: 730; }
.section-heading p { color: var(--muted); margin-top: 3px; font-size: 0.82rem; line-height: 1.45; }
.step {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  border-radius: 10px;
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 0.72rem;
  font-weight: 780;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}
.choice-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.choice {
  min-height: 64px;
  padding: 12px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.035);
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}
.choice:hover { transform: translateY(-1px); }
.choice[aria-pressed="true"] {
  border-color: rgba(239, 182, 110, 0.6);
  background: var(--amber-soft);
}
.choice strong { display: block; font-size: 0.91rem; }
.choice span { display: block; margin-top: 4px; color: var(--muted); font-size: 0.72rem; line-height: 1.35; }
.choice-row .choice {
  min-height: 48px;
  padding: 11px 8px;
  text-align: center;
}
.choice-row .choice span { display: none; }

.recommendation {
  position: relative;
  overflow: hidden;
  padding: 20px;
  background:
    linear-gradient(145deg, rgba(111, 51, 69, 0.43), rgba(29, 31, 36, 0.86) 52%, rgba(46, 72, 87, 0.52));
}
.recommendation::after {
  content: "";
  position: absolute;
  width: 180px;
  height: 180px;
  right: -65px;
  top: -95px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  box-shadow: 0 0 70px rgba(239, 182, 110, 0.08) inset;
}
.rec-topline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
}
.rec-state { color: var(--good); }
.recommendation h2 {
  margin-top: 10px;
  font-family: Georgia, "Noto Serif TC", serif;
  font-size: 1.85rem;
  font-weight: 500;
}
.rec-flavor {
  margin-top: 3px;
  color: var(--amber);
  font-size: 0.76rem;
}
.rec-preview {
  position: relative;
  z-index: 1;
  margin: 14px 0 0;
}
.rec-preview img {
  display: block;
  width: 100%;
  aspect-ratio: 2 / 1;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 17px;
  background: #171417;
}
.rec-preview figcaption {
  min-height: 18px;
  margin-top: 5px;
  text-align: right;
}
.rec-preview a,
.preview-source {
  color: #9e928d;
  font-size: 0.66rem;
  text-decoration: none;
}
.rec-preview a:hover,
.preview-source:hover { color: var(--amber); }
.rec-why {
  max-width: 620px;
  margin-top: 8px;
  color: #e1d7d1;
  line-height: 1.62;
}
.capability-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 15px;
}
.capability {
  padding: 6px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #eee5df;
  font-size: 0.73rem;
}
.honest-limit {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.79rem;
  line-height: 1.45;
}
.honest-limit span { color: var(--muted); }
.honest-limit strong { font-weight: 580; }
.link-button {
  min-height: 44px;
  margin-top: 10px;
  padding: 0;
  background: transparent;
  color: var(--amber);
  font-size: 0.8rem;
}

.scene-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.75rem;
}
textarea {
  width: 100%;
  resize: vertical;
  min-height: 116px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 15px;
  outline: none;
  background: rgba(8, 8, 10, 0.58);
  color: var(--text);
  line-height: 1.55;
}
textarea:focus { border-color: rgba(239, 182, 110, 0.52); box-shadow: 0 0 0 3px rgba(239, 182, 110, 0.08); }
textarea::placeholder { color: #776e6a; }
.submit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 13px;
}
.delivery-note { display: grid; gap: 2px; font-size: 0.72rem; }
.delivery-note span { color: var(--muted); }
.primary-button {
  min-height: 50px;
  padding: 0 18px;
  border-radius: 15px;
  background: linear-gradient(135deg, #d9975c, #b76066);
  color: #160d0f;
  font-weight: 800;
  box-shadow: 0 10px 28px rgba(144, 63, 73, 0.24);
}
.primary-button:disabled { opacity: 0.45; cursor: not-allowed; }
.runtime-note { margin-top: 10px; color: var(--muted); font-size: 0.72rem; line-height: 1.45; }

.museum-room {
  padding: 20px;
  background:
    radial-gradient(circle at 92% 0%, rgba(66, 112, 143, 0.16), transparent 18rem),
    #191719;
  backdrop-filter: none;
}
.museum-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}
.museum-heading h2 {
  margin-top: 6px;
  font-family: Georgia, "Noto Serif TC", serif;
  font-size: clamp(1.65rem, 6vw, 2.25rem);
  font-weight: 500;
  letter-spacing: -0.035em;
}
.museum-heading p {
  max-width: 500px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.55;
}
.museum-count {
  display: grid;
  flex: 0 0 auto;
  min-width: 70px;
  padding: 10px 12px;
  border: 1px solid rgba(239, 182, 110, 0.18);
  border-radius: 15px;
  background: var(--amber-soft);
  text-align: center;
}
.museum-count strong {
  color: var(--amber);
  font-family: Georgia, serif;
  font-size: 1.35rem;
  font-weight: 500;
}
.museum-count span { margin-top: 2px; color: var(--muted); font-size: 0.62rem; }
.museum-note {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 16px;
  padding: 11px 12px;
  border: 1px solid rgba(131, 174, 202, 0.16);
  border-radius: 13px;
  background: rgba(91, 139, 169, 0.08);
  color: #b8aaa4;
  font-size: 0.72rem;
  line-height: 1.5;
}
.museum-note > span { color: var(--blue); }
.museum-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}
.museum-list .model-card { align-self: start; }
.museum-list .model-select { margin-top: auto; }

.all-models {
  padding: 18px;
  background: #191719;
  backdrop-filter: none;
}
.all-models-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.all-models h2 { margin-top: 4px; }
.model-browser-intro {
  max-width: 560px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
}
.icon-button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.055);
  font-size: 1.35rem;
}
.model-picker-label {
  display: block;
  margin: 18px 0 7px;
  color: var(--muted);
  font-size: 0.72rem;
}
.model-picker-wrap { position: relative; }
.model-picker-wrap select {
  width: 100%;
  min-height: 50px;
  padding: 0 42px 0 14px;
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: none;
  background: #121012;
  color: var(--text);
  cursor: pointer;
}
.model-picker-wrap select:focus { border-color: rgba(239, 182, 110, 0.55); box-shadow: 0 0 0 3px rgba(239, 182, 110, 0.08); }
.model-picker-wrap > span {
  position: absolute;
  right: 15px;
  top: 50%;
  translate: 0 -54%;
  color: var(--amber);
  pointer-events: none;
}
.model-browser-card {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.028);
}
.model-browser-meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.model-browser-meta h3 { margin: 0; font-size: 1rem; }
.model-browser-meta p { margin-top: 4px; color: var(--amber); font-size: 0.73rem; }
.work-stage,
.work-thumb-crop {
  overflow: hidden;
  background: #111012;
}
.work-stage {
  width: min(100%, 420px);
  aspect-ratio: 2 / 3;
  margin: 14px auto 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 17px;
}
.work-stage img,
.work-thumb-crop img {
  display: block;
  width: 300%;
  max-width: none;
  height: 100%;
  transform: translateX(calc(var(--work-index) * -33.333333%));
}
.work-stage img { transition: transform 180ms ease; }
.work-caption {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  width: min(100%, 420px);
  min-height: 22px;
  margin: 7px auto 0;
  color: var(--muted);
  font-size: 0.68rem;
}
.work-caption a { color: #9e928d; text-decoration: none; }
.work-caption a:hover { color: var(--amber); }
.work-choice-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  width: min(100%, 420px);
  margin: 5px auto 0;
}
.work-choice {
  min-width: 0;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted);
  cursor: pointer;
}
.work-choice[data-selected="true"] {
  border-color: rgba(239, 182, 110, 0.62);
  background: var(--amber-soft);
  color: var(--amber);
}
.work-thumb-crop {
  display: block;
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: 8px;
}
.work-choice-label { display: block; padding: 5px 0 2px; font-size: 0.66rem; font-weight: 760; }
.browser-model-summary {
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.55;
}
.browser-use-button { width: 100%; margin-top: 14px; }
.model-list { display: grid; gap: 9px; margin-top: 15px; }
.model-card {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.028);
  transition: border-color 140ms ease, background 140ms ease;
}
.model-card[data-selected="true"] {
  border-color: rgba(239, 182, 110, 0.42);
  background: rgba(239, 182, 110, 0.055);
}
.model-card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.model-title-copy { min-width: 0; }
.model-card h3 { margin: 0; font-size: 0.92rem; }
.model-flavor {
  display: block;
  margin-top: 3px;
  color: var(--amber);
  font-size: 0.71rem;
}
.model-card p { color: var(--muted); font-size: 0.75rem; line-height: 1.45; }
.model-status { align-self: start; padding: 5px 8px; border-radius: 999px; font-size: 0.68rem; white-space: nowrap; }
.model-status.ready { color: var(--good); background: rgba(79, 133, 91, 0.16); }
.model-status.downloading { color: var(--pending); background: rgba(155, 118, 66, 0.16); }
.model-status.testing { color: var(--blue); background: var(--blue-soft); }
.model-status.blocked { color: var(--blocked); background: rgba(126, 71, 80, 0.18); }
.model-preview {
  width: 100%;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 13px;
  background: #151315;
}
button.model-preview { cursor: pointer; }
button.model-preview:active { transform: translateY(1px); }
.model-preview img {
  display: block;
  width: 100%;
  aspect-ratio: 2 / 1;
  object-fit: cover;
}
.preview-source { align-self: flex-end; min-height: 16px; }
.model-download {
  display: grid;
  place-items: center;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid rgba(131, 174, 202, 0.34);
  border-radius: 12px;
  background: var(--blue-soft);
  color: #b8d6e8;
  font-size: 0.74rem;
  font-weight: 720;
  text-decoration: none;
}
.model-download:active { transform: translateY(1px); }
.model-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.model-meta span { padding: 4px 7px; border-radius: 7px; background: rgba(255, 255, 255, 0.05); color: #d6cbc5; font-size: 0.67rem; }
.model-select {
  align-self: flex-start;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid rgba(239, 182, 110, 0.28);
  border-radius: 12px;
  background: rgba(239, 182, 110, 0.08);
  color: var(--amber);
  font-size: 0.74rem;
  font-weight: 700;
}
.model-select:active { transform: translateY(1px); }

footer {
  display: grid;
  gap: 4px;
  padding: 18px 4px 0;
  color: #726966;
  font-size: 0.68rem;
  line-height: 1.45;
}

dialog {
  width: min(380px, calc(100% - 34px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #201c1e;
  color: var(--text);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.62);
}
dialog::backdrop { background: rgba(0, 0, 0, 0.62); backdrop-filter: blur(4px); }
.dialog-body { padding: 24px; text-align: center; }
.dialog-icon { display: grid; place-items: center; width: 48px; height: 48px; margin: 0 auto 12px; border-radius: 50%; background: var(--amber-soft); color: var(--amber); font-size: 1.4rem; }
.dialog-body h2 { font-size: 1.15rem; }
.dialog-body p { margin: 8px 0 18px; color: var(--muted); line-height: 1.5; }

:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }

@media (max-width: 540px) {
  .shell { padding-left: 13px; padding-right: 13px; }
  .hero-row { align-items: flex-start; }
  .status-button { padding: 0 11px; }
  .room-tab { min-height: 55px; padding: 8px 9px; }
  .room-tab span { font-size: 0.8rem; }
  .room-tab small { font-size: 0.61rem; }
  .museum-room { padding: 18px; }
  .museum-heading { gap: 12px; }
  .museum-count { min-width: 64px; padding: 9px; }
  .museum-list { grid-template-columns: 1fr; }
  .choice-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .submit-row { align-items: stretch; flex-direction: column; }
  .primary-button { width: 100%; }
  .honest-limit { grid-template-columns: 1fr; gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
