/* YiMoo public front-end theme (desktop + mobile).
   This is the single stylesheet for every public/user-facing flow: it replaces the
   earlier stacked prototype sheets for the public app so no light-theme rule can
   leak through. Admin sheets (admin.css and friends) are intentionally untouched. */

/* ============================================================ 1. tokens + base */

:root {
  color-scheme: dark;
  --bg: #0b0b10;
  --surface: #17171f;
  --surface-2: #1e1e28;
  --surface-3: #23232f;
  --text: #f4f4f7;
  --muted: #a0a3b0;
  --border: #292b36;
  --border-strong: #3a3d4b;
  --violet: #7132ff;
  --violet-2: #8847ff;
  --violet-soft: #241a44;
  --lime: #dfff40;
  --lime-2: #cbf22f;
  --on-lime: #0b0b10;
  --teal: #008b96;
  --teal-2: #007d87;
  --tile-purple: #6222ee;
  --tile-purple-2: #5a1ed8;
  --amber: #ffbb31;
  --amber-2: #f5ab1f;
  --on-amber: #14140f;
  --green: #35d39a;
  --red: #ff6b6b;
  --blue: #6aa8ff;
  --warning: #ffbc35;
  --accent: var(--lime);
  --accent-soft: #232a17;
  --on-accent: var(--on-lime);
  --focus: var(--lime);
  --radius: 16px;
  --sidebar-w: 216px;
  --topbar-h: 60px;
  font: 14px/1.6 "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC",
    "Hiragino Sans GB", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body.no-scroll {
  overflow: hidden;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
  color: inherit;
  border: 0;
  background: none;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

a {
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
  object-fit: cover;
}

svg {
  flex-shrink: 0;
  vertical-align: middle;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1 {
  font-size: 32px;
  line-height: 1.35;
  letter-spacing: -1.2px;
}

h2 {
  font-size: 21px;
  letter-spacing: -0.5px;
}

h3 {
  font-size: 16px;
}

p {
  line-height: 1.8;
}

small {
  font-size: 12px;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 6px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  padding: 12px;
  color: var(--text);
}

input::placeholder,
textarea::placeholder {
  color: #6f7280;
}

textarea {
  resize: vertical;
  min-height: 100px;
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--lime);
}

input[type="radio"] {
  accent-color: var(--lime);
}

input[type="range"] {
  padding: 0;
  border: 0;
  background: none;
  accent-color: var(--lime);
}

select option {
  background: var(--surface-2);
  color: var(--text);
}

label {
  display: grid;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  min-width: 0;
}

label small {
  font-weight: 400;
  color: var(--muted);
}

.muted {
  color: var(--muted);
}

.skip-link {
  position: fixed;
  top: -80px;
  left: 10px;
  z-index: 200;
  background: var(--lime);
  color: var(--on-lime);
  padding: 12px 16px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 600;
}

.skip-link:focus {
  top: 10px;
}

/* The local demo entry is marked by the small 本地演示 chip in the footer and by
   the explanation in the help dialog. No developer banner is injected. */

/* ======================================================== 2. shared components */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  min-height: 42px;
  text-decoration: none;
  transition: background 0.18s, border-color 0.18s, color 0.18s, filter 0.18s;
}

.btn-primary {
  background: var(--lime);
  color: var(--on-lime);
  font-weight: 700;
}

.btn-primary:hover:not(:disabled) {
  background: var(--lime-2);
}

.btn-secondary {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
}

.btn-secondary:hover:not(:disabled) {
  border-color: var(--border-strong);
  background: var(--surface-3);
}

.btn-subtle {
  color: var(--muted);
  padding: 8px 0;
}

.btn-subtle:hover {
  color: var(--text);
}

.btn-small {
  min-height: 34px;
  padding: 8px 12px;
  font-size: 12px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}

.icon-btn:hover {
  border-color: var(--border-strong);
  background: var(--surface-3);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--muted);
  white-space: nowrap;
}

.badge.green {
  color: var(--green);
  background: #10291f;
}

.badge.amber {
  color: var(--amber);
  background: #2c2313;
}

.badge.red {
  color: var(--red);
  background: #2e1717;
}

.badge.blue {
  color: var(--blue);
  background: #16213a;
}

.panel {
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.stack {
  display: grid;
  gap: 20px;
  min-width: 0;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  min-width: 0;
}

.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 13px 16px;
  border-radius: 12px;
  font-size: 12px;
  line-height: 1.8;
}

.notice svg {
  margin-top: 2px;
  color: var(--muted);
}

.notice.warn,
.notice.warning {
  background: #2a2110;
  border-color: #4a3a15;
  color: #ffd98a;
}

.notice.warning svg {
  color: var(--amber);
}

.notice.danger {
  background: #2c1618;
  border-color: #4d2226;
  color: #ffb3b3;
}

.notice.danger svg {
  color: var(--red);
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 30px 0 18px;
}

.section-heading h2,
.section-heading h4 {
  margin: 0;
  font-size: 19px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.3px;
}

.page-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 26px;
}

.page-heading h1 {
  font-size: 30px;
  font-weight: 600;
  margin-bottom: 8px;
}

.page-heading p {
  color: var(--muted);
  margin: 0;
  font-size: 13px;
}

.avatar {
  background: linear-gradient(140deg, #2c2c3c, #1d1d27);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.divider {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 3px;
}

.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.empty p {
  margin: 12px 0 0;
}

.error-message {
  color: #ff9b9b;
  font-size: 12px;
  min-height: 18px;
  margin: 10px 0 0;
}

.demo-note {
  font-size: 11px;
  color: var(--muted);
  margin: 26px 0 0;
  line-height: 1.7;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 15px);
  background: var(--surface-3);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 14px 22px;
  z-index: 120;
  box-shadow: 0 12px 40px #0008;
  opacity: 0;
  pointer-events: none;
  transition: 0.2s;
  max-width: min(580px, 90vw);
  font-size: 13px;
  text-align: center;
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.media-unavailable {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  height: 100%;
  min-height: 140px;
  color: var(--muted);
  background: linear-gradient(135deg, #1c1c26, #14141c);
}

.task-type-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 72px;
  height: 72px;
  border-radius: 16px;
  color: var(--lime);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.real-video {
  display: block;
  width: 100%;
  max-height: 62vh;
  background: #000;
  border-radius: 16px;
}

.result-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 40vh;
  overflow: auto;
}

/* ====================================================== 3. workspace shell */

.a-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
  background: var(--bg);
}

.a-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  padding: 18px 14px 16px;
  border-right: 1px solid var(--border);
  background: #0d0d13;
  display: flex;
  flex-direction: column;
  z-index: 30;
}

.a-sidebar > .brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.6px;
  color: var(--text);
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 10px;
  align-self: flex-start;
}

.a-sidebar > .brand img {
  width: 26px;
  height: 26px;
  object-fit: contain;
}

.a-sidebar > .brand .a-brand-dot {
  display: none;
}

.a-brand-word {
  display: inline-block;
}

.a-nav-label {
  font-size: 10px;
  letter-spacing: 0.14em;
  color: #6c7080;
  margin: 26px 12px 10px;
  text-transform: uppercase;
}

.a-sidebar nav {
  display: grid;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  text-align: left;
  border-radius: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  width: 100%;
  transition: background 0.16s, color 0.16s;
}

.nav-item:hover {
  background: var(--surface);
  color: var(--text);
}

.nav-item.active {
  background: #1d2415;
  color: var(--lime);
  font-weight: 700;
  box-shadow: inset 0 0 0 1px #3d4a1f;
}

.a-sidebar-foot {
  margin-top: auto;
  display: grid;
  gap: 6px;
  padding-top: 18px;
}

.a-side-extra {
  display: grid;
  gap: 2px;
  margin-bottom: 10px;
}

.a-side-extra .nav-item {
  font-size: 12px;
  padding: 9px 12px;
}

.a-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  text-align: left;
  width: 100%;
  min-height: 56px;
}

.a-profile .avatar {
  width: 32px;
  height: 32px;
  flex: none;
}

.a-profile-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.a-profile-copy strong {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.a-profile-copy small {
  font-size: 10px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.a-body {
  grid-column: 2;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.a-header {
  position: sticky;
  top: 0;
  z-index: 25;
  height: var(--topbar-h);
  padding: 0 30px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: #0b0b10f2;
  backdrop-filter: blur(10px);
}

.a-breadcrumb {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.a-breadcrumb b {
  font-weight: 500;
  color: #d7d9e2;
}

.a-breadcrumb span {
  color: #4b4e5c;
}

.a-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.header-actions .region-btn {
  font-size: 12px;
  color: var(--muted);
}

.a-credits {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.a-credits svg {
  color: var(--lime);
}

.a-credits small {
  color: var(--muted);
  font-weight: 500;
  font-size: 11px;
}

.a-credits:hover {
  border-color: var(--border-strong);
}

.a-main {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 22px 32px 72px;
  flex: 1;
  min-width: 0;
}

.a-main:focus {
  outline: none;
}

.a-foot {
  margin-top: 34px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  font-size: 11px;
  color: var(--muted);
}

.a-foot button {
  color: var(--muted);
  font-size: 11px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.a-foot button:hover {
  color: var(--text);
}

.a-foot .a-demo-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
}

.a-bottomnav {
  display: none;
}

/* ============================================================== 4. home page */

.a-welcome {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin: 0 0 16px;
}

.a-welcome h1 {
  font-size: 42px;
  font-weight: 800;
  letter-spacing: -1.6px;
  margin: 0;
  line-height: 1.15;
}

.a-welcome h1 .a-dot {
  color: var(--lime);
}

.a-date {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

/* --- clone hero --- */
.a-clone {
  position: relative;
  display: grid;
  grid-template-columns: minmax(260px, 0.86fr) minmax(0, 1.35fr);
  gap: 20px;
  align-items: center;
  padding: 16px 22px;
  border-radius: 18px;
  border: 1px solid #7b3dff;
  background: radial-gradient(
      ellipse at 6% 0%,
      #7a35ff 0%,
      transparent 52%
    ),
    linear-gradient(120deg, #681eff 4%, #661eff 96%);
  overflow: hidden;
}

.a-clone-copy {
  min-width: 0;
}

.a-clone-copy h2 {
  margin: 0 0 6px;
  font-size: 45px;
  line-height: 1.08;
  font-weight: 800;
  letter-spacing: -1.5px;
  color: #fff;
}

.a-clone-copy h2 span {
  display: block;
}

.a-clone-copy p {
  margin: 0 0 14px;
  font-size: 18px;
  color: #efe7ff;
  letter-spacing: 0.02em;
}

.a-clone-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 20px;
  border-radius: 999px;
  background: var(--lime);
  color: var(--on-lime);
  font-size: 20px;
  font-weight: 800;
  box-shadow: 0 6px 18px #2b127a55;
}

.a-clone-cta:hover {
  background: var(--lime-2);
}

.a-clone-players {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  min-width: 0;
}

.a-player {
  position: relative;
  margin: 0;
  border-radius: 14px;
  overflow: hidden;
  background: #101018;
  border: 1px solid #ffffff2e;
  aspect-ratio: 16 / 9;
  min-width: 0;
}

.a-player video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #101018;
}

.a-player-label {
  position: absolute;
  left: 10px;
  bottom: 26px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: calc(100% - 20px);
  padding: 5px 10px;
  border-radius: 6px;
  background: #0b0b10c9;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  pointer-events: none;
}

.a-player-label small {
  color: #b9bcc9;
  font-size: 10px;
  font-weight: 500;
}

.a-player-play {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #0b0b10a6;
  border: 2px solid #ffffff;
  color: #fff;
  backdrop-filter: blur(2px);
  box-shadow: 0 8px 24px #00000066;
  transition: transform 0.16s, background 0.16s;
}

/* Quiet "demo material" marker: the hero players show licensed stock footage,
   never a claimed clone result. */
.a-player-demo {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid #ffffff2e;
  background: #0b0b10a8;
  color: #d8d8e4;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  pointer-events: none;
}

.a-player-play:hover {
  transform: translate(-50%, -50%) scale(1.06);
  background: #0b0b10d9;
}

.a-player.is-playing .a-player-play {
  opacity: 0;
  pointer-events: none;
}

.a-player.is-playing:hover .a-player-play,
.a-player.is-playing .a-player-play:focus-visible {
  opacity: 1;
  pointer-events: auto;
}

.a-player-seek {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  width: auto;
  height: 4px;
  margin: 0;
  appearance: none;
  background: #ffffff45;
  border-radius: 999px;
  cursor: pointer;
}

.a-player-seek::-webkit-slider-thumb {
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  border: 0;
}

.a-player-seek::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 0;
  border-radius: 50%;
  background: #fff;
}

/* --- tool tiles --- */
.a-tools {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.a-tool {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 198px;
  padding: 24px 26px;
  border-radius: 16px;
  border: 0;
  text-align: left;
  color: #fff;
  overflow: hidden;
  transition: transform 0.18s, box-shadow 0.18s, filter 0.18s;
}

.a-tool:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 34px #00000059;
}

.a-tool:focus-visible {
  outline: 3px solid var(--lime);
  outline-offset: 3px;
}

.a-tool.teal {
  background: linear-gradient(135deg, var(--teal) 0%, var(--teal-2) 100%);
}

.a-tool.purple {
  background: linear-gradient(135deg, var(--tile-purple) 0%, var(--tile-purple-2) 100%);
}

.a-tool.amber {
  background: linear-gradient(135deg, var(--amber) 0%, var(--amber-2) 100%);
  color: var(--on-amber);
}

/* The icon sits in the top-right corner so it never pushes the title down:
   the whole card stays a single clickable button with the title at top-left. */
.a-tool-top {
  position: absolute;
  top: 22px;
  right: 24px;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 16px;
  max-width: 40%;
}

.a-tool-icon {
  display: grid;
  place-items: center;
  color: #ffffffd9;
}

/* The markup ships 30px inline SVGs; the desktop reference draws the corner
   icons noticeably larger, so scale the existing icon instead of adding art. */
.a-tool-icon svg {
  width: 48px;
  height: 48px;
}

.a-tool.amber .a-tool-icon {
  color: #1d1a0e;
}

.a-tool-diagram {
  display: none;
}

.a-tool h3 {
  font-size: 37px;
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1.15;
  margin: 0 0 6px;
  padding-right: 84px;
}

.a-tool p {
  font-size: 16px;
  line-height: 1.5;
  margin: 0;
  color: #ffffffd9;
}

.a-tool.amber p {
  color: #1d1a0ed9;
}

.a-tool-tags {
  display: none;
}

.a-tool-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 20px;
  font-size: 20px;
  font-weight: 700;
}

/* Translucent dark circles so each tile tint shows through, instead of the
   previous opaque near-black disc. */
.a-tool-arrow {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #0b0b1059;
  color: #fff;
  flex: none;
}

.a-tool.amber .a-tool-arrow {
  background: #4a320059;
  color: var(--on-amber);
}

/* --- upscale strip --- */
.a-upscale {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  margin-top: 16px;
  padding: 16px 20px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  text-align: left;
  color: var(--text);
  min-height: 74px;
}

.a-upscale:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.a-upscale:focus-visible {
  outline: 3px solid var(--lime);
  outline-offset: 3px;
}

.a-upscale-icon {
  display: none;
}

.a-upscale-hd {
  display: grid;
  place-items: center;
  width: 46px;
  height: 38px;
  border: 2px solid var(--lime);
  border-radius: 9px;
  color: var(--lime);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.02em;
  flex: none;
}

.a-upscale-copy {
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.a-upscale-copy > strong {
  font-size: 17px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 14px;
}

.a-aux-label {
  display: none;
}

.a-upscale-sep {
  width: 1px;
  height: 18px;
  background: var(--border-strong);
}

.a-upscale-copy > span {
  display: inline;
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.a-quality-art {
  display: none;
}

.a-upscale-link {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  flex: none;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.a-upscale:hover .a-upscale-link {
  background: var(--surface-3);
  border-color: var(--border-strong);
}

/* --- recent projects --- */
.a-recent {
  min-width: 0;
}

/* Home thumbnails are short and wide like the reference so the recent captions
   still fit the first desktop viewport; the library grid keeps its own box. */
.a-recent .project-image {
  aspect-ratio: 2.9 / 1;
}

.a-recent .project-card p {
  display: none;
}

.a-heading-count {
  font-size: 12px;
  color: var(--muted);
  margin-left: 8px;
  font-weight: 400;
}

.a-recent .section-heading {
  margin: 14px 0 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.a-bottom-note {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
  margin-top: 28px;
}

.a-bottom-note button {
  margin-left: auto;
  font-size: 11px;
  color: var(--lime);
  white-space: nowrap;
}

.a-creation-heading {
  margin: 20px 0 14px;
}

.a-creation-heading h2 {
  font-size: 19px;
  font-weight: 600;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.project-card {
  min-width: 0;
  text-align: left;
  padding: 0;
  display: block;
  width: 100%;
}

.project-card-action {
  min-width: 0;
  text-align: left;
  padding: 0;
  display: block;
  width: 100%;
}

.project-image {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  aspect-ratio: 16 / 9;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.project-image img,
.project-image video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s;
}

.project-card:hover .project-image img,
.project-card:hover .project-image video {
  transform: scale(1.035);
}

.project-image .badge {
  position: absolute;
  left: 10px;
  top: 10px;
  background: #0b0b10c4;
  color: #e9e9f2;
  border: 1px solid #ffffff1f;
}

.project-image .duration {
  position: absolute;
  right: 10px;
  bottom: 10px;
  color: #fff;
  background: #0b0b10b8;
  padding: 4px 7px;
  border-radius: 5px;
  font-size: 11px;
}

.project-card h3 {
  font-size: 14px;
  font-weight: 600;
  margin: 12px 0 4px;
}

.project-card p {
  color: var(--muted);
  font-size: 12px;
  margin: 0;
}

.project-play {
  position: absolute;
  left: 12px;
  bottom: 12px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #0b0b10c4;
  border: 1px solid #ffffff29;
  color: #fff;
  opacity: 1;
  transition: opacity 0.18s, background 0.18s;
}

.project-play svg {
  width: 16px;
  height: 16px;
}

.project-card:hover .project-play {
  background: #0b0b10f2;
}

/* Demo-clip thumbnails in the compact lists keep the still-image box. */
.recent-row img,
.recent-row video {
  width: 57px;
  height: 38px;
  border-radius: 8px;
  object-fit: cover;
  flex: none;
  background: #101018;
  pointer-events: none;
}

.task-card > img,
.task-card > video {
  width: 72px;
  height: 54px;
  border-radius: 8px;
  object-fit: cover;
  background: #101018;
  pointer-events: none;
}

.project-image.is-playing .project-play {
  opacity: 0;
}

.recent-list {
  display: grid;
}

.recent-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 0;
  border-bottom: 1px solid var(--border);
  text-align: left;
  width: 100%;
}

.recent-row:last-child {
  border-bottom: 0;
}

.recent-row img {
  width: 57px;
  height: 38px;
  border-radius: 8px;
}

.recent-title {
  flex: 1;
  min-width: 0;
}

.recent-title strong {
  display: block;
  font-size: 13px;
}

.recent-title small {
  color: var(--muted);
  display: block;
  margin-top: 4px;
}

/* ==================================== 5. account menu / auth / wallet pages */

.account-control {
  position: relative;
  flex: none;
  z-index: 45;
}

.account-trigger {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  border: 1px solid var(--border);
  padding: 4px 10px 4px 5px;
  border-radius: 999px;
  background: var(--surface);
  font-size: 12px;
  white-space: nowrap;
}

.account-trigger:hover {
  border-color: var(--border-strong);
}

.account-trigger > svg {
  color: var(--muted);
}

.account-trigger .avatar {
  height: 30px;
  width: 30px;
}

.account-button-label {
  color: var(--text);
}

.account-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  width: 268px;
  padding: 8px;
  display: grid;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 22px 60px #000000a6;
  text-align: left;
  z-index: 50;
  max-height: calc(100dvh - 100px);
  overflow-y: auto;
}

.account-menu[hidden] {
  display: none !important;
}

.account-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 12px;
  text-align: left;
  border-radius: 9px;
  font-size: 12px;
  color: var(--text);
}

.account-menu button:hover {
  background: var(--surface-2);
  color: var(--lime);
}

.account-menu-profile {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 5px;
  overflow-wrap: anywhere;
}

.account-menu-profile strong {
  display: block;
  font-size: 14px;
}

.account-menu-profile small {
  display: block;
  font-size: 10px;
  line-height: 1.7;
  margin-top: 7px;
  color: var(--muted);
}

.account-menu-separator {
  height: 1px;
  background: var(--border);
  margin: 5px;
}

.account-wallet {
  margin: 8px 4px;
  padding: 15px 13px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: linear-gradient(120deg, #1d2415, #191922);
}

.account-wallet-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: var(--muted);
}

.account-wallet-label .badge {
  margin-left: auto;
  font-size: 9px;
}

.account-wallet > strong {
  display: block;
  margin: 9px 0 5px;
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: -0.7px;
  font-weight: 700;
  color: var(--lime);
}

.account-wallet > small {
  display: block;
  font-size: 10px;
  line-height: 1.7;
  color: var(--muted);
}

.account-item-hint {
  margin-left: auto;
  font-size: 10px;
  color: var(--muted);
}

.creation-choices {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.creation-choice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
  text-align: left;
  padding: 22px 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--text);
}

.creation-choice > svg:first-child {
  color: var(--lime);
}

.creation-choice strong {
  font-size: 17px;
}

.creation-choice small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
  min-height: 42px;
}

.creation-choice > svg:last-child {
  align-self: flex-end;
  color: var(--muted);
}

.creation-choice:hover {
  border-color: var(--lime);
  background: #1d2415;
}

.auxiliary-tool {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  padding: 17px 0 0;
  width: 100%;
  font-size: 12px;
  color: var(--muted);
}

.auxiliary-tool > svg:last-child {
  margin-left: auto;
}

.auxiliary-tool:hover {
  color: var(--lime);
}

.auth-tabs {
  display: flex;
  gap: 8px;
  padding: 5px;
  border-radius: 11px;
  background: var(--surface-2);
  margin-bottom: 22px;
}

.auth-tabs button {
  flex: 1;
  padding: 10px;
  border-radius: 9px;
  color: var(--muted);
}

.auth-tabs button.active {
  background: var(--surface-3);
  color: var(--lime);
  font-weight: 700;
}

.wallet {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 22px;
  margin-bottom: 26px;
}

.balance-card {
  position: relative;
  overflow: hidden;
  padding: 30px;
  border-radius: 16px;
  border: 1px solid #7b3dff;
  background: linear-gradient(120deg, var(--violet) 0%, var(--violet-2) 100%);
  color: #fff;
}

.balance-card:after {
  content: "";
  position: absolute;
  right: -40px;
  top: -70px;
  width: 260px;
  height: 260px;
  border: 45px solid #ffffff14;
  border-radius: 50%;
  pointer-events: none;
}

.balance-card > span {
  font-size: 13px;
  color: #f0e9ff;
}

.balance-number {
  font-size: 54px;
  letter-spacing: -2px;
  margin: 12px 0;
  font-weight: 700;
  color: #fff;
}

.balance-number small {
  font-size: 14px;
  font-weight: 500;
  color: #f0e9ff;
}

.balance-card .btn {
  background: var(--lime);
  color: var(--on-lime);
  font-weight: 700;
}

.wallet-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

.wallet-stats strong {
  font-size: 30px;
  display: block;
  margin-top: 12px;
}

.ledger-wrap {
  overflow-x: auto;
}

.ledger {
  border-collapse: collapse;
  width: 100%;
  font-size: 12px;
}

.ledger th {
  text-align: left;
  color: var(--muted);
  font-weight: 500;
  background: var(--surface-2);
  padding: 13px;
}

.ledger td {
  padding: 16px 13px;
  border-bottom: 1px solid var(--border);
}

.ledger tbody tr:hover td {
  background: #1b1b24;
}

.amount-positive {
  color: var(--green);
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.pack {
  border: 1px solid var(--border);
  padding: 24px 12px;
  border-radius: 14px;
  background: var(--surface-2);
  text-align: center;
  color: var(--text);
}

.pack strong {
  font-size: 27px;
  display: block;
  margin-bottom: 6px;
}

.pack small {
  display: block;
  color: var(--muted);
}

.pack:hover {
  border-color: var(--lime);
  background: #1d2415;
}

.account-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 24px;
}

.account-profile {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
}

.account-profile .avatar {
  width: 56px;
  height: 56px;
  font-size: 22px;
}

.account-profile h3 {
  margin-bottom: 5px;
}

.form-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 25px;
}

.check-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 400;
}

.check-field {
  align-items: flex-start;
}

.check-field span {
  display: grid;
  gap: 3px;
}

.check-field strong {
  font-size: 13px;
  font-weight: 600;
}

.check-field small {
  font-weight: 400;
  line-height: 1.6;
}

.worker-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.worker-tile {
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  min-width: 0;
  overflow-wrap: anywhere;
}

.worker-tile h3 {
  font-size: 14px;
  margin-top: 20px;
}

.worker-tile p {
  font-size: 12px;
  color: var(--muted);
}

.worker-tile .badge {
  white-space: normal;
  line-height: 1.6;
}

.references-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.reference-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}

.reference-card img {
  width: 100%;
  aspect-ratio: 1.44;
  object-fit: cover;
  object-position: top;
}

.reference-copy {
  padding: 20px;
}

.reference-copy p {
  font-size: 12px;
  color: var(--muted);
}

.reference-copy h2 {
  font-size: 20px;
}

/* =================================================== 6. tasks + library pages */

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.search-field {
  max-width: 280px;
}

.search-input {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 280px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 400;
}

.search-input input {
  border: 0;
  background: none;
  padding: 11px 0;
  min-height: 42px;
}

.tabs {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.tab {
  padding: 9px 14px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
  border: 1px solid transparent;
}

.tab:hover {
  color: var(--text);
  background: var(--surface);
}

.tab.active {
  background: #1d2415;
  color: var(--lime);
  font-weight: 700;
  border-color: #3d4a1f;
}

.task-card {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 21px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  min-width: 0;
}

.task-card > img {
  width: 72px;
  height: 54px;
  border-radius: 9px;
}

.task-card h3 {
  font-size: 14px;
  margin: 0 0 7px;
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
  margin-top: 9px;
}

.task-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.task-card progress {
  width: 180px;
  max-width: 100%;
  height: 5px;
  accent-color: var(--lime);
}

.delivery-stage {
  font-size: 11px;
  color: var(--muted);
  margin: 8px 0 0;
}

.detail-events,
.detail-artifacts {
  margin-top: 22px;
  padding-top: 6px;
}

.detail-events h4,
.detail-artifacts h4 {
  font-size: 14px;
}

.artifact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.modal-pager {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
}

/* ================================================ 7. wizard / creation pages */

.creation-page {
  max-width: 980px;
  margin: 0 auto;
}

.creation-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  padding: 5px 0;
  margin-bottom: 22px;
}

.creation-back > svg {
  transform: rotate(180deg);
}

.creation-back:hover {
  color: var(--lime);
}

.creation-page-heading {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 26px;
}

.creation-page-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface-2);
  color: var(--lime);
}

.creation-page-heading h1 {
  font-size: 29px;
  margin: 0 0 7px;
  font-weight: 700;
  letter-spacing: -0.6px;
}

.creation-page-heading p {
  margin: 0;
  font-size: 13px;
  line-height: 1.8;
  color: var(--muted);
}

.creation-workspace {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
}

.creation-page-body {
  padding: 30px 34px 12px;
}

.creation-page .stepper {
  padding-bottom: 24px;
  margin-bottom: 26px;
  border-bottom: 1px solid var(--border);
  gap: 28px;
}

.creation-page .stack {
  gap: 22px;
}

.creation-page-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 34px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

.creation-page-footer > .muted {
  font-size: 11px;
}

.creation-page .error-message {
  margin-top: 16px;
}

.stepper {
  display: flex;
  gap: 16px;
  margin-bottom: 26px;
}

.step {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
}

.step span {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
}

.step.active {
  color: var(--lime);
}

.step.active span {
  background: var(--lime);
  border-color: var(--lime);
  color: var(--on-lime);
  font-weight: 700;
}

.upload-zone {
  display: grid;
  place-items: center;
  text-align: center;
  border: 1.5px dashed var(--border);
  border-radius: 14px;
  padding: 26px;
  background: var(--surface-2);
  gap: 10px;
}

.upload-zone input {
  max-width: 300px;
  font-size: 12px;
  background: var(--surface);
  padding: 8px;
}

.video-source,
.image-source {
  display: grid;
  gap: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  background: var(--surface-2);
}

.source-platforms {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 11px;
}

.source-platforms > span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
}

.source-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  min-height: 24px;
  font-size: 11px;
}

.source-status small {
  font-size: 11px;
  line-height: 1.7;
}

.source-error {
  color: #ff9b9b;
}

.source-disclaimer {
  font-size: 10px;
  color: var(--muted);
  margin: 0;
  line-height: 1.8;
}

.sample-source {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  text-align: left;
  width: 100%;
  color: var(--text);
}

.sample-source img {
  width: 65px;
  height: 44px;
  border-radius: 8px;
}

.sample-source.selected {
  border-color: var(--lime);
  background: #1d2415;
}

.sample-source strong {
  display: block;
  font-size: 13px;
}

.sample-source small {
  color: var(--muted);
}

.generation-modes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.mode-choice {
  padding: 15px 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.6;
  background: var(--surface-2);
  color: var(--text);
}

.mode-choice.selected {
  border-color: var(--lime);
  background: #1d2415;
  color: var(--lime);
  font-weight: 700;
}

.direction-field {
  padding: 0;
  border: 0;
  margin: 0;
  min-width: 0;
}

.direction-field legend {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
}

.direction-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.direction-option {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 17px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  cursor: pointer;
}

.direction-option input {
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: var(--lime);
  flex: none;
}

.direction-option.selected {
  border-color: var(--lime);
  background: #1d2415;
}

.direction-option strong {
  font-size: 13px;
}

.direction-option small {
  display: block;
  margin-top: 7px;
  line-height: 1.7;
  font-size: 11px;
  color: var(--muted);
}

.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.summary-row span {
  color: var(--muted);
  flex-shrink: 0;
  max-width: 48%;
}

.summary-row strong {
  text-align: right;
  overflow-wrap: anywhere;
  min-width: 0;
}

.summary-row.total strong {
  font-size: 24px;
  color: var(--lime);
}

.preview-frame {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: #101018;
}

.preview-frame img,
.preview-frame video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-frame > span {
  position: absolute;
  bottom: 16px;
  left: 16px;
  background: #0b0b10c9;
  color: #fff;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
}

.preview-frame .comparison-before {
  position: absolute;
  inset: 0;
  filter: blur(3px) saturate(0.6);
  clip-path: inset(0 50% 0 0);
}

.preview-caption {
  display: flex;
  justify-content: space-between;
  margin: 12px 0;
  color: var(--muted);
  font-size: 12px;
}

.workflow-steps {
  display: flex;
  gap: 8px;
  margin: 22px 0;
}

.workflow-stage {
  flex: 1;
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  padding: 12px 4px;
  border-top: 3px solid var(--border);
}

.workflow-stage.done {
  border-color: var(--lime);
  color: var(--lime);
}

.advanced-options {
  grid-column: 1 / -1;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
  overflow: hidden;
}

.advanced-options summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 13px 16px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  list-style: none;
  user-select: none;
}

.advanced-options summary::-webkit-details-marker {
  display: none;
}

.advanced-options summary small {
  color: var(--muted);
  font-weight: 400;
}

.advanced-options summary::after {
  content: "";
  margin-left: auto;
  border: solid var(--muted);
  border-width: 0 2px 2px 0;
  display: inline-block;
  padding: 4px;
  transform: rotate(45deg);
  transition: transform 0.18s;
}

.advanced-options[open] summary::after {
  transform: rotate(225deg);
}

.advanced-options[open] summary {
  border-bottom: 1px solid var(--border);
}

.advanced-grid {
  display: grid;
  gap: 14px;
  padding: 16px;
}

/* --- H3 generation controls (live module markup) --- */
.h3-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.h3-mode-track {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 22px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
  overflow: hidden;
}

.h3-mode-track::before {
  content: "";
  position: absolute;
  left: 12.5%;
  right: 12.5%;
  top: 29px;
  height: 1px;
  background: var(--border);
}

.h3-mode {
  position: relative;
  z-index: 1;
  min-height: 94px;
  padding: 16px 10px 13px;
  border-right: 1px solid var(--border);
  text-align: center;
  color: var(--text);
}

.h3-mode:last-child {
  border-right: 0;
}

.h3-mode i {
  width: 23px;
  height: 23px;
  margin: 0 auto 9px;
  display: grid;
  place-items: center;
  border: 4px solid var(--surface-2);
  border-radius: 50%;
  background: #565a68;
  box-shadow: 0 0 0 1px var(--border-strong);
}

.h3-mode strong,
.h3-mode small {
  display: block;
}

.h3-mode strong {
  font-size: 12px;
}

.h3-mode small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.h3-mode.selected {
  background: #1d2415;
  color: var(--lime);
}

.h3-mode.selected i {
  background: var(--lime);
  border-color: #1d2415;
  box-shadow: 0 0 0 1px var(--lime);
}

.h3-field-grid,
.h3-frame-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.h3-field {
  display: grid;
  gap: 8px;
  min-width: 0;
  font-size: 12px;
  font-weight: 600;
}

.h3-field small {
  color: var(--muted);
  font-weight: 400;
  line-height: 1.65;
}

.h3-field-error {
  display: block;
  color: #ff9b9b;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.h3-field-error[hidden] {
  display: none;
}

.h3-material {
  margin-bottom: 22px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
}

.h3-material-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 15px;
}

.h3-material-head strong {
  font-size: 13px;
}

.h3-material-head span {
  color: var(--muted);
  font-size: 11px;
}

.h3-frame-choice {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 17px;
}

.h3-frame-choice button,
.h3-resolution button {
  padding: 10px 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  font-size: 12px;
  color: var(--text);
}

.h3-frame-choice button.selected,
.h3-resolution button.selected {
  border-color: var(--lime);
  background: #1d2415;
  color: var(--lime);
  font-weight: 700;
}

.h3-image-list {
  display: grid;
  gap: 10px;
}

.h3-image-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 36px;
  gap: 9px;
  align-items: center;
}

.h3-image-index {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.h3-remove {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}

.h3-remove:disabled {
  visibility: hidden;
}

.h3-add-material {
  margin-top: 12px;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: var(--surface);
  color: var(--lime);
  font-size: 11px;
  font-weight: 700;
}

.h3-input-meta {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  color: var(--muted);
  font-size: 10px;
}

.h3-settings {
  display: grid;
  gap: 24px;
}

.h3-setting-block {
  min-width: 0;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
}

.h3-setting-block:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.h3-setting-block h3 {
  margin: 0 0 6px;
  font-size: 14px;
}

.h3-setting-block > p {
  margin: 0 0 15px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.65;
}

.h3-duration-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 104px;
  gap: 18px;
  align-items: center;
}

.h3-duration-number {
  position: relative;
}

.h3-duration-number input {
  padding-right: 34px;
}

.h3-duration-number span {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 11px;
  pointer-events: none;
}

.h3-ticks {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  color: var(--muted);
  font-size: 9px;
}

.h3-resolution {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.h3-resolution button {
  min-height: 58px;
  text-align: left;
}

.h3-resolution strong,
.h3-resolution small {
  display: block;
}

.h3-resolution small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 400;
}

.h3-inline-note {
  margin-top: 12px;
  padding: 11px 13px;
  border-radius: 10px;
  background: #2a2110;
  color: #ffd98a;
  font-size: 11px;
  line-height: 1.65;
}

.h3-review {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 28px;
  align-items: start;
}

.h3-review-list {
  min-width: 0;
  border-top: 1px solid var(--border);
}

.h3-review-row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}

.h3-review-row span {
  color: var(--muted);
}

.h3-review-row strong {
  max-width: 62%;
  text-align: right;
  overflow-wrap: anywhere;
}

.h3-review-aside {
  padding: 18px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.h3-review-aside strong {
  display: block;
  margin-bottom: 8px;
  color: var(--lime);
  font-size: 13px;
}

.h3-review-aside p {
  margin: 0 0 11px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.75;
}

.h3-review-aside p:last-child {
  margin-bottom: 0;
}

/* clone-specific form blocks */
.clone-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 16px;
  border: 1px solid #4b2fa8;
  border-radius: 12px;
  background: #1c1440;
  color: #e5dcff;
  font-size: 12px;
  line-height: 1.8;
}

.clone-note svg {
  color: var(--violet-2);
  margin-top: 2px;
}

.clone-steps {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0 0 0 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.9;
}

/* ============================================================ 8. dialogs */

dialog {
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0;
  background: var(--surface);
  color: var(--text);
  width: min(820px, calc(100vw - 32px));
  max-width: calc(100vw - 24px);
  max-height: min(88dvh, 920px);
  overflow: auto;
  box-shadow: 0 30px 100px #000000b8;
}

dialog::backdrop {
  background: #05050ac9;
  backdrop-filter: blur(6px);
}

.dialog-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 26px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.dialog-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
}

.dialog-body {
  padding: 24px 26px;
}

.dialog-footer {
  position: sticky;
  bottom: 0;
  padding: 18px 26px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  background: var(--surface-2);
}

/* =========================================================== 9. motion */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* ====================================================== 10. tablet widths */

@media (max-width: 1240px) {
  .a-clone {
    grid-template-columns: minmax(240px, 0.9fr) minmax(0, 1.2fr);
  }
  .a-clone-copy h2 {
    font-size: 34px;
  }
  .a-welcome h1 {
    font-size: 33px;
  }
  .a-tool h3 {
    font-size: 24px;
  }
  .a-tool-icon svg {
    width: 36px;
    height: 36px;
  }
  .a-tool p {
    font-size: 14px;
  }
  .a-main {
    padding: 24px 26px 72px;
  }
  .a-header {
    padding: 0 26px;
  }
}

@media (max-width: 1080px) {
  .a-tools {
    gap: 14px;
  }
  .a-tool {
    padding: 22px;
    min-height: 190px;
  }
  .a-tool h3 {
    font-size: 22px;
  }
  .a-tool-icon svg {
    width: 30px;
    height: 30px;
  }
  .worker-grid {
    grid-template-columns: 1fr 1fr;
  }
  .references-grid {
    grid-template-columns: 1fr;
  }
  .reference-card {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .wallet,
  .account-grid {
    grid-template-columns: 1fr;
  }
  .project-grid {
    gap: 14px;
  }
  .h3-review {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
  }
}

/* ==================== 11. compact shell (<= 980px: phones + tablets) */

/* The shell collapses to the single-column layout all the way to 980px so a
   768px-wide tablet gets the full content width (no 216px sidebar eating into
   it). The stacked home geometry further down is re-tuned for 721-980px in
   the dedicated block after this one; <=720px keeps its previous appearance. */

@media (max-width: 980px) {
  .a-layout {
    display: block;
    min-height: 100dvh;
  }

  .a-sidebar {
    display: none;
  }

  .a-body {
    display: block;
    min-height: 0;
  }

  .a-header {
    position: sticky;
    top: 0;
    height: auto;
    min-height: 56px;
    padding: 8px 12px;
    gap: 10px;
    flex-wrap: nowrap;
  }

  .a-header .brand {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 19px;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text);
    flex: none;
  }

  .a-header .brand img {
    width: 24px;
    height: 24px;
    object-fit: contain;
  }

  .a-breadcrumb {
    display: none;
  }

  .a-mobile-brand {
    display: inline-flex !important;
  }

  .a-header-right {
    margin-left: auto;
    gap: 8px;
  }

  .a-credits {
    min-height: 38px;
    padding: 0 10px;
    font-size: 12px;
  }

  .a-credits small {
    display: none;
  }

  .header-actions {
    gap: 6px;
  }

  .header-actions .btn {
    padding: 8px;
    min-height: 38px;
    min-width: 38px;
  }

  .header-actions .btn span,
  .header-actions .btn {
    font-size: 12px;
  }

  .account-trigger {
    min-height: 38px;
    padding-right: 6px;
  }

  .account-trigger .avatar {
    width: 28px;
    height: 28px;
  }

  .account-button-label {
    display: none;
  }

  .account-menu {
    width: min(280px, calc(100vw - 24px));
  }

  .a-main {
    max-width: none;
    padding: 6px 14px calc(92px + env(safe-area-inset-bottom));
  }

  .a-welcome {
    margin: 0 0 6px;
    align-items: flex-start;
  }

  .a-welcome h1 {
    font-size: 26px;
    letter-spacing: -1px;
  }

  .a-date {
    display: none;
  }

  .a-clone {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    padding: 8px 12px;
    border-radius: 14px;
  }

  .a-clone-copy h2 {
    font-size: 26px;
    line-height: 1.15;
    letter-spacing: -0.6px;
    margin: 0 0 4px;
  }

  .a-clone-copy p {
    font-size: 12px;
    line-height: 1.35;
    margin: 0 0 8px;
  }

  .a-clone-cta {
    width: auto;
    align-self: flex-start;
    justify-content: flex-start;
    min-height: 44px;
    padding: 0 16px;
    gap: 8px;
    font-size: 14px;
  }

  .a-clone-players {
    gap: 8px;
  }

  .a-player {
    aspect-ratio: 3 / 2;
    border-radius: 10px;
  }

  .a-player-play {
    width: 42px;
    height: 42px;
  }

  .a-player-play svg {
    width: 18px;
    height: 18px;
  }

  .a-player-demo {
    top: 6px;
    left: 6px;
    padding: 2px 6px;
    font-size: 9px;
    background: #0b0b1073;
    border-color: #ffffff24;
  }

  .a-player-label {
    left: 6px;
    bottom: 16px;
    gap: 1px;
    padding: 2px 6px;
    border-radius: 5px;
    font-size: 9px;
  }

  .a-player-label small {
    font-size: 8px;
  }

  .a-player-seek {
    left: 6px;
    right: 6px;
    bottom: 6px;
    height: 4px;
  }

  .a-creation-heading {
    margin: 12px 0 6px;
  }

  .a-creation-heading h2,
  .a-recent .section-heading h2 {
    font-size: 18px;
  }

  .a-tools {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  /* Compact stacked tiles: each one lands in a ~110px row, with the footer
     kept inside the card padding instead of an inherited 20px gap. */
  .a-tool {
    min-height: 108px;
    padding: 10px 16px;
    border-radius: 14px;
  }

  .a-tool h3 {
    font-size: 26px;
    line-height: 1.1;
    margin: 0 0 2px;
    padding-right: 50px;
  }

  .a-tool p {
    font-size: 13px;
    line-height: 1.3;
    margin: 0;
  }

  .a-tool-top {
    position: absolute;
    right: 16px;
    top: 12px;
    max-width: none;
  }

  .a-tool-icon svg {
    width: 32px;
    height: 32px;
  }

  .a-tool-footer {
    gap: 8px;
    padding-top: 0;
    margin-top: 2px;
    font-size: 14px;
    line-height: 1.2;
  }

  .a-tool-arrow {
    width: 32px;
    height: 32px;
  }

  /* One compact horizontal strip: HD badge, a two-line copy column and a small
     trailing action. Nothing stretches to the full width. */
  .a-upscale {
    flex-wrap: nowrap;
    gap: 10px;
    margin-top: 8px;
    padding: 10px 14px;
    min-height: 58px;
  }

  .a-upscale-hd {
    width: 40px;
    height: 30px;
    font-size: 13px;
    border-radius: 8px;
  }

  .a-upscale-copy {
    flex: 1 1 auto;
    flex-direction: column;
    align-items: flex-start;
    flex-wrap: nowrap;
    gap: 2px;
    min-width: 0;
  }

  .a-upscale-copy > strong {
    font-size: 15px;
    line-height: 1.2;
    gap: 0;
  }

  /* Must out-specify the base `.a-upscale-copy > span { display: inline }`
     rule, otherwise the empty separator keeps an 18px phantom row. */
  .a-upscale-copy > .a-upscale-sep {
    display: none;
  }

  .a-upscale-copy > span {
    max-width: 100%;
    font-size: 10.5px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .a-upscale-link {
    flex: none;
    width: auto;
    min-height: 32px;
    padding: 0 10px;
    gap: 5px;
    font-size: 12px;
  }

  .project-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .project-grid .project-card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  /* Home only: a two-card viewport that scrolls sideways, so the third recent
     project stays reachable instead of spanning the full width. */
  .a-recent .project-grid {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: calc(50% - 6px);
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 4px;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }

  .a-recent .project-grid .project-card {
    grid-column: auto;
    scroll-snap-align: start;
  }

  /* Home-only: out-specify the generic `.project-grid .project-card
     :last-child:nth-child(odd)` full-width rule (0,4) so the three recent
     cards keep source order city -> coast -> music inside the side-scrolling
     strip instead of the third card spanning the row. */
  .a-recent .project-grid .project-card:last-child:nth-child(odd) {
    grid-column: auto;
  }

  .a-recent .project-image {
    aspect-ratio: 2.1 / 1;
  }

  .a-recent .section-heading {
    margin: 12px 0 6px;
    padding-top: 8px;
  }

  .a-recent .section-heading .btn-subtle {
    min-height: 0;
    padding: 4px 0;
  }

  .page-heading {
    flex-direction: column;
    gap: 14px;
  }

  .page-heading h1 {
    font-size: 25px;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }

  .task-card {
    grid-template-columns: 52px minmax(0, 1fr);
    padding: 15px;
    gap: 12px;
  }

  .task-card > img {
    width: 52px;
    height: 44px;
  }

  .task-actions {
    grid-column: 2;
    flex-wrap: wrap;
  }

  .task-actions .btn {
    min-height: 44px;
  }

  .wallet-stats .panel {
    padding: 18px;
  }

  .reference-card {
    display: block;
  }

  .worker-tile {
    padding: 15px;
  }

  .panel {
    padding: 18px;
  }

  .toolbar .search-field,
  .toolbar .search-input {
    max-width: none;
    width: 100%;
  }

  .search-input input {
    font-size: 16px;
  }

  .toolbar {
    align-items: stretch;
  }

  .tabs {
    gap: 6px;
  }

  .tab {
    padding: 10px 14px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  .recent-row .badge {
    max-width: 110px;
    white-space: normal;
  }

  .balance-number {
    font-size: 44px;
  }

  .creation-choices {
    grid-template-columns: 1fr;
  }

  .creation-choice {
    display: grid;
    grid-template-columns: 28px 1fr 20px;
    gap: 9px 13px;
    padding: 17px;
  }

  .creation-choice > svg:first-child {
    grid-row: 1 / 3;
  }

  .creation-choice strong {
    font-size: 15px;
  }

  .creation-choice small {
    grid-column: 2;
    grid-row: 2;
    min-height: 0;
  }

  .creation-choice > svg:last-child {
    grid-column: 3;
    grid-row: 1 / 3;
    align-self: center;
  }

  .video-source,
  .image-source,
  .h3-material {
    padding: 15px;
  }

  .generation-modes {
    gap: 6px;
  }

  .mode-choice {
    flex-direction: column;
    font-size: 11px;
    padding: 12px 7px;
    min-height: 56px;
  }

  .direction-options {
    grid-template-columns: 1fr;
  }

  .direction-option {
    padding: 13px;
  }

  .source-platforms {
    gap: 6px;
  }

  .source-platforms > span {
    padding: 4px 8px;
    font-size: 10px;
  }

  .source-status .badge {
    white-space: normal;
  }

  .auxiliary-tool {
    font-size: 11px;
  }

  .creation-page-body {
    padding: 20px 16px 8px;
  }

  .creation-page .stepper {
    gap: 10px;
    justify-content: space-between;
    padding-bottom: 18px;
    margin-bottom: 20px;
  }

  .creation-page .step {
    gap: 5px;
    font-size: 11px;
  }

  .creation-page .step span {
    width: 23px;
    height: 23px;
  }

  .creation-page-footer {
    padding: 16px;
    gap: 10px;
    flex-wrap: wrap;
  }

  .creation-page-footer > .muted {
    width: 100%;
    order: 3;
    text-align: center;
  }

  .creation-page-footer .btn {
    flex: 1;
    min-height: 46px;
  }

  .creation-page-heading {
    gap: 13px;
    margin-bottom: 20px;
  }

  .creation-page-icon {
    width: 50px;
    height: 50px;
    border-radius: 14px;
  }

  .creation-page-heading h1 {
    font-size: 24px;
  }

  .creation-page-heading p {
    font-size: 12px;
  }

  .creation-workspace {
    border-radius: 16px;
  }

  .h3-mode-track {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .h3-mode-track::before {
    display: none;
  }

  .h3-mode {
    border-bottom: 1px solid var(--border);
    min-height: 84px;
  }

  .h3-mode:nth-child(2n) {
    border-right: 0;
  }

  .h3-mode:nth-child(n + 3) {
    border-bottom: 0;
  }

  .h3-field-grid,
  .h3-frame-grid,
  .h3-resolution {
    grid-template-columns: minmax(0, 1fr);
  }

  .h3-duration-control {
    grid-template-columns: minmax(0, 1fr) 92px;
    gap: 12px;
  }

  .h3-image-row {
    grid-template-columns: 26px minmax(0, 1fr) 34px;
    gap: 7px;
  }

  .h3-review-row {
    display: grid;
    gap: 6px;
  }

  .h3-review-row strong {
    max-width: none;
    text-align: left;
  }

  .task-type-icon {
    width: 48px;
    height: 48px;
  }

  .task-meta {
    overflow-wrap: anywhere;
  }

  .real-video {
    max-height: 50vh;
  }

  .option-grid {
    gap: 8px;
  }

  .pack {
    padding: 18px 7px;
  }

  .pack strong {
    font-size: 22px;
  }

  .stepper {
    gap: 9px;
  }

  .step {
    font-size: 11px;
    gap: 5px;
  }

  .step span {
    width: 20px;
    height: 20px;
  }

  dialog {
    width: calc(100vw - 16px);
    max-width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
    border-radius: 16px;
  }

  .dialog-header,
  .dialog-body {
    padding: 16px;
  }

  .dialog-footer {
    padding: 14px 16px;
    flex-wrap: wrap;
  }

  .dialog-footer .btn {
    flex: 1;
    min-height: 44px;
  }

  .icon-btn {
    min-width: 44px;
    min-height: 44px;
  }

  .btn {
    min-height: 44px;
  }

  .account-grid {
    grid-template-columns: 1fr;
  }

  .a-foot {
    padding-bottom: 4px;
  }

  .toast {
    bottom: calc(78px + env(safe-area-inset-bottom));
    max-width: calc(100vw - 24px);
  }

  /* bottom navigation */
  .a-bottomnav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 2px;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
    background: #0d0d13f7;
    backdrop-filter: blur(12px);
  }

  .a-bottomnav button {
    display: grid;
    justify-items: center;
    gap: 3px;
    min-height: 52px;
    padding: 6px 4px;
    border-radius: 12px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 500;
  }

  .a-bottomnav button[aria-current="page"] {
    color: var(--lime);
    font-weight: 700;
  }

  .a-bottomnav button:active {
    background: var(--surface);
  }
}

/* ============================== 11b. tablet home (721-980px) */

/* The compact shell above already gives this range a full-width header with
   no sidebar, a hidden breadcrumb, the mobile brand and the 3-control bottom
   nav. Only the home hero and the tool tiles need tablet geometry, because
   the <=720px stacked/one-column versions look wrong on a 768px screen.
   Declared after the <=980px block so these win at equal specificity. */

@media (min-width: 721px) and (max-width: 980px) {
  /* Hero keeps two columns: the copy column shrinks, the two 16:9 players keep
     enough width for their centre play buttons to stay fully visible. */
  .a-clone {
    grid-template-columns: minmax(200px, 0.75fr) minmax(0, 1.3fr);
    gap: 18px;
    align-items: center;
    padding: 16px;
  }

  .a-clone-copy h2 {
    font-size: 28px;
    line-height: 1.12;
    letter-spacing: -0.8px;
    margin: 0 0 6px;
  }

  .a-clone-copy p {
    font-size: 13px;
    line-height: 1.4;
    margin: 0 0 10px;
  }

  .a-clone-cta {
    width: auto;
    align-self: flex-start;
    justify-content: flex-start;
    min-height: 40px;
    padding: 0 16px;
    gap: 8px;
    font-size: 14px;
  }

  .a-clone-players {
    gap: 10px;
  }

  .a-player {
    aspect-ratio: 16 / 9;
    border-radius: 10px;
  }

  .a-player-play {
    width: 44px;
    height: 44px;
  }

  .a-player-play svg {
    width: 18px;
    height: 18px;
  }

  .a-player-demo {
    top: 8px;
    left: 8px;
    padding: 2px 6px;
    font-size: 9px;
  }

  .a-player-label {
    left: 8px;
    bottom: 18px;
    gap: 1px;
    padding: 3px 7px;
    font-size: 10px;
  }

  .a-player-label small {
    font-size: 9px;
  }

  .a-player-seek {
    left: 8px;
    right: 8px;
    bottom: 6px;
    height: 4px;
  }

  /* Three tiles per row again: at 768px this leaves each card ~238px, enough
     for a 4-character Chinese title on one line once the 40px icon gutter is
     reserved. */
  .a-tools {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
  }

  .a-tool {
    min-height: 170px;
    padding: 16px;
    border-radius: 14px;
  }

  .a-tool h3 {
    font-size: 24px;
    line-height: 1.15;
    letter-spacing: -0.5px;
    margin: 0 0 4px;
    padding-right: 40px;
  }

  .a-tool p {
    font-size: 13px;
    line-height: 1.4;
    margin: 0;
  }

  .a-tool-top {
    position: absolute;
    right: 14px;
    top: 14px;
    max-width: none;
  }

  .a-tool-icon svg {
    width: 32px;
    height: 32px;
  }

  .a-tool-footer {
    gap: 8px;
    padding-top: 12px;
    margin-top: auto;
    font-size: 14px;
    line-height: 1.2;
  }

  .a-tool-arrow {
    width: 34px;
    height: 34px;
  }
}

/* ============================================ 12. narrow phones (<= 380px) */

/* At 320-380px the ≤980px header still overflows horizontally (credits +
   language + account). Tighten spacing and type only: every control stays
   visible, keeps a >=40px touch target and keeps its label/aria wiring.
   390px and wider keeps the previous appearance untouched. */

@media (max-width: 380px) {
  .a-header {
    padding: 0 10px;
    gap: 6px;
  }

  .a-header .brand {
    gap: 4px;
    font-size: 18px;
  }

  .a-header .brand img {
    width: 22px;
    height: 22px;
  }

  .a-header-right {
    gap: 4px;
  }

  .a-credits {
    gap: 4px;
    min-height: 40px;
    padding: 0 6px;
    font-size: 12px;
  }

  .header-actions {
    gap: 4px;
  }

  .header-actions .btn {
    gap: 4px;
    min-width: 0;
    min-height: 40px;
    padding: 0 4px;
    font-size: 10px;
  }

  .header-actions .btn span {
    font-size: 10px;
  }

  .header-actions .btn svg {
    display: none;
  }

  .account-trigger {
    width: 36px;
    min-width: 34px;
    min-height: 40px;
    gap: 0;
    padding: 2px;
    justify-content: center;
  }

  .account-trigger .avatar {
    width: 24px;
    height: 24px;
  }

  .account-trigger > svg {
    display: none;
  }
}

@media (min-width: 981px) {
  .a-mobile-brand {
    display: none;
  }
}

