:root {
  color-scheme: light;
  --paper: #f6f7f9;
  --white: #ffffff;
  --ink: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --red: #dc2626;
  --blue: #2563eb;
  --yellow: #eff6ff;
  --green: #059669;
  --radius: 12px;
  --surface-soft: #f9fafb;
  --blue-soft: #eff6ff;
  --green-soft: #ecfdf5;
  --amber: #d97706;
  --amber-soft: #fffbeb;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .06);
  --shadow-md: 0 12px 28px rgba(15, 23, 42, .08);
  --body: "Microsoft YaHei UI", "Microsoft YaHei", "Segoe UI Variable Text", "Segoe UI", "Noto Sans SC", sans-serif;
  --display: "Microsoft YaHei", "Microsoft YaHei UI", "Segoe UI Variable Display", "Segoe UI", "Noto Sans SC", sans-serif;
  --mono: "Consolas", "Cascadia Mono", "SFMono-Regular", "Liberation Mono", monospace;
  --font-mono: var(--mono);
  --motion-fast: 140ms;
  --motion-standard: 180ms;
  --motion-dialog: 220ms;
  --ease-out: cubic-bezier(.23, 1, .32, 1);
  --ease-in-out: cubic-bezier(.77, 0, .175, 1);
  --scrollbar-thumb: #aeb5c1;
  --scrollbar-thumb-hover: #8d96a5;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0f1219;
  --white: #171b24;
  --ink: #eef1f8;
  --muted: #a9afbd;
  --line: #2a3040;
  --red: #ff7a8d;
  --blue: #8b7cff;
  --yellow: rgba(139, 124, 255, .16);
  --green: #5be0ae;
  --radius: 12px;
  --surface-soft: #1e2330;
  --blue-soft: rgba(139, 124, 255, .16);
  --green-soft: rgba(91, 224, 174, .12);
  --amber: #e5b15f;
  --amber-soft: rgba(229, 177, 95, .13);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .26);
  --shadow-md: 0 18px 42px rgba(0, 0, 0, .34);
  --scrollbar-thumb: #454d60;
  --scrollbar-thumb-hover: #596276;
}

html { overscroll-behavior-y: none; background: var(--paper); font-synthesis: none; text-rendering: auto; -webkit-font-smoothing: auto; -moz-osx-font-smoothing: auto; }
body { overscroll-behavior-y: none; color: var(--ink); background: var(--paper); font-synthesis: none; text-rendering: auto; -webkit-font-smoothing: auto; -moz-osx-font-smoothing: auto; }
body::before { display: none; }
button, input, textarea, select { letter-spacing: 0; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid rgba(37, 99, 235, .7); outline-offset: 2px; }

.app-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  width: 256px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, .99);
  transition: transform var(--motion-standard) var(--ease-out);
}
.sidebar-brand {
  height: 64px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  border-bottom: 1px solid #f0f1f3;
  overflow: hidden;
}
.sidebar-logo { width: 36px; height: 36px; flex: 0 0 36px; display: block; }
.sidebar-brand-copy { min-width: 0; display: grid; gap: 1px; white-space: nowrap; transition: opacity var(--motion-fast) var(--ease-out), transform var(--motion-standard) var(--ease-out); }
.sidebar-brand-copy strong { font-size: 16px; font-weight: 700; }
.sidebar-brand-copy small { color: var(--muted); font-size: 12px; }
.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  padding: 16px 12px;
  border: 0;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  background: transparent;
}
.sidebar-nav::-webkit-scrollbar { display: none; }
.sidebar-section-label {
  display: block;
  min-height: 24px;
  margin-top: 12px;
  padding: 4px 10px;
  color: #9ca3af;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity 140ms ease;
}
.sidebar-section-label:first-child { margin-top: 0; }
.sidebar-nav button,
.sidebar-collapse,
.sidebar-theme-toggle,
.sidebar-public-link {
  flex: 0 0 auto;
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 13px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #4b5563;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  transition: background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}
.sidebar-nav button:hover,
.sidebar-collapse:hover,
.sidebar-theme-toggle:hover,
.sidebar-public-link:hover { background: #f3f4f6; color: var(--ink); }
.sidebar-home-link { min-height: 36px; margin-bottom: 2px; border-radius: 8px; font-size: 12px; }
.sidebar-home-link .nav-icon { width: 20px; height: 20px; flex-basis: 20px; }
.sidebar-nav button[aria-selected="true"] { background: var(--blue-soft); color: var(--blue); box-shadow: inset 0 0 0 1px #dbeafe; }
.nav-icon { width: 20px; height: 20px; flex: 0 0 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle-glyph { width: 20px; height: 20px; flex: 0 0 20px; display: grid; place-items: center; }
.theme-toggle-icon { grid-area: 1 / 1; transition: opacity var(--motion-standard) var(--ease-out), transform var(--motion-standard) var(--ease-out); }
.theme-toggle-icon-sun { opacity: 0; transform: rotate(-16deg) scale(.86); }
:root[data-theme="dark"] .theme-toggle-icon-moon { opacity: 0; transform: rotate(16deg) scale(.86); }
:root[data-theme="dark"] .theme-toggle-icon-sun { opacity: 1; transform: rotate(0) scale(1); }
.sidebar-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; transition: opacity var(--motion-fast) var(--ease-out), transform var(--motion-standard) var(--ease-out); }
.sidebar-footer { display: grid; gap: 4px; padding: 12px; border-top: 1px solid #f0f1f3; }
.collapse-icon { transition: transform var(--motion-standard) var(--ease-in-out); }
.sidebar-backdrop { display: none; }

.sidebar-brand-copy strong {
  font-family: var(--body);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0;
}

.sidebar-brand-copy small {
  color: #64748b;
  font-family: var(--body);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: 0;
}

.sidebar-section-label {
  min-height: 22px;
  padding: 5px 10px 3px;
  color: #8b95a5;
  font-family: var(--body);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0;
  text-transform: none;
}

.sidebar-nav button,
.sidebar-collapse,
.sidebar-theme-toggle,
.sidebar-public-link {
  color: #334155;
  font-family: var(--body);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0;
}

.sidebar-home-link {
  color: #475569;
  font-size: 13px;
  font-weight: 600;
}

.sidebar-label {
  letter-spacing: 0;
}

.sidebar-nav button[aria-selected="true"] {
  font-weight: 700;
}

.app-frame { min-height: 100vh; margin-left: 256px; padding-top: 64px; }
.app-header {
  position: fixed;
  inset: 0 0 auto 256px;
  z-index: 30;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 28px;
  border-bottom: 1px solid rgba(229, 231, 235, .95);
  background: rgba(255, 255, 255, .98);
  box-shadow: 0 1px 0 rgba(15, 23, 42, .03);
}
.header-leading { min-width: 0; display: flex; align-items: center; gap: 12px; }
.header-leading h1 { font-size: 16px; line-height: 1.3; font-weight: 700; }
.header-leading p { margin-top: 2px; color: var(--muted); font-size: 12px; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.header-link { min-height: 34px; display: inline-flex; align-items: center; padding: 0 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: #4b5563; font-size: 12px; font-weight: 700; }
.header-link:hover { border-color: #bfdbfe; color: var(--blue); }
.mobile-menu-button { width: 38px; height: 38px; display: none; place-items: center; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: #4b5563; }
.phase { min-height: 28px; display: inline-flex; align-items: center; padding: 0 10px; border: 1px solid #a7f3d0; border-radius: 999px; background: var(--green-soft); color: #047857; font-size: 12px; font-weight: 700; }
.phase.ended { border-color: #fecaca; background: #fef2f2; color: #b91c1c; }
.phase.upcoming { border-color: #bfdbfe; background: var(--blue-soft); color: #1d4ed8; }

.app-main,
main.app-main { width: min(1360px, calc(100% - 48px)); margin: 0 auto; padding: 28px 0 56px; }
.sidebar-collapsed .app-sidebar { width: 72px; }
.sidebar-collapsed .app-frame { margin-left: 72px; }
.sidebar-collapsed .app-header { left: 72px; }
.sidebar-collapsed .sidebar-brand { padding: 0 18px; gap: 0; }
.sidebar-collapsed .sidebar-brand-copy,
.sidebar-collapsed .sidebar-label,
.sidebar-collapsed .sidebar-section-label { width: 0; opacity: 0; transform: translateX(-4px); pointer-events: none; }
.sidebar-collapsed .sidebar-nav button,
.sidebar-collapsed .sidebar-collapse,
.sidebar-collapsed .sidebar-theme-toggle,
.sidebar-collapsed .sidebar-public-link { gap: 0; justify-content: center; padding: 0; }
.sidebar-collapsed .collapse-icon { transform: rotate(180deg); }

input:not([type="checkbox"]):not([type="radio"]),
textarea,
select {
  width: 100%;
  min-height: 44px;
  padding: 10px 13px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  background-color: #fff;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
  box-shadow: 0 1px 1px rgba(15, 23, 42, .02);
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}
textarea { resize: vertical; }
select {
  appearance: none;
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
input:not([type="checkbox"]):not([type="radio"]):hover,
textarea:hover,
select:hover { border-color: #9ca3af; }
input:not([type="checkbox"]):not([type="radio"]):focus,
textarea:focus,
select:focus { border-color: var(--blue); outline: 0; box-shadow: 0 0 0 3px rgba(37, 99, 235, .14); }
input:disabled, textarea:disabled, select:disabled { cursor: not-allowed; background-color: #f3f4f6; color: #9ca3af; opacity: 1; }
.secret-input { -webkit-text-security: disc; }
.field { gap: 7px; margin-bottom: 16px; }
.field > span, .provider-switch legend { color: #374151; font-size: 12px; font-weight: 700; }
.field > small { color: var(--muted); font-size: 12px; }
.field input, .field textarea, .field select { min-height: 44px; padding: 10px 13px; border-color: #d1d5db; border-radius: 10px; }

.primary-command { min-height: 46px; padding: 0 16px; border: 1px solid var(--blue); border-radius: 10px; background: var(--blue); color: #fff; box-shadow: 0 4px 10px rgba(37, 99, 235, .18); font-size: 13px; }
.primary-command b { color: #dbeafe; font-size: 14px; }
.primary-command:hover { border-color: #1d4ed8; background: #1d4ed8; transform: translateY(-1px); }
.icon-button { min-width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: #4b5563; }
.icon-button:hover { border-color: #bfdbfe; background: var(--blue-soft); color: var(--blue); }
.icon-button.is-loading:disabled { background: var(--blue-soft); color: var(--blue); }

.contest-hero {
  position: relative;
  display: grid;
  min-height: 0;
  grid-template-columns: minmax(0, 1fr) 230px;
  border: 0;
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.contest-index { display: none; }
.hero-copy { position: relative; width: 100%; min-width: 0; align-self: start; overflow: hidden; padding: 0; border-radius: 14px 0 0 14px; background: #fff; isolation: isolate; }
.hero-copy::before { content: ""; display: block; width: 100%; padding-top: calc(552 / 1800 * 100%); }
.hero-backgrounds { position: absolute; inset: 0; z-index: 0; background: #fff; }
.hero-backgrounds > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transform: scale(1.06); transition: opacity 700ms ease; }
.hero-backgrounds > img.is-active { opacity: 1; }
.hero-background-indicator { position: absolute; top: 18px; right: 20px; z-index: 2; display: flex; gap: 6px; padding: 6px 8px; background: rgba(255, 255, 255, .88); }
.hero-background-indicator span { width: 18px; height: 3px; background: rgba(15, 23, 42, .22); }
.hero-background-indicator span.is-active { background: var(--blue); }
.hero-content { position: absolute; inset: 0; z-index: 2; padding: 0; color: #fff; }
.hero-copy[data-hero-background="light"] .hero-content { color: var(--ink); }
.kicker, .section-label { color: var(--blue); font-family: var(--body); font-size: 12px; font-weight: 700; }
.prize-block small,
.provider-switch small,
.judge-divider span,
.request-status-label,
.review-rank span,
.review-copy small,
.ranking-summary small { font-family: var(--body); text-transform: none; }
.hero-copy h1 { position: absolute; top: var(--hero-title-y, 40%); left: var(--hero-title-x, 5%); width: min(68%, calc(96% - var(--hero-title-x, 5%))); max-width: 760px; margin: 0; color: var(--hero-title-color, currentColor); font-size: var(--hero-title-size, 32px); line-height: 1.25; font-weight: 700; transform: translateY(-50%); overflow-wrap: anywhere; }
.contest-clock { position: absolute; top: var(--hero-countdown-y, 62%); left: var(--hero-countdown-x, 5%); width: min(68%, calc(96% - var(--hero-countdown-x, 5%))); margin: 0; transform: translateY(-50%); }
.contest-clock { color: var(--hero-countdown-color, currentColor); }
.contest-clock span { font-size: var(--hero-countdown-size, 18px); }
.contest-clock small { color: currentColor; font-size: var(--hero-countdown-label-size, 12px); opacity: .82; }
.prize-block { position: static; width: auto; min-height: 0; gap: 14px; padding: 24px; border-left: 1px solid rgba(153, 27, 27, .24); background: #fff7ed; }
.prize-block small { color: var(--amber); }
.prize-block strong { display: grid; gap: 5px; font-family: var(--body); line-height: 1.3; }
.prize-summary-label { color: #8a6a23; font-size: 12px; font-weight: 600; }
.prize-summary-values { color: var(--ink); font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; text-wrap: balance; overflow-wrap: anywhere; }
.contest-background-picker { min-width: 0; margin: 4px 0 20px; padding: 0; border: 0; }
.contest-background-picker legend { margin-bottom: 9px; color: #374151; font-size: 12px; font-weight: 700; }
.contest-background-picker > div { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.contest-background-picker label { position: relative; min-width: 0; cursor: pointer; }
.contest-background-picker input { position: absolute; top: 10px; left: 10px; z-index: 2; width: 18px; height: 18px; accent-color: var(--blue); }
.contest-background-picker label > span { display: grid; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.contest-background-picker input:checked + span { border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); }
.contest-background-picker img { width: 100%; aspect-ratio: 16 / 5; object-fit: contain; background: #fff; }
.contest-background-picker b { padding: 8px 10px; border-top: 1px solid var(--line); font-size: 13px; font-weight: 600; }
.hero-style-editor { margin: 0 0 20px; padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); }
.hero-style-editor > header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.hero-style-editor > header h2 { font-size: 14px; font-weight: 700; }
.hero-style-editor > header p { color: var(--muted); font-size: 12px; }
.hero-style-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.hero-style-controls > label { min-width: 0; display: grid; gap: 6px; color: #374151; font-size: 12px; font-weight: 600; }
.hero-style-controls > label > div { min-width: 0; display: grid; grid-template-columns: 48px minmax(0, 1fr); align-items: center; gap: 8px; }
.hero-style-controls > label:has(input[type="number"]) > div { grid-template-columns: minmax(0, 1fr) 24px; }
.hero-style-controls input[type="color"] { width: 48px; height: 42px; padding: 3px; border: 1px solid #d1d5db; border-radius: 8px; background: #fff; }
.hero-style-controls input[type="number"] { min-width: 0; }
.hero-style-controls code, .hero-style-controls em { min-width: 0; color: var(--muted); font-size: 12px; font-style: normal; font-weight: 500; }
.hero-style-controls code { overflow: hidden; text-overflow: ellipsis; }
.hero-position-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.hero-position-controls fieldset { min-width: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.hero-position-controls legend { padding: 0 5px; color: #374151; font-size: 12px; font-weight: 700; }
.hero-position-controls label { min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.hero-position-controls input { min-width: 0; }
.hero-position-controls em { font-size: 12px; font-style: normal; }
/* Shared percentage coordinate system for the admin preview and user hero. */
:root {
  --contest-hero-aspect: 3.8 / 1;
}
.hero-preview-toolbar {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  margin-top: 14px;
}
.hero-preview-layer-switch {
  min-width: 0;
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(96px, 1fr));
  overflow: hidden;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
}
.hero-preview-layer-switch button {
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  border-right: 1px solid #cbd5e1;
  background: #fff;
  color: #475569;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.hero-preview-layer-switch button:last-child { border-right: 0; }
.hero-preview-layer-switch button[aria-pressed="true"] {
  background: #111827;
  color: #fff;
}
.hero-preview-layer-switch button:focus-visible {
  position: relative;
  z-index: 1;
  outline: 2px solid #2563eb;
  outline-offset: -2px;
}
.hero-style-preview-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(120px, .26fr);
  align-items: stretch;
  margin-top: 14px;
  overflow: hidden;
  border: 1px solid #dbe2ec;
  border-radius: 10px;
  background: #fff;
}
.hero-style-preview {
  position: relative;
  width: 100%;
  min-width: 0;
  height: auto;
  min-height: 0;
  aspect-ratio: var(--contest-hero-aspect);
  margin: 0;
  overflow: hidden;
  /* Desktop: left rounded, right flat */
  border-radius: 10px 0 0 10px;
  background: #111827;
}
.hero-style-editor .hero-style-preview {
  height: auto;
  aspect-ratio: var(--contest-hero-aspect);
}
.hero-style-preview.is-blank { background: #fff; }
.hero-style-preview.is-blank .hero-preview-item { color: var(--ink); }
.hero-style-preview > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transform: none;
}
.hero-style-preview-prize {
  display: grid;
  align-content: center;
  gap: 8px;
  min-height: 0;
  height: auto;
  padding: 14px 12px;
  border-left: 1px solid #e5e7eb;
  /* Desktop: right rounded, left flat */
  border-radius: 0 10px 10px 0;
  background: #fff7ed;
  color: #9a5b10;
}
.hero-style-preview-prize small {
  font-size: 12px;
  font-weight: 600;
}
.hero-style-preview-prize strong {
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
}
.hero-preview-item {
  position: absolute;
  z-index: 2;
  width: max-content;
  max-width: min(68%, calc(96% - var(--hero-item-x, 5%)));
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  transform: translateY(-50%);
  cursor: default;
  touch-action: none;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}
.hero-preview-item.is-active {
  z-index: 4;
  cursor: grab;
  pointer-events: auto;
}
.hero-preview-item.is-active::before {
  content: "";
  position: absolute;
  inset: -10px;
}
.hero-preview-item.is-dragging {
  z-index: 8;
  cursor: grabbing;
}
.hero-preview-item.is-active:hover, .hero-preview-item.is-active:focus-visible, .hero-preview-item.is-dragging {
  outline: 1px dashed rgba(255, 255, 255, .88);
  outline-offset: 6px;
}
.hero-preview-item:focus-visible {
  outline: 2px solid #93c5fd;
  outline-offset: 6px;
}
/* Keep text origin on the true left/top % anchors (no padding offset). */
.hero-style-preview h3 {
  margin: 0;
  overflow-wrap: anywhere;
  font-family: var(--display);
  font-size: 32px;
  font-weight: 700;
  line-height: 1.25;
  pointer-events: none;
}
.hero-style-preview p {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0;
  pointer-events: none;
}
.hero-style-preview p strong { font-weight: 700; font-variant-numeric: tabular-nums; }
.hero-style-preview p span { font-weight: 500; opacity: .82; }
.hero-style-preview.is-blank .hero-preview-item.is-active:hover,
.hero-style-preview.is-blank .hero-preview-item.is-active:focus-visible,
.hero-style-preview.is-blank .hero-preview-item.is-dragging {
  outline-color: rgba(15, 23, 42, .45);
}
@media (max-width: 700px) {
  .hero-preview-toolbar { align-items: stretch; }
  .hero-preview-layer-switch { width: 100%; }
  .hero-style-preview-card { grid-template-columns: 1fr; }
  .hero-style-preview,
  .hero-style-editor .hero-style-preview {
    height: auto;
    min-height: 0;
    aspect-ratio: var(--contest-hero-aspect);
    /* Mobile: top corners rounded, bottom flat */
    border-radius: 10px 10px 0 0;
  }
  .hero-style-preview-prize {
    min-height: 72px;
    height: auto;
    border-top: 1px solid #e5e7eb;
    border-left: 0;
    /* Mobile: bottom corners rounded, top flat */
    border-radius: 0 0 10px 10px;
  }
}

:root[data-theme="dark"] .app-sidebar {
  border-color: var(--line);
  background: rgba(18, 22, 31, .98);
}
:root[data-theme="dark"] .sidebar-brand,
:root[data-theme="dark"] .sidebar-footer,
:root[data-theme="dark"] .app-header,
:root[data-theme="dark"] .settings-dialog-panel > header,
:root[data-theme="dark"] .settings-dialog-panel > footer {
  border-color: var(--line);
}
:root[data-theme="dark"] .sidebar-brand-copy small,
:root[data-theme="dark"] .header-leading p,
:root[data-theme="dark"] .settings-dialog-panel header p,
:root[data-theme="dark"] .composer-menu-copy small {
  color: var(--muted);
}
:root[data-theme="dark"] .sidebar-section-label {
  color: #798292;
}
:root[data-theme="dark"] .sidebar-nav button,
:root[data-theme="dark"] .sidebar-collapse,
:root[data-theme="dark"] .sidebar-theme-toggle,
:root[data-theme="dark"] .sidebar-public-link {
  color: #aeb5c4;
}
:root[data-theme="dark"] .sidebar-nav button:hover,
:root[data-theme="dark"] .sidebar-collapse:hover,
:root[data-theme="dark"] .sidebar-theme-toggle:hover,
:root[data-theme="dark"] .sidebar-public-link:hover {
  background: #1e2430;
  color: var(--ink);
}
:root[data-theme="dark"] .sidebar-nav button[aria-selected="true"] {
  background: var(--blue-soft);
  color: #b7aeff;
  box-shadow: inset 0 0 0 1px rgba(139, 124, 255, .24);
}
:root[data-theme="dark"] .app-header {
  background: rgba(18, 22, 31, .96);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .04);
}
:root[data-theme="dark"] .mobile-menu-button,
:root[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]),
:root[data-theme="dark"] textarea,
:root[data-theme="dark"] select,
:root[data-theme="dark"] .icon-button,
:root[data-theme="dark"] .composer-icon-button,
:root[data-theme="dark"] .canvas-download-command,
:root[data-theme="dark"] .canvas-preview-command,
:root[data-theme="dark"] .app-select-trigger,
:root[data-theme="dark"] .app-select-option,
:root[data-theme="dark"] .composer-menu-row,
:root[data-theme="dark"] .composer-menu-action,
:root[data-theme="dark"] .composer-model-refresh,
:root[data-theme="dark"] .composer-menu-back,
:root[data-theme="dark"] .generation-settings-dialog .provider-switch label {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--ink);
}
:root[data-theme="dark"] input::placeholder,
:root[data-theme="dark"] textarea::placeholder {
  color: #798292;
}
:root[data-theme="dark"] .mobile-menu-button:hover,
:root[data-theme="dark"] .icon-button:hover,
:root[data-theme="dark"] .composer-icon-button:hover,
:root[data-theme="dark"] .app-select-trigger:hover:not(:disabled),
:root[data-theme="dark"] .app-select-option:hover:not(:disabled),
:root[data-theme="dark"] .app-select-option:focus-visible,
:root[data-theme="dark"] .composer-menu-row:hover,
:root[data-theme="dark"] .composer-menu-item.is-open > .composer-menu-row,
:root[data-theme="dark"] .composer-menu-item:hover > .composer-menu-row,
:root[data-theme="dark"] .composer-menu-action:hover,
:root[data-theme="dark"] .composer-model-refresh:hover,
:root[data-theme="dark"] .composer-menu-back:hover,
:root[data-theme="dark"] .generation-settings-dialog .provider-switch label:hover {
  border-color: #3a4254;
  background: #272d3a;
  color: var(--ink);
}
:root[data-theme="dark"] .contest-agent-card,
:root[data-theme="dark"] .prompt-card,
:root[data-theme="dark"] .entry-panel,
:root[data-theme="dark"] .result-panel,
:root[data-theme="dark"] .score-detail-dialog,
:root[data-theme="dark"] .player-career-dialog,
:root[data-theme="dark"] .workbench-trace-detail-dialog,
:root[data-theme="dark"] .admin-profile-dialog,
:root[data-theme="dark"] .email-preview-dialog,
:root[data-theme="dark"] .confirm-dialog,
:root[data-theme="dark"] .generation-settings-dialog .settings-dialog-panel,
:root[data-theme="dark"] .generation-settings-dialog .entry-controls-grid,
:root[data-theme="dark"] .generation-settings-dialog .settings-block,
:root[data-theme="dark"] .profile-settings-nav,
:root[data-theme="dark"] .workbench-user-dashboard,
:root[data-theme="dark"] .app-select-menu,
:root[data-theme="dark"] .composer-model-menu,
:root[data-theme="dark"] .composer-submenu,
:root[data-theme="dark"] .canvas-score-popover > div {
  border-color: var(--line);
  background: var(--white);
  color: var(--ink);
  box-shadow: var(--shadow-md);
}
:root[data-theme="dark"] .generation-settings-dialog .settings-dialog-panel,
:root[data-theme="dark"] .settings-dialog-panel > header,
:root[data-theme="dark"] .settings-dialog-panel > footer {
  background: var(--white);
}
:root[data-theme="dark"] .generation-settings-dialog .provider-switch label:has(input:checked),
:root[data-theme="dark"] .app-select-option[aria-selected="true"],
:root[data-theme="dark"] .profile-settings-nav button[aria-selected="true"],
:root[data-theme="dark"] .composer-menu-item.is-open > .composer-menu-row {
  border-color: rgba(139, 124, 255, .28);
  background: var(--blue-soft);
  color: #b7aeff;
}
:root[data-theme="dark"] .settings-block-heading > span,
:root[data-theme="dark"] .generation-settings-dialog .judge-divider.settings-block-heading > span,
:root[data-theme="dark"] .save-ack-inline,
:root[data-theme="dark"] .profile-settings-nav,
:root[data-theme="dark"] .workbench-user-usage-head,
:root[data-theme="dark"] .composer-menu-title,
:root[data-theme="dark"] .composer-menu-subhead {
  background: var(--surface-soft);
  color: var(--muted);
}
:root[data-theme="dark"] .generation-settings-dialog .save-warning,
:root[data-theme="dark"] .save-warning,
:root[data-theme="dark"] .request-status.error {
  border-color: rgba(229, 177, 95, .26);
  background: var(--amber-soft);
  color: var(--amber);
}
:root[data-theme="dark"] .phase {
  border-color: rgba(91, 224, 174, .24);
  background: var(--green-soft);
  color: #7ff0c0;
}
:root[data-theme="dark"] .phase.ended,
:root[data-theme="dark"] .toast.error {
  border-color: rgba(255, 122, 141, .3);
  background: rgba(255, 122, 141, .14);
  color: var(--red);
}
:root[data-theme="dark"] .phase.upcoming {
  border-color: rgba(139, 124, 255, .3);
  background: var(--blue-soft);
  color: #b7aeff;
}
:root[data-theme="dark"] .toast {
  border-color: rgba(58, 66, 84, .92);
  background: rgba(23, 27, 36, .96);
  box-shadow: 0 12px 28px rgba(0, 0, 0, .36);
  color: var(--ink);
}
:root[data-theme="dark"] .sidebar-backdrop,
:root[data-theme="dark"] .generation-settings-dialog::backdrop,
:root[data-theme="dark"] .score-detail-dialog::backdrop,
:root[data-theme="dark"] .player-career-dialog::backdrop,
:root[data-theme="dark"] .workbench-trace-detail-dialog::backdrop,
:root[data-theme="dark"] .admin-profile-dialog::backdrop,
:root[data-theme="dark"] .email-preview-dialog::backdrop,
:root[data-theme="dark"] .confirm-dialog::backdrop {
  background: rgba(2, 4, 9, .64);
}
:root[data-theme="dark"] .score-detail-dialog,
:root[data-theme="dark"] .player-career-dialog,
:root[data-theme="dark"] .generation-settings-dialog,
:root[data-theme="dark"] .share-card-dialog,
:root[data-theme="dark"] .workbench-trace-detail-dialog,
:root[data-theme="dark"] .admin-profile-dialog,
:root[data-theme="dark"] .email-preview-dialog,
:root[data-theme="dark"] .confirm-dialog,
:root[data-theme="dark"] .composer-model-menu,
:root[data-theme="dark"] .composer-submenu,
:root[data-theme="dark"] .app-select-menu,
:root[data-theme="dark"] .profile-settings-nav,
:root[data-theme="dark"] .workbench-user-usage-list {
  scrollbar-color: var(--scrollbar-thumb) transparent;
}

@media (prefers-reduced-motion: no-preference) {
  html,
  body,
  .app-sidebar,
  .app-header,
  .contest-agent-card,
  .prompt-card,
  .entry-panel,
  .result-panel,
  .generation-settings-dialog .settings-dialog-panel,
  .composer-model-menu,
  .app-select-menu,
  .toast {
    transition: background-color 180ms var(--ease-out), border-color 180ms var(--ease-out), color 180ms var(--ease-out), box-shadow 180ms var(--ease-out);
  }
}

:root[data-theme="dark"] .prompt-band,
:root[data-theme="dark"] .entry-panel,
:root[data-theme="dark"] .result-panel,
:root[data-theme="dark"] .result-panel.is-empty,
:root[data-theme="dark"] .rolling-announcement,
:root[data-theme="dark"] .profile-unlock-panel,
:root[data-theme="dark"] .profile-form,
:root[data-theme="dark"] .podium-card,
:root[data-theme="dark"] .ranking-rules,
:root[data-theme="dark"] .ranking-list,
:root[data-theme="dark"] .score-detail-dialog,
:root[data-theme="dark"] .player-career-card,
:root[data-theme="dark"] .player-career-stats,
:root[data-theme="dark"] .archive-edition,
:root[data-theme="dark"] .award-lookup,
:root[data-theme="dark"] .admin-auth,
:root[data-theme="dark"] .contest-editor,
:root[data-theme="dark"] .contest-history,
:root[data-theme="dark"] .dashboard-toolbar,
:root[data-theme="dark"] .payout-list > .empty-state,
:root[data-theme="dark"] .payout-item,
:root[data-theme="dark"] .ranking-table-wrap,
:root[data-theme="dark"] .admin-submissions-wrap,
:root[data-theme="dark"] .audit-table-wrap,
:root[data-theme="dark"] .allowance-form,
:root[data-theme="dark"] .allowance-list,
:root[data-theme="dark"] .generation-settings-dialog .settings-dialog-panel,
:root[data-theme="dark"] .generation-settings-dialog .entry-controls-grid,
:root[data-theme="dark"] .composer-model-menu,
:root[data-theme="dark"] .composer-submenu,
:root[data-theme="dark"] .app-select-menu,
:root[data-theme="dark"] .workbench-user-dashboard {
  border-color: var(--line);
  background: var(--white);
  color: var(--ink);
}
:root[data-theme="dark"] .prompt-band p,
:root[data-theme="dark"] .prompt-band .prompt-adjustment-field > span,
:root[data-theme="dark"] .empty-state strong,
:root[data-theme="dark"] .score-detail-prompts h4,
:root[data-theme="dark"] .score-detail-prompts p {
  color: var(--muted);
}
:root[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]),
:root[data-theme="dark"] textarea,
:root[data-theme="dark"] select,
:root[data-theme="dark"] .provider-switch label,
:root[data-theme="dark"] .leaderboard-contest-picker select,
:root[data-theme="dark"] .submission-contest-picker select,
:root[data-theme="dark"] .submission-filters select,
:root[data-theme="dark"] .award-review-file input,
:root[data-theme="dark"] .award-review-publish,
:root[data-theme="dark"] .payout-actions button,
:root[data-theme="dark"] .submission-filter-actions .filter-reset,
:root[data-theme="dark"] .admin-email-copy,
:root[data-theme="dark"] .score-detail-head button {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--ink);
}
:root[data-theme="dark"] .prompt-band .section-label,
:root[data-theme="dark"] .panel-heading > span,
:root[data-theme="dark"] .provider-switch label:has(input:checked),
:root[data-theme="dark"] .profile-settings-nav button[aria-selected="true"],
:root[data-theme="dark"] .dashboard-mode-switch button[aria-pressed="true"],
:root[data-theme="dark"] .ranking-list .ranking-row.rank-first,
:root[data-theme="dark"] .ranking-list .ranking-row.rank-second,
:root[data-theme="dark"] .ranking-list .ranking-row.rank-third,
:root[data-theme="dark"] .podium-card.rank-1,
:root[data-theme="dark"] .podium-card.rank-3 {
  border-color: rgba(139, 124, 255, .28);
  background: var(--blue-soft);
  color: #b7aeff;
  box-shadow: inset 0 0 0 1px rgba(139, 124, 255, .18);
}
:root[data-theme="dark"] .ranking-list .ranking-row,
:root[data-theme="dark"] .ranking-table tbody tr,
:root[data-theme="dark"] .admin-submission-row,
:root[data-theme="dark"] .audit-row {
  border-color: var(--line);
  background: var(--white);
  color: var(--ink);
}
:root[data-theme="dark"] .ranking-list .ranking-row:hover,
:root[data-theme="dark"] .ranking-table tbody tr:hover {
  background: var(--surface-soft);
}
:root[data-theme="dark"] .ranking-list .ranking-row code,
:root[data-theme="dark"] .ranking-list .ranking-row small,
:root[data-theme="dark"] .ranking-table td,
:root[data-theme="dark"] .ranking-table code {
  color: var(--muted);
}
:root[data-theme="dark"] .score-detail-trigger,
:root[data-theme="dark"] .icon-score-detail-trigger,
:root[data-theme="dark"] .ranking-points-cell button {
  border-color: rgba(139, 124, 255, .3);
  background: var(--blue-soft);
  color: #b7aeff;
}
:root[data-theme="dark"] .prompt-adjustment-field,
:root[data-theme="dark"] .save-warning,
:root[data-theme="dark"] .request-status.error,
:root[data-theme="dark"] .payout-item.rank-first,
:root[data-theme="dark"] .payout-item.rank-third,
:root[data-theme="dark"] .award-action-label.needs-review {
  border-color: rgba(229, 177, 95, .26);
  background: var(--amber-soft);
  color: var(--amber);
}
:root[data-theme="dark"] .composer-model-trigger,
:root[data-theme="dark"] .composer-input-card,
:root[data-theme="dark"] .composer-input-shell,
:root[data-theme="dark"] .composer-footer,
:root[data-theme="dark"] .composer-toolbar {
  border-color: var(--line);
  background: var(--white);
  color: var(--ink);
}
:root[data-theme="dark"] .composer-input,
:root[data-theme="dark"] #promptAdjustment {
  background: var(--surface-soft);
  color: var(--ink);
}
:root[data-theme="dark"] .rolling-announcement-signal {
  background: rgba(229, 177, 95, .16);
  color: var(--amber);
  box-shadow: 10px 0 18px 5px rgba(23, 27, 36, .92);
}
:root[data-theme="dark"] .settings-dialog-panel h2,
:root[data-theme="dark"] .settings-block-heading h3,
:root[data-theme="dark"] .generation-settings-dialog .judge-divider.settings-block-heading h3,
:root[data-theme="dark"] .generation-settings-dialog .field > span,
:root[data-theme="dark"] .generation-settings-dialog .provider-switch span,
:root[data-theme="dark"] .generation-settings-dialog .app-select-trigger,
:root[data-theme="dark"] .generation-settings-dialog .app-select-option {
  color: var(--ink);
}
:root[data-theme="dark"] .settings-dialog-panel header p,
:root[data-theme="dark"] .settings-block-heading p,
:root[data-theme="dark"] .generation-settings-dialog .judge-divider.settings-block-heading p,
:root[data-theme="dark"] .generation-settings-dialog .provider-switch small,
:root[data-theme="dark"] .generation-settings-dialog .field > small,
:root[data-theme="dark"] .settings-dialog-panel .key-note {
  color: var(--muted);
}
:root[data-theme="dark"] .settings-block-heading > span,
:root[data-theme="dark"] .generation-settings-dialog .judge-divider.settings-block-heading > span {
  background: var(--surface-soft);
  color: var(--ink);
}
:root[data-theme="dark"] .generation-settings-dialog .provider-switch label {
  opacity: 1;
}
:root[data-theme="dark"] .generation-settings-dialog .provider-switch label:has(input:checked) {
  color: #b7aeff;
}
:root[data-theme="dark"] .generation-settings-dialog input,
:root[data-theme="dark"] .generation-settings-dialog select,
:root[data-theme="dark"] .generation-settings-dialog .app-select-trigger {
  border-color: #3a4254;
  background: #1e2330;
  color: var(--ink);
}
:root[data-theme="dark"] .settings-dialog-panel .key-note svg {
  color: #cfe0ff;
}
:root[data-theme="dark"] .generation-settings-dialog .save-warning strong,
:root[data-theme="dark"] .generation-settings-dialog .save-warning p {
  color: #f1c46f;
}

@media (prefers-reduced-motion: reduce) {
  .hero-backgrounds > img { transition: none; }
}
.prompt-band {
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 9px 14px;
  min-height: 94px;
  margin-top: 18px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.prompt-band .section-label {
  grid-column: 1;
  width: fit-content;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  border: 1px solid #dbeafe;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}
.prompt-content { min-width: 0; grid-column: 1; }
.prompt-band p { color: #334155; font-size: 14px; line-height: 1.7; }
#contestPrompt { max-height: clamp(180px, 32vh, 320px); padding-right: 10px; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; scrollbar-width: thin; scrollbar-color: transparent transparent; }
#contestPrompt:hover, #contestPrompt:focus-visible { scrollbar-color: rgba(71, 85, 105, .5) transparent; }
#contestPrompt:focus-visible { outline: 2px solid rgba(37, 99, 235, .35); outline-offset: 6px; }
#contestPrompt::-webkit-scrollbar { width: 8px; }
#contestPrompt::-webkit-scrollbar-track { background: transparent; }
#contestPrompt::-webkit-scrollbar-thumb { border: 2px solid transparent; border-radius: 8px; background: transparent; background-clip: padding-box; }
#contestPrompt:hover::-webkit-scrollbar-thumb, #contestPrompt:focus-visible::-webkit-scrollbar-thumb { background: rgba(71, 85, 105, .5); background-clip: padding-box; }
.prompt-band .icon-button {
  grid-column: 2;
  grid-row: 1 / 3;
  align-self: start;
}
.prompt-band .prompt-adjustment-field { margin: 16px 0 0; padding: 14px; }
.prompt-band .prompt-adjustment-field > span { color: #1f2937; font-size: 12px; }
.prompt-band .prompt-adjustment-field > small { color: var(--muted); }

.workbench { grid-template-columns: minmax(360px, .78fr) minmax(440px, 1.22fr); gap: 18px; margin-top: 18px; border: 0; background: transparent; }
.entry-panel, .result-panel { padding: 24px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: var(--shadow-sm); }
.entry-panel { border-right: 1px solid var(--line); }
.panel-heading { gap: 10px; margin-bottom: 22px; }
.panel-heading > span { min-width: 26px; height: 26px; display: grid; place-items: center; border-radius: 7px; background: var(--blue-soft); color: var(--blue); font-size: 12px; }
.panel-heading h1, .panel-heading h2 { font-size: 20px; font-weight: 700; }
.provider-switch { gap: 10px; margin-bottom: 20px; }
.provider-switch label { min-height: 60px; padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 10px; }
.provider-switch label:has(input:checked) { border-color: #93c5fd; background: var(--blue-soft); box-shadow: inset 0 0 0 1px #93c5fd; color: #1d4ed8; }
.key-loader { grid-template-columns: minmax(0, 1fr) 90px; gap: 8px; }
.key-loader button { border: 0; border-radius: 9px; background: #111827; font-size: 12px; }
.key-loader button:hover { background: var(--blue); }
.judge-divider { margin: 24px 0 16px; padding-top: 16px; border-color: var(--line); }
.judge-divider span { color: var(--blue); }
.save-warning { margin: 22px 0 16px; padding: 16px; border: 1px solid #fde68a; border-radius: 10px; background: var(--amber-soft); }
.save-warning strong { color: #92400e; font-size: 13px; }
.save-warning p { color: #78350f; font-size: 12px; }
.checkline input { accent-color: var(--blue); }
.key-note { margin-top: 12px; }
.key-note button { border-bottom: 0; color: var(--blue); }
.prompt-adjustment-field { border: 1px solid #bfdbfe; border-radius: 10px; background: #f8fbff; }

.empty-state {
  min-height: 180px;
  display: grid;
  place-content: center;
  gap: 6px;
  padding: 28px 20px;
  color: var(--muted);
  text-align: center;
}
.empty-state strong { color: #374151; font-family: var(--body); font-size: 14px; font-weight: 700; }
.empty-state span { color: var(--muted); font-family: var(--body); font-size: 12px; font-weight: 500; }
.board-empty.empty-state { border-top: 0; font-family: var(--body); font-size: inherit; }
.award-empty.empty-state { padding: 24px 16px; }
.allowance-empty.empty-state { min-height: 112px; padding: 20px 16px; }
.table-empty-row td { padding: 0 !important; }
.table-empty-row .empty-state { min-height: 220px; }

.result-panel { min-height: 580px; }
.result-panel.is-empty { background: #fff; color: var(--ink); }
.result-empty { min-height: 430px; }
.result-empty::before { content: ""; width: 64px; height: 64px; margin: 0 auto 10px; border-radius: 16px; background: var(--blue-soft); box-shadow: inset 0 0 0 1px #dbeafe; }
.result-empty b { color: #374151; font-size: 19px; font-weight: 700; }
.result-empty span { color: var(--muted); }
.generated-frame { min-height: 340px; border: 0; border-radius: 10px; background: #111827; }
.download-command { min-height: 38px; border: 1px solid #bfdbfe; border-radius: 9px; background: var(--blue-soft); color: #1d4ed8; }
.score-result { border-color: var(--line); border-radius: 10px; overflow: hidden; }
.score-item { border-color: var(--line); }
.score-total { border-color: #1f2937; background: #111827; }
.score-total strong { color: #93c5fd; }
.score-pending { background: var(--blue-soft); }
.retry-form { border: 1px solid #fecaca; border-radius: 10px; background: #fffafa; }
.retry-form input, .retry-form select, .retry-form button, .review-form input, .review-form button { border-color: #d1d5db; border-radius: 9px; }

.request-status { min-height: 112px; grid-template-columns: 154px minmax(0, 1fr) minmax(250px, .55fr); margin-top: 18px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: var(--shadow-sm); overflow: hidden; }
.request-status-label, .request-status-copy, .request-status-meta { padding: 18px 20px; }
.request-status-label { border-color: var(--line); }
.request-status-label strong { border: 0; border-radius: 999px; background: #f3f4f6; }
.request-status-copy h2 { font-size: 17px; font-weight: 700; }
.request-status-meta { border-color: var(--line); }
.request-status.running .request-status-label strong { background: var(--blue-soft); color: var(--blue); }
.request-status.success .request-status-label strong { background: var(--green-soft); color: #047857; }
.request-status.error { border-color: #fecaca; background: #fff; }
.request-status.error .request-status-label { border-color: #fecaca; }
.request-status.error .request-status-label strong { border: 0; background: #fef2f2; color: #b91c1c; }
.review-band { margin-top: 18px; border: 1px solid #fde68a; border-radius: 12px; background: var(--amber-soft); overflow: hidden; }
.review-rank { border-color: #fde68a; }
.review-rank strong { font-size: 44px; }
.review-copy h2 { font-size: 20px; }
.review-form { border-color: #fde68a; }

.leaderboard-section, .archive-section { min-height: auto; padding: 0 0 40px; }
.rolling-announcement { height: 54px; display: flex; align-items: center; margin-bottom: 16px; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: var(--shadow-sm); overflow: hidden; }
.rolling-announcement[hidden] { display: none; }
.rolling-announcement-signal { position: relative; z-index: 1; width: 34px; height: 34px; flex: 0 0 34px; display: grid; place-items: center; margin: 0 12px; border-radius: 50%; background: #fff4cc; color: #8a6100; box-shadow: 10px 0 18px 5px rgba(255,255,255,.94); }
.rolling-announcement-signal svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.rolling-announcement-viewport { min-width: 0; flex: 1; overflow: hidden; mask-image: linear-gradient(to right, transparent, #000 28px, #000 calc(100% - 28px), transparent); }
.rolling-announcement-track { width: max-content; display: flex; animation: rolling-announcement-scroll 32s linear infinite; will-change: transform; }
.rolling-announcement:hover .rolling-announcement-track, .rolling-announcement:focus-within .rolling-announcement-track { animation-play-state: paused; }
.rolling-announcement-group { display: flex; flex: 0 0 auto; align-items: center; padding-right: 64px; white-space: nowrap; font-size: 12px; font-weight: 700; }
.rolling-announcement-block a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.rolling-announcement-block code { padding: 2px 5px; border-radius: 4px; background: #f1f5f9; color: inherit; font-size: 12px; }
.rolling-announcement-separator { width: 4px; height: 4px; flex: 0 0 4px; margin: 0 20px; border-radius: 50%; background: #cbd5e1; }
@keyframes rolling-announcement-scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.profile-section { min-height: auto; padding: 0 0 40px; }
.profile-page-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.profile-page-head h2 { font-size: 22px; font-weight: 700; }
.profile-page-head p { margin-top: 5px; color: var(--muted); font-size: 12px; }
.profile-page-head > span { padding: 6px 9px; border: 1px solid #cbdcff; border-radius: 999px; background: #eff5ff; color: var(--blue); font-size: 12px; font-weight: 700; }
.profile-unlock-panel { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(260px, .85fr) auto; align-items: end; gap: 18px; padding: 20px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: var(--shadow-sm); }
.profile-unlock-panel > div strong { font-size: 14px; }
.profile-unlock-panel > div p { max-width: 460px; margin-top: 5px; color: var(--muted); font-size: 12px; line-height: 1.65; }
.profile-unlock-panel label { display: grid; gap: 7px; color: #4b5563; font-size: 12px; font-weight: 700; }
.profile-unlock-panel input { width: 100%; min-height: 42px; padding: 0 12px; border: 1px solid #d1d5db; border-radius: 9px; background: #fff; }
.profile-unlock-panel button { min-height: 42px; padding: 0 16px; border: 0; border-radius: 9px; background: var(--blue); color: #fff; font-size: 12px; font-weight: 700; cursor: pointer; }
.profile-unlock-panel.is-loading button { position: relative; color: transparent; }
.profile-unlock-panel.is-loading button::after { content: ""; position: absolute; inset: 0; width: 16px; height: 16px; margin: auto; border: 2px solid rgba(255,255,255,.45); border-top-color: #fff; border-radius: 50%; animation: career-spin 700ms linear infinite; }
.profile-editor { display: grid; grid-template-columns: minmax(0, .86fr) minmax(360px, 1.14fr); align-items: start; gap: 18px; margin-top: 18px; }
.profile-preview { position: sticky; top: 82px; min-height: 224px; display: grid; grid-template-columns: 52px minmax(0, 1fr); align-content: center; gap: 16px; padding: 28px; border: 1px solid rgba(111, 132, 170, .22); border-radius: 12px; background: #eaf2ff; box-shadow: var(--shadow-md); overflow: hidden; }
.profile-preview::after { content: ""; position: absolute; inset: auto 24px 20px 24px; height: 3px; border-radius: 3px; background: rgba(37, 99, 235, .68); }
.profile-preview-mark { width: 52px; height: 52px; display: grid; place-items: center; border: 1px solid rgba(37, 99, 235, .2); border-radius: 8px; background: rgba(255,255,255,.74); color: var(--blue); }
.profile-preview-mark svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.player-avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.24);
  border-radius: 9px;
  background: linear-gradient(145deg, #686871, #3f3f46);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 3px 8px rgba(15, 23, 42, .16);
}
.profile-preview-mark.player-avatar { width: 52px; height: 52px; flex-basis: 52px; background: linear-gradient(145deg, #686871, #3f3f46); color: #fff; font-size: 16px; }
.profile-preview > div { min-width: 0; }
.profile-preview small { color: #64748b; font-size: 12px; font-weight: 700; }
.profile-preview h3 { overflow: hidden; margin-top: 7px; color: #172033; font-size: 18px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.profile-preview p { margin-top: 10px; color: #46546a; font-size: 12px; line-height: 1.75; overflow-wrap: anywhere; }
.profile-preview-theme { position: absolute; top: 20px; right: 20px; padding: 5px 8px; border: 1px solid rgba(37, 99, 235, .18); border-radius: 999px; background: rgba(255,255,255,.68); color: #385483; font-size: 12px; font-weight: 700; }
.profile-preview.has-dark-background small, .profile-preview.has-dark-background p { color: rgba(255,255,255,.76); }
.profile-preview.has-dark-background h3 { color: #fff; }
.profile-preview.has-dark-background .profile-preview-mark, .profile-preview.has-dark-background .profile-preview-theme { border-color: rgba(255,255,255,.28); background: rgba(255,255,255,.14); color: #fff; }
.profile-form { display: grid; gap: 18px; padding: 22px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: var(--shadow-sm); }
.profile-form-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.profile-form-heading h3 { font-size: 16px; font-weight: 700; }
.profile-form-heading p { margin-top: 4px; color: var(--muted); font-size: 12px; }
.profile-color-field, .profile-avatar-field { display: grid; gap: 12px; padding: 0; border: 0; }
.profile-color-field legend, .profile-avatar-field legend { margin-bottom: 9px; color: #4b5563; font-size: 12px; font-weight: 700; }
.profile-color-row { display: flex; align-items: center; gap: 10px; }
.profile-color-row input { width: 48px; height: 38px; padding: 3px; border: 1px solid #d1d5db; border-radius: 8px; background: #fff; cursor: pointer; }
.profile-color-row code { color: #596579; font-size: 12px; }
.profile-color-swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.profile-color-swatches button { width: 28px; height: 28px; padding: 0; border: 2px solid #fff; border-radius: 50%; background: var(--swatch); box-shadow: 0 0 0 1px #cfd7e2; cursor: pointer; transition: transform 150ms ease, box-shadow 150ms ease; }
.profile-color-swatches button:hover { transform: translateY(-2px); box-shadow: 0 0 0 2px #9ab6f1; }
.leaderboard-head, .archive-heading { margin-bottom: 20px; }
.leaderboard-head { align-items: flex-end; }
.leaderboard-head-actions { display: flex; align-items: flex-end; gap: 10px; }
.leaderboard-contest-picker { width: min(420px, 44vw); display: grid; grid-template-columns: 1fr; gap: 5px; }
.leaderboard-contest-picker > span { color: var(--muted); font-size: 12px; font-weight: 700; }
.leaderboard-contest-picker select { min-height: 42px; padding: 0 38px 0 12px; border: 1px solid #d1d5db; border-radius: 9px; background-color: #fff; color: var(--ink); font-size: 12px; font-weight: 600; }
.leaderboard-contest-picker small { overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.archive-heading { display: flex; align-items: center; gap: 12px; }
.leaderboard-head h2, .archive-heading h2 { margin-top: 6px; font-size: 26px; font-weight: 700; }
.leaderboard-podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: stretch; gap: 14px; margin: 28px 0 20px; padding-top: 8px; }
.podium-card { min-width: 0; min-height: 306px; display: grid; grid-template-rows: auto auto auto minmax(48px, auto) auto; align-content: start; gap: 14px; padding: 20px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: var(--shadow-sm); }
.podium-card.rank-1 { border-color: #d6a72e; background: #fff8df; box-shadow: 0 12px 30px rgba(154, 107, 0, .1); transform: translateY(-8px); }
.podium-card.rank-2 { border-color: #94a3b8; background: #f3f6f9; }
.podium-card.rank-3 { border-color: #c77843; background: #fff1e8; }
.podium-card > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.podium-rank-label { min-height: 28px; display: inline-flex; align-items: center; padding: 0 10px; border: 1px solid currentColor; border-radius: 999px; font-size: 12px; font-weight: 700; }
.rank-1 .podium-rank-label { color: #9a6b00; }
.rank-2 .podium-rank-label { color: #526174; }
.rank-3 .podium-rank-label { color: #9a4f24; }
.podium-medal { color: var(--muted); font-size: 12px; font-weight: 700; }
.podium-person { min-width: 0; display: flex; align-items: center; gap: 12px; padding: 0; border: 0; background: transparent; color: var(--ink); cursor: pointer; text-align: left; }
.podium-person:hover .podium-name { color: var(--blue); }
.podium-person:focus-visible { outline: 3px solid rgba(37, 99, 235, .16); outline-offset: 4px; }
.player-avatar.podium-avatar { width: 58px; height: 58px; flex-basis: 58px; border-radius: 12px; font-size: 17px; }
.podium-name { min-width: 0; overflow: hidden; font-size: 14px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.podium-score { display: flex; align-items: baseline; gap: 8px; }
.podium-score strong { min-width: 2.4ch; font-size: 36px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.podium-score strong.is-counting { will-change: contents; }
.podium-card.rank-1 .podium-score strong { color: #9a6b00; }
.podium-card.rank-2 .podium-score strong { color: #526174; }
.podium-card.rank-3 .podium-score strong { color: #9a4f24; }
.podium-score span { color: var(--muted); font-size: 12px; }
.podium-signature { display: -webkit-box; overflow: hidden; color: #526174; font-size: 12px; line-height: 1.65; overflow-wrap: anywhere; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.podium-signature::before { content: "“"; margin-right: 2px; color: #94a3b8; font-size: 16px; }
.podium-career-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding-top: 14px; border-top: 1px solid rgba(148, 163, 184, .28); }
.podium-career-summary span { min-width: 0; display: grid; gap: 4px; color: var(--muted); font-size: 12px; text-align: center; }
.podium-career-summary b { overflow: hidden; color: #263246; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.ranking-rules { margin-bottom: 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; overflow: hidden; }
.ranking-rules div { border-color: var(--line); }
.ranking-head { border: 1px solid var(--line); border-radius: 10px 10px 0 0; background: #f9fafb; color: #6b7280; }
.ranking-list { border: 1px solid var(--line); border-top: 0; border-radius: 0 0 10px 10px; overflow: hidden; background: #fff; }
.ranking-list .leaderboard-empty {
  min-height: 224px;
  padding: 32px 20px;
  border-top: 0;
}
.ranking-row {
  min-height: 58px;
  border-color: var(--line);
  transition: background 150ms ease, box-shadow 150ms ease;
}
.ranking-row:hover { background: #f8fafc; }
.ranking-row .name { font-size: 13px; font-weight: 600; }
.ranking-skeleton-row {
  pointer-events: none;
}

.ranking-skeleton-row span {
  position: relative;
  overflow: hidden;
  height: 14px;
  border-radius: 999px;
  background: #eef2f7;
}

.ranking-skeleton-row span::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 28%, rgba(255, 255, 255, .72) 48%, transparent 68%);
  transform: translateX(-105%);
  animation: workspace-ranking-skeleton-sweep 1350ms linear infinite;
}

.ranking-skeleton-row span:first-child {
  width: 34px;
}

.ranking-skeleton-row span:nth-child(2) {
  width: min(240px, 70%);
}

.ranking-skeleton-row span:nth-child(3) {
  width: min(220px, 82%);
}

.ranking-skeleton-row span:last-child {
  justify-self: end;
  width: 54px;
}

.leaderboard-section.is-loading .leaderboard-podium,
.leaderboard-section.is-loading .pagination {
  display: none;
}

.player-career-trigger {
  min-width: 0;
  width: fit-content;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 7px;
  margin-left: -7px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.player-career-trigger .player-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-career-trigger:hover { background: #eef4ff; color: var(--blue); }
.player-career-trigger:focus-visible { outline: 3px solid rgba(37, 99, 235, .18); outline-offset: 1px; }
.ranking-row code { font-size: 12px; }
.ranking-row .points { font-family: var(--body); font-size: 19px; font-weight: 700; }
.ranking-points-cell { min-width: 0; display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.score-detail-trigger { min-height: 30px; padding: 0 10px; border: 1px solid #bfdbfe; border-radius: 6px; background: #eff6ff; color: #1d4ed8; font-size: 12px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.score-detail-trigger:hover { border-color: #93c5fd; background: #dbeafe; }
.score-detail-trigger:focus-visible { outline: 3px solid rgba(37, 99, 235, .2); outline-offset: 2px; }
.ranking-table { min-width: 980px; }
.ranking-table th:nth-child(1) { width: 60px; }
.ranking-table th:nth-child(2) { width: 190px; }
.ranking-table th:nth-child(3) { width: 120px; }
.ranking-table th:nth-child(4) { width: 200px; }
.ranking-table th:nth-child(5) { width: 150px; }
.ranking-table th:nth-child(6) { width: 180px; }
.ranking-table th:nth-child(7) { width: 80px; }
.ranking-table td:nth-child(2) > strong, .ranking-table td:nth-child(2) > small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-ranking-score-cell { display: inline-flex; align-items: center; gap: 9px; white-space: nowrap; }
.admin-ranking-score-cell > span { min-width: 2.5ch; display: grid; gap: 2px; }
.admin-ranking-score-cell > span small { color: var(--muted); font-size: 12px; }
.icon-score-detail-trigger { width: 32px; min-height: 32px; display: inline-grid; place-items: center; padding: 0; }
.ranking-points-cell .icon-score-detail-trigger { flex: 0 0 32px; }
.icon-score-detail-trigger .nav-icon { width: 16px; height: 16px; }
.score-detail-dialog { width: min(820px, calc(100% - 32px)); max-height: min(860px, calc(100vh - 32px)); max-height: min(860px, calc(100dvh - 32px)); padding: 0; overflow: hidden; border: 1px solid #d7dee8; border-radius: 12px; background: #fff; color: var(--ink); box-shadow: 0 24px 70px rgba(15, 23, 42, .22); }
.score-detail-dialog::backdrop { background: rgba(15, 23, 42, .58); }
.score-detail-dialog > div { max-height: inherit; display: grid; grid-template-rows: auto minmax(0, 1fr); }
.score-detail-head { min-width: 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding: 22px 24px 18px; border-bottom: 1px solid var(--line); background: #f8fafc; }
.score-detail-head > div { min-width: 0; }
.score-detail-head small { color: var(--blue); font-size: 12px; font-weight: 700; }
.score-detail-head h2 { margin-top: 4px; font-size: 22px; line-height: 1.2; font-weight: 700; }
.score-detail-head p { margin-top: 6px; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.score-detail-head button { flex: 0 0 38px; width: 38px; height: 38px; padding: 0; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: #475569; font-size: 24px; line-height: 1; cursor: pointer; }
.score-detail-head button:hover { border-color: #94a3b8; color: var(--ink); }
.score-detail-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 24px 24px; scrollbar-gutter: stable; }
.score-detail-body > section { padding: 22px 0; border-bottom: 1px solid var(--line); }
.score-detail-body > section:last-child { padding-bottom: 0; border-bottom: 0; }
.score-detail-body h3 { margin-bottom: 12px; color: #334155; font-size: 13px; font-weight: 700; }
.score-detail-breakdown { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: #f8fafc; }
.score-detail-breakdown span { min-width: 0; display: grid; gap: 4px; padding: 13px 12px; border-right: 1px solid var(--line); }
.score-detail-breakdown span:last-child { border-right: 0; }
.score-detail-breakdown small { color: var(--muted); font-size: 12px; line-height: 1.35; }
.score-detail-breakdown strong { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.score-detail-breakdown i { margin-left: 2px; color: var(--muted); font-size: 12px; font-style: normal; font-weight: 500; }
.score-detail-copy { max-height: 180px; padding-right: 8px; overflow-y: auto; color: #475569; font-size: 13px; line-height: 1.75; white-space: pre-wrap; overflow-wrap: anywhere; scrollbar-width: thin; scrollbar-color: #cbd5e1 transparent; }
.score-detail-prompts { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.score-detail-prompts > div { min-width: 0; padding-left: 14px; border-left: 3px solid #dbeafe; }
.score-detail-prompts h4 { margin-bottom: 7px; color: #334155; font-size: 12px; font-weight: 700; }
.score-detail-prompts p { max-height: 220px; padding-right: 8px; overflow-y: auto; color: #64748b; font-size: 12px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; scrollbar-width: thin; scrollbar-color: #cbd5e1 transparent; }
.score-detail-copy::-webkit-scrollbar, .score-detail-prompts p::-webkit-scrollbar { width: 7px; }
.score-detail-copy::-webkit-scrollbar-thumb, .score-detail-prompts p::-webkit-scrollbar-thumb { border: 2px solid transparent; border-radius: 8px; background: #cbd5e1; background-clip: padding-box; }
.score-detail-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.score-detail-meta div { min-width: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: #f8fafc; }
.score-detail-meta dt { margin: 0; color: var(--muted); font-size: 12px; font-weight: 600; }
.score-detail-meta dd { margin: 6px 0 0; color: #1f2937; font-size: 13px; font-weight: 600; line-height: 1.45; overflow-wrap: anywhere; word-break: break-word; }

.local-detail-meta {
  display: grid;
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.local-detail-meta > div {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 13px 16px;
  border-top: 1px solid #eef2f7;
}
.local-detail-meta > div:first-child { border-top: 0; }
.local-detail-meta > div:nth-child(odd) { background: #fbfcfd; }
.local-detail-meta dt {
  margin: 0;
  color: #64748b;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
}
.local-detail-meta dd {
  margin: 0;
  min-width: 0;
  display: grid;
  gap: 3px;
  color: #111827;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.local-detail-meta-main { display: block; }
.local-detail-meta-sub {
  display: block;
  color: #64748b;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.45;
}
.local-detail-meta code {
  display: block;
  margin: 0;
  color: #1e293b;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
  overflow-wrap: anywhere;
  word-break: break-all;
}
.ranking-row .rank { color: #4b5563; font-size: 12px; font-weight: 700; }
.ranking-score-details { grid-column: 1 / -1; width: 100%; margin: -1px 0 10px; border-top: 1px dashed var(--line); }
.ranking-score-details summary { width: fit-content; padding-top: 8px; color: var(--blue); font-size: 12px; font-weight: 700; cursor: pointer; }
.ranking-score-details-body { padding: 10px 0 2px; overflow-x: auto; }
.ranking-score-breakdown { min-width: 500px; display: grid; grid-template-columns: repeat(5, minmax(86px, 1fr)); border: 1px solid var(--line); border-radius: 8px; background: #f8fafc; }
.ranking-score-breakdown span { min-width: 0; display: grid; gap: 3px; padding: 10px 12px; border-right: 1px solid var(--line); }
.ranking-score-breakdown span:last-child { border-right: 0; }
.ranking-score-breakdown small { color: var(--muted); font-size: 12px; }
.ranking-score-breakdown strong { font-size: 15px; font-weight: 700; }
.ranking-score-breakdown i { margin-left: 2px; color: var(--muted); font-size: 12px; font-style: normal; font-weight: 600; }
.ranking-score-details-body > p { min-width: 500px; margin-top: 8px; color: var(--muted); font-size: 12px; line-height: 1.55; overflow-wrap: anywhere; }
.ranking-score-details-body > p b { margin-right: 7px; color: var(--ink); }
.ranking-list .ranking-row.top-rank { background: #f8fbff; box-shadow: inset 3px 0 0 #bfdbfe; }
.ranking-list .ranking-row.rank-first { background: #fff8df; box-shadow: inset 3px 0 0 #d6a72e; }
.ranking-list .ranking-row.rank-second { background: #f3f6f9; box-shadow: inset 3px 0 0 #94a3b8; }
.ranking-list .ranking-row.rank-third { background: #fff1e8; box-shadow: inset 3px 0 0 #c77843; }
.ranking-list .ranking-row.rank-first .rank,
.ranking-list .ranking-row.rank-first .points { color: #9a6b00; }
.ranking-list .ranking-row.rank-second .rank,
.ranking-list .ranking-row.rank-second .points { color: #526174; }
.ranking-list .ranking-row.rank-third .rank,
.ranking-list .ranking-row.rank-third .points { color: #9a4f24; }
.player-career-dialog {
  width: min(780px, calc(100% - 32px));
  max-height: min(820px, calc(100vh - 32px));
  padding: 0;
  border: 1px solid #dfe5ec;
  border-radius: 16px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 24px 70px rgba(15, 23, 42, .2);
  overflow: auto;
}
.player-career-dialog::backdrop { background: rgba(51, 65, 85, .56); }
.player-career-dialog[open] { animation: career-enter var(--motion-dialog) var(--ease-out) both; }
.player-career-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid #d9e0e8;
  border-radius: 8px;
  background: rgba(255, 255, 255, .92);
  color: #475569;
  font-size: 21px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(15, 23, 42, .06);
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, transform 160ms ease;
}
.player-career-close:hover { border-color: #b9c9f4; background: #edf4ff; color: var(--blue); transform: translateY(-1px); }
.player-career-content { min-height: 360px; }
.player-career-card { min-width: 0; }
.player-career-head {
  min-height: 148px;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  align-items: center;
  gap: 17px;
  padding: 28px 68px 28px 28px;
  border-bottom: 1px solid #dfe7f2;
  background: #f5f8fd;
  color: var(--ink);
}
.player-career-mark { width: 58px; height: 58px; display: grid; place-items: center; border: 1px solid #cbdcff; border-radius: 8px; background: #e8f0ff; color: var(--blue); box-shadow: 0 6px 16px rgba(37, 99, 235, .08); }
.player-career-mark svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.player-career-mark.player-avatar { width: 58px; height: 58px; flex-basis: 58px; border-color: rgba(255,255,255,.24); background: linear-gradient(145deg, #686871, #3f3f46); color: #fff; font-size: 17px; }
.player-career-head > div { min-width: 0; }
.player-career-head small { color: #64748b; font-size: 12px; font-weight: 700; }
.player-career-head h2 { overflow: hidden; margin-top: 5px; color: #172033; font-size: 21px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.player-career-head p { margin-top: 7px; color: #64748b; font-size: 12px; }
.player-career-signature { max-width: 490px; line-height: 1.55; overflow-wrap: anywhere; }
.player-career-meta { display: block; margin-top: 7px; color: #718096; font-size: 12px; }
.player-career-badge { align-self: center; padding: 7px 10px; border: 1px solid #b8dfcc; border-radius: 999px; background: #edf9f3; color: #24724b; font-size: 12px; font-weight: 700; white-space: nowrap; }
.player-career-head.has-dark-background small, .player-career-head.has-dark-background p, .player-career-head.has-dark-background .player-career-meta { color: rgba(255,255,255,.76); }
.player-career-head.has-dark-background h2 { color: #fff; }
.player-career-head.has-dark-background .player-career-mark, .player-career-head.has-dark-background .player-career-badge { border-color: rgba(255,255,255,.28); background: rgba(255,255,255,.14); color: #fff; }
.player-career-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border-bottom: 1px solid var(--line); background: #fff; }
.player-career-stats > div { min-width: 0; min-height: 116px; display: grid; align-content: center; padding: 17px; border-right: 1px solid var(--line); }
.player-career-stats > div:last-child { border-right: 0; background: #fff9e8; }
.player-career-stats small { color: var(--muted); font-size: 12px; font-weight: 700; }
.player-career-stats strong { overflow-wrap: anywhere; margin-top: 8px; font-size: 25px; line-height: 1; font-weight: 700; }
.player-career-stats span { margin-top: 7px; color: #8a928e; font-size: 12px; line-height: 1.35; }
.career-reward-stat strong { color: #9a6b00; font-size: 20px; }
.player-career-awards { padding: 24px 28px 18px; }
.player-career-awards > header { display: flex; align-items: baseline; justify-content: space-between; gap: 18px; margin-bottom: 12px; }
.player-career-awards h3 { font-size: 16px; font-weight: 700; }
.player-career-awards > header span { color: var(--muted); font-size: 12px; }
.player-career-awards ol { border-top: 1px solid var(--line); }
.career-award { min-height: 60px; display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); }
.career-award-rank { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: #f1f5f4; color: #53615a; font-size: 12px; font-weight: 700; }
.career-award.rank-1 .career-award-rank { background: #fff0b8; color: #8a6100; }
.career-award.rank-2 .career-award-rank { background: #e8edf2; color: #526174; }
.career-award.rank-3 .career-award-rank { background: #fde5d7; color: #9a4f24; }
.career-award > div { min-width: 0; display: grid; gap: 3px; }
.career-award strong { overflow: hidden; font-size: 12px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.career-award small { color: var(--muted); font-size: 12px; }
.career-award-value { color: #25744b; font-size: 12px; font-weight: 700; white-space: nowrap; }
.career-award-empty { min-height: 112px; display: grid; place-content: center; gap: 5px; color: var(--muted); text-align: center; }
.career-award-empty strong { color: var(--ink); font-size: 13px; }
.career-award-empty span { font-size: 12px; }
.player-career-card > footer { padding: 0 28px 22px; color: #8a928e; font-size: 12px; line-height: 1.6; }
.player-career-loading { min-height: 360px; display: grid; place-content: center; justify-items: center; gap: 12px; padding: 32px; color: var(--muted); text-align: center; }
.player-career-loading > span { width: 28px; height: 28px; border: 2px solid #dbe3df; border-top-color: var(--blue); border-radius: 50%; animation: career-spin 750ms linear infinite; }
.player-career-loading strong { color: var(--ink); font-size: 13px; }
.player-career-loading.is-error span { font-size: 12px; }
@keyframes career-enter { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes career-spin { to { transform: rotate(360deg); } }
.podium { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow-sm); }
.podium-entry { border-color: var(--line); }
.podium-entry:first-child { background: var(--amber-soft); }
.local-history-note { padding: 14px 16px; border: 1px solid #bfdbfe; border-radius: 10px; background: var(--blue-soft); font-size: 12px; line-height: 1.65; }
.local-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) minmax(200px, 1fr) auto;
  align-items: end;
  gap: 12px;
  margin: 0 0 16px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.local-filters > label { min-width: 0; display: grid; gap: 6px; }
.local-filters > label > span { color: var(--muted); font-size: 12px; font-weight: 600; }
.local-filters select {
  width: 100%;
  min-height: 40px;
  padding: 0 36px 0 12px;
  border: 1px solid #d1d5db;
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}
.local-filters select:focus { border-color: #93b4ff; outline: 3px solid rgba(37, 99, 235, .10); }
.local-filter-actions { display: flex; align-items: end; gap: 8px; flex-wrap: wrap; }
.local-filter-actions button {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.local-filter-actions button:hover { border-color: #bfdbfe; background: var(--blue-soft); color: var(--blue); }
.local-bulk-bar {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  min-height: 44px;
  margin-top: 2px;
  padding: 10px 12px;
  border: 1px solid #eef2f7;
  border-radius: 10px;
  background: #f8fafc;
}
.local-bulk-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  min-width: 0;
}
.local-select-all {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
.local-select-all input {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  margin: 0;
  accent-color: var(--blue);
  cursor: pointer;
}
.local-select-all span {
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
}
#deleteLocalSelected {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fff1f2;
  color: #b91c1c;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}
#deleteLocalSelected:hover:not(:disabled) { background: #fee2e2; }
#deleteLocalSelected:disabled { opacity: .45; cursor: not-allowed; }
#localSelectionMeta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}
#localFilterMeta {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}
.local-filters > p {
  grid-column: 1 / -1;
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.local-submission-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 12px;
  border-top: 0;
}
.local-submission-list > .empty-state { grid-column: 1 / -1; }
.archive-list { gap: 14px; }
.local-submission-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.local-submission-card.is-selected {
  border-color: #93c5fd;
  box-shadow: 0 0 0 1px #93c5fd, var(--shadow-sm);
}
.local-select {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .12);
  cursor: pointer;
}
.local-select input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--blue);
  cursor: pointer;
}
.archive-edition { border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: var(--shadow-sm); overflow: hidden; }
.local-thumb-button {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: #eef2f7;
  cursor: zoom-in;
  overflow: hidden;
}
.local-thumb-button img,
.local-submission-card > img {
  display: block;
  width: 100%;
  height: auto;
  min-height: 0;
  aspect-ratio: 1;
  border: 0;
  border-bottom: 1px solid var(--line);
  object-fit: cover;
  background: #eef2f7;
}
.local-score-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  min-width: 34px;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(17, 24, 39, .78);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}
.local-score-badge.is-pending { background: rgba(220, 38, 38, .9); }
.local-submission-detail {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 10px 12px;
}
.local-submission-detail h3 {
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  font-family: var(--body);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.local-submission-detail > small {
  color: var(--muted);
  font-family: var(--body);
  font-size: 12px;
  line-height: 1.4;
}
.local-submission-detail .local-model {
  display: block;
  margin-top: 0;
}
.local-submission-detail > .local-model code {
  display: block;
  overflow: hidden;
  color: #475569;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.local-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
  padding-top: 0;
}
.local-actions .download-command,
.local-actions .share-command,
.local-actions .retry-command {
  min-height: 30px;
  width: auto;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  line-height: 30px;
  text-decoration: none;
  cursor: pointer;
}
.local-actions .download-command:hover,
.local-actions .share-command:hover,
.local-actions .retry-command:hover {
  border-color: #bfdbfe;
  background: var(--blue-soft);
  color: var(--blue);
}
.local-actions .share-command:disabled,
.local-actions .retry-command:disabled {
  opacity: .45;
  cursor: not-allowed;
}
.local-actions .retry-command {
  border-color: #fde68a;
  background: #fffbeb;
  color: #b45309;
}
.local-actions .local-detail-command {
  min-height: 30px;
  width: auto;
  padding: 0 9px;
  border: 1px solid #bfdbfe;
  border-radius: 7px;
  background: var(--blue-soft);
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 600;
  line-height: 30px;
  cursor: pointer;
}
.local-actions .local-detail-command:hover {
  border-color: #93c5fd;
  background: #dbeafe;
  color: #1d4ed8;
}
.local-detail-preview-section { padding-top: 18px; }
.local-detail-preview {
  display: block;
  width: 100%;
  max-width: 280px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #eef2f7;
  overflow: hidden;
  cursor: zoom-in;
}
.local-detail-preview img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}
.score-detail-prompts.is-single { grid-template-columns: 1fr; }

.local-score-pending { color: var(--red); font-weight: 700; }
.archive-edition > header {
  min-height: 0;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
}
.archive-edition > header h3 { margin-top: 4px; font-size: 20px; line-height: 1.35; font-weight: 700; }
.archive-edition > header small { color: var(--muted); font-family: var(--body); font-size: 12px; }
.archive-edition > header > span {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid #dbeafe;
  border-radius: 999px;
  background: var(--blue-soft);
  color: #1d4ed8;
  font-family: var(--body);
  font-size: 12px;
  font-weight: 700;
}
.archive-winners {
  grid-template-columns: repeat(auto-fill, minmax(240px, 320px));
  justify-content: start;
  gap: 16px;
  padding: 18px;
  background: #f8fafc;
}
.archive-work {
  border-color: var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.archive-preview-button { position: relative; width: 100%; display: block; padding: 0; border: 0; background: #eef2f7; cursor: zoom-in; overflow: hidden; }
.archive-preview-button img { transition: transform var(--motion-dialog) var(--ease-out), filter var(--motion-dialog) ease; }
.archive-preview-button > span { position: absolute; right: 10px; bottom: 10px; min-height: 27px; display: inline-flex; align-items: center; padding: 0 9px; border-radius: 7px; background: rgba(17, 24, 39, .78); color: #fff; font-size: 12px; font-weight: 700; opacity: 0; transform: translateY(4px); transition: opacity var(--motion-standard) var(--ease-out), transform var(--motion-standard) var(--ease-out); }
.archive-preview-button:focus-visible img { transform: scale(1.025); filter: saturate(1.04); }
.archive-preview-button:focus-visible > span { opacity: 1; transform: translateY(0); }
@media (hover: hover) and (pointer: fine) {
  .archive-preview-button:hover img { transform: scale(1.025); filter: saturate(1.04); }
  .archive-preview-button:hover > span { opacity: 1; transform: translateY(0); }
}
.archive-preview-button:focus-visible { outline: 3px solid rgba(37, 99, 235, .26); outline-offset: -3px; }
.archive-work.rank-first { border-top: 3px solid #d6a72e; }
.archive-work.rank-second { border-top: 3px solid #94a3b8; }
.archive-work.rank-third { border-top: 3px solid #c77843; }
.archive-work figcaption { min-height: 50px; padding: 10px 12px; border-color: var(--line); }
.archive-career-trigger { min-width: 0; display: inline-flex; align-items: center; gap: 5px; margin-left: -6px; padding: 5px 6px; border: 0; border-radius: 6px; background: transparent; color: var(--ink); cursor: pointer; text-align: left; }
.archive-career-trigger b { flex: 0 0 auto; font-size: 12px; font-weight: 700; }
.archive-career-trigger span { min-width: 0; overflow: hidden; color: inherit; font-size: 12px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.archive-career-trigger:hover { background: var(--blue-soft); color: var(--blue); }
.archive-career-trigger:focus-visible { outline: 3px solid rgba(37, 99, 235, .2); outline-offset: 1px; }
.archive-work figcaption > span { color: var(--muted); font-family: var(--body); font-size: 12px; }
.pagination { gap: 10px; }
.pagination > label {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.pagination > label input[type="number"] {
  flex: 0 0 68px;
  width: 68px;
  height: 36px;
  min-height: 36px;
  margin: 0;
  padding: 0 8px;
  text-align: center;
}
.award-lookup { margin-bottom: 28px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: var(--shadow-sm); }
.profile-award-lookup { margin-top: 22px; margin-bottom: 0; }
.award-lookup input, .award-lookup button { border-color: #d1d5db; }
.award-lookup form.award-lookup-actions,
.profile-award-lookup form.award-lookup-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  align-self: center;
  justify-self: end;
  width: auto;
  max-width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  grid-template-columns: none;
}
.award-lookup form.award-lookup-actions button,
.profile-award-lookup form.award-lookup-actions button {
  width: auto;
  min-width: 0;
  min-height: 38px;
  flex: 0 0 auto;
  padding: 0 14px;
  border: 0;
  border-radius: 9px;
  background: var(--blue);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
}
.award-lookup form.award-lookup-actions button:hover:not(:disabled),
.profile-award-lookup form.award-lookup-actions button:hover:not(:disabled) {
  background: #1d4ed8;
}
.award-lookup form.award-lookup-actions button:disabled,
.profile-award-lookup form.award-lookup-actions button:disabled {
  background: #cbd5e1;
  color: #64748b;
  cursor: not-allowed;
}
.award-results { grid-column: 1 / -1; gap: 10px; padding-top: 18px; border-color: var(--line); }
.award-record {
  min-height: 0;
  grid-template-columns: 76px minmax(220px, 1fr) 104px 68px;
  align-items: center;
  gap: 12px 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.award-record:last-child { border-bottom: 1px solid var(--line); }
.award-record-rank { min-height: 58px; display: grid; align-content: center; padding-right: 14px; border-right: 1px solid var(--line); }
.award-record-rank small { color: var(--muted); font-size: 12px; font-weight: 700; }
.award-record-rank strong { margin-top: 3px; font-size: 26px; line-height: 1; font-weight: 700; }
.award-record-copy { min-width: 0; }
.award-record-copy small { color: var(--muted); font-size: 12px; }
.award-record-copy h3 { overflow: hidden; margin: 3px 0 0; font-size: 14px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.award-record-copy p { overflow: hidden; margin-top: 4px; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.award-action-label { width: fit-content; min-height: 23px; display: inline-flex; align-items: center; margin-top: 7px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.award-action-label.needs-review { background: #fff7ed; color: #c2410c; }
.award-action-label.pending { background: var(--blue-soft); color: #1d4ed8; }
.award-action-label.approved { background: var(--green-soft); color: #047857; }
.award-action-label.not-winner { background: #f3f4f6; color: #6b7280; }
.award-record-result { display: grid; gap: 5px; text-align: right; }
.award-record-result span { font-size: 13px; font-weight: 700; }
.award-record-result small { color: var(--muted); font-size: 12px; }
.award-record-preview { width: 64px; height: 64px; display: block; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: #f3f4f6; cursor: zoom-in; overflow: hidden; }
.award-record-preview img { width: 100%; height: 100%; display: block; object-fit: cover; transition: transform 180ms ease; }
.award-record-preview:hover img, .award-record-preview:focus-visible img { transform: scale(1.05); }
.award-record-preview:focus-visible { outline: 3px solid rgba(37, 99, 235, .2); outline-offset: 2px; }
.award-record .award-reward { margin-top: 0; border-color: var(--line); border-radius: 9px; }
.award-pagination { grid-column: 1 / -1; margin-top: 2px; padding-top: 4px; }
.award-review-form {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(150px, .52fr) minmax(220px, 1fr) minmax(180px, .72fr) auto;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 9px;
  border: 1px solid #c9d8ea;
  border-radius: 9px;
  background: linear-gradient(180deg, #fbfdff, #f5f9ff);
}
.award-review-intro { min-width: 0; align-self: center; }
.award-review-intro strong { color: #1d4ed8; font-size: 12px; font-weight: 700; }
.award-review-intro p { display: none; }
.award-review-file { min-width: 0; display: grid; gap: 4px; }
.award-review-file > span { color: #53657d; font-size: 12px; font-weight: 600; }
.award-review-file input { min-height: 36px; padding: 5px 7px; border: 1px solid #cad7e6; border-radius: 8px; background: #fff; color: #53657d; font-size: 12px; }
.award-review-publish { min-height: 36px; display: flex; align-items: center; gap: 8px; padding: 0 10px; border: 1px solid #d7e2ef; border-radius: 8px; background: #fff; color: #4b5f78; font-size: 12px; }
.award-review-publish input { width: 16px; height: 16px; flex: 0 0 auto; accent-color: var(--blue); }
.award-review-form > button {
  min-height: 36px;
  padding: 0 13px;
  align-self: center;
  border: 0;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.award-review-form > button:hover { background: #1d4ed8; }
.award-review-form > button:disabled { cursor: wait; opacity: .6; }
.pagination button, .pagination input { border-color: var(--line); border-radius: 8px; }
.archive-lightbox {
  width: 100vw;
  max-width: none;
  height: 100vh;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(15, 23, 42, .92);
}
.archive-lightbox::backdrop { background: rgba(15, 23, 42, .55); }
.archive-lightbox img { max-width: min(1400px, calc(100vw - 72px)); max-height: calc(100vh - 72px); border-radius: 8px; box-shadow: 0 24px 80px rgba(0, 0, 0, .42); }
.archive-lightbox button {
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 9px;
  background: rgba(15, 23, 42, .42);
  color: #fff;
  cursor: pointer;
}
.archive-lightbox button:hover { background: rgba(15, 23, 42, .72); }

html.admin-auth-pending .admin-login-shell { visibility: hidden; }
.admin-login-shell { min-height: 100vh; display: grid; place-content: center; gap: 20px; padding: 24px; background: var(--paper); }
.admin-login-brand { display: flex; align-items: center; justify-content: center; gap: 12px; }
.admin-login-brand img { width: 42px; height: 42px; }
.admin-login-brand span { display: grid; }
.admin-login-brand strong { font-size: 17px; }
.admin-login-brand small { color: var(--muted); font-size: 12px; }
.admin-auth { width: min(440px, calc(100vw - 32px)); max-width: none; display: grid; grid-template-columns: 1fr; gap: 16px; margin: 0; padding: 28px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: var(--shadow-md); }
.admin-auth-copy h1 { margin-top: 8px; font-size: 24px; }
.admin-auth-copy p { margin-top: 6px; color: var(--muted); font-size: 12px; }
.admin-auth .field { margin: 0; }
.admin-remember-login {
  margin: -2px 0 0;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 9px;
  background: #f8fafc;
}
.admin-remember-login strong { font-size: 13px; font-weight: 700; }
.admin-remember-login small { color: #64748b; font-size: 12px; line-height: 1.55; }
.admin-remember-login input { margin-top: 2px; }
.admin-app-shell { min-height: 100vh; }
.admin-grid { grid-template-columns: minmax(0, 1.25fr) minmax(300px, .58fr); gap: 18px; border: 0; background: transparent; }
.contest-editor, .contest-history { padding: 24px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: var(--shadow-sm); }
.contest-editor { border-right: 1px solid var(--line); }
.contest-form-heading button { border-color: var(--line); border-radius: 8px; }
.admin-toggle { margin: 6px 0 18px; padding: 14px; border: 1px solid #dbeafe; border-radius: 10px; background: #f8fbff; }
.reward-config { border-color: var(--line); }
.reward-fields, .reward-field-row { border-color: var(--line); }
.reward-field-row input { border-color: #d1d5db; border-radius: 9px; }
.reward-config-tools button { border-color: var(--line); border-radius: 8px; }
.contest-history-item { padding: 14px 10px; border-color: var(--line); border-radius: 9px; }
.contest-history-item:hover, .contest-history-item:focus-visible { background: #f9fafb; outline-color: #dbeafe; }
.history-actions button, .submission-actions button { border-color: var(--line); border-radius: 8px; }
.history-actions button:hover, .submission-actions button:hover { border-color: #bfdbfe; background: var(--blue-soft); color: var(--blue); }
.review-public-toggle { border-color: var(--line); border-radius: 8px; color: #047857; box-shadow: 0 1px 1px rgba(15, 23, 42, .02); }
.review-public-toggle:hover { border-color: #bbf7d0; background: var(--green-soft); }
.review-public-toggle-persistent { gap: 7px; }
.review-public-toggle-persistent input { appearance: none; position: relative; width: 30px; height: 18px; flex: 0 0 30px; margin: 0; border: 0; border-radius: 999px; background: #cbd5e1; cursor: pointer; transition: background 160ms ease; }
.review-public-toggle-persistent input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 12px; height: 12px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(15, 23, 42, .2); transition: transform 160ms ease; }
.review-public-toggle-persistent input:checked { background: #10b981; }
.review-public-toggle-persistent input:checked::after { transform: translateX(12px); }
.review-public-toggle-persistent input:disabled { cursor: wait; opacity: .65; }
.admin-email-cell { min-width: 0; display: flex; align-items: center; gap: 5px; }
.admin-email-value { min-width: 0; max-width: 100%; overflow: hidden; padding: 0; border: 0; background: transparent; color: var(--ink); font: inherit; text-align: left; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.admin-email-value:hover, .admin-email-value:focus-visible { color: var(--blue); text-decoration: underline; text-underline-offset: 3px; }
.admin-email-copy { flex: 0 0 auto; width: 25px; height: 25px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--muted); font-size: 13px; line-height: 1; cursor: pointer; }
.admin-email-copy:hover, .admin-email-copy:focus-visible { border-color: #bfdbfe; background: var(--blue-soft); color: var(--blue); }
.email-preview-dialog { width: min(520px, calc(100vw - 32px)); padding: 22px; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-md); }
.email-preview-dialog::backdrop { background: rgba(15, 23, 42, .48); }
.email-preview-dialog h2 { margin: 0; font-size: 18px; }
.email-preview-value { margin: 16px 0; padding: 12px; overflow-wrap: anywhere; border: 1px solid var(--line); border-radius: 8px; background: #f8fafc; color: var(--ink); font-family: var(--font-mono); font-size: 12px; line-height: 1.5; }
.dashboard-toolbar { margin-bottom: 18px; padding: 20px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: var(--shadow-sm); }
.dashboard-toolbar h2 { font-size: 24px; font-weight: 700; }
.dashboard-toolbar select { border-color: #d1d5db; border-radius: 10px; }
.dashboard-mode-switch { display: inline-flex; align-self: end; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: #f3f4f6; }
.dashboard-mode-switch button { min-height: 34px; padding: 0 15px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer; }
.dashboard-mode-switch button[aria-pressed="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(15, 23, 42, .12); }
.payout-toolbar { grid-template-columns: minmax(0, 1fr) minmax(260px, 360px) 170px 48px; }
.payout-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.payout-summary > span { min-height: 76px; display: grid; align-content: center; padding: 14px 18px; border-right: 1px solid var(--line); }
.payout-summary > span:nth-of-type(4) { border-right: 0; }
.payout-summary small { color: var(--muted); font-size: 12px; font-weight: 700; }
.payout-summary strong { margin-top: 4px; font-size: 25px; font-weight: 700; }
.payout-summary > p { grid-column: 1 / -1; padding: 10px 18px; border-top: 1px solid #fde68a; background: var(--amber-soft); color: #92400e; font-size: 12px; }
.payout-list { display: grid; gap: 10px; }
.payout-list > .empty-state { border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: var(--shadow-sm); }
.payout-item {
  min-width: 0;
  display: grid;
  grid-template-columns: 76px minmax(210px, 1fr) 132px 158px minmax(220px, auto);
  align-items: center;
  gap: 16px;
  min-height: 86px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.payout-item.rank-first { border-left: 3px solid #d6a72e; background: #fffdf5; }
.payout-item.rank-second { border-left: 3px solid #94a3b8; background: #fafbfc; }
.payout-item.rank-third { border-left: 3px solid #c77843; background: #fffaf7; }
.payout-rank, .payout-user, .payout-state { min-width: 0; display: grid; gap: 5px; }
.payout-rank small, .payout-state small { color: var(--muted); font-size: 12px; font-weight: 700; }
.payout-rank strong { font-size: 22px; font-weight: 700; }
.payout-user strong { overflow: hidden; font-size: 13px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.payout-user small { overflow: hidden; color: var(--muted); font-family: var(--font-mono); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.payout-state .status-tag, .payout-state .reward-state { width: fit-content; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.payout-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 7px; }
.payout-actions button { min-height: 34px; padding: 0 11px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: 12px; font-weight: 700; cursor: pointer; }
.payout-actions button:hover { border-color: #bfdbfe; background: var(--blue-soft); color: var(--blue); }
.payout-actions .danger-command:hover { border-color: #fecaca; background: #fef2f2; color: #b91c1c; }
.dashboard-kpis { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow-sm); }
.dashboard-kpis article { border-color: var(--line); }
.dashboard-kpis strong { font-size: 34px; }
.dashboard-kpis .dashboard-kpi-action { padding: 0; }
.dashboard-kpi-action > button { width: 100%; min-height: inherit; display: flex; flex-direction: column; padding: 18px; border: 0; background: #fff; color: var(--ink); text-align: left; cursor: pointer; }
.dashboard-kpi-action > button:hover { background: #fafbff; }
.dashboard-kpi-action > button:focus-visible { outline: 2px solid var(--blue); outline-offset: -3px; }
.dashboard-kpi-action > button > span { color: var(--blue); }
.provider-dashboard, .model-dashboard { border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-sm); }
.provider-dashboard > header, .model-dashboard > header, .provider-rows, .provider-rows > div, .model-usage-row { border-color: var(--line); }
.provider-dashboard h3, .model-dashboard h3 { font-size: 20px; }
.provider-rows progress, .model-usage-track { border: 0; border-radius: 999px; }
.ranking-summary { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.ranking-summary > span { border-color: var(--line); }
.ranking-table-wrap, .admin-submissions-wrap, .audit-table-wrap { border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: var(--shadow-sm); }
.ranking-table th, .audit-table th, .admin-submission-head { border-color: var(--line); background: #f9fafb; color: #6b7280; }
.ranking-table td, .audit-table td, .admin-submission { border-color: var(--line); }
.ranking-table tr:hover td, .audit-table tbody tr:hover td, .admin-submission:hover { background: #fafcff; }
.allowance-form { border: 1px solid var(--line); border-radius: 12px 12px 0 0; background: #fff; }
.submission-contest-picker { width: min(380px, 42vw); display: grid; gap: 5px; }
.submission-contest-picker > span { color: var(--muted); font-size: 12px; font-weight: 700; }
.submission-contest-picker select { min-height: 42px; padding: 0 38px 0 12px; border: 1px solid #d1d5db; border-radius: 9px; background-color: #fff; color: var(--ink); font-size: 12px; font-weight: 600; }
.allowance-form input { border-color: #d1d5db; border-radius: 9px; }
.allowance-form button { border: 0; border-radius: 9px; background: var(--blue); }
.allowance-list { border-color: var(--line); border-radius: 0 0 12px 12px; background: #fff; }
.submission-filters {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 170px 170px auto;
  align-items: end;
  gap: 12px;
  margin: 14px 0;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.submission-filters label { min-width: 0; display: grid; gap: 6px; }
.submission-filters label > span { color: var(--muted); font-size: 12px; font-weight: 700; }
.submission-filters input,
.submission-filters select { width: 100%; min-height: 40px; padding: 0 12px; border: 1px solid #d1d5db; border-radius: 9px; background-color: #fff; color: var(--ink); font-size: 12px; }
.submission-filters input:focus,
.submission-filters select:focus { border-color: #93b4ff; outline: 3px solid rgba(37, 99, 235, .10); }
.submission-filter-actions { display: flex; gap: 7px; }
.submission-filter-actions button { min-height: 40px; border: 1px solid var(--line); border-radius: 9px; font-size: 12px; font-weight: 700; cursor: pointer; }
.submission-filter-actions .filter-command { padding: 0 17px; border-color: var(--blue); background: var(--blue); color: #fff; }
.submission-filter-actions .filter-reset { width: 40px; padding: 0; background: #fff; color: var(--muted); font-size: 19px; }
.submission-filter-actions .filter-reset:hover { border-color: #bfdbfe; background: var(--blue-soft); color: var(--blue); }
.submission-filters > p { grid-column: 1 / -1; margin: -2px 0 0; color: var(--muted); font-size: 12px; }
.audit-filters { grid-template-columns: 110px 140px 120px 140px 150px minmax(200px, 1fr) 70px; border: 1px solid var(--line); border-radius: 12px 12px 0 0; background: #fff; }
.audit-filters input, .audit-filters select { border-color: #d1d5db; border-radius: 9px; }
.audit-source { width: fit-content; display: inline-flex; margin-bottom: 7px; padding: 3px 7px; border-radius: 5px; background: #eef2ff; color: #4338ca; font-size: 12px; font-weight: 700; }
.audit-source.workbench { background: #ecfdf5; color: #047857; }
.audit-source.admin { background: #fff7ed; color: #c2410c; }

.workbench-trace-admin, .application-admin { min-height: 620px; padding-top: 18px; }
.workbench-trace-filters { display: grid; grid-template-columns: 180px 140px minmax(180px, 240px) 130px minmax(240px, 1fr) auto; align-items: end; gap: 12px; margin-bottom: 14px; padding: 15px 16px; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: var(--shadow-sm); }
.workbench-trace-filters label { min-width: 0; display: grid; gap: 6px; }
.workbench-trace-filters label > span, .application-form-grid label > span, .application-retention-row label > span { color: var(--muted); font-size: 12px; font-weight: 600; }
.workbench-trace-filters input, .workbench-trace-filters select, .application-form-grid > label:not(.checkline) input, .application-form-grid select, .application-retention-row > label:not(.checkline) input { width: 100%; min-height: 42px; padding: 0 12px; border: 1px solid #d1d5db; border-radius: 7px; background: #fff; color: var(--ink); font-size: 13px; }
.workbench-trace-filters > div { display: flex; gap: 7px; }
.workbench-trace-filters button, .workbench-trace-image figcaption button, .workbench-trace-image figcaption a { min-height: 42px; padding: 0 14px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--ink); font-size: 13px; font-weight: 600; text-decoration: none; cursor: pointer; }
.workbench-trace-filters button:first-child { border-color: var(--ink); background: var(--ink); color: #fff; }
.workbench-trace-list { display: grid; gap: 8px; }
.workbench-trace-row { min-width: 0; min-height: 92px; display: grid; grid-template-columns: 72px minmax(140px, .95fr) minmax(260px, 1.8fr) 86px 104px 118px minmax(154px, auto); align-items: center; gap: 12px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: var(--shadow-sm); }
.workbench-trace-row:hover { border-color: #cfd6df; background: #fdfdfd; }
.workbench-trace-thumbnail { position: relative; width: 72px; height: 72px; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: #f1f5f9; }
.workbench-trace-thumbnail-button { width: 100%; height: 100%; display: block; padding: 0; border: 0; background: transparent; cursor: zoom-in; }
.workbench-trace-thumbnail-button:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.workbench-trace-thumbnail img { width: 100%; height: 100%; display: block; object-fit: cover; }
.workbench-trace-thumbnail > span:not(.workbench-trace-thumb-empty) { position: absolute; right: 4px; bottom: 4px; padding: 2px 5px; border-radius: 4px; background: rgba(17, 24, 39, .82); color: #fff; font-size: 12px; }
.workbench-trace-thumb-empty { color: #9ca3af; font-size: 22px; font-weight: 600; }
.workbench-trace-row-user, .workbench-trace-row-model, .workbench-trace-row-cost, .workbench-trace-row-backup { min-width: 0; }
.workbench-trace-row-user { display: grid; gap: 6px; font-size: 13px; }
.workbench-trace-row-user > small, .workbench-trace-row-cost small, .workbench-trace-row-backup small { color: var(--muted); font-size: 12px; }
.workbench-trace-row-model { display: grid; gap: 4px; }
.workbench-trace-row-model > div { min-width: 0; display: flex; align-items: center; gap: 7px; }
.workbench-trace-row-model > div strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.workbench-trace-row-model code, .workbench-trace-row-model p { min-width: 0; overflow: hidden; margin: 0; text-overflow: ellipsis; white-space: nowrap; }
.workbench-trace-row-model code { color: #4b5563; font-size: 12px; }
.workbench-trace-row-model p { color: var(--muted); font-size: 12px; }
.workbench-trace-row-cost, .workbench-trace-row-backup { display: grid; gap: 5px; }
.workbench-trace-row-cost strong, .workbench-trace-row-backup strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.workbench-trace-row > time { color: var(--muted); font-size: 12px; line-height: 1.5; }
.workbench-trace-row-actions { min-width: 0; display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.workbench-trace-detail-button { min-height: 34px; padding: 0 10px; border: 1px solid #cfd6df; border-radius: 6px; background: #fff; color: #374151; font-size: 12px; font-weight: 600; cursor: pointer; }
.workbench-trace-detail-button:hover { border-color: #93b4ff; background: var(--blue-soft); color: var(--blue); }
.workbench-trace-refresh-button { width: 34px; min-width: 34px; height: 34px; min-height: 34px; padding: 0; }
.workbench-trace-status { flex: 0 0 auto; display: inline-flex; padding: 4px 8px; border-radius: 5px; background: #f3f4f6; color: #4b5563; font-size: 12px; font-weight: 700; }
.workbench-trace-status.success { background: #ecfdf5; color: #047857; }
.workbench-trace-status.failed, .workbench-trace-status.rejected { background: #fef2f2; color: #b91c1c; }
.workbench-trace-status.running { background: #eff6ff; color: #1d4ed8; }
.workbench-trace-status.cancelled { background: #f3f4f6; color: #6b7280; }
.workbench-trace-detail-dialog { width: min(980px, calc(100% - 32px)); max-height: min(860px, calc(100vh - 32px)); padding: 0; overflow: hidden; border: 1px solid #d7dee8; border-radius: 10px; background: #fff; color: var(--ink); box-shadow: 0 24px 70px rgba(15, 23, 42, .22); }
.workbench-trace-detail-dialog::backdrop { background: rgba(15, 23, 42, .52); }
.workbench-trace-detail-dialog[open] { animation: career-enter 180ms cubic-bezier(.2,.7,.2,1) both; }
.workbench-trace-detail-dialog > div { max-height: inherit; overflow-y: auto; }
.workbench-trace-detail-head { min-height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 13px 16px 13px 20px; border-bottom: 1px solid var(--line); }
.workbench-trace-detail-head > div { min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 9px; }
.workbench-trace-detail-head h2 { overflow: hidden; margin: 0; font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }
.workbench-trace-detail-head time { color: var(--muted); font-size: 12px; white-space: nowrap; }
.workbench-trace-detail-head > button { width: 36px; height: 36px; flex: 0 0 36px; padding: 0; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--muted); font-size: 21px; cursor: pointer; }
.workbench-trace-detail-head > button:hover { background: #f3f4f6; color: var(--ink); }
.workbench-trace-detail-body { display: grid; grid-template-columns: minmax(0, 1fr) 300px; border-bottom: 1px solid var(--line); }
.workbench-trace-detail-copy { min-width: 0; padding: 18px 20px; border-right: 1px solid var(--line); }
.workbench-trace-prompt-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.workbench-trace-prompt-heading small { color: var(--muted); font-size: 12px; font-weight: 600; }
.workbench-trace-prompt-heading button { min-height: 28px; padding: 0 9px; border: 1px solid var(--line); border-radius: 5px; background: #fff; color: #374151; font-size: 12px; cursor: pointer; }
.workbench-trace-prompt-heading button:hover { border-color: #93b4ff; background: var(--blue-soft); color: var(--blue); }
.workbench-trace-detail-copy > p { max-height: 160px; margin: 8px 0 0; overflow-y: auto; color: var(--ink); font-size: 13px; line-height: 1.75; overflow-wrap: anywhere; white-space: pre-wrap; }
.workbench-trace-detail-copy details { margin-top: 12px; }
.workbench-trace-detail-copy summary { width: fit-content; color: var(--blue); font-size: 12px; font-weight: 600; cursor: pointer; }
.workbench-trace-detail-copy pre { max-height: 180px; margin: 8px 0 0; overflow: auto; padding: 10px; border: 1px solid var(--line); border-radius: 6px; background: #f8fafc; font: 12px/1.6 var(--mono); white-space: pre-wrap; }
.workbench-trace-error { margin-top: 12px; padding: 9px 10px; border-left: 3px solid #ef4444; background: #fef2f2; color: #991b1b; font-size: 12px; line-height: 1.6; }
.workbench-trace-detail-meta { display: grid; align-content: start; margin: 0; }
.workbench-trace-detail-meta > div { min-width: 0; display: grid; gap: 5px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.workbench-trace-detail-meta > div:last-child { border-bottom: 0; }
.workbench-trace-detail-meta dt { color: var(--muted); font-size: 12px; }
.workbench-trace-detail-meta dd { min-width: 0; display: grid; gap: 4px; margin: 0; font-size: 13px; }
.workbench-trace-detail-meta dd small { color: var(--muted); font-size: 12px; }
.workbench-trace-detail-images { padding: 14px 20px 17px; border-bottom: 1px solid var(--line); background: #fcfcfc; }
.workbench-trace-detail-images > header { display: flex; justify-content: space-between; margin-bottom: 10px; font-size: 13px; }
.workbench-trace-detail-images > header span { color: var(--muted); font-size: 12px; }
.workbench-trace-detail-images > div { display: flex; gap: 10px; overflow-x: auto; }
.workbench-trace-image { flex: 0 0 154px; margin: 0; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; background: #fff; }
.workbench-trace-image > button { width: 100%; height: 126px; display: block; padding: 0; border: 0; background: #f1f5f9; cursor: zoom-in; }
.workbench-trace-image img { width: 100%; height: 100%; display: block; object-fit: contain; }
.workbench-trace-image figcaption { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; padding: 7px; }
.workbench-trace-image figcaption button, .workbench-trace-image figcaption a { min-height: 30px; display: grid; place-items: center; padding: 0 6px; font-size: 12px; }
.workbench-trace-image figcaption span { grid-column: 1 / -1; color: var(--muted); font-size: 12px; text-align: center; }
.workbench-trace-no-image { min-height: 72px; display: grid; align-content: center; gap: 4px; color: var(--muted); }
.workbench-trace-no-image strong { color: var(--ink); font-size: 13px; }
.workbench-trace-no-image span { font-size: 12px; }
.workbench-trace-detail-ids { display: grid; gap: 10px; padding: 14px 20px 18px; }
.workbench-trace-detail-ids > div { min-width: 0; display: grid; grid-template-columns: 74px minmax(0, 1fr) auto; align-items: start; gap: 8px; }
.workbench-trace-detail-ids span { color: var(--muted); font-size: 12px; }
.workbench-trace-detail-ids code, .workbench-trace-detail-ids p { min-width: 0; margin: 0; overflow-wrap: anywhere; font-size: 12px; }
.workbench-trace-detail-ids p { display: flex; flex-wrap: wrap; gap: 6px; }
.workbench-trace-detail-ids button { min-height: 28px; padding: 0 9px; border: 1px solid var(--line); border-radius: 5px; background: #fff; color: var(--ink); font-size: 12px; cursor: pointer; }

.application-config-form { display: grid; gap: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: var(--shadow-sm); }
.application-config-form > section { padding: 20px; border-bottom: 1px solid var(--line); }
.application-config-form h3 { font-size: 16px; font-weight: 700; }
.application-config-form section > div > p { margin-top: 5px; color: var(--muted); font-size: 12px; }
.application-toggle-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 15px; }
.application-config-form .checkline { min-height: 68px; margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 7px; background: #fafafa; }
.application-config-form .checkline span { display: grid; gap: 4px; }
.application-config-form .checkline strong { font-size: 13px; }
.application-config-form .checkline small { color: var(--muted); font-size: 12px; line-height: 1.55; }
.application-policy-settings > .application-lock { margin-top: 15px; border-color: #bfdbfe; background: #f8fbff; }
.application-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; margin-top: 15px; }
.application-form-grid > label { min-width: 0; display: grid; gap: 6px; }
.application-form-grid > .wide { grid-column: 1 / -1; }
.application-form-grid > .compact { min-height: 48px; }
.application-retention-row { display: grid; grid-template-columns: minmax(0, 1fr) 220px; align-items: stretch; gap: 12px; margin-top: 15px; }
.application-retention-row > label:not(.checkline) { display: grid; align-content: center; gap: 6px; }
.application-retention-row > label > small { color: var(--muted); font-size: 12px; }
.application-form-actions { display: flex; justify-content: flex-end; padding: 14px 20px; background: #fafafa; }
.application-form-actions button { min-height: 42px; padding: 0 18px; border: 1px solid var(--ink); border-radius: 7px; background: var(--ink); color: #fff; font-size: 13px; font-weight: 600; cursor: pointer; }
.status-tag, .audit-status, .reward-state { border: 0; border-radius: 999px; }
.confirm-dialog { width: min(430px, calc(100% - 32px)); padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: var(--shadow-md); }
.confirm-dialog::backdrop { background: rgba(15, 23, 42, .48); }
.confirm-dialog form { padding: 20px; }
.confirm-dialog h2 { margin: 0; font-family: inherit; font-size: 17px; font-weight: 700; }
.confirm-dialog p { margin-top: 12px; font-size: 13px; line-height: 1.7; }
.confirm-dialog .confirm-actions { margin-top: 20px; }
.confirm-actions button { min-height: 38px; padding: 0 14px; border-color: var(--line); border-radius: 6px; font-size: 13px; }
.confirm-actions #confirmActionButton { border-color: var(--blue); background: var(--blue); }
.confirm-actions #confirmActionButton.danger { border-color: #dc5b70; background: #dc5b70; }
.toast {
  top: 50%;
  left: 50%;
  right: auto;
  bottom: auto;
  z-index: 120;
  width: max-content;
  max-width: min(440px, calc(100vw - 40px));
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(17, 24, 39, .92);
  color: #fff;
  box-shadow: 0 18px 48px rgba(15, 23, 42, .28);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  transform: translate(-50%, calc(-50% + 10px));
}
.toast.show { transform: translate(-50%, -50%); }
.toast.error {
  border-color: rgba(254, 202, 202, .55);
  background: rgba(185, 28, 28, .94);
  color: #fff;
}

body.app-body > .toast {
  left: calc(50% + 128px);
  max-width: min(440px, calc(100vw - 296px));
}

body.app-body.sidebar-collapsed > .toast {
  left: calc(50% + 36px);
  max-width: min(440px, calc(100vw - 112px));
}
.announcement-editor { display: grid; gap: 20px; padding: 20px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: var(--shadow-sm); }
.announcement-toggle { padding: 0 0 18px; border-bottom: 1px solid var(--line); }
.announcement-toggle span { display: grid; gap: 4px; }
.announcement-toggle strong { font-size: 12px; }
.announcement-toggle small, .announcement-preview-panel p, .announcement-blocks-heading p { color: var(--muted); font-size: 12px; }
.announcement-preview-panel { display: grid; gap: 12px; }
.announcement-preview-panel h3, .announcement-blocks-heading h3 { font-size: 14px; }
.announcement-preview-panel .rolling-announcement { margin-bottom: 0; }
.announcement-preview-empty { width: 100%; color: var(--muted); font-size: 12px; text-align: center; }
.announcement-blocks-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; padding-top: 2px; }
.announcement-blocks-heading button, .announcement-editor > .primary { min-height: 40px; padding: 0 18px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); font-size: 12px; font-weight: 700; cursor: pointer; }
.announcement-blocks-heading button { border-color: #bfdbfe; background: var(--blue-soft); color: var(--blue); }
.announcement-block-list { display: grid; gap: 10px; }
.announcement-block { display: grid; grid-template-columns: minmax(0, 1fr) 150px; gap: 12px 16px; padding: 15px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfd; }
.announcement-block > header { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.announcement-block > header > span { color: var(--muted); font-size: 12px; font-weight: 700; }
.announcement-block > header > div { display: flex; gap: 4px; }
.announcement-block > header button { width: 30px; height: 30px; padding: 0; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--muted); cursor: pointer; }
.announcement-block > header button:hover:not(:disabled) { border-color: #bfdbfe; background: var(--blue-soft); color: var(--blue); }
.announcement-block > header button:disabled { opacity: .3; cursor: not-allowed; }
.announcement-block label { min-width: 0; display: grid; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 700; }
.announcement-block label > span { display: flex; justify-content: space-between; gap: 8px; }
.announcement-block textarea { width: 100%; min-height: 74px; padding: 10px; border: 1px solid #d1d5db; border-radius: 8px; background: #fff; color: var(--ink); font-size: 12px; line-height: 1.55; resize: vertical; }
.announcement-color-control { align-content: start; grid-template-columns: 52px minmax(0, 1fr); }
.announcement-color-control > span { grid-column: 1 / -1; }
.announcement-color-control input { width: 52px; height: 40px; padding: 3px; border: 1px solid #d1d5db; border-radius: 8px; background: #fff; }
.announcement-color-control code { min-width: 0; min-height: 40px; display: flex; align-items: center; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--muted); font-size: 12px; }
.announcement-editor > .primary { justify-self: end; min-width: 160px; border-color: var(--blue); background: var(--blue); color: #fff; }
.profile-admin-toolbar { display: grid; grid-template-columns: minmax(260px, 1fr) auto; align-items: end; gap: 12px; margin-bottom: 16px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.profile-admin-toolbar label { display: grid; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 700; }
.profile-admin-toolbar input { min-height: 40px; padding: 0 12px; border: 1px solid #d1d5db; border-radius: 9px; }
.profile-admin-toolbar button { min-height: 40px; padding: 0 18px; border: 0; border-radius: 9px; background: var(--blue); color: #fff; font-size: 12px; font-weight: 700; cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.profile-admin, .admin-profile-list { min-width: 0; }
.admin-profile-table-wrap { position: relative; overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: var(--shadow-sm); }
.admin-profile-table { width: 100%; min-width: 900px; border-collapse: collapse; }
.admin-profile-table th { height: 42px; padding: 0 14px; border-bottom: 1px solid var(--line); background: #f8fafc; color: var(--muted); font-size: 12px; font-weight: 700; text-align: left; }
.admin-profile-table td { height: 68px; padding: 10px 14px; border-bottom: 1px solid #edf0f4; color: #334155; font-size: 12px; vertical-align: middle; }
.admin-profile-table tbody tr:last-child td { border-bottom: 0; }
.admin-profile-table tbody tr:hover { background: #f8fbff; }
.admin-profile-table th:last-child, .admin-profile-table td:last-child { width: 76px; text-align: right; }
.admin-profile-row-user { min-width: 210px; display: flex; align-items: center; gap: 10px; }
.admin-profile-row-user > div { min-width: 0; }
.admin-profile-avatar { width: 38px; height: 38px; flex-basis: 38px; font-size: 12px; }
.admin-profile-email { max-width: 230px; display: block; overflow: hidden; padding: 0; border: 0; background: transparent; color: var(--ink); font-size: 12px; font-weight: 700; text-align: left; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.admin-profile-email:hover, .admin-profile-email:focus-visible { color: var(--blue); text-decoration: underline; text-underline-offset: 3px; }
.admin-profile-row-user code { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; }
.admin-profile-signature { max-width: 310px; overflow: hidden; color: #475569; line-height: 1.55; text-overflow: ellipsis; white-space: nowrap; }
.admin-profile-current { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.admin-profile-current i { width: 16px; height: 16px; flex: 0 0 16px; border: 1px solid rgba(15, 23, 42, .12); border-radius: 5px; }
.admin-profile-counts { color: var(--muted); white-space: nowrap; }
.admin-profile-edit { min-height: 32px; padding: 0 12px; border: 1px solid #cbd5e1; border-radius: 8px; background: #fff; color: #334155; font-size: 12px; font-weight: 700; cursor: pointer; }
.admin-profile-edit:hover { border-color: var(--blue); background: var(--blue-soft); color: var(--blue); }
.admin-profile-dialog { width: min(920px, calc(100% - 32px)); max-height: calc(100vh - 32px); padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: #fff; color: var(--ink); box-shadow: 0 24px 70px rgba(15, 23, 42, .24); }
.admin-profile-dialog::backdrop { background: rgba(15, 23, 42, .48); }
.admin-profile-dialog[open] { animation: career-enter 180ms cubic-bezier(.2,.7,.2,1) both; }
.admin-profile-dialog-head { min-height: 82px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 16px 18px 16px 20px; border-bottom: 1px solid var(--line); background: #fff; }
.admin-profile-dialog-person { min-width: 0; display: flex; align-items: center; gap: 12px; }
.admin-profile-dialog-avatar { width: 46px; height: 46px; flex: 0 0 46px; font-size: 13px; }
.admin-profile-dialog-person > div { min-width: 0; }
.admin-profile-dialog-person small { display: block; margin-bottom: 3px; color: var(--blue); font-size: 12px; font-weight: 700; }
.admin-profile-dialog-person h2 { overflow: hidden; margin: 0; font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }
.admin-profile-dialog-person code { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.admin-profile-dialog-close { width: 38px; height: 38px; flex: 0 0 38px; padding: 0; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--muted); font-size: 21px; cursor: pointer; }
.admin-profile-dialog-close:hover { background: #f1f5f9; color: var(--ink); }
.admin-profile-preview { min-height: 390px; display: grid; grid-template-columns: minmax(260px, .72fr) minmax(320px, 1fr); }
.admin-profile-preview-banner { min-height: 390px; display: grid; place-items: center; border-right: 1px solid var(--line); }
.admin-profile-preview-avatar { width: 84px; height: 84px; font-size: 22px; box-shadow: 0 12px 34px rgba(15, 23, 42, .18); }
.admin-profile-preview-body { display: grid; align-content: center; gap: 24px; padding: 34px; }
.admin-profile-preview-signature { min-height: 52px; color: #334155; font-size: 16px; font-weight: 600; line-height: 1.65; }
.admin-profile-preview-body dl { display: grid; grid-template-columns: 1fr 1fr; margin: 0; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.admin-profile-preview-body dl div { min-height: 74px; padding: 14px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.admin-profile-preview-body dt { color: var(--muted); font-size: 12px; font-weight: 700; }
.admin-profile-preview-body dd { margin: 7px 0 0; font-size: 12px; font-weight: 700; }
.admin-profile-preview-edit { min-height: 42px; border-color: var(--blue); border-radius: 8px; background: var(--blue); color: #fff; cursor: pointer; }
.admin-profile-dialog-editor { max-height: calc(100vh - 116px); display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 18px; overflow-y: auto; background: #f8fafc; }
.admin-profile-editor, .admin-background-editor, .admin-avatar-editor { display: grid; align-content: start; gap: 10px; }
.admin-profile-dialog-editor h3 { margin: 0 0 2px; font-size: 12px; }
.admin-profile-editor label, .admin-background-editor label, .admin-avatar-editor label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; font-weight: 700; }
.admin-profile-editor textarea, .admin-profile-editor select, .admin-background-editor input, .admin-avatar-editor input { width: 100%; padding: 9px 10px; border: 1px solid #d1d5db; border-radius: 8px; background: #fff; font-size: 12px; }
.admin-profile-editor textarea { min-height: 74px; resize: vertical; }
.admin-profile-color { display: grid; grid-template-columns: 48px 1fr; gap: 8px; }
.admin-profile-avatar-controls { display: grid; grid-template-columns: 48px 1fr; gap: 8px; }
.admin-profile-color input[type="color"], .admin-profile-avatar-controls input[type="color"], .admin-avatar-editor input[type="color"] { width: 48px; height: 38px; padding: 3px; }
.admin-profile-dialog-editor button { min-height: 36px; padding: 0 12px; border: 1px solid #cbd5e1; border-radius: 8px; background: #fff; color: #334155; font-size: 12px; font-weight: 700; cursor: pointer; }
.admin-profile-dialog-editor button.primary { border-color: var(--blue); background: var(--blue); color: #fff; }
.admin-profile-editor, .admin-profile-assets, .admin-profile-rewards form { padding: 14px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.admin-profile-assets { display: grid; align-content: start; gap: 18px; }
.admin-profile-assets > div { display: grid; gap: 8px; }
.admin-profile-rewards { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.admin-background-colors { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.admin-avatar-grant-fields { display: grid; grid-template-columns: 1fr 58px; gap: 8px; }
.admin-background-list { display: flex; flex-wrap: wrap; gap: 6px; }
.admin-background-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 3px 5px 3px 9px; border: 1px solid var(--line); border-radius: 999px; background: #f8fafc; font-size: 12px; }
.admin-profile-dialog-editor .admin-background-chip button { min-height: 20px; width: 20px; padding: 0; border: 0; border-radius: 50%; background: #e2e8f0; }
.admin-avatar-chip i { width: 20px; height: 20px; display: grid; place-items: center; border-radius: 5px; color: #fff; font-size: 7px; font-style: normal; font-weight: 700; }

/* Windows readability pass */
html,
body,
button,
input,
textarea,
select {
  font-family: var(--body);
  font-synthesis: none;
  text-rendering: auto;
  -webkit-font-smoothing: auto;
  -moz-osx-font-smoothing: auto;
}

code,
.ranking-row code,
.ranking-table code,
.model-usage-row code,
.admin-submission code,
.audit-table code,
.email-preview-value,
.award-code code,
.local-model code,
.local-submission-id code {
  font-family: var(--font-mono);
  font-variant-ligatures: none;
}

.key-note,
.submission-quota,
.leaderboard-head p,
.leaderboard-contest-picker > span,
.leaderboard-contest-picker small,
.ranking-head,
.ranking-rules summary,
.ranking-prompt-details summary,
.ranking-score-details summary,
.dashboard-toolbar p,
.dashboard-toolbar label span,
.ranking-summary small,
.model-usage-head,
.admin-submission-head,
.audit-table th,
.audit-filters label > span,
.submission-contest-picker > span,
.submission-filters label > span,
.local-filters label > span,
.local-filters > p,
.profile-admin-toolbar label,
.announcement-block label,
.announcement-block > header > span {
  font-family: var(--body);
  letter-spacing: 0;
  text-transform: none;
}

.dashboard-toolbar,
.payout-summary,
.payout-item,
.dashboard-kpis,
.provider-dashboard,
.model-dashboard,
.ranking-summary,
.ranking-table-wrap,
.admin-submissions-wrap,
.audit-table-wrap,
.announcement-editor,
.profile-admin-toolbar,
.admin-profile-table-wrap,
.confirm-dialog,
.email-preview-dialog,
.admin-profile-dialog {
  border-radius: 8px;
}

.dashboard-toolbar,
.payout-summary,
.dashboard-kpis,
.provider-dashboard,
.model-dashboard,
.ranking-summary,
.ranking-table-wrap,
.admin-submissions-wrap,
.audit-table-wrap,
.announcement-editor,
.profile-admin-toolbar,
.admin-profile-table-wrap {
  box-shadow: var(--shadow-sm);
}

.sidebar-brand-copy strong,
.header-leading h1,
.leaderboard-head h2,
.archive-heading h2,
.profile-page-head h2,
.dashboard-toolbar h2,
.provider-dashboard h3,
.model-dashboard h3 {
  font-weight: 700;
}

.sidebar-brand-copy small,
.header-leading p,
.phase,
.field > small,
.provider-switch small,
.key-note,
.judge-divider p,
.save-warning p,
.request-status-copy p,
.request-status-meta dt,
.request-status-meta dd,
.leaderboard-head p,
.leaderboard-contest-picker > span,
.leaderboard-contest-picker small,
.ranking-rules p,
.ranking-prompt-details summary,
.ranking-prompt-details p,
.ranking-prompt-details b,
.ranking-score-details summary,
.ranking-score-breakdown small,
.ranking-score-breakdown i,
.ranking-score-details-body > p,
.local-history-note,
.local-prompts p,
.local-submission-detail > small,
.local-submission-id,
.local-score,
.local-submission-detail blockquote,
.archive-edition > header small,
.archive-edition > header > span,
.archive-work figcaption > span,
.award-lookup p,
.award-record-copy small,
.award-record-copy p,
.award-record-rank small,
.award-record-result small,
.award-action-label,
.award-identity-state small,
.award-review-intro p,
.award-review-file > span,
.award-review-publish,
.profile-preview small,
.profile-preview p,
.profile-form-heading p,
.profile-color-field legend,
.profile-avatar-field legend,
.player-career-head small,
.player-career-head p,
.player-career-meta,
.player-career-stats small,
.player-career-stats span,
.career-award small,
.player-career-awards > header span,
.player-career-card > footer,
.dashboard-toolbar p,
.dashboard-toolbar label span,
.dashboard-kpis span,
.provider-dashboard > header > span,
.model-dashboard > header > span,
.ranking-summary small,
.payout-summary small,
.payout-summary > p,
.payout-rank small,
.payout-state small,
.payout-user small,
.contest-history-item small,
.reward-rank span,
.reward-field-row label > span,
.reward-status small,
.prompt-details summary,
.prompt-details b,
.prompt-details p,
.allowance-form small,
.allowance-row small,
.submission-contest-picker > span,
.submission-filters label > span,
.submission-filters > p,
.admin-submission time,
.audit-filters label > span,
.audit-table small,
.announcement-toggle small,
.announcement-preview-panel p,
.announcement-blocks-heading p,
.announcement-block > header > span,
.announcement-block label,
.profile-admin-toolbar label,
.admin-profile-table th,
.admin-profile-row-user code,
.admin-profile-dialog-person small,
.admin-profile-dialog-person code,
.admin-profile-preview-body dt,
.admin-profile-editor label,
.admin-background-editor label,
.admin-avatar-editor label {
  font-size: 12px;
  line-height: 1.55;
  font-weight: 500;
}

.field > span,
.field > span small,
.provider-switch legend,
.provider-switch span,
.checkline,
.primary-command,
.key-loader button,
.download-command,
.key-note button,
.submission-quota,
.contest-clock small,
.prize-block small,
.sidebar-section-label,
.judge-divider span,
.score-pending span,
.score-item small,
.retry-heading span,
.retry-form label > span,
.retry-form label > small,
.submission-quota,
.request-status-label,
.request-status-label strong,
.review-rank span,
.review-copy small,
.share-card-controls p,
.share-card-controls button,
.save-warning p,
.leaderboard-contest-picker select,
.rolling-announcement-group,
.profile-unlock-panel label,
.profile-unlock-panel button,
.profile-form-heading h3,
.profile-color-row code,
.podium-rank-label,
.podium-medal,
.podium-name,
.podium-score span,
.podium-signature,
.podium-career-summary span,
.ranking-rules summary,
.ranking-head,
.ranking-row .rank,
.ranking-row .name,
.ranking-row code,
.ranking-row .points.is-hidden,
.ranking-score-breakdown strong,
.archive-career-trigger b,
.archive-career-trigger span,
.award-identity-state strong,
.award-review-intro strong,
.award-review-file input,
.award-review-form > button,
.pagination,
.pagination button,
.pagination input,
.pagination span,
.pagination label,
.admin-toggle small,
.dashboard-toolbar select,
.payout-user strong,
.payout-actions button,
.reward-field-row input,
.reward-state,
.review-public-toggle,
.allowance-form button,
.admin-submission-head,
.admin-submission code,
.attempt-number,
.status-tag,
.submission-actions button,
.audit-table code,
.audit-status,
.announcement-toggle strong,
.announcement-preview-empty,
.announcement-blocks-heading button,
.announcement-editor > .primary,
.announcement-block textarea,
.announcement-color-control code,
.profile-admin-toolbar button,
.admin-profile-table td,
.admin-profile-email,
.admin-profile-counts,
.admin-profile-edit,
.admin-background-chip,
.admin-profile-dialog-editor h3,
.admin-profile-editor textarea,
.admin-profile-editor select,
.admin-background-editor input,
.admin-avatar-editor input,
.admin-profile-dialog-editor button {
  font-size: 13px;
  line-height: 1.5;
}

.submission-quota,
.key-note,
.key-note button {
  font-family: var(--body);
}

.submission-quota {
  margin-top: 12px;
  color: #475569;
  font-weight: 500;
}

.key-note {
  width: fit-content;
  max-width: 100%;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-top: 12px;
  padding: 7px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  color: #64748b;
  font-size: 12px;
  line-height: 1.55;
}

.key-note::before {
  content: "i";
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: #e0ecff;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.key-note span {
  min-width: min(100%, 260px);
  flex: 1 1 260px;
}

.key-note button {
  padding: 2px 0;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.ranking-table th,
.model-usage-head,
.audit-table th {
  font-size: 12px;
  font-weight: 700;
}

.ranking-table td,
.audit-table td {
  font-size: 13px;
  line-height: 1.55;
}

.ranking-table td > small,
.ranking-table td > code,
.score-detail,
.winner-mark,
.ranking-normal,
.model-usage-row small,
.model-usage-row > span,
.model-usage-row code {
  font-size: 12px;
  line-height: 1.5;
}

.podium-score strong,
.ranking-row .points,
.rank-number,
.ranking-score,
.dashboard-kpis strong,
.provider-rows b,
.model-usage-row > b,
.payout-rank strong,
.admin-submission > strong,
.award-record-rank strong,
.award-record-result span,
.profile-page-head > span,
.profile-preview-theme,
.player-career-badge {
  font-variant-numeric: tabular-nums;
}

.podium-score strong {
  min-width: 2.6ch;
  font-weight: 700;
}

.podium-career-summary b,
.ranking-score-breakdown strong,
.ranking-summary strong,
.dashboard-kpis strong,
.payout-summary strong,
.provider-rows b,
.model-usage-row > b,
.rank-number,
.ranking-score {
  font-weight: 700;
}

.sidebar-brand-copy strong {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.25;
}

.sidebar-brand-copy small {
  color: #64748b;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.25;
}

.sidebar-section-label {
  min-height: 22px;
  padding: 5px 10px 3px;
  color: #8b95a5;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0;
  text-transform: none;
}

.sidebar-nav button,
.sidebar-collapse,
.sidebar-public-link {
  color: #334155;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0;
}

.sidebar-home-link {
  color: #475569;
  font-size: 13px;
  font-weight: 600;
}

.sidebar-nav button[aria-selected="true"] {
  font-weight: 700;
}

/* Font rendering guard for Windows/Edge */
.app-body,
.admin-body,
.app-body *,
.admin-body * {
  font-synthesis: none;
  text-rendering: auto;
  -webkit-font-smoothing: auto;
  -moz-osx-font-smoothing: auto;
}

.hero-copy h1,
.leaderboard-head h2,
.archive-heading h2,
.profile-page-head h2,
.dashboard-toolbar h2,
.provider-dashboard h3,
.model-dashboard h3,
.panel-heading h1,
.panel-heading h2,
.request-status-copy h2,
.review-copy h2,
.profile-form-heading h3,
.admin-auth-copy h1 {
  font-family: var(--display);
  font-weight: 700;
}

.sidebar-nav button,
.sidebar-collapse,
.sidebar-public-link,
.field > span,
.provider-switch legend,
.provider-switch span,
.prompt-band .section-label,
.primary-command,
.key-loader button,
.download-command,
.share-command,
.retry-command,
.pagination button,
.submission-actions button,
.history-actions button,
.payout-actions button,
.confirm-actions button,
.announcement-blocks-heading button,
.announcement-editor > .primary,
.profile-admin-toolbar button,
.admin-profile-edit,
.admin-profile-dialog-editor button {
  font-weight: 600;
}

.sidebar-nav button[aria-selected="true"],
.primary-command,
.key-loader button,
.podium-rank-label,
.ranking-table th,
.model-usage-head,
.admin-submission-head,
.audit-table th,
.status-tag,
.winner-mark,
.ranking-normal,
.reward-state,
.audit-status {
  font-weight: 700;
}

.podium-score strong,
.ranking-row .points,
.rank-number,
.ranking-score,
.dashboard-kpis strong,
.provider-rows b,
.model-usage-row > b,
.payout-rank strong,
.admin-submission > strong,
.award-record-rank strong,
.award-record-result span {
  font-family: var(--display);
  font-weight: 700;
}

.dashboard-kpis {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.dashboard-kpis .billing-kpi strong {
  font-size: 24px;
  overflow-wrap: anywhere;
}

.billing-dashboard {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.billing-dashboard > header {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.billing-dashboard h3 { font-size: 20px; font-weight: 700; }
.billing-dashboard header p { margin-top: 5px; color: var(--muted); font-size: 12px; }
.billing-dashboard header > strong { flex: 0 0 auto; font-size: 22px; font-weight: 700; }
.billing-breakdowns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.billing-breakdowns > div { min-width: 0; padding: 18px 20px; }
.billing-breakdowns > div:first-child { border-right: 1px solid var(--line); }
.billing-breakdowns h4 { margin-bottom: 10px; font-size: 13px; font-weight: 700; }
.billing-row { min-height: 38px; display: grid; grid-template-columns: minmax(0, 1fr) 64px 104px; align-items: center; gap: 10px; border-top: 1px solid var(--line); font-size: 13px; }
.billing-row > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.billing-row i { margin-right: 7px; color: var(--blue); font-size: 12px; font-style: normal; font-weight: 600; }
.billing-row small { color: var(--muted); font-size: 12px; text-align: right; }
.billing-row strong { font-size: 13px; font-weight: 700; text-align: right; }
.billing-empty { padding: 18px 0; color: var(--muted); font-size: 12px; }

.usage-admin { min-height: 620px; padding-top: 18px; }
.usage-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: var(--shadow-sm); }
.usage-summary > span { min-height: 88px; display: flex; flex-direction: column; justify-content: center; padding: 14px 18px; border-right: 1px solid var(--line); }
.usage-summary > span:nth-child(4) { border-right: 0; }
.usage-summary small { color: var(--muted); font-size: 12px; font-weight: 600; }
.usage-summary strong { margin-top: 6px; font-size: 24px; font-weight: 700; }
.usage-summary > p { grid-column: 1 / -1; margin: 0; padding: 10px 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.usage-filters { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(230px, auto) 120px 140px 120px 110px auto; align-items: end; gap: 12px; margin: 14px 0; padding: 15px 16px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: var(--shadow-sm); }
.usage-filters label { min-width: 0; display: grid; gap: 6px; }
.usage-filters label > span { color: var(--muted); font-size: 12px; font-weight: 600; }
.usage-filters input, .usage-filters select { width: 100%; min-height: 42px; padding: 0 12px; border: 1px solid #d1d5db; border-radius: 9px; background: #fff; font-size: 13px; }
.usage-date-range { min-width: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.usage-filter-actions { display: flex; gap: 7px; }
.usage-filter-actions button { min-height: 42px; padding: 0 14px; border: 1px solid var(--line); border-radius: 9px; background: #fff; font-size: 13px; font-weight: 600; cursor: pointer; }
.usage-filter-actions button:first-child { border-color: var(--blue); background: var(--blue); color: #fff; }
.usage-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: var(--shadow-sm); }
.usage-table { width: 100%; min-width: 1260px; border-collapse: collapse; table-layout: fixed; }
.usage-table th { height: 44px; padding: 0 14px; background: #f9fafb; color: #6b7280; font-size: 13px; font-weight: 700; text-align: left; }
.usage-table th:nth-child(1) { width: 170px; }
.usage-table th:nth-child(2) { width: 220px; }
.usage-table th:nth-child(3) { width: 190px; }
.usage-table th:nth-child(4) { width: 220px; }
.usage-table th:nth-child(5) { width: 210px; }
.usage-table th:nth-child(6) { width: 130px; }
.usage-table th:nth-child(7) { width: 250px; }
.usage-table td { height: 76px; padding: 12px 14px; border-top: 1px solid var(--line); font-size: 13px; vertical-align: middle; }
.usage-table td > strong, .usage-table td > small, .usage-table td > code, .usage-table td > time { display: block; }
.usage-table td > small { max-width: 220px; margin-top: 5px; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.usage-table td > code, .usage-table td > time { font-size: 13px; }
.usage-table td > code { margin-top: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usage-phase { display: inline-flex; padding: 3px 7px; border-radius: 6px; background: var(--blue-soft); color: var(--blue); font-size: 12px; font-weight: 600; }
.usage-phase.judge { background: #ecfdf5; color: #047857; }
.usage-cost { white-space: nowrap; }

@media (max-width: 1450px) {
  .usage-filters { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .usage-filter-query, .usage-date-range { grid-column: span 2; }
  .usage-filter-actions { grid-column: 1 / -1; justify-content: flex-end; }
}

.audit-table { min-width: 1480px; }
.audit-table th:nth-child(1) { width: 150px; }
.audit-table th:nth-child(2) { width: 200px; }
.audit-table th:nth-child(3) { width: 200px; }
.audit-table th:nth-child(4) { width: 250px; }
.audit-table th:nth-child(5) { width: 230px; }
.audit-table th:nth-child(6) { width: 230px; }
.audit-table th:nth-child(7) { width: 220px; }
.audit-pool-meta { display: grid; gap: 8px; }
.audit-pool-meta > span { min-width: 0; display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 2px 7px; align-items: center; }
.audit-pool-meta i { grid-row: 1 / 3; display: inline-flex; align-items: center; justify-content: center; min-height: 24px; border-radius: 6px; background: var(--blue-soft); color: var(--blue); font-size: 12px; font-style: normal; font-weight: 600; }
.audit-pool-meta strong, .audit-pool-meta small { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audit-pool-meta strong { font-size: 13px; font-weight: 600; }
.audit-pool-meta small { margin-top: 0; font-size: 12px; }
.audit-pool-empty { color: var(--muted); font-size: 12px; }

.admin-score-grid { display: grid; grid-template-columns: repeat(5, minmax(42px, 1fr)); overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.admin-score-grid > span { min-width: 0; padding: 7px 6px; border-right: 1px solid var(--line); text-align: center; }
.admin-score-grid > span:last-child { border-right: 0; }
.admin-score-grid small { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; }
.admin-score-grid strong { display: block; margin-top: 2px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.admin-score-grid i { color: var(--muted); font-size: 12px; font-style: normal; font-weight: 400; }
.ranking-comment-details { margin-top: 8px; }
.ranking-comment-details summary, .prompt-details summary { width: fit-content; color: var(--blue); font-size: 12px; font-weight: 600; cursor: pointer; }
.ranking-comment-details p { margin-top: 7px; color: var(--muted); font-size: 12px; line-height: 1.65; }
.submission-billing-meta { min-width: 0; display: grid; gap: 4px; }
.submission-billing-meta code, .submission-billing-meta small, .submission-billing-meta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.submission-billing-meta code { font-size: 13px; }
.submission-billing-meta small { color: var(--ink); font-size: 12px; font-weight: 600; }
.submission-billing-meta span { color: var(--muted); font-size: 12px; }

@media (max-width: 1180px) {
  .workbench { grid-template-columns: 1fr; }
  .entry-panel { border-right: 1px solid var(--line); }
  .admin-grid { grid-template-columns: 1fr; }
  .contest-editor { border-right: 1px solid var(--line); }
  .payout-item { grid-template-columns: 68px minmax(180px, 1fr) 128px 150px; }
  .payout-actions { grid-column: 2 / -1; justify-content: flex-start; }
  .dashboard-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dashboard-kpis article:nth-child(3n) { border-right: 0; }
  .dashboard-kpis article:nth-child(-n+3) { border-bottom: 1px solid var(--line); }
  .usage-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .usage-filter-query { grid-column: span 2; }
  .usage-date-range { grid-column: span 1; }
  .usage-filter-actions { grid-column: 1 / -1; }
  .audit-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .audit-query { grid-column: span 2; }
  .workbench-trace-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .workbench-trace-query { grid-column: span 2; }
}

@media (max-width: 1300px) and (min-width: 981px) {
  .workbench-trace-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .workbench-trace-query { grid-column: span 2; }
}

@media (max-width: 980px) {
  body.app-body > .toast,
  body.app-body.sidebar-collapsed > .toast {
    left: 50%;
    max-width: min(440px, calc(100vw - 40px));
  }

  .app-sidebar { transform: translateX(calc(-100% - 2px)); width: 256px; box-shadow: none; }
  .app-frame, .sidebar-collapsed .app-frame { margin-left: 0; }
  .app-header, .sidebar-collapsed .app-header { left: 0; }
  .sidebar-collapsed .app-sidebar { width: 256px; }
  .sidebar-collapsed .sidebar-brand-copy,
  .sidebar-collapsed .sidebar-label,
  .sidebar-collapsed .sidebar-section-label { width: auto; opacity: 1; transform: none; pointer-events: auto; }
  .sidebar-collapsed .sidebar-nav button,
  .sidebar-collapsed .sidebar-collapse,
  .sidebar-collapsed .sidebar-theme-toggle,
  .sidebar-collapsed .sidebar-public-link { gap: 12px; justify-content: flex-start; padding: 0 13px; }
  .sidebar-collapsed .collapse-icon { transform: none; }
  .sidebar-collapse { display: none; }
  .sidebar-mobile-open .app-sidebar { transform: translateX(0); box-shadow: var(--shadow-md); }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 35; border: 0; background: rgba(15, 23, 42, .42); opacity: 0; pointer-events: none; transition: opacity 180ms ease; }
  .sidebar-mobile-open .sidebar-backdrop { display: block; opacity: 1; pointer-events: auto; }
  .mobile-menu-button { display: grid; }
  .local-filters { grid-template-columns: 1fr; }
  .local-filter-actions { justify-content: flex-start; }
  .local-bulk-bar { align-items: flex-start; }
  .local-bulk-actions { width: 100%; }
  .local-submission-list { grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); }
  .submission-filters { grid-template-columns: minmax(240px, 1fr) 150px 150px; }
  .submission-filter-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .usage-filters { grid-template-columns: minmax(220px, 1fr) 160px; }
  .usage-filter-query { grid-column: 1 / -1; }
  .usage-filter-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .audit-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .audit-query { grid-column: 1 / -1; }
  .audit-filters > button { width: 100%; }
  .workbench-trace-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workbench-trace-query { grid-column: 1 / -1; }
  .workbench-trace-row { grid-template-columns: 64px minmax(0, 1fr) 90px 104px; }
  .workbench-trace-thumbnail { width: 64px; height: 64px; grid-row: 1 / span 2; }
  .workbench-trace-row-model { grid-column: 2; grid-row: 2; }
  .workbench-trace-row-cost { grid-column: 3; grid-row: 1; }
  .workbench-trace-row-backup { grid-column: 3; grid-row: 2; }
  .workbench-trace-row > time { grid-column: 4; grid-row: 1; }
  .workbench-trace-detail-button { grid-column: 4; grid-row: 2; }
  .app-header { padding: 0 18px; }
  .app-main, main.app-main { width: min(100% - 28px, 1360px); padding-top: 20px; }
  .payout-toolbar { grid-template-columns: minmax(0, 1fr) 170px 42px; }
  .payout-toolbar > div { grid-column: 1 / -1; }
}

@media (max-width: 700px) {
  .app-header { height: 60px; }
  .header-leading h1 { font-size: 15px; }
  .header-leading p { display: none; }
  .contest-hero { grid-template-columns: 1fr; }
  .prize-block { width: 100%; min-height: 84px; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; border-top: 1px solid var(--line); border-left: 0; background: var(--amber-soft); }
  .prize-block strong { justify-self: end; text-align: right; }
  .hero-copy h1 { font-size: min(var(--hero-title-size, 20px), 26px); }
  .contest-clock span { font-size: min(var(--hero-countdown-size, 18px), 20px); }
  .contest-clock small { font-size: min(var(--hero-countdown-label-size, 12px), 14px); }
  .prompt-band { grid-template-columns: 1fr 44px; }
  .prompt-band .section-label { grid-column: 1; padding: 0 9px; }
  .prompt-band .icon-button { grid-column: 2; grid-row: 1 / 3; }
  .prompt-band .prompt-adjustment-field { margin-top: 14px; }
  .entry-panel, .result-panel { padding: 18px; }
  .result-panel { min-height: 500px; }
  .request-status { grid-template-columns: 1fr; }
  .request-status-label { min-height: 72px; border-right: 0; border-bottom: 1px solid var(--line); }
  .request-status-meta { border-top: 1px solid var(--line); border-left: 0; }
  .review-band { grid-template-columns: 78px 1fr; }
  .review-form { grid-column: 1 / -1; border-top: 1px solid #fde68a; border-left: 0; }
  .field-pair { grid-template-columns: 1fr; gap: 0; }
  .leaderboard-head { align-items: stretch; flex-direction: column; }
  .ranking-points-cell { gap: 5px; }
  .ranking-points-cell .points { font-size: 16px; }
  .score-detail-trigger { min-height: 28px; padding: 0 7px; font-size: 12px; }
  .ranking-points-cell .icon-score-detail-trigger { flex-basis: 28px; width: 28px; padding: 0; }
  .score-detail-dialog { width: calc(100% - 20px); max-height: calc(100vh - 20px); max-height: calc(100dvh - 20px); border-radius: 9px; }
  .score-detail-head { padding: 18px 16px 15px; }
  .score-detail-head h2 { font-size: 19px; }
  .score-detail-body { padding: 0 16px 18px; }
  .score-detail-body > section { padding: 18px 0; }
  .score-detail-breakdown { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .score-detail-breakdown span { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .score-detail-breakdown span:nth-child(2n) { border-right: 0; }
  .score-detail-breakdown span:last-child { grid-column: 1 / -1; border-right: 0; border-bottom: 0; }
  .score-detail-prompts, .score-detail-meta { grid-template-columns: 1fr; }
  .local-detail-meta > div { grid-template-columns: 64px minmax(0, 1fr); gap: 10px; padding: 12px 14px; }
  .leaderboard-head-actions { align-items: flex-end; }
  .leaderboard-podium { grid-template-columns: 1fr; gap: 10px; margin-top: 20px; padding-top: 0; }
  .podium-card { min-height: 0; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto auto auto; gap: 11px 16px; padding: 17px; transform: none; }
  .podium-card.rank-1 { order: 1; transform: none; }
  .podium-card.rank-2 { order: 2; }
  .podium-card.rank-3 { order: 3; }
  .podium-card > header, .podium-signature, .podium-career-summary { grid-column: 1 / -1; }
  .podium-person { grid-column: 1; grid-row: 2; }
  .podium-score { grid-column: 2; grid-row: 2; align-self: center; }
  .podium-score strong { font-size: 30px; }
  .podium-signature { min-height: 0; }
  .leaderboard-contest-picker { width: 100%; }
  .player-career-dialog { width: min(100% - 20px, 620px); max-height: calc(100vh - 20px); }
  .player-career-head { grid-template-columns: 48px minmax(0, 1fr); min-height: 132px; gap: 13px; padding: 24px 54px 24px 20px; }
  .player-career-mark { width: 48px; height: 48px; }
  .player-career-head h2 { font-size: 18px; }
  .player-career-badge { grid-column: 2; width: fit-content; margin-top: -6px; }
  .player-career-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .player-career-stats > div { min-height: 94px; border-bottom: 1px solid var(--line); }
  .player-career-stats > div:nth-child(even) { border-right: 0; }
  .player-career-stats > div:nth-last-child(2) { border-bottom: 0; }
  .player-career-stats > div:last-child { grid-column: 1 / -1; min-height: 86px; border-top: 1px solid var(--line); border-bottom: 0; }
  .player-career-awards { padding: 20px 20px 14px; }
  .player-career-card > footer { padding: 0 20px 20px; }
  .profile-page-head { align-items: flex-start; }
  .profile-unlock-panel { grid-template-columns: 1fr; align-items: stretch; }
  .profile-editor { grid-template-columns: 1fr; }
  .profile-preview { position: relative; top: auto; min-height: 196px; padding: 24px 20px; }
  .archive-preview-button > span { opacity: 1; transform: none; }
  .provider-switch { grid-template-columns: 1fr; }
  .dashboard-toolbar { grid-template-columns: minmax(0, 1fr) 42px; }
  .dashboard-toolbar > div { grid-column: 1 / -1; }
  .payout-toolbar { grid-template-columns: minmax(0, 1fr) 42px; }
  .payout-toolbar > label { grid-column: 1 / -1; }
  .payout-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .payout-summary > span:nth-of-type(2) { border-right: 0; }
  .payout-summary > span:nth-of-type(-n+2) { border-bottom: 1px solid var(--line); }
  .payout-item { grid-template-columns: 58px minmax(0, 1fr); gap: 12px; }
  .payout-state, .payout-actions { grid-column: 1 / -1; }
  .payout-actions { justify-content: flex-start; }
  .allowance-form { grid-template-columns: 1fr 72px; }
  .allowance-form > div { grid-column: 1 / -1; }
  .allowance-form button { grid-column: 1 / -1; }
  .submission-filters { grid-template-columns: 1fr; padding: 14px; }
  .billing-breakdowns { grid-template-columns: 1fr; }
  .billing-breakdowns > div:first-child { border-right: 0; border-bottom: 1px solid var(--line); }
  .usage-summary { grid-template-columns: 1fr; }
  .usage-summary > span { border-right: 0; border-bottom: 1px solid var(--line); }
  .usage-summary > span:nth-child(4) { border-bottom: 0; }
  .usage-filters { grid-template-columns: 1fr; padding: 14px; }
  .usage-filter-query, .usage-filter-actions { grid-column: auto; }
  .usage-filter-actions { justify-content: stretch; }
  .usage-filter-actions button { flex: 1; }
  .audit-filters { grid-template-columns: 1fr; padding: 14px; }
  .audit-query { grid-column: auto; }
  .workbench-trace-filters { grid-template-columns: 1fr; padding: 14px; }
  .workbench-trace-query { grid-column: auto; }
  .workbench-trace-filters > div { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workbench-trace-row { grid-template-columns: 58px minmax(0, 1fr) auto; gap: 8px 10px; padding: 8px; }
  .workbench-trace-thumbnail { width: 58px; height: 58px; grid-column: 1; grid-row: 1 / span 2; }
  .workbench-trace-row-user { grid-column: 2; grid-row: 1; }
  .workbench-trace-row-model { grid-column: 2 / 4; grid-row: 2; }
  .workbench-trace-row-cost { grid-column: 1 / 2; grid-row: 3; }
  .workbench-trace-row-backup { grid-column: 2; grid-row: 3; }
  .workbench-trace-row > time { grid-column: 3; grid-row: 1; text-align: right; }
  .workbench-trace-row-actions { grid-column: 3; grid-row: 3; }
  .workbench-trace-detail-dialog { width: calc(100% - 20px); max-height: calc(100vh - 20px); }
  .workbench-trace-detail-head > div { grid-template-columns: auto minmax(0, 1fr); }
  .workbench-trace-detail-head time { grid-column: 1 / -1; }
  .workbench-trace-detail-body { grid-template-columns: 1fr; }
  .workbench-trace-detail-copy { border-right: 0; border-bottom: 1px solid var(--line); }
  .workbench-trace-detail-ids > div { grid-template-columns: 1fr auto; }
  .workbench-trace-detail-ids > div > span { grid-column: 1 / -1; }
  .application-toggle-grid, .application-form-grid, .application-retention-row { grid-template-columns: 1fr; }
  .application-form-grid > .wide { grid-column: auto; }
  .contest-background-picker > div { grid-template-columns: 1fr; }
  .hero-style-controls { grid-template-columns: 1fr; }
  .hero-position-controls { grid-template-columns: 1fr; }
  .hero-style-editor > header { align-items: flex-start; flex-direction: column; gap: 3px; }
  .submission-filter-actions { grid-column: auto; justify-content: stretch; }
  .submission-filter-actions .filter-command { flex: 1; }
  .profile-admin-toolbar { grid-template-columns: 1fr; }
  .admin-profile-dialog { width: min(100% - 20px, 920px); max-height: calc(100vh - 20px); }
  .admin-profile-preview { grid-template-columns: 1fr; }
  .admin-profile-preview-banner { min-height: 180px; border-right: 0; border-bottom: 1px solid var(--line); }
  .admin-profile-preview-body { padding: 22px; }
  .admin-profile-dialog-editor { grid-template-columns: 1fr; }
  .announcement-block { grid-template-columns: 1fr; }
  .announcement-block > header, .announcement-color-control { grid-column: auto; }
  .announcement-blocks-heading { align-items: stretch; flex-direction: column; }
  .announcement-editor > .primary { width: 100%; justify-self: stretch; }
  .admin-profile-rewards { grid-column: auto; grid-template-columns: 1fr; }
  .award-lookup { padding: 18px; }
  .award-record { grid-template-columns: 58px minmax(0, 1fr) 78px; gap: 10px; padding: 12px; }
  .award-record-rank { min-height: 52px; padding-right: 10px; }
  .award-record-rank strong { font-size: 22px; }
  .award-record-copy h3, .award-record-copy p { white-space: normal; }
  .award-record-result span { font-size: 12px; }
  .award-record-preview { grid-column: 1; width: 52px; height: 52px; }
  .review-head-actions { width: 100%; align-items: flex-end; flex-direction: row; }
  .submission-contest-picker { width: 100%; }
  .award-review-form { grid-template-columns: 1fr; grid-template-rows: auto; gap: 8px; padding: 9px; }
  .award-review-intro, .award-review-form > button { grid-column: auto; grid-row: auto; }
  .award-review-form > button { min-height: 38px; }
}

@media (prefers-reduced-motion: reduce) {
  .app-sidebar, .app-frame, .sidebar-brand-copy, .sidebar-label, .collapse-icon { transition: none; }
  .rolling-announcement-track { animation: none; }
  .rolling-announcement-group:nth-child(2) { display: none; }
}

/* Contest workspace */
main.app-main:has(.contest-agent-shell:not([hidden])),
main.app-main.is-contest-workspace {
  width: calc(100% - clamp(24px, 2vw, 40px));
  max-width: none;
  padding-top: 12px;
  padding-bottom: 12px;
}

.contest-agent-shell {
  height: calc(100vh - 88px);
  height: calc(100dvh - 88px);
  min-height: 560px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 12px;
}

/* Loading skeleton: banner image area only. */
.contest-agent-shell.is-loading .contest-hero {
  position: relative;
  overflow: hidden;
}

.contest-agent-shell.is-loading .contest-hero::before,
.contest-agent-shell.is-loading .contest-hero::after {
  content: "";
  position: absolute;
  z-index: 3;
  pointer-events: none;
}

.contest-agent-shell.is-loading .contest-hero::before {
  inset: 0;
  background:
    linear-gradient(100deg, #e8eef5 0 36%, #f7fafc 48%, #e8eef5 60% 100%);
}

.contest-agent-shell.is-loading .contest-hero::after {
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 4;
  width: 42%;
  background: linear-gradient(100deg, transparent 0, rgba(255, 255, 255, .7) 50%, transparent 100%);
  transform: translateX(-110%);
  will-change: transform;
  animation: workspace-skeleton-sweep 1300ms linear infinite;
}

@keyframes workspace-skeleton-sweep {
  from { transform: translateX(-110%); }
  to { transform: translateX(350%); }
}

@keyframes workspace-ranking-skeleton-sweep {
  to { transform: translateX(105%); }
}

@media (prefers-reduced-motion: reduce) {
  .contest-agent-shell.is-loading .contest-hero::after { display: none; animation: none; }
  .ranking-skeleton-row span::after { display: none; animation: none; }
}

.contest-agent-top {
  display: grid;
  gap: 10px;
}

.contest-agent-top .prompt-band {
  min-height: 74px;
  margin-top: 0;
  padding: 12px 14px;
  border-radius: 10px;
}

.contest-agent-top #contestPrompt {
  width: 100%;
  max-width: none;
  max-height: 82px;
  overflow-wrap: anywhere;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  font-size: 13px;
}

.contest-agent-top .prompt-content {
  width: 100%;
  min-height: 0;
}

.contest-agent-shell .rolling-announcement {
  height: 42px;
  margin-bottom: 0;
  border-radius: 8px;
}

.contest-agent-shell .contest-hero {
  min-height: 0;
  align-items: stretch;
  grid-template-columns: minmax(0, 1fr) minmax(260px, .26fr);
  overflow: hidden;
  border: 1px solid #dbe2ec;
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.contest-agent-shell .hero-copy {
  width: 100%;
  height: auto;
  min-height: 0;
  aspect-ratio: var(--contest-hero-aspect);
  /* Desktop: left side rounded, right edge flat against prize rail */
  border-radius: 10px 0 0 10px;
  background: #111827;
}

.contest-agent-shell .hero-copy::before {
  display: none;
}

.contest-agent-shell .hero-backgrounds {
  opacity: 1;
}

.contest-agent-shell .hero-backgrounds > img {
  object-fit: cover;
  object-position: center;
  transform: none;
}

.contest-agent-shell .hero-background-indicator {
  display: none;
}

.contest-agent-shell .hero-content {
  position: absolute;
  inset: 0;
  display: block;
  padding: 0;
  color: #fff;
}

.contest-agent-shell .hero-copy[data-hero-background="light"] .hero-content {
  color: var(--ink);
}

.contest-agent-shell .hero-copy h1 {
  position: absolute;
  top: var(--hero-title-y, 40%);
  left: var(--hero-title-x, 5%);
  width: min(68%, calc(96% - var(--hero-title-x, 5%)));
  max-width: 760px;
  max-height: none;
  margin: 0;
  color: var(--hero-title-color, currentColor);
  overflow: visible;
  font-size: var(--hero-title-size, 32px);
  line-height: 1.25;
  font-weight: 700;
  transform: translateY(-50%);
}

.contest-agent-shell .contest-clock {
  position: absolute;
  top: var(--hero-countdown-y, 62%);
  left: var(--hero-countdown-x, 5%);
  width: min(68%, calc(96% - var(--hero-countdown-x, 5%)));
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--hero-countdown-color, currentColor);
  text-align: left;
  transform: translateY(-50%);
}

.contest-agent-shell .contest-clock span {
  font-size: var(--hero-countdown-size, 18px);
  font-weight: 700;
}

.contest-agent-shell .contest-clock small {
  color: currentColor;
  font-size: var(--hero-countdown-label-size, 12px);
  font-weight: 500;
  opacity: .82;
}

.contest-agent-shell .prize-block {
  min-height: 0;
  height: auto;
  padding: 18px 20px;
  border-left: 1px solid #e5e7eb;
  /* Desktop: right side rounded, left edge flat against hero image */
  border-radius: 0 10px 10px 0;
  background: #fff7ed;
}

.contest-agent-shell .prize-block small {
  color: #9a5b10;
  font-size: 12px;
  font-weight: 600;
}

.contest-agent-shell .prize-summary-label {
  color: #8a6a23;
  font-size: 12px;
  font-weight: 600;
}

.contest-agent-shell .prize-summary-values {
  max-height: 112px;
  overflow-y: auto;
  color: var(--ink);
  font-size: 16px;
  font-weight: 700;
}

.contest-agent-stream {
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(260px, 1fr) auto;
  align-content: start;
  gap: 12px;
  overflow-y: auto;
  padding: 2px 4px 4px;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
}

.contest-agent-stream,
.contest-agent-stream .result-content,
.canvas-score-popover,
.agent-composer .entry-panel {
  scrollbar-color: transparent transparent;
  transition: scrollbar-color 140ms ease;
}

.contest-agent-stream:hover,
.contest-agent-stream:focus-within,
.contest-agent-stream .result-content:hover,
.contest-agent-stream .result-content:focus-within,
.canvas-score-popover:hover,
.canvas-score-popover:focus-within,
.agent-composer .entry-panel:hover,
.agent-composer .entry-panel:focus-within {
  scrollbar-color: #9db2ce transparent;
}

.contest-agent-stream::-webkit-scrollbar,
.contest-agent-stream .result-content::-webkit-scrollbar,
.canvas-score-popover::-webkit-scrollbar,
.agent-composer .entry-panel::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.contest-agent-stream::-webkit-scrollbar-track,
.contest-agent-stream .result-content::-webkit-scrollbar-track,
.canvas-score-popover::-webkit-scrollbar-track,
.agent-composer .entry-panel::-webkit-scrollbar-track {
  background: transparent;
}

.contest-agent-stream::-webkit-scrollbar-thumb,
.contest-agent-stream .result-content::-webkit-scrollbar-thumb,
.canvas-score-popover::-webkit-scrollbar-thumb,
.agent-composer .entry-panel::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: transparent;
  background-clip: content-box;
}

.contest-agent-stream:hover::-webkit-scrollbar-thumb,
.contest-agent-stream:focus-within::-webkit-scrollbar-thumb,
.contest-agent-stream .result-content:hover::-webkit-scrollbar-thumb,
.contest-agent-stream .result-content:focus-within::-webkit-scrollbar-thumb,
.canvas-score-popover:hover::-webkit-scrollbar-thumb,
.canvas-score-popover:focus-within::-webkit-scrollbar-thumb,
.agent-composer .entry-panel:hover::-webkit-scrollbar-thumb,
.agent-composer .entry-panel:focus-within::-webkit-scrollbar-thumb {
  background-color: #9db2ce;
}

.contest-agent-stream::-webkit-scrollbar-thumb:hover,
.contest-agent-stream .result-content::-webkit-scrollbar-thumb:hover,
.canvas-score-popover::-webkit-scrollbar-thumb:hover,
.agent-composer .entry-panel::-webkit-scrollbar-thumb:hover {
  background-color: #6f89ac;
}

.contest-agent-stream .result-panel {
  position: relative;
  min-height: clamp(260px, 34vh, 460px);
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  gap: 12px;
  padding: 0;
  overflow: hidden;
  border-color: #d8e0ea;
  border-radius: 8px;
  background:
    linear-gradient(rgba(226, 232, 240, .34) 1px, transparent 1px),
    linear-gradient(90deg, rgba(226, 232, 240, .28) 1px, transparent 1px),
    #ffffff;
  background-size: 32px 32px;
  background-position: -1px -1px;
  box-shadow: none;
}

.result-heading,
.composer-heading {
  align-items: start;
  margin-bottom: 0;
}

.result-heading > div,
.composer-heading > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.result-heading p,
.composer-heading p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.contest-agent-stream .request-status {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 3;
  width: min(calc(100% - 24px), 560px);
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 4px;
  border: 1px solid #dbe3ee;
  border-radius: 999px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 8px 22px rgba(15, 23, 42, .08);
}
.contest-agent-stream .request-status[hidden] {
  display: none !important;
}
.contest-agent-stream .request-status:not(.has-badge) .request-status-label {
  display: none;
}

.contest-agent-stream .request-status-label,
.contest-agent-stream .request-status-copy,
.contest-agent-stream .request-status-meta {
  padding: 0;
}

.contest-agent-stream .request-status-label {
  flex: 0 0 auto;
  border: 0;
}

.contest-agent-stream .request-status-copy h2 {
  overflow: hidden;
  color: #1e293b;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contest-agent-stream .request-status-copy h2:empty {
  display: none;
}

.contest-agent-stream .request-status-copy p,
.contest-agent-stream .request-status-meta dt,
.contest-agent-stream .request-status-meta dd {
  font-size: 12px;
}

.contest-agent-stream .request-status-copy {
  min-width: 0;
  flex: 1 1 auto;
}

.contest-agent-stream .request-status-copy p:empty {
  display: none;
}

.contest-agent-stream .request-status-label strong {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.contest-agent-stream .request-status-meta {
  flex: 0 1 auto;
  display: flex;
  gap: 8px;
  min-width: 0;
}

.contest-agent-stream .request-status-meta div {
  min-width: 0;
  display: none;
  align-items: center;
  gap: 4px;
  color: #64748b;
}

.contest-agent-stream .request-status.has-code .request-status-meta div:first-child,
.contest-agent-stream .request-status.has-submission .request-status-meta div:last-child {
  display: inline-flex;
}

.contest-agent-stream .request-status-meta dt {
  color: #94a3b8;
  font-weight: 500;
}

.contest-agent-stream .request-status-meta dd {
  max-width: 120px;
  overflow: hidden;
  color: #475569;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contest-agent-stream .result-empty {
  min-height: clamp(260px, 34vh, 460px);
  display: grid;
  place-items: center;
  padding-top: 38px;
  color: #94a3b8;
  text-align: center;
}

.contest-agent-stream .result-empty::before {
  display: none;
}

.contest-agent-stream .result-empty b {
  position: absolute;
  right: 14px;
  bottom: 12px;
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 500;
}

.contest-agent-stream .result-content {
  min-width: 0;
  display: grid;
  gap: 10px;
  padding: 58px 14px 14px;
  overflow-y: auto;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
}

.contest-agent-stream .generated-frame {
  position: relative;
  isolation: isolate;
  min-height: clamp(180px, 26vh, 330px);
  max-height: 52vh;
  border: 1px solid #d8e0ea;
  background:
    linear-gradient(rgba(226, 232, 240, .34) 1px, transparent 1px),
    linear-gradient(90deg, rgba(226, 232, 240, .28) 1px, transparent 1px),
    #ffffff;
  background-size: 32px 32px;
  background-position: -1px -1px;
}

.contest-agent-stream .generated-frame img {
  max-height: 52vh;
}

.contest-agent-stream .result-actions {
  min-height: 22px;
  justify-content: flex-end;
  margin-top: 0;
  padding: 0 2px;
}

.contest-agent-stream .result-actions:has(#saveStatus[hidden]) {
  display: none;
}

.contest-agent-stream .result-actions span {
  font-size: 12px;
}

.canvas-download-command,
.canvas-preview-command {
  position: absolute;
  top: 10px;
  z-index: 2;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(226, 232, 240, .88);
  border-radius: 8px;
  background: rgba(255, 255, 255, .94);
  color: #475569;
  box-shadow: 0 8px 20px rgba(15, 23, 42, .12);
}

.canvas-download-command {
  right: 10px;
}

.canvas-preview-command {
  right: 52px;
  padding: 0;
  cursor: zoom-in;
}

.canvas-download-command:hover,
.canvas-preview-command:hover {
  border-color: #bfdbfe;
  background: #fff;
  color: #2563eb;
}

.canvas-download-command .nav-icon,
.canvas-preview-command .nav-icon {
  width: 18px;
  height: 18px;
}

.contest-agent-stream .score-result {
  margin-top: 0;
  border-color: #d7e2ef;
  background: #f8fbff;
}

.canvas-score-peek {
  position: absolute;
  top: -1px;
  left: 50%;
  z-index: 5;
  width: max-content;
  max-width: calc(100% - 104px);
  display: grid;
  justify-items: center;
  transform: translateX(-50%);
}

.canvas-score-peek:has(.score-result:empty) {
  display: none;
}

.canvas-score-trigger {
  min-width: 116px;
  height: 27px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid #c9d8ea;
  border-top: 0;
  border-radius: 0 0 7px 7px;
  background: rgba(248, 251, 255, .98);
  color: #50657f;
  box-shadow: 0 8px 18px rgba(37, 99, 235, .10);
  font-size: 12px;
  font-weight: 500;
  cursor: default;
}

.canvas-score-trigger .nav-icon {
  width: 14px;
  height: 14px;
}

.canvas-score-trigger strong {
  color: #0f172a;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.canvas-score-popover {
  position: absolute;
  top: 27px;
  width: min(680px, calc(100vw - 72px));
  max-height: min(360px, calc(100dvh - 160px));
  overflow: auto;
  border: 1px solid #c9d8ea;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .98), rgba(248, 251, 255, .98));
  box-shadow: 0 18px 44px rgba(30, 64, 110, .16);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-5px);
  transition: opacity 140ms ease, transform 140ms ease, visibility 140ms ease;
}

.canvas-score-peek:hover .canvas-score-popover,
.canvas-score-peek:focus-within .canvas-score-popover {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
  transform-origin: var(--score-popover-origin-x, 50%) var(--score-popover-origin-y, 0);
  transition: opacity var(--motion-fast) var(--ease-out), transform var(--motion-fast) var(--ease-out);
}

.canvas-score-popover .score-result {
  border: 0;
  border-radius: 0;
}

.contest-agent-stream .score-item {
  border-color: #dbe5f1;
  background: rgba(255, 255, 255, .72);
  padding: 10px;
}

.contest-agent-stream .score-item small {
  min-height: 26px;
  color: #64748b;
}

.contest-agent-stream .score-item strong {
  margin-top: 3px;
  color: #111827;
  font-size: 22px;
}

.contest-agent-stream .score-total,
.contest-agent-stream .judge-comment {
  padding: 11px 12px;
}

.contest-agent-stream .score-total {
  border-color: #cfe0f3;
  background: linear-gradient(135deg, #eef7ff, #f8fbff 62%, #edf4fb);
  color: #142033;
}

.contest-agent-stream .score-total strong {
  color: #2563eb;
  font-size: 28px;
}

.contest-agent-stream .judge-comment {
  border-color: #dbe5f1;
  background: rgba(255, 255, 255, .82);
  color: #243244;
}

.contest-agent-stream .score-pending {
  background: linear-gradient(135deg, #f0f7ff, #fbfdff);
}

.contest-agent-stream .retry-form {
  grid-template-columns: minmax(112px, .48fr) minmax(250px, 1fr) minmax(180px, .68fr) minmax(210px, .78fr) auto;
  align-items: end;
  gap: 8px;
  margin-top: 0;
  padding: 9px;
  border-color: #c9d8ea;
  border-radius: 9px;
  background: linear-gradient(180deg, #fbfdff, #f5f9ff);
}

.contest-agent-stream .retry-heading {
  min-width: 0;
  align-self: center;
  gap: 1px;
  padding: 0 2px;
  border-bottom: 0;
}

.contest-agent-stream .retry-heading strong {
  overflow: hidden;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contest-agent-stream .retry-heading span {
  display: none;
}

.contest-agent-stream .retry-form label {
  min-width: 0;
  gap: 4px;
}

.contest-agent-stream .retry-form label > span {
  color: #53657d;
  font-size: 12px;
  font-weight: 600;
}

.contest-agent-stream .retry-form label > small {
  display: none;
}

.contest-agent-stream .retry-form input,
.contest-agent-stream .retry-form select,
.contest-agent-stream .retry-form button,
.contest-agent-stream .review-form input,
.contest-agent-stream .review-form button {
  min-height: 36px;
  padding: 0 10px;
  border-color: #cad7e6;
  border-radius: 8px;
  background-color: #fff;
  color: #243244;
  font-size: 12px;
}

.contest-agent-stream .retry-form input:focus,
.contest-agent-stream .retry-form select:focus,
.contest-agent-stream .review-form input:focus {
  border-color: #9dbcf8;
  outline: 3px solid rgba(37, 99, 235, .10);
}

.contest-agent-stream .retry-form .key-loader {
  grid-template-columns: minmax(0, 1fr) 72px;
}

.contest-agent-stream .retry-form .key-loader button {
  border-left: 0;
  background: #eef6ff;
  color: #2563eb;
  font-size: 12px;
  font-weight: 700;
}

.contest-agent-stream .retry-form .key-loader button:hover {
  background: #dbeafe;
}

.contest-agent-stream .retry-form > button {
  min-width: 66px;
  padding: 0 13px;
  border: 0;
  background: var(--blue);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.contest-agent-stream .review-band {
  display: grid;
  grid-template-columns: 74px minmax(170px, .34fr) minmax(0, 1fr);
  align-items: stretch;
  border-color: #c9d8ea;
  margin-top: 0;
  border-radius: 9px;
  background: linear-gradient(180deg, #fbfdff, #f5f9ff);
}

.contest-agent-stream .review-rank {
  min-height: 0;
  padding: 9px 10px;
  border-color: #d7e2ef;
}

.contest-agent-stream .review-rank strong {
  font-size: 28px;
}

.contest-agent-stream .review-copy {
  min-width: 0;
  padding: 10px 12px;
}

.contest-agent-stream .review-copy h2 {
  overflow: hidden;
  color: #1e293b;
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contest-agent-stream .review-copy p {
  display: none;
}

.contest-agent-stream .review-form {
  grid-template-columns: minmax(170px, 1fr) minmax(180px, 1fr) minmax(170px, auto) auto;
  align-items: center;
  gap: 8px;
  padding: 9px;
  border-color: #d7e2ef;
  background: transparent;
}

.contest-agent-stream .review-form .checkline {
  min-height: 36px;
  align-items: center;
  margin-top: 0;
  padding: 0 10px;
  border: 1px solid #d7e2ef;
  border-radius: 8px;
  background: #fff;
  color: #4b5f78;
  font-size: 12px;
  line-height: 1.35;
}

.contest-agent-stream .review-form .checkline input {
  width: 15px;
  height: 15px;
  accent-color: var(--blue);
}

.contest-agent-stream .review-form > button {
  min-width: 76px;
  border: 0;
  background: var(--blue);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.contest-agent-stream .review-form > button:hover,
.contest-agent-stream .retry-form > button:hover {
  background: #1d4ed8;
}

.contest-agent-stream .retry-form input[type="file"],
.contest-agent-stream .review-form input[type="file"],
.award-review-file input[type="file"] {
  min-width: 0;
  padding: 5px 7px;
  color: #64748b;
}

.contest-agent-stream .retry-form input[type="file"]::file-selector-button,
.contest-agent-stream .review-form input[type="file"]::file-selector-button,
.award-review-file input[type="file"]::file-selector-button {
  min-height: 24px;
  margin-right: 9px;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  background: #edf5ff;
  color: #2563eb;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
}

.contest-agent-stream .retry-form input[type="file"]:hover::file-selector-button,
.contest-agent-stream .review-form input[type="file"]:hover::file-selector-button,
.award-review-file input[type="file"]:hover::file-selector-button {
  background: #dbeafe;
}

.agent-composer {
  display: block;
  margin-top: 0;
  border: 0;
  background: transparent;
}

.agent-composer .entry-panel {
  max-height: min(330px, 40vh);
  overflow-y: auto;
  padding: 14px;
  border-radius: 10px;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
}

.agent-composer #entryForm {
  display: grid;
  gap: 10px;
}

.agent-composer .prompt-adjustment-field {
  margin: 0;
  padding: 12px;
  border-radius: 8px;
}

.agent-composer .prompt-adjustment-field textarea {
  min-height: 76px;
  max-height: 120px;
}

.entry-controls-grid {
  display: grid;
  grid-template-columns:
    minmax(260px, .95fr)
    minmax(260px, 1.1fr)
    minmax(190px, .7fr)
    minmax(118px, .42fr)
    minmax(260px, 1.1fr)
    minmax(190px, .7fr);
  gap: 10px;
  align-items: end;
}

.entry-controls-grid .field,
.entry-controls-grid .provider-switch {
  margin-bottom: 0;
}

.agent-composer .provider-switch {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.agent-composer .provider-switch label {
  min-height: 54px;
  border-radius: 8px;
}

.agent-composer .judge-divider {
  min-height: 54px;
  align-content: center;
  margin: 0;
  padding: 8px 10px;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
}

.agent-composer .judge-divider p {
  text-align: left;
}

.agent-composer .key-loader {
  gap: 7px;
}

.agent-composer .key-loader button {
  border-radius: 8px;
  font-weight: 700;
}

.agent-composer .save-warning {
  min-height: 58px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px 14px;
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
}

.agent-composer .save-warning strong {
  font-size: 13px;
  font-weight: 700;
}

.agent-composer .save-warning p {
  margin-top: 3px;
  font-size: 12px;
}

.agent-composer .save-warning .checkline {
  margin-top: 0;
}

.composer-actions {
  display: grid;
  grid-template-columns: minmax(220px, .34fr) minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.composer-actions .primary-command {
  min-height: 44px;
  border-radius: 8px;
  font-size: 13px;
}

.composer-actions .submission-quota {
  margin-top: 0;
}

.agent-composer .key-note {
  margin-top: 8px;
}

@media (max-width: 1180px) {
  main.app-main:has(.contest-agent-shell:not([hidden])),
  main.app-main.is-contest-workspace {
    width: min(100% - 28px, 1360px);
    padding-top: 20px;
    padding-bottom: 16px;
  }

  .contest-agent-shell {
    height: auto;
    min-height: calc(100vh - 128px);
    min-height: calc(100dvh - 128px);
    grid-template-rows: auto minmax(360px, 1fr) auto;
  }

  .entry-controls-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .agent-composer .provider-switch,
  .agent-composer .judge-divider {
    grid-column: 1 / -1;
  }
}

@media (max-width: 700px) {
  .contest-agent-shell {
    height: auto;
    min-height: calc(100vh - 104px);
    min-height: calc(100dvh - 104px);
  }

  .contest-agent-shell .contest-hero {
    grid-template-columns: 1fr;
  }

  .contest-agent-shell .hero-copy {
    height: auto;
    min-height: 0;
    aspect-ratio: var(--contest-hero-aspect);
    /* Mobile: top-left/top-right rounded, bottom flat against prize */
    border-radius: 10px 10px 0 0;
  }

  .contest-agent-shell .hero-content {
    position: absolute;
    inset: 0;
    height: auto;
    min-height: 0;
    display: block;
    padding: 0;
  }

  .contest-agent-shell .hero-copy h1 {
    max-height: none;
    font-size: min(var(--hero-title-size, 20px), 26px);
  }

  .contest-agent-shell .contest-clock {
    position: absolute;
    min-width: 0;
    display: flex;
    text-align: left;
  }

  .contest-agent-shell .prize-block {
    min-height: 72px;
    grid-template-columns: 1fr;
    border-top: 1px solid #e5e7eb;
    border-left: 0;
    /* Mobile: bottom corners rounded, top flat under hero image */
    border-radius: 0 0 10px 10px;
  }

  .contest-agent-shell .prize-block strong {
    justify-self: start;
    text-align: left;
  }

  .contest-agent-stream {
    padding-right: 0;
  }

  .contest-agent-stream .request-status {
    grid-template-columns: 1fr;
  }

  .contest-agent-stream .request-status-label {
    min-height: 58px;
    flex-direction: row;
    justify-content: space-between;
  }

  .contest-agent-stream .generated-frame,
  .contest-agent-stream .generated-frame img {
    max-height: 44vh;
  }

  .agent-composer .entry-panel {
    max-height: none;
    overflow: visible;
  }

  .entry-controls-grid,
  .composer-actions,
  .agent-composer .save-warning {
    grid-template-columns: 1fr;
  }

  .agent-composer .provider-switch {
    grid-template-columns: 1fr;
  }
}

@keyframes workspace-dialog-fade { from { opacity: 0; } to { opacity: 1; } }

/* Compact composer and pre-flight settings dialog */
.contest-agent-stream .generated-frame {
  min-height: clamp(180px, 30vh, 330px);
}

.generated-preview-button {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: inherit;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: #fff;
  cursor: zoom-in;
}

.generated-preview-button img {
  display: block;
  width: 100%;
  max-height: inherit;
  object-fit: contain;
}

.generated-preview-button span {
  position: absolute;
  right: 10px;
  bottom: 10px;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 0 7px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 5px;
  background: rgba(15, 23, 42, .72);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.generated-preview-button:hover span,
.generated-preview-button:focus-visible span {
  opacity: 1;
  transform: none;
}

.agent-composer .entry-panel {
  max-height: none;
  overflow: visible;
  padding: 12px 14px 10px;
}

.agent-composer #entryForm {
  grid-template-columns: minmax(0, 1fr) minmax(520px, .42fr);
  align-items: end;
  gap: 12px;
}

.agent-composer #entryForm.no-adjustment {
  grid-template-columns: 1fr;
}

.agent-composer #entryForm.no-adjustment .composer-actions {
  grid-column: 1;
  justify-self: end;
  width: min(100%, 560px);
}

.agent-composer .prompt-adjustment-field {
  grid-column: 1;
  padding: 10px 12px;
}

.agent-composer .prompt-adjustment-field textarea {
  min-height: 68px;
  max-height: 86px;
  resize: vertical;
}

.composer-actions {
  grid-column: 2;
  display: grid;
  grid-template-columns: 136px 138px minmax(170px, 1fr);
  align-items: center;
  gap: 8px;
}

.secondary-command {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 12px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 13px;
  font-weight: 700;
}

.secondary-command:hover {
  border-color: #93c5fd;
  background: #dbeafe;
}

.save-ack-inline {
  min-height: 42px;
  align-items: center;
  justify-content: center;
  margin-top: 0;
  padding: 0 10px;
  border: 1px solid #fde68a;
  border-radius: 8px;
  background: #fffbeb;
  color: #78350f;
  font-weight: 600;
}

.save-ack-inline input {
  width: 16px;
  height: 16px;
}

.composer-actions .primary-command {
  min-height: 42px;
}

.composer-actions .submission-quota {
  grid-column: 1 / -1;
  min-height: 20px;
  margin-top: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.generation-settings-dialog {
  width: min(980px, calc(100% - 32px));
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 24px 70px rgba(15, 23, 42, .22);
}

.generation-settings-dialog::backdrop {
  background: rgba(15, 23, 42, .48);
}

.settings-dialog-panel {
  max-height: inherit;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  overflow: hidden;
}

.settings-dialog-panel > header {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.settings-dialog-panel h2 {
  font-size: 20px;
  font-weight: 700;
}

.settings-dialog-panel header p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.settings-dialog-panel > header .icon-button {
  width: 36px;
  min-width: 36px;
  height: 36px;
  font-size: 22px;
  line-height: 1;
}

#closeGenerationSettings {
  cursor: pointer;
}

#closeGenerationSettings:not(:disabled):hover {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #2563eb;
}

.generation-settings-dialog .entry-controls-grid {
  min-height: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  overflow-y: auto;
  padding: 18px 20px;
}

.generation-settings-dialog .provider-switch,
.generation-settings-dialog .judge-divider {
  grid-column: 1 / -1;
}

.generation-settings-dialog .provider-switch {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.generation-settings-dialog .field {
  margin-bottom: 0;
}

.generation-settings-dialog .judge-divider {
  min-height: 50px;
  margin: 4px 0 -4px;
  padding: 12px;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
}

.generation-settings-dialog .save-warning {
  margin: 0 20px 16px;
  padding: 12px 14px;
}

.generation-settings-dialog .save-warning p {
  font-size: 12px;
}

.settings-dialog-panel > footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 160px;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
}

.settings-dialog-panel .key-note {
  margin-top: 0;
}

.settings-dialog-panel .primary-command {
  min-height: 42px;
}

@media (max-width: 1180px) {
  .agent-composer #entryForm {
    grid-template-columns: 1fr;
  }

  .agent-composer #entryForm.no-adjustment .composer-actions {
    justify-self: stretch;
    width: 100%;
  }

  .composer-actions {
    grid-column: 1;
    grid-template-columns: 140px 138px minmax(170px, 1fr);
  }

  .contest-agent-stream .retry-form {
    grid-template-columns: minmax(116px, .5fr) minmax(220px, 1fr) minmax(180px, .8fr);
  }

  .contest-agent-stream .retry-form > button {
    justify-self: end;
  }

  .contest-agent-stream .review-band {
    grid-template-columns: 70px minmax(150px, .38fr) minmax(0, 1fr);
  }

  .contest-agent-stream .review-form {
    grid-template-columns: minmax(160px, 1fr) minmax(170px, 1fr) auto;
  }

  .contest-agent-stream .review-form .checkline {
    grid-column: 1 / -2;
  }
}

@media (max-width: 700px) {
  .contest-agent-stream .generated-frame,
  .contest-agent-stream .generated-frame img {
    max-height: 34vh;
  }

  .generated-preview-button span {
    opacity: 1;
    transform: none;
  }

  .composer-actions {
    grid-template-columns: 1fr 1fr;
  }

  .composer-actions .primary-command,
  .composer-actions .submission-quota {
    grid-column: 1 / -1;
  }

  .contest-agent-stream .retry-form {
    grid-template-columns: 1fr;
    gap: 7px;
    padding: 8px;
  }

  .contest-agent-stream .retry-form > button {
    width: 100%;
    justify-self: stretch;
  }

  .contest-agent-stream .review-band {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .contest-agent-stream .review-copy {
    padding: 9px 10px;
  }

  .contest-agent-stream .review-form {
    grid-column: 1 / -1;
    grid-template-columns: 1fr;
    gap: 7px;
    padding: 8px;
    border-top: 1px solid #d7e2ef;
    border-left: 0;
  }

  .contest-agent-stream .review-form .checkline {
    grid-column: auto;
  }

  .generation-settings-dialog {
    width: calc(100% - 18px);
    max-height: calc(100vh - 18px);
    max-height: calc(100dvh - 18px);
    border-radius: 10px;
  }

  .settings-dialog-panel > header,
  .generation-settings-dialog .entry-controls-grid,
  .settings-dialog-panel > footer {
    padding-left: 16px;
    padding-right: 16px;
  }

  .generation-settings-dialog .entry-controls-grid,
  .settings-dialog-panel > footer,
  .generation-settings-dialog .provider-switch {
    grid-template-columns: 1fr;
  }

  .generation-settings-dialog .save-warning {
    margin-left: 16px;
    margin-right: 16px;
  }
}

/* Composer toolbar: controls live inside the input surface */
.agent-composer .entry-panel {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.agent-composer #entryForm,
.agent-composer #entryForm.no-adjustment {
  display: block;
}

.agent-composer #entryForm.no-adjustment .composer-actions {
  width: auto;
  justify-self: stretch;
}

.composer-input-shell {
  min-height: 108px;
  display: grid;
  grid-template-rows: minmax(58px, 1fr) auto;
  padding: 8px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 26px rgba(15, 23, 42, .07);
}

.agent-composer .prompt-adjustment-field {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.agent-composer .prompt-adjustment-field > span {
  min-height: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 4px 4px;
  color: #64748b;
  font-size: 12px;
  font-weight: 500;
}

.agent-composer .prompt-adjustment-field textarea {
  min-height: 46px;
  max-height: 78px;
  padding: 2px 4px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  box-shadow: none;
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
}

.agent-composer .prompt-adjustment-field textarea:focus {
  outline: 0;
}

.agent-composer .prompt-adjustment-field textarea::placeholder {
  color: #94a3b8;
}

.composer-disabled-note {
  min-height: 42px;
  display: flex;
  align-items: center;
  margin: 0;
  padding: 2px 4px;
  color: #94a3b8;
  font-size: 13px;
}

.composer-actions {
  grid-column: auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid #edf2f7;
}

.composer-actions-left,
.composer-actions-right {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.composer-actions-left {
  flex: 1 1 auto;
}

.composer-actions-right {
  flex: 0 0 auto;
  justify-content: flex-end;
}

.composer-request-status,
.agent-composer .request-status {
  position: static;
  top: auto;
  left: auto;
  z-index: 2;
  width: auto;
  max-width: min(100%, 420px);
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 3px 4px 3px 3px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  background: #f8fafc;
  box-shadow: none;
}

.agent-composer .request-status[hidden] {
  display: none !important;
}

.agent-composer .request-status-label,
.agent-composer .request-status-copy,
.agent-composer .request-status-meta {
  padding: 0;
  border: 0;
}

.agent-composer .request-status-label {
  flex: 0 0 auto;
}

.agent-composer .request-status:not(.has-badge) .request-status-label {
  display: none;
}

.agent-composer .request-status-label strong {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  background: #f3f4f6;
  color: #334155;
  font-size: 12px;
  font-weight: 600;
}

.agent-composer .request-status.running .request-status-label strong {
  background: var(--blue-soft);
  color: var(--blue);
}

.agent-composer .request-status.success .request-status-label strong {
  background: var(--green-soft);
  color: #047857;
}

.agent-composer .request-status.error {
  border-color: #fecaca;
  background: #fff7f7;
}

.agent-composer .request-status.error .request-status-label strong {
  background: #fef2f2;
  color: #b91c1c;
}

.agent-composer .request-status-copy {
  min-width: 0;
  flex: 1 1 auto;
  padding-right: 10px;
}

.agent-composer .request-status-copy h2 {
  overflow: hidden;
  margin: 0;
  color: #1e293b;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-composer .request-status-copy h2:empty,
.agent-composer .request-status-copy p:empty {
  display: none;
}

.agent-composer .request-status-copy p {
  overflow: hidden;
  margin: 1px 0 0;
  color: #64748b;
  font-size: 12px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-composer .request-status-meta {
  display: none;
}

.composer-actions-right .composer-model-picker {
  max-width: min(46vw, 260px);
}

.composer-icon-button,
.save-ack-inline,
.composer-send-button {
  width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1;
}

.composer-icon-button {
  border: 1px solid #d9e2ec;
  background: #f8fafc;
  color: #475569;
  cursor: pointer;
}

.composer-icon-button:hover {
  border-color: #b7c5d6;
  background: #f1f5f9;
  color: #0f172a;
}

.composer-model-picker {
  position: relative;
  min-width: 0;
  flex: 0 1 auto;
  max-width: min(100%, 280px);
}

.composer-model-trigger {
  min-width: 0;
  max-width: 100%;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 0 10px 0 12px;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  background: #fff;
  color: #111827;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}

.composer-model-trigger:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.composer-model-trigger[aria-expanded="true"] {
  border-color: #cbd5e1;
  background: #f8fafc;
  box-shadow: 0 0 0 3px rgba(15, 23, 42, .05);
}

.composer-model-summary {
  min-width: 0;
  overflow: hidden;
  color: #111827;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.composer-model-trigger[data-ready="empty"] .composer-model-summary,
.composer-model-trigger[data-ready="keys"] .composer-model-summary {
  color: #6b7280;
  font-weight: 500;
}

.composer-model-trigger .nav-icon {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  color: #9ca3af;
}

.composer-model-menu {
  position: absolute;
  left: auto;
  right: 0;
  bottom: calc(100% + 10px);
  z-index: 45;
  width: min(320px, calc(100vw - 32px));
  overflow: visible;
  border: 1px solid rgba(15, 23, 42, .08);
  padding: 5px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .98);
  box-shadow: 0 16px 40px rgba(15, 23, 42, .14);
}

.composer-model-panel {
  max-height: none;
  overflow: visible;
}

.composer-menu-title { padding: 7px 9px 6px; color: #9a9daa; font-size: 12px; font-weight: 600; }

.composer-menu-list {
  position: relative;
  display: grid;
  gap: 2px;
  padding: 0;
}

.composer-menu-item {
  position: relative;
}

.composer-menu-row {
  width: 100%;
  min-width: 0;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding: 7px 9px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #111827;
  cursor: pointer;
  text-align: left;
}

.composer-menu-row:hover,
.composer-menu-item.is-open > .composer-menu-row,
.composer-menu-item:hover > .composer-menu-row {
  background: #f3f4f6;
}

.composer-submenu {
  position: absolute;
  top: 0;
  left: calc(100% + 8px);
  z-index: 46;
  width: min(300px, calc(100vw - 24px));
  max-height: min(340px, 52vh);
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid rgba(15, 23, 42, .08);
  border-radius: 8px;
  background: rgba(255, 255, 255, .98);
  box-shadow: 0 16px 40px rgba(15, 23, 42, .14);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(4px);
  transition: opacity 120ms ease, transform 120ms ease, visibility 120ms ease;
}

.composer-submenu.is-flip-left {
  left: auto;
  right: calc(100% + 8px);
  transform: translateX(-4px);
}

.composer-submenu.is-flip-up {
  top: auto;
  bottom: 0;
}

.composer-menu-item:hover > .composer-submenu,
.composer-menu-item:focus-within > .composer-submenu,
.composer-menu-item.is-open > .composer-submenu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(0);
}


.composer-menu-copy { min-width: 0; display: grid; gap: 3px; }
.composer-menu-copy strong, .composer-menu-copy small { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.composer-menu-copy strong { color: #20212a; font-size: 13px; font-weight: 600; line-height: 1.25; }
.composer-menu-copy small { color: #777b89; font-size: 12px; font-weight: 400; line-height: 1.25; }
.composer-menu-copy small { overflow: visible; overflow-wrap: anywhere; text-overflow: clip; white-space: normal; line-height: 1.4; }

.composer-menu-value {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  overflow: hidden;
  color: #9ca3af;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.composer-menu-value .nav-icon {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  color: #9a9daa;
}

.composer-menu-settings { min-height: 42px; justify-content: flex-start; margin-top: 4px; border-top: 1px solid #e1e3e8; border-radius: 0 0 5px 5px; color: #777b89; font-size: 12px; }
.composer-menu-settings > .nav-icon { width: 16px; height: 16px; flex: 0 0 16px; }

.composer-menu-subhead {
  position: sticky;
  top: 0;
  z-index: 1;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 6px 10px;
  border-bottom: 1px solid #f3f4f6;
  background: rgba(255, 255, 255, .96);
}

.composer-menu-subhead strong {
  min-width: 0;
  overflow: hidden;
  color: #111827;
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.composer-menu-back {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin: 0;
  padding: 0 8px 0 4px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #6b7280;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.composer-menu-back:hover {
  background: #f3f4f6;
  color: #111827;
}

.composer-menu-back .nav-icon {
  width: 16px;
  height: 16px;
}

.composer-model-list {
  display: grid;
  gap: 2px;
  padding: 6px;
}

.composer-model-option {
  min-width: 0;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #111827;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}

.composer-model-option span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.composer-model-option span { overflow: visible; overflow-wrap: anywhere; text-overflow: clip; white-space: normal; word-break: break-word; line-height: 1.4; }

.composer-model-option small {
  flex: 0 0 auto;
  color: #2563eb;
  font-size: 12px;
  font-weight: 700;
}

.composer-model-option:hover {
  background: #f3f4f6;
}

.composer-model-option.is-selected {
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 600;
}

.composer-model-empty {
  display: grid;
  gap: 8px;
  justify-items: center;
  padding: 22px 16px 18px;
  color: #6b7280;
  text-align: center;
}

.composer-model-empty strong {
  color: #111827;
  font-size: 13px;
  font-weight: 700;
}

.composer-model-empty span {
  max-width: 220px;
  font-size: 12px;
  line-height: 1.55;
}

.composer-menu-action {
  min-height: 34px;
  margin: 0;
  padding: 0 12px;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  background: #fff;
  color: #374151;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.composer-menu-action:hover {
  border-color: #cbd5e1;
  background: #f9fafb;
}

.composer-model-subhead { position: sticky; z-index: 1; top: 0; min-height: 48px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 8px 11px; border-bottom: 1px solid #e1e3e8; background: rgba(255, 255, 255, .98); }
.composer-model-subhead strong { min-width: 0; overflow: hidden; color: #20212a; font-size: 13px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.composer-model-subhead .composer-menu-back { display: none; }

.composer-model-refresh {
  width: 30px;
  height: 30px;
  min-width: 30px;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  border: 1px solid #e5e7eb;
  border-radius: 5px;
  background: #f7f8fa;
  color: #777b89;
  cursor: pointer;
}

.composer-model-refresh:hover {
  border-color: #c8c4ed;
  background: #f0edff;
  color: #5f57d7;
}
.composer-model-refresh:disabled { cursor: not-allowed; opacity: .4; }

.composer-model-refresh .nav-icon {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.composer-model-refresh.is-loading,
.composer-model-refresh:disabled {
  cursor: wait;
  opacity: .7;
}

.composer-model-refresh.is-loading .nav-icon {
  animation: career-spin 700ms linear infinite;
}

.save-ack-inline {
  min-height: 42px;
  align-items: center;
  justify-content: center;
  margin-top: 0;
  padding: 0 10px;
  border: 1px solid #fde68a;
  border-radius: 8px;
  background: #fffbeb;
  color: #78350f;
  font-weight: 600;
}

.save-ack-inline input {
  width: 16px;
  height: 16px;
}

.composer-actions .primary-command {
  min-height: 42px;
}

.composer-actions .submission-quota {
  grid-column: 1 / -1;
  min-height: 20px;
  margin-top: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.generation-settings-dialog {
  width: min(980px, calc(100% - 32px));
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 24px 70px rgba(15, 23, 42, .22);
}

.generation-settings-dialog::backdrop {
  background: rgba(15, 23, 42, .48);
}

.settings-dialog-panel {
  max-height: inherit;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  overflow: hidden;
}

.settings-dialog-panel > header {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.settings-dialog-panel h2 {
  font-size: 20px;
  font-weight: 700;
}

.settings-dialog-panel header p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.settings-dialog-panel > header .icon-button {
  width: 36px;
  min-width: 36px;
  height: 36px;
  font-size: 22px;
  line-height: 1;
}

#closeGenerationSettings {
  cursor: pointer;
}

#closeGenerationSettings:not(:disabled):hover {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #2563eb;
}

.generation-settings-dialog .entry-controls-grid {
  min-height: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  overflow-y: auto;
  padding: 18px 20px;
}

.generation-settings-dialog .provider-switch,
.generation-settings-dialog .judge-divider {
  grid-column: 1 / -1;
}

.generation-settings-dialog .provider-switch {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.generation-settings-dialog .field {
  margin-bottom: 0;
}

.generation-settings-dialog .judge-divider {
  min-height: 50px;
  margin: 4px 0 -4px;
  padding: 12px;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
}

.generation-settings-dialog .save-warning {
  margin: 0 20px 16px;
  padding: 12px 14px;
}

.generation-settings-dialog .save-warning p {
  font-size: 12px;
}

.settings-dialog-panel > footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 160px;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
}

.settings-dialog-panel .key-note {
  margin-top: 0;
}

.settings-dialog-panel .primary-command {
  min-height: 42px;
}

@media (max-width: 1180px) {
  .agent-composer #entryForm {
    grid-template-columns: 1fr;
  }

  .agent-composer #entryForm.no-adjustment .composer-actions {
    justify-self: stretch;
    width: 100%;
  }

  .composer-actions {
    grid-column: 1;
    grid-template-columns: 140px 138px minmax(170px, 1fr);
  }
}

@media (max-width: 700px) {
  .contest-agent-stream .generated-frame,
  .contest-agent-stream .generated-frame img {
    max-height: 34vh;
  }

  .generated-preview-button span {
    opacity: 1;
    transform: none;
  }

  .composer-actions {
    grid-template-columns: 1fr 1fr;
  }

  .composer-actions .primary-command,
  .composer-actions .submission-quota {
    grid-column: 1 / -1;
  }

  .generation-settings-dialog {
    width: calc(100% - 18px);
    max-height: calc(100vh - 18px);
    max-height: calc(100dvh - 18px);
    border-radius: 10px;
  }

  .settings-dialog-panel > header,
  .generation-settings-dialog .entry-controls-grid,
  .settings-dialog-panel > footer {
    padding-left: 16px;
    padding-right: 16px;
  }

  .generation-settings-dialog .entry-controls-grid,
  .settings-dialog-panel > footer,
  .generation-settings-dialog .provider-switch {
    grid-template-columns: 1fr;
  }

  .generation-settings-dialog .save-warning {
    margin-left: 16px;
    margin-right: 16px;
  }
}

/* Composer toolbar: controls live inside the input surface */
.agent-composer .entry-panel {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.agent-composer #entryForm,
.agent-composer #entryForm.no-adjustment {
  display: block;
}

.agent-composer #entryForm.no-adjustment .composer-actions {
  width: auto;
  justify-self: stretch;
}

.composer-input-shell {
  min-height: 108px;
  display: grid;
  grid-template-rows: minmax(58px, 1fr) auto;
  padding: 8px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 26px rgba(15, 23, 42, .07);
}

.agent-composer .prompt-adjustment-field {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.agent-composer .prompt-adjustment-field > span {
  min-height: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 4px 4px;
  color: #64748b;
  font-size: 12px;
  font-weight: 500;
}

.agent-composer .prompt-adjustment-field textarea {
  min-height: 46px;
  max-height: 78px;
  padding: 2px 4px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  box-shadow: none;
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
}

.agent-composer .prompt-adjustment-field textarea:focus {
  outline: 0;
}

.agent-composer .prompt-adjustment-field textarea::placeholder {
  color: #94a3b8;
}

.composer-disabled-note {
  min-height: 42px;
  display: flex;
  align-items: center;
  margin: 0;
  padding: 2px 4px;
  color: #94a3b8;
  font-size: 13px;
}

.composer-actions {
  grid-column: auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid #edf2f7;
}

.composer-actions-left,
.composer-actions-right {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.composer-actions-left {
  flex: 1 1 auto;
}

.composer-actions-right {
  flex: 0 0 auto;
  justify-content: flex-end;
}

.composer-icon-button,
.save-ack-inline,
.composer-send-button {
  width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1;
}

.composer-icon-button {
  border: 1px solid #d9e2ec;
  background: #f8fafc;
  color: #475569;
  cursor: pointer;
}

.composer-icon-button:hover {
  border-color: #b7c5d6;
  background: #f1f5f9;
  color: #0f172a;
}

.save-ack-inline {
  position: relative;
  border: 1px solid #d9e2ec;
  background: #fff;
  color: #64748b;
  cursor: pointer;
}

.save-ack-inline input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.save-ack-inline:hover {
  border-color: #b7c5d6;
  color: #0f172a;
}

.save-ack-inline:has(input:focus-visible) {
  outline: 2px solid rgba(37, 99, 235, .7);
  outline-offset: 2px;
}

.save-ack-inline:has(input:checked) {
  border-color: #16a34a;
  background: #ecfdf5;
  color: #047857;
}

.composer-send-button {
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  border: 0;
  border-radius: 50%;
  background: #111827;
  color: #fff;
  cursor: pointer;
  box-shadow: none;
  transition: background 140ms ease, color 140ms ease, opacity 140ms ease;
}

.composer-send-button:hover:not(:disabled) {
  background: #000;
  transform: none;
}

.composer-send-button .send-icon,
.composer-send-button .stop-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.composer-send-button .stop-icon {
  display: none;
  fill: currentColor;
  stroke: none;
}

.composer-send-button[data-loading="true"] .send-icon {
  display: none;
}

.composer-send-button[data-loading="true"] .stop-icon {
  display: block;
}

.composer-send-button:disabled {
  border: 0;
  background: #9ca3af;
  color: #fff;
  cursor: not-allowed;
  opacity: 1;
  transform: none;
}

.composer-send-button:disabled[data-loading="true"] {
  background: #111827;
  color: #fff;
  cursor: wait;
  opacity: 1;
}

.composer-icon-button:disabled,
.save-ack-inline:has(input:disabled) {
  cursor: not-allowed;
  opacity: .48;
  transform: none;
}

.composer-icon-button .nav-icon,
.save-ack-inline .nav-icon {
  width: 18px;
  height: 18px;
  flex-basis: 18px;
}

.composer-send-button .nav-icon {
  width: 18px;
  height: 18px;
  flex-basis: 18px;
}

.submission-quota {
  max-width: min(42vw, 420px);
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 0 9px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  background: #f8fafc;
  color: #64748b;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.submission-quota[hidden] {
  display: none;
}

.submission-quota.exhausted {
  border-color: #fecaca;
  background: #fff1f2;
  color: #b91c1c;
}

@media (max-width: 1180px) {
  .composer-actions {
    grid-column: auto;
  }
}

@media (max-width: 700px) {
  .composer-input-shell {
    min-height: 92px;
    grid-template-rows: minmax(36px, 1fr) auto;
    padding: 7px;
  }

  .composer-actions {
    gap: 8px;
  }

  .composer-actions-left {
    max-width: calc(100% - 86px);
  }

  .composer-actions-left {
    min-width: 0;
    flex: 1 1 auto;
  }
  .composer-request-status,
  .agent-composer .request-status {
    max-width: min(100%, 180px);
  }
  .composer-actions-right .composer-model-picker,
  .composer-model-picker {
    max-width: min(100%, 150px);
  }

  .composer-model-menu {
    width: min(320px, calc(100vw - 28px));
  }

  .composer-menu-item { position: static; }
  .composer-submenu,
  .composer-submenu.is-flip-left,
  .composer-submenu.is-flip-up {
    inset: auto 0 0;
    width: 100%;
    max-height: min(360px, 70vh);
    border-radius: 7px;
    transform: none;
  }
  .composer-menu-item:hover > .composer-submenu,
  .composer-menu-item:focus-within > .composer-submenu,
  .composer-menu-item.is-open > .composer-submenu { transform: none; }
  .composer-model-panel[data-level] .composer-submenu {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }
  .composer-model-panel[data-level="image"] .composer-menu-item[data-submenu="image"] > .composer-submenu,
  .composer-model-panel[data-level="judge"] .composer-menu-item[data-submenu="judge"] > .composer-submenu {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
  }
  .composer-model-subhead { grid-template-columns: auto minmax(0, 1fr) auto; }
  .composer-model-subhead .composer-menu-back { display: grid; width: 30px; height: 30px; min-height: 30px; place-items: center; padding: 0; }
  .composer-model-subhead .composer-menu-back .nav-icon { width: 16px; height: 16px; }

  .submission-quota {
    max-width: 100%;
  }

  .composer-disabled-note {
    min-height: 32px;
  }

  .agent-composer .prompt-adjustment-field textarea {
    min-height: 34px;
    max-height: 52px;
  }

}

/* Final workspace refinements */
.contest-agent-shell .hero-copy {
  background:
    linear-gradient(90deg, #eef2f7 0 22%, #f8fafc 22% 46%, #eef2f7 46% 100%);
}

.contest-agent-shell .hero-backgrounds {
  background:
    linear-gradient(90deg, #eef2f7 0 22%, #f8fafc 22% 46%, #eef2f7 46% 100%);
}

.contest-agent-stream .request-status:not(.has-copy):not(.has-code):not(.has-submission) {
  width: auto;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.contest-agent-stream .request-status:not(.has-copy):not(.has-code):not(.has-submission) .request-status-label strong {
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid #dbe3ee;
  background: rgba(248, 250, 252, .96);
  box-shadow: 0 4px 12px rgba(15, 23, 42, .06);
}

.contest-agent-stream .request-status:not(.has-copy) .request-status-copy {
  display: none;
}

.contest-agent-stream .request-status:not(.has-code):not(.has-submission) .request-status-meta {
  display: none;
}

@media (max-width: 700px) {
  main.app-main:has(.contest-agent-shell:not([hidden])),
  main.app-main.is-contest-workspace {
    width: calc(100% - 20px);
    padding-top: 10px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
  }

  .contest-agent-shell {
    height: auto;
    min-height: calc(100dvh - 80px - env(safe-area-inset-bottom));
    grid-template-rows: auto minmax(190px, 1fr) auto;
    gap: 8px;
    overflow: visible;
  }

  .contest-agent-top {
    gap: 8px;
  }

  .contest-agent-shell .hero-copy,
  .contest-agent-shell .hero-backgrounds {
    background:
      linear-gradient(90deg, #eef2f7 0 22%, #f8fafc 22% 46%, #eef2f7 46% 100%);
  }

  .contest-agent-shell .hero-copy {
    height: auto;
    min-height: 0;
    aspect-ratio: var(--contest-hero-aspect);
  }

  .contest-agent-shell .hero-content {
    height: 100%;
    min-height: 0;
  }

  .contest-agent-shell .hero-backgrounds > img {
    object-fit: cover;
    object-position: center;
    transform: none;
  }

  .contest-agent-top .prompt-band {
    min-height: 74px;
    padding: 10px 12px;
  }

  .contest-agent-top #contestPrompt {
    max-height: 54px;
    font-size: 13px;
    line-height: 1.55;
  }

  .contest-agent-stream {
    min-height: 0;
    grid-template-rows: minmax(190px, 1fr) auto;
    gap: 8px;
    overflow: visible;
  }

  .contest-agent-stream .result-panel,
  .contest-agent-stream .result-empty {
    min-height: clamp(190px, 28vh, 260px);
  }

  .contest-agent-stream .request-status {
    top: 8px;
    left: 8px;
    min-height: 26px;
    padding: 2px;
    border-radius: 8px;
    box-shadow: none;
  }

  .contest-agent-stream .request-status-label {
    min-height: 0;
    flex-direction: row;
    justify-content: center;
  }

  .contest-agent-stream .request-status-label strong {
    min-height: 22px;
    padding: 0 8px;
    border-radius: 7px;
    font-size: 12px;
  }

  .contest-agent-stream .result-empty {
    padding-top: 24px;
  }

  .contest-agent-stream .result-empty b {
    right: 10px;
    bottom: 8px;
  }

  .agent-composer {
    min-height: 0;
  }

  .composer-input-shell {
    min-height: 92px;
    grid-template-rows: minmax(36px, 1fr) auto;
  }

  .agent-composer .prompt-adjustment-field textarea {
    min-height: 34px;
    max-height: 52px;
    line-height: 1.45;
  }

  .canvas-score-popover {
    width: calc(100vw - 28px);
    max-height: min(320px, calc(100dvh - 112px));
  }
}

@media (min-width: 701px) and (max-width: 900px) {
  .contest-agent-shell .contest-hero {
    grid-template-columns: minmax(0, 1fr) minmax(190px, .34fr);
  }

  .contest-agent-shell .prize-block {
    grid-column: auto;
    width: auto;
    display: flex;
    grid-template-columns: none;
    align-items: stretch;
    padding: 14px 16px;
    border-top: 0;
    border-left: 1px solid #e5e7eb;
  }
}

@media (min-width: 701px) and (max-height: 820px) {
  main.app-main:has(.contest-agent-shell:not([hidden])),
  main.app-main.is-contest-workspace {
    padding-top: 6px;
    padding-bottom: 6px;
  }

  .contest-agent-shell {
    height: calc(100vh - 76px);
    height: calc(100dvh - 76px);
    min-height: 0;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 8px;
    overflow: hidden;
  }

  .contest-agent-top {
    gap: 8px;
  }

  .contest-agent-shell .contest-hero,
  .contest-agent-shell .prize-block {
    min-height: 0;
  }

  .contest-agent-shell .hero-copy {
    height: auto;
    min-height: 0;
    aspect-ratio: var(--contest-hero-aspect);
  }

  .contest-agent-shell .hero-copy h1 {
    font-size: min(var(--hero-title-size, 32px), 22px);
  }

  .contest-agent-shell .contest-clock span {
    font-size: min(var(--hero-countdown-size, 18px), 16px);
  }

  .contest-agent-top .prompt-band {
    min-height: 52px;
    grid-template-columns: auto minmax(0, 1fr) 38px;
    align-items: center;
    gap: 8px 10px;
    padding: 6px 8px;
  }

  .contest-agent-top .prompt-band .section-label {
    grid-column: 1;
    grid-row: 1;
    min-height: 20px;
  }

  .contest-agent-top .prompt-content {
    grid-column: 2;
    grid-row: 1;
  }

  .contest-agent-top .prompt-band .icon-button {
    grid-column: 3;
    grid-row: 1;
    min-width: 36px;
    width: 36px;
    height: 36px;
  }

  .contest-agent-top #contestPrompt {
    max-height: 34px;
    line-height: 1.4;
  }

  .contest-agent-stream {
    grid-template-rows: minmax(0, 1fr) auto;
    overflow: hidden;
    padding: 2px 4px 6px;
    scrollbar-gutter: auto;
  }

  .contest-agent-stream .result-panel,
  .contest-agent-stream .result-empty {
    min-height: 0;
    height: 100%;
  }

  .contest-agent-stream .result-panel {
    border: 1px solid #d8e0ea;
    border-radius: 8px;
  }

  .composer-input-shell {
    min-height: 74px;
    grid-template-rows: minmax(24px, 1fr) auto;
    padding: 6px;
  }

  .composer-disabled-note {
    min-height: 22px;
  }

  .agent-composer .prompt-adjustment-field > span {
    min-height: 18px;
    padding-bottom: 2px;
  }

  .agent-composer .prompt-adjustment-field textarea {
    min-height: 24px;
    max-height: 34px;
    line-height: 1.4;
  }

  .composer-actions {
    margin-top: 4px;
    padding-top: 4px;
  }

  .composer-icon-button,
  .save-ack-inline,
  .composer-send-button {
    width: 30px;
    height: 30px;
    min-width: 30px;
    min-height: 30px;
    border-radius: 7px;
  }
}

@media (min-width: 701px) and (max-height: 480px) {
  .contest-agent-shell {
    height: auto;
    min-height: calc(100dvh - 76px);
    grid-template-rows: auto auto auto;
    overflow: visible;
  }

  .contest-agent-stream {
    min-height: 140px;
    grid-template-rows: minmax(140px, auto) auto;
    overflow: visible;
  }

  .contest-agent-stream .result-panel,
  .contest-agent-stream .result-empty {
    min-height: 140px;
    height: auto;
  }
}

.agent-composer .prompt-adjustment-heading {
  min-height: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 4px 4px;
  color: #64748b;
  font-size: 12px;
  font-weight: 500;
}

.agent-composer .prompt-adjustment-title {
  flex: 0 0 auto;
  color: #64748b;
  font-size: 12px;
  font-weight: 500;
}

.agent-composer .prompt-adjustment-meta {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.agent-composer .prompt-adjustment-counter {
  color: #94a3b8;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.agent-composer .prompt-adjustment-field .submission-quota,
.agent-composer .composer-disabled-note .submission-quota {
  max-width: none;
  min-height: 22px;
  margin: 0;
  padding: 0 8px;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  background: #f8fafc;
  color: #64748b;
  font-size: 12px;
  font-weight: 600;
  line-height: 20px;
  white-space: nowrap;
}

.agent-composer .prompt-adjustment-field .submission-quota.exhausted,
.agent-composer .composer-disabled-note .submission-quota.exhausted {
  border-color: #fecaca;
  background: #fff1f2;
  color: #b91c1c;
}

.agent-composer .composer-disabled-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* Refined neutral workspace theme */
:root {
  --paper: #eff1f4;
  --white: #ffffff;
  --ink: #20212a;
  --muted: #777b89;
  --line: #e1e3e8;
  --blue: #7468e8;
  --blue-soft: #f0edff;
  --green: #35ad79;
  --green-soft: #eaf9f1;
  --amber: #c88935;
  --amber-soft: #fff7e9;
  --red: #df5a70;
  --surface-soft: #f7f8fa;
  --radius: 8px;
  --shadow-sm: 0 1px 2px rgba(32, 33, 42, .04);
  --shadow-md: 0 14px 34px rgba(32, 33, 42, .09);
}

html,
body { background: var(--paper); }

.app-sidebar {
  width: 236px;
  border-color: #e3e5ea;
  background: #f6f7f9;
}

.app-frame { margin-left: 236px; padding-top: 68px; }
.sidebar-brand { height: 68px; border-color: #e8e9ed; }
.sidebar-logo { width: 34px; height: 34px; flex-basis: 34px; }
.sidebar-brand-copy strong { color: #24252d; }
.sidebar-nav { gap: 5px; padding: 18px 12px; }
.sidebar-section-label { margin-top: 14px; color: #9a9daa; }

.sidebar-nav button,
.sidebar-collapse,
.sidebar-public-link {
  min-height: 42px;
  border-radius: 8px;
  color: #696d7a;
  font-weight: 500;
}

.sidebar-nav button:hover,
.sidebar-collapse:hover,
.sidebar-public-link:hover { background: #eceef2; color: #31323b; }

.sidebar-nav button[aria-selected="true"] {
  background: #fff;
  color: #5f57d7;
  font-weight: 600;
  box-shadow: inset 0 0 0 1px #d9dbe1, 0 1px 3px rgba(32, 33, 42, .06);
}

.sidebar-nav button[aria-selected="true"] .nav-icon { stroke-width: 1.9; }
.sidebar-footer { border-color: #e8e9ed; }

.app-header {
  left: 236px;
  height: 68px;
  padding: 0 26px;
  border-color: #e3e5ea;
  background: rgba(249, 250, 251, .98);
  box-shadow: none;
}

.header-leading h1 { color: #292a32; font-size: 17px; }
.header-leading p { color: #8b8e99; font-size: 12px; }
.phase {
  min-height: 30px;
  padding: 0 12px;
  border-color: #cceede;
  border-radius: 999px;
  background: var(--green-soft);
  color: #268d62;
  font-size: 12px;
  font-weight: 600;
}

.phase.ended { border-color: #f4d4da; background: #fff0f2; color: #c54a60; }
.phase.upcoming { border-color: #d8d3ff; background: var(--blue-soft); color: #6659d7; }
.app-main,
main.app-main { width: min(1420px, calc(100% - 52px)); padding-top: 26px; }

input:not([type="checkbox"]):not([type="radio"]),
textarea,
select {
  min-height: 42px;
  border-color: #d9dbe1;
  border-radius: 7px;
  box-shadow: none;
}

input:not([type="checkbox"]):not([type="radio"]):hover,
textarea:hover,
select:hover { border-color: #babdc7; }

input:not([type="checkbox"]):not([type="radio"]):focus,
textarea:focus,
select:focus {
  border-color: #8b80ec;
  box-shadow: 0 0 0 3px rgba(116, 104, 232, .12);
}

.icon-button {
  border-color: #dfe1e6;
  border-radius: 8px;
  background: #fff;
  color: #757986;
}

.icon-button:hover { border-color: #cfc9ff; background: #f5f3ff; color: #6659d7; }
.primary-command { border-color: #7468e8; border-radius: 7px; background: #7468e8; font-weight: 600; }
.primary-command:hover { border-color: #6559d6; background: #6559d6; }

/* Keep the contest layout while aligning its surfaces and controls. */
.contest-agent-shell .contest-hero,
.contest-agent-top .prompt-band,
.contest-agent-stream .result-panel,
.composer-input-shell,
.generation-settings-dialog .settings-dialog-panel {
  border-color: #dfe1e6;
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

.contest-agent-shell .contest-hero,
.contest-agent-top .prompt-band,
.composer-input-shell { background: #fff; }
.contest-agent-shell .prize-block { border-color: #e5e3ef; background: #faf9ff; }
.contest-agent-top .prompt-band .section-label { background: #f1efff; color: #6659d7; }
.contest-agent-top .prompt-band .icon-button { background: #f8f7fb; }
.composer-input-shell:focus-within { border-color: #9186ee; box-shadow: 0 0 0 3px rgba(116, 104, 232, .1); }
.composer-model-trigger:hover { background: #f3f1ff; color: #6659d7; }
.composer-send-button { background: #20212a; box-shadow: 0 5px 12px rgba(32, 33, 42, .2); }
.composer-send-button:hover:not(:disabled) { background: #000; }
.composer-model-menu,
.canvas-score-popover { border-color: #dddfe5; border-radius: 8px; box-shadow: var(--shadow-md); }
.provider-switch label:has(input:checked) { border-color: #8b80ec; background: #f3f1ff; box-shadow: inset 0 0 0 1px #8b80ec; }
.key-loader button { border-color: #7468e8; background: #7468e8; font-weight: 600; }
.key-loader button:hover { background: #6559d6; }
.player-career-dialog::backdrop { background: rgba(41, 42, 50, .42); backdrop-filter: none; }

/* Leaderboard */
.leaderboard-section { padding-bottom: 48px; }
.leaderboard-head { align-items: center; margin-bottom: 18px; }
.leaderboard-head h2 { margin: 0; color: #292a32; font-size: 24px; font-weight: 700; }
.leaderboard-head p { margin-top: 6px; color: #888b96; font-size: 12px; }
.leaderboard-head-actions { align-items: center; }
.leaderboard-contest-picker {
  width: min(430px, 44vw);
  grid-template-columns: auto minmax(220px, 1fr);
  align-items: center;
  gap: 4px 10px;
}

.leaderboard-contest-picker > span { color: #777b87; font-size: 12px; font-weight: 500; }
.leaderboard-contest-picker select { grid-column: 2; grid-row: 1 / 3; min-height: 40px; border-radius: 7px; font-size: 13px; }
.leaderboard-contest-picker > .app-select { grid-column: 2; grid-row: 1 / 3; align-self: center; }
.leaderboard-contest-picker small { font-size: 12px; }

.leaderboard-podium {
  gap: 10px;
  margin: 0 0 16px;
  padding: 0;
}

.podium-card {
  min-height: 190px;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto minmax(42px, auto) auto;
  gap: 12px 14px;
  padding: 18px;
  border-color: #e2e3e8;
  border-radius: 8px;
  box-shadow: none;
}

.podium-card.rank-1,
.podium-card.rank-2,
.podium-card.rank-3 { border-color: #e0e1e6; background: #fff; transform: none; box-shadow: none; }
.podium-card.rank-1 { box-shadow: inset 0 3px 0 #e6bd59; }
.podium-card.rank-2 { box-shadow: inset 0 3px 0 #aeb5c2; }
.podium-card.rank-3 { box-shadow: inset 0 3px 0 #cf8d69; }
.podium-card > header { grid-column: 1 / -1; }
.podium-rank-label { min-height: 25px; padding: 0 8px; border: 0; border-radius: 999px; background: #f3f3f6; font-size: 12px; font-weight: 700; }
.podium-medal { font-size: 12px; }
.player-avatar.podium-avatar { width: 44px; height: 44px; flex-basis: 44px; border-radius: 50%; font-size: 14px; box-shadow: none; }
.podium-name { font-size: 13px; }
.podium-score { grid-column: 2; grid-row: 2; }
.podium-score strong { font-size: 30px; }
.podium-score span { font-size: 12px; }
.podium-signature { grid-column: 1 / -1; font-size: 12px; }
.podium-career-summary { grid-column: 1 / -1; padding-top: 11px; }
.podium-career-summary span { font-size: 12px; }
.podium-career-summary b { font-size: 13px; }

.leaderboard-surface {
  overflow: hidden;
  border: 1px solid #dedfe4;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.ranking-rules { margin: 0; border: 0; border-bottom: 1px solid #ececf0; border-radius: 0; }
.ranking-rules summary { min-height: 46px; padding: 0 16px; color: #626674; font-size: 13px; font-weight: 600; }
.ranking-rules summary::after { color: #8a7feb; font-size: 17px; }
.ranking-rules div { padding: 14px 16px 16px; border-color: #ececf0; background: #fafafe; }
.ranking-rules p { color: #717582; font-size: 12px; }
.ranking-table-scroll { overflow-x: auto; }
.ranking-head,
.ranking-row { min-width: 720px; grid-template-columns: 82px minmax(220px, 1fr) minmax(240px, .8fr) 122px; gap: 16px; }
.ranking-head {
  min-height: 42px;
  padding: 0 18px;
  border: 0;
  border-bottom: 1px solid #ececf0;
  border-radius: 0;
  background: #f7f7f9;
  color: #888b96;
  font-size: 12px;
  font-weight: 500;
}

.ranking-list { border: 0; border-radius: 0; }
.ranking-row {
  min-height: 64px;
  padding: 0 18px;
  border-color: #eeeeF2;
  background: #fff;
}

.ranking-row:hover { background: #fafafe; }
.ranking-list .ranking-row.top-rank,
.ranking-list .ranking-row.rank-first,
.ranking-list .ranking-row.rank-second,
.ranking-list .ranking-row.rank-third { background: #fff; box-shadow: none; }
.ranking-row .rank { width: fit-content; min-width: 32px; min-height: 26px; display: inline-grid; place-items: center; padding: 0 7px; border-radius: 999px; background: #f1f2f5; color: #626674; font-size: 12px; }
.ranking-list .ranking-row.rank-first .rank { background: #fff3d7; color: #9a6b00; }
.ranking-list .ranking-row.rank-second .rank { background: #eef0f3; color: #526174; }
.ranking-list .ranking-row.rank-third .rank { background: #fff0e7; color: #9a4f24; }
.ranking-row .name { font-size: 13px; font-weight: 600; }
.ranking-row code { color: #777b87; font-size: 12px; }
.ranking-row .points { color: #3b3d47; font-size: 18px; }
.ranking-list .ranking-row.rank-first .points,
.ranking-list .ranking-row.rank-second .points,
.ranking-list .ranking-row.rank-third .points { color: #3b3d47; }
.player-avatar { border-radius: 50%; box-shadow: none; }
.player-career-trigger:hover { background: #f0edff; color: #6659d7; }
.score-detail-trigger { border-color: #ddd8ff; background: #f2efff; color: #6659d7; }
.score-detail-trigger:hover { border-color: #c8c1ff; background: #e9e5ff; }
.leaderboard-surface > .pagination { min-height: 58px; margin: 0; padding: 10px 16px; border-top: 1px solid #ececf0; }

/* Profile settings */
.profile-page-head { margin-bottom: 18px; }
.profile-page-head h2 { color: #292a32; font-size: 24px; }
.profile-page-head p { color: #888b96; font-size: 12px; }
.profile-page-head > span { border-color: #ddd8ff; background: #f0edff; color: #6659d7; font-size: 12px; font-weight: 600; }
.profile-settings-shell { min-width: 0; display: grid; gap: 14px; }
.profile-settings-nav { position: sticky; top: 80px; z-index: 12; min-width: 0; display: flex; align-items: center; gap: 6px; padding: 11px 14px; overflow-x: auto; border: 1px solid #dedfe4; border-radius: 8px; background: #fbfbfc; box-shadow: var(--shadow-sm); }
.profile-settings-nav button { min-height: 38px; display: flex; flex: 0 0 auto; align-items: center; padding: 0 12px; border: 0; border-radius: 7px; background: transparent; color: #747784; font-size: 13px; font-weight: 500; cursor: pointer; }
.profile-settings-nav button:hover:not(:disabled) { background: #f0f0f3; color: #34353e; }
.profile-settings-nav button[aria-selected="true"] { background: #786de8; color: #fff; font-weight: 600; box-shadow: 0 4px 10px rgba(116, 104, 232, .18); }
.profile-settings-nav button:disabled { cursor: not-allowed; opacity: .42; }
.profile-settings-content { min-width: 0; padding: 0; }
.profile-stack { min-width: 0; }
.profile-stack-panel { min-width: 0; border: 1px solid #dedfe4; border-radius: 8px; background: #fff; box-shadow: var(--shadow-sm); }
.profile-stack-panel[hidden] { display: none; }
.profile-identity-panel { padding: 0 20px 22px; }
.profile-appearance-panel { padding: 20px; }
.profile-combined-grid { min-width: 0; display: grid; grid-template-columns: minmax(260px, .72fr) minmax(420px, 1.28fr); align-items: start; gap: 20px; margin-top: 20px; }
.profile-account-stack { min-width: 0; padding: 0 20px 22px; border: 1px solid #dedfe4; border-radius: 8px; background: #fff; box-shadow: var(--shadow-sm); }
.profile-unlock-panel {
  grid-template-columns: minmax(260px, 1fr) minmax(250px, .72fr) auto;
  gap: 16px;
  margin: 0;
  padding: 20px 0;
  border: 0;
  border-bottom: 1px solid #e9e9ed;
  border-radius: 0;
  box-shadow: none;
}

.profile-unlock-panel > div strong { color: #30313a; font-size: 14px; }
.profile-unlock-panel > div p { color: #7f828e; font-size: 12px; }
.profile-unlock-panel label { color: #626674; font-size: 12px; font-weight: 500; }
.profile-unlock-panel button { min-height: 42px; border-radius: 7px; background: #7468e8; font-size: 13px; font-weight: 600; }
.profile-editor { grid-template-columns: minmax(260px, .72fr) minmax(420px, 1.28fr); gap: 20px; margin-top: 20px; }
.profile-preview { top: 88px; min-height: 210px; padding: 24px; border-color: rgba(116, 104, 232, .18); border-radius: 8px; box-shadow: none; }
.profile-identity-panel .profile-preview { position: relative; top: auto; width: 100%; margin: 0; }
.profile-preview::after { height: 2px; background: rgba(116, 104, 232, .58); }
.profile-preview small,
.profile-preview p { font-size: 12px; }
.profile-preview-theme { font-size: 12px; font-weight: 600; }
.profile-form { gap: 18px; padding: 0; border: 0; border-radius: 0; box-shadow: none; }
.profile-form-heading { min-height: 48px; padding: 0 0 14px; }
.profile-form-heading h3 { font-size: 15px; }
.profile-form-heading p { font-size: 12px; }
.profile-form .field > span,
.profile-color-field legend,
.profile-avatar-field legend { color: #565a67; font-size: 12px; font-weight: 600; }
.profile-form textarea { min-height: 90px; }
.profile-appearance-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; scroll-margin-top: 88px; }
.profile-setting-column { min-width: 0; padding: 14px; border: 1px solid #e4e5e9; border-radius: 8px; background: #fafafb; }
.profile-setting-column .field { margin: 14px 0 0; }
.profile-color-row code { font-size: 12px; }
.profile-color-row input { border-radius: 7px; }
.profile-color-swatches button { width: 26px; height: 26px; border-radius: 50%; transition: box-shadow 150ms ease; }
.profile-color-swatches button:hover { transform: none; box-shadow: 0 0 0 2px #aaa1f2; }
.profile-form .primary-command { width: auto; min-width: 150px; min-height: 42px; justify-self: end; gap: 28px; padding: 0 14px; }
.profile-award-lookup { margin: 0; padding: 20px; border: 1px solid #dedfe4; border-radius: 8px; background: #fff; box-shadow: var(--shadow-sm); scroll-margin-top: 88px; }
.profile-award-lookup h2 { margin: 0; font-size: 17px; }
.profile-award-lookup p { font-size: 12px; }
.profile-award-lookup form.award-lookup-actions button { border-radius: 7px; background: #7468e8; font-size: 13px; font-weight: 600; }

/* Supporting views */
.local-history-note { border-color: #ddd8ff; background: #f3f1ff; color: #686b77; }
.local-filters,
.local-submission-card,
.archive-edition { border-color: #dedfe4; border-radius: 8px; box-shadow: none; }
.local-filters {
  position: relative;
  top: auto;
  z-index: auto;
  box-shadow: none;
}
.local-submission-list {
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  align-items: stretch;
  gap: 14px;
}
.local-submission-card {
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
}
.local-thumb-button { aspect-ratio: 1; }
.local-thumb-button img,
.local-submission-card > img { height: 100%; object-fit: cover; }
.local-submission-detail {
  display: grid;
  grid-template-rows: auto minmax(34px, auto) auto 32px;
  align-content: start;
  gap: 6px;
  min-height: 145px;
  padding: 11px;
}
.local-submission-detail > small {
  min-height: 34px;
  display: -webkit-box;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.local-submission-detail > .local-model code { line-height: 18px; }
.local-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-self: end;
  gap: 5px;
  margin: 0;
}
.local-actions .download-command,
.local-actions .share-command,
.local-actions .retry-command,
.local-actions .local-detail-command {
  min-width: 0;
  width: 100%;
  min-height: 32px;
  justify-content: center;
  padding: 0 4px;
  border-radius: 7px;
  font-size: 12px;
  line-height: 30px;
  white-space: nowrap;
}
.local-filter-actions button,
#deleteLocalSelected { border-radius: 7px; }
.local-filter-actions button:hover { border-color: #d3ceff; background: #f2efff; color: #6659d7; }
.archive-heading h2 { color: #292a32; font-size: 24px; }
.archive-edition > header { background: #fafafb; }
.archive-list { gap: 16px; }
.archive-edition > header {
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.archive-edition > header h3 { margin-top: 4px; }
.archive-edition > header small,
.archive-edition > header > span { font-size: 12px; }
.archive-winners {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
  gap: 14px;
  padding: 16px;
}
.archive-work {
  height: 100%;
  display: grid;
  grid-template-rows: auto 56px;
  box-shadow: none;
}
.archive-preview-button { aspect-ratio: 1; }
.archive-preview-button img { width: 100%; height: 100%; object-fit: cover; }
.archive-work figcaption {
  min-width: 0;
  min-height: 56px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
}
.archive-career-trigger { width: fit-content; max-width: 100%; margin-left: -5px; }
.archive-work figcaption > span { font-size: 12px; white-space: nowrap; }
.archive-work.rank-first { border-top-color: #e6bd59; }
.archive-work.rank-second { border-top-color: #aeb5c2; }
.archive-work.rank-third { border-top-color: #cf8d69; }
.pagination button[aria-current="page"] { border-color: #7468e8; background: #7468e8; color: #fff; }
.score-detail-dialog,
.player-career-dialog,
.share-card-dialog { border-color: #dcdde3; border-radius: 8px; }
.score-detail-head { background: #fafafb; }

/* Shared icon actions and model settings */
.icon-button {
  width: 36px;
  min-width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid #d9dbe1;
  border-radius: 8px;
  background: #fff;
  color: #6f7380;
  box-shadow: 0 1px 2px rgba(32, 33, 42, .04);
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, color 150ms ease, box-shadow 150ms ease;
}
.icon-button .nav-icon,
.icon-button .refresh-icon { width: 17px; height: 17px; flex-basis: 17px; }
.icon-button:hover:not(:disabled) { border-color: #c8c1ff; background: #f3f1ff; color: #6659d7; box-shadow: 0 3px 8px rgba(116, 104, 232, .1); }
.icon-button:active:not(:disabled) { background: #ebe7ff; }
.icon-button.is-loading:disabled { border-color: #d8d3ff; background: #f3f1ff; color: #6659d7; opacity: 1; }
.icon-button.is-loading .refresh-icon { animation: refresh-spin 700ms linear infinite; }

.generation-settings-dialog {
  width: min(900px, calc(100% - 32px));
  max-height: min(820px, calc(100dvh - 32px));
  border-color: #d9dbe1;
  border-radius: 8px;
  box-shadow: 0 26px 72px rgba(32, 33, 42, .2);
}
.generation-settings-dialog::backdrop { background: rgba(32, 33, 42, .44); }
.generation-settings-dialog .settings-dialog-panel { grid-template-rows: auto minmax(0, 1fr) auto auto; background: #fff; }
.settings-dialog-panel > header {
  min-height: 76px;
  padding: 18px 24px;
  border-color: #e5e6ea;
  background: #fafafb;
}
.settings-dialog-panel h2 { color: #292a32; font-size: 19px; }
.settings-dialog-panel header p { color: #7d808c; font-size: 12px; }
.settings-dialog-panel > header .icon-button { width: 36px; min-width: 36px; height: 36px; font-size: inherit; }
#closeGenerationSettings:not(:disabled):hover { border-color: #c8c1ff; background: #f3f1ff; color: #6659d7; }
.generation-settings-dialog .entry-controls-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  gap: 0;
  padding: 0 24px;
  background: #fff;
}
.generation-settings-dialog .settings-block {
  min-width: 0;
  display: grid;
  gap: 16px;
  padding: 20px 0;
  border-bottom: 1px solid #e8e9ed;
}
.generation-settings-dialog .settings-block:last-child { border-bottom: 0; }
.settings-block-heading,
.generation-settings-dialog .judge-divider.settings-block-heading {
  min-height: 0;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  margin: 0;
  padding: 0;
  border: 0;
}
.settings-block-heading > span,
.generation-settings-dialog .judge-divider.settings-block-heading > span {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #f0edff;
  color: #6659d7;
  font-size: 12px;
  font-weight: 700;
}
.settings-block-heading h3 { color: #30313a; font-size: 14px; font-weight: 700; }
.settings-block-heading p,
.generation-settings-dialog .judge-divider.settings-block-heading p { margin: 3px 0 0; color: #858894; font-size: 12px; text-align: left; }
.generation-settings-dialog .provider-switch {
  grid-column: auto;
  width: fit-content;
  grid-template-columns: repeat(2, minmax(132px, 168px));
  gap: 10px;
  margin: 0;
  padding: 0;
  background: transparent;
}
.generation-settings-dialog .provider-switch legend { width: 1px; height: 1px; position: absolute; overflow: hidden; clip: rect(0 0 0 0); }
.generation-settings-dialog .provider-switch label {
  min-height: 42px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid #d9dbe1;
  border-radius: 7px;
  background: #fff;
}
.generation-settings-dialog .provider-switch input {
  position: static;
  width: 17px;
  height: 17px;
  margin: 0;
  opacity: 1;
  accent-color: #7468e8;
  pointer-events: auto;
}
.generation-settings-dialog .provider-switch label:hover { border-color: #bbb6ee; background: #fdfdff; }
.generation-settings-dialog .provider-switch label:has(input:checked) {
  border-color: #8b80ec;
  background: #faf9ff;
  box-shadow: 0 0 0 2px rgba(116, 104, 232, .08);
}
.generation-settings-dialog .provider-switch span { color: #3d3f49; font-size: 13px; font-weight: 600; }
.generation-settings-dialog .provider-switch small { color: #888b96; font-size: 12px; }
.settings-field-grid { min-width: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.generation-settings-dialog .field { min-width: 0; gap: 7px; margin: 0; }
.generation-settings-dialog .field > span { color: #5f626f; font-size: 12px; font-weight: 600; }
.generation-settings-dialog .field input,
.generation-settings-dialog .field select { min-height: 42px; border-radius: 7px; }
.generation-settings-dialog .key-loader { grid-template-columns: minmax(0, 1fr) 88px; }
.generation-settings-dialog .key-loader input { border-radius: 7px 0 0 7px; }
.generation-settings-dialog .key-loader button {
  min-height: 42px;
  border-radius: 0 7px 7px 0;
  background: #7468e8;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}
.generation-settings-dialog .save-warning {
  margin: 0 24px 16px;
  padding: 12px 14px;
  border: 1px solid #f0dfb8;
  border-radius: 7px;
  background: #fff9ed;
}
.generation-settings-dialog .save-warning strong { color: #75551d; font-size: 13px; }
.generation-settings-dialog .save-warning p { margin-top: 4px; color: #8a6a32; font-size: 12px; }
.settings-dialog-panel > footer {
  grid-template-columns: minmax(0, 1fr) 148px;
  gap: 16px;
  padding: 14px 24px;
  border-color: #e5e6ea;
  background: #fafafb;
}
.settings-dialog-panel .key-note {
  width: auto;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #747784;
}
.settings-dialog-panel .primary-command { min-height: 42px; border-radius: 7px; }

.player-career-head {
  grid-template-columns: 58px minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 26px 68px 26px 28px;
}
.player-career-head > div { display: grid; grid-template-rows: auto auto minmax(36px, auto) auto; align-content: center; }
.player-career-head small,
.player-career-head p,
.player-career-meta,
.player-career-badge { font-size: 12px; }
.player-career-head h2 { margin-top: 4px; }
.player-career-signature {
  min-height: 36px;
  display: -webkit-box;
  overflow: hidden;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.player-career-badge { justify-self: end; font-weight: 600; }
.player-career-stats > div {
  min-height: 112px;
  display: grid;
  grid-template-rows: 18px 32px 20px;
  align-content: center;
  padding: 16px;
}
.player-career-stats small,
.player-career-stats span { margin: 0; font-size: 12px; }
.player-career-stats strong {
  align-self: stretch;
  height: 32px;
  display: flex;
  align-items: center;
  margin: 0;
  overflow: hidden;
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.career-reward-stat strong { font-size: 18px; }
.player-career-awards > header { align-items: center; }
.player-career-awards > header span { font-size: 12px; }
.career-award {
  grid-template-columns: 44px minmax(0, 1fr) 86px;
  gap: 12px;
  min-height: 62px;
}
.career-award-rank { font-size: 12px; font-weight: 700; }
.career-award strong,
.career-award small,
.career-award-value { font-size: 12px; }
.career-award-value { justify-self: end; min-width: 86px; font-weight: 600; text-align: right; }
.player-career-card > footer { font-size: 12px; }

@media (max-width: 1180px) {
  .profile-editor { grid-template-columns: 1fr; }
  .profile-combined-grid { grid-template-columns: 1fr; }
  .profile-preview { position: relative; top: auto; }
}

@media (max-width: 980px) {
  .app-frame { margin-left: 0; }
  .app-header, .sidebar-collapsed .app-header { left: 0; }
  .app-main,
  main.app-main { width: min(100% - 28px, 1420px); }
  .profile-unlock-panel { grid-template-columns: 1fr; align-items: stretch; }
  .archive-winners { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
  .app-header { height: 60px; padding: 0 14px; }
  .app-frame, .sidebar-collapsed .app-frame { padding-top: 60px; }
  .app-main,
  main.app-main { width: min(100% - 20px, 1420px); padding-top: 14px; }
  .leaderboard-head { align-items: stretch; gap: 14px; }
  .leaderboard-head-actions { align-items: flex-end; }
  .leaderboard-contest-picker { width: 100%; grid-template-columns: 1fr; }
  .leaderboard-contest-picker select { grid-column: 1; grid-row: auto; }
  .leaderboard-contest-picker > .app-select { grid-column: 1; grid-row: auto; }
  .leaderboard-podium { grid-template-columns: 1fr; }
  .podium-card { min-height: 0; }
  .profile-page-head > span { display: none; }
  .profile-settings-shell { overflow: visible; }
  .profile-settings-nav { top: 70px; gap: 6px; padding: 10px; }
  .profile-settings-nav button { padding: 0 10px; }
  .profile-account-stack { padding: 0 14px 16px; }
  .profile-identity-panel { padding: 0 14px 16px; }
  .profile-appearance-panel { padding: 14px; }
  .profile-award-lookup { padding: 16px 14px; }
  .profile-appearance-grid { grid-template-columns: 1fr; }
  .profile-form .primary-command { width: 100%; justify-self: stretch; }
  .profile-award-lookup { grid-template-columns: 1fr; }
  .local-filters {
    position: relative;
    top: auto;
    z-index: auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 12px;
    box-shadow: none;
  }
  .local-filters > label { gap: 5px; }
  .local-filters select { min-height: 38px; padding-left: 10px; font-size: 12px; }
  .local-filter-actions,
  .local-bulk-bar { grid-column: 1 / -1; }
  .local-filter-actions { flex-wrap: nowrap; }
  .local-filter-actions button { min-height: 36px; padding: 0 12px; }
  .local-bulk-bar { min-height: 0; padding: 9px 10px; }
  .local-bulk-actions { flex-wrap: nowrap; gap: 8px; }
  .local-select-all { min-height: 32px; }
  #deleteLocalSelected { min-height: 32px; padding: 0 9px; }
  #localSelectionMeta { margin-left: auto; }
  .local-submission-list { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .local-submission-card { grid-template-rows: auto auto; }
  .local-thumb-button { aspect-ratio: 16 / 10; }
  .local-submission-detail {
    min-height: 0;
    grid-template-rows: auto auto auto auto;
    gap: 7px;
    padding: 12px;
  }
  .local-submission-detail > small { min-height: 0; display: block; }
  .local-actions { grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: 34px; gap: 6px; }
  .archive-winners { grid-template-columns: 1fr; padding: 10px; }
  .archive-edition > header { min-height: 78px; padding: 14px; }
  .player-career-stats > div { min-height: 100px; }
  .career-award { grid-template-columns: 38px minmax(0, 1fr) 72px; gap: 9px; }
  .career-award-value { min-width: 72px; }
  .generation-settings-dialog { width: calc(100% - 16px); max-height: calc(100dvh - 16px); }
  .settings-dialog-panel > header { min-height: 68px; padding: 14px 16px; }
  .generation-settings-dialog .entry-controls-grid { padding: 0 16px; }
  .generation-settings-dialog .settings-block { padding: 16px 0; }
  .settings-field-grid,
  .settings-dialog-panel > footer { grid-template-columns: 1fr; }
  .generation-settings-dialog .provider-switch {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .generation-settings-dialog .save-warning { margin: 0 16px 12px; }
  .settings-dialog-panel > footer { padding: 12px 16px; }
}

/* Mobile hero keeps desktop coordinates while fitting long titles to one line. */
@media (max-width: 700px) {
  .contest-agent-shell .hero-copy h1 {
    width: max-content;
    max-width: calc(100% - var(--hero-title-x, 5%) - 8px);
    max-height: none;
    overflow: hidden;
    font-size: var(--hero-title-mobile-size, 14px);
    line-height: 1.25;
    overflow-wrap: normal;
    text-overflow: clip;
    white-space: nowrap;
    word-break: keep-all;
  }

  .contest-agent-shell .contest-clock {
    width: min(72%, calc(96% - var(--hero-countdown-x, 5%)));
    gap: 6px;
    flex-wrap: nowrap;
    white-space: nowrap;
  }

  .contest-agent-shell .contest-clock span {
    font-size: min(var(--hero-countdown-size, 14px), 14px);
    line-height: 1.2;
  }

  .contest-agent-shell .contest-clock small {
    font-size: 12px;
    line-height: 1.2;
  }

  .contest-agent-shell .prize-block {
    min-height: 68px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 6px 14px;
    padding: 11px 14px;
  }

  .contest-agent-shell .prize-block > small { grid-column: 1; }
  .contest-agent-shell .prize-block > strong {
    grid-column: 2;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 6px 10px;
  }

  .contest-agent-shell .prize-summary-label,
  .contest-agent-shell .prize-summary-values { font-size: 12px; }
  .contest-agent-shell .prize-summary-values { max-height: none; overflow: visible; }
}

@media (max-width: 420px) {
  .contest-agent-shell .hero-copy h1 { font-size: var(--hero-title-mobile-size, 14px); }
  .contest-agent-shell .contest-clock span { font-size: min(var(--hero-countdown-size, 13px), 13px); }
}

/* Compact prize summary with a single visual center. */
.contest-agent-shell .prize-block {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: center;
  justify-items: start;
  gap: 18px;
  padding: 22px;
  border-left: 1px solid #e3e2e8;
  background: #fbfaf8;
}

.prize-heading {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.prize-icon {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: grid;
  place-items: center;
  border: 1px solid #f0dfb8;
  border-radius: 8px;
  background: #fff7e7;
  color: #9b6417;
}

.prize-icon .nav-icon { width: 18px; height: 18px; flex-basis: 18px; }
.contest-agent-shell .prize-heading small { color: #6f6252; font-size: 13px; font-weight: 600; }
.contest-agent-shell .prize-block > strong { width: 100%; display: grid; gap: 7px; }
.contest-agent-shell .prize-summary-label { color: #8c7351; font-size: 12px; font-weight: 600; }
.contest-agent-shell .prize-summary-values { max-height: none; overflow: visible; color: #292a32; font-size: 20px; line-height: 1.3; }

@media (max-width: 700px) {
  .contest-agent-shell .prize-block {
    min-height: 68px;
    grid-template-columns: auto minmax(0, 1fr);
    align-content: center;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-top: 1px solid #e3e2e8;
    border-left: 0;
  }

  .prize-heading { gap: 7px; }
  .prize-icon { width: 30px; height: 30px; flex-basis: 30px; border-radius: 7px; }
  .prize-icon .nav-icon { width: 16px; height: 16px; flex-basis: 16px; }
  .contest-agent-shell .prize-heading small { font-size: 12px; white-space: nowrap; }
  .contest-agent-shell .prize-block > strong { grid-column: 2; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 8px; }
  .contest-agent-shell .prize-summary-label,
  .contest-agent-shell .prize-summary-values { font-size: 12px; }
}

/* Generated image canvas and score inspector. */
.contest-agent-stream .generated-frame {
  height: clamp(280px, 52vh, 640px);
  min-height: 280px;
  max-height: none;
  overflow: hidden;
}

.contest-agent-stream .generated-preview-button {
  position: absolute;
  inset: 0;
  min-width: 0;
  min-height: 0;
  height: 100%;
}

.contest-agent-stream .generated-preview-button img,
.contest-agent-stream .generated-frame img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
}

.canvas-score-trigger {
  min-width: 132px;
  height: 34px;
  gap: 7px;
  padding: 0 12px;
  border: 1px solid rgba(221, 223, 229, .96);
  border-top: 0;
  border-radius: 0 0 8px 8px;
  background: rgba(255, 255, 255, .97);
  color: #626777;
  box-shadow: 0 6px 18px rgba(41, 42, 50, .1);
  cursor: pointer;
}

.canvas-score-trigger:hover,
.canvas-score-trigger[aria-expanded="true"] {
  border-color: #d2d5dc;
  background: #f5f6f8;
  color: #292a32;
}

.canvas-score-trigger:focus-visible {
  outline: 3px solid rgba(75, 85, 99, .16);
  outline-offset: 2px;
}

.canvas-score-popover {
  position: fixed;
  inset: auto;
  z-index: 1000;
  width: min(460px, calc(100vw - 24px));
  max-height: min(360px, calc(100dvh - 24px));
  margin: 0;
  padding: 0;
  overflow: auto;
  border: 1px solid #d9dbe2;
  border-radius: 8px;
  background: #fff;
  color: #292a32;
  box-shadow: 0 18px 50px rgba(41, 42, 50, .18);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
  transform-origin: var(--score-popover-origin-x, 50%) var(--score-popover-origin-y, 0);
  transition: opacity var(--motion-fast) var(--ease-out), transform var(--motion-fast) var(--ease-out);
}

.canvas-score-popover:not(:popover-open):not(.is-open) { display: none; }
.canvas-score-popover.is-open { display: block; }
.canvas-score-popover.is-entering,
.canvas-score-popover.is-closing {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-5px) scale(.98);
}
.canvas-score-popover::backdrop { background: transparent; }
.canvas-score-popover > header {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 12px 10px 14px;
  border-bottom: 1px solid #e6e7eb;
  background: #fafafb;
}
.canvas-score-popover > header > div { min-width: 0; display: grid; gap: 2px; }
.canvas-score-popover > header small { color: #8a8d98; font-size: 12px; font-weight: 500; }
.canvas-score-popover > header strong { font-size: 14px; font-weight: 700; }
.canvas-score-popover > header button {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid #dfe1e6;
  border-radius: 7px;
  background: #fff;
  color: #717582;
  cursor: pointer;
}
.canvas-score-popover > header button:hover { border-color: #cfd2d9; color: #292a32; }
.canvas-score-popover > header .nav-icon { width: 16px; height: 16px; }
.canvas-score-popover .score-result {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin: 0;
  border: 0;
  border-radius: 0;
  background: #fff;
}
.canvas-score-popover .score-item {
  min-height: 84px;
  display: grid;
  align-content: center;
  gap: 5px;
  padding: 11px 10px;
  border-right: 1px solid #e6e7eb;
  background: #fff;
}
.canvas-score-popover .score-item:last-of-type { border-right: 0; }
.canvas-score-popover .score-item small { min-height: 0; color: #858996; font-size: 12px; line-height: 1.35; }
.canvas-score-popover .score-item strong { margin: 0; color: #292a32; font-size: 20px; font-weight: 700; }
.canvas-score-popover .score-total {
  min-height: 58px;
  padding: 10px 14px;
  border-top: 1px solid #e1e2e7;
  background: #f6f7fa;
  color: #4d5260;
}
.canvas-score-popover .score-total span { font-size: 13px; font-weight: 600; }
.canvas-score-popover .score-total strong { color: #292a32; font-size: 26px; font-weight: 700; }
.canvas-score-popover .judge-comment {
  grid-column: 1 / -1;
  max-height: 96px;
  margin: 0;
  padding: 11px 14px;
  overflow-y: auto;
  border-top: 1px solid #e6e7eb;
  background: #fff;
  color: #626777;
  font-size: 12px;
  line-height: 1.65;
}

/* Full-screen image canvas. */
.archive-lightbox { background: #17181d; }
.archive-lightbox::backdrop { background: rgba(23, 24, 29, .82); }
.image-viewer-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  touch-action: none;
  cursor: default;
  background:
    linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px),
    #17181d;
  background-size: 32px 32px;
}
.image-viewer-stage.can-pan { cursor: grab; }
.image-viewer-stage.is-dragging { cursor: grabbing; }
.archive-lightbox .image-viewer-stage img {
  top: 50%;
  left: 50%;
  max-width: calc(100vw - 72px);
  max-height: calc(100dvh - 116px);
  border-radius: 4px;
  box-shadow: 0 18px 70px rgba(0, 0, 0, .42);
  user-select: none;
  will-change: transform;
}
.image-viewer-toolbar {
  position: absolute;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 3;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 8px;
  background: rgba(32, 34, 40, .94);
  transform: translateX(-50%);
}
.archive-lightbox .image-viewer-control {
  position: static;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #f5f5f7;
  font-size: 12px;
}
.archive-lightbox .image-viewer-control:hover { background: rgba(255, 255, 255, .1); }
.archive-lightbox .image-viewer-control:disabled { color: #777b86; cursor: not-allowed; }
.archive-lightbox .image-viewer-control .nav-icon { width: 17px; height: 17px; }
.archive-lightbox .image-viewer-fit { width: auto; padding: 0 10px; white-space: nowrap; }
.archive-lightbox .image-viewer-fit b { font-size: 12px; font-weight: 600; white-space: nowrap; }
.image-viewer-toolbar output { min-width: 52px; color: #e3e4e8; font-size: 12px; font-variant-numeric: tabular-nums; text-align: center; }
.image-viewer-toolbar > span { width: 1px; height: 20px; margin: 0 3px; background: rgba(255, 255, 255, .16); }
.archive-lightbox .image-viewer-close {
  top: max(16px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  z-index: 4;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  padding: 0;
  border-color: rgba(255, 255, 255, .22);
  border-radius: 8px;
  background: rgba(32, 34, 40, .9);
}
.archive-lightbox .image-viewer-close .nav-icon { width: 18px; height: 18px; }
.image-viewer-hint {
  position: absolute;
  left: max(16px, env(safe-area-inset-left));
  bottom: max(24px, env(safe-area-inset-bottom));
  z-index: 2;
  margin: 0;
  color: #a6a9b2;
  font-size: 12px;
}

@media (max-width: 700px) {
  .contest-agent-stream .generated-frame {
    height: clamp(240px, 40vh, 420px);
    min-height: 240px;
    max-height: none;
  }
  .canvas-score-popover .score-result { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .canvas-score-popover .score-item { min-height: 68px; border-bottom: 1px solid #e6e7eb; }
  .canvas-score-popover .score-item:nth-child(2n) { border-right: 0; }
  .canvas-score-popover .score-item:nth-child(5) { grid-column: 1 / -1; border-right: 0; }
  .canvas-score-popover .score-total { min-height: 52px; }
  .canvas-score-popover { max-height: min(420px, calc(100dvh - 24px)); }
  .archive-lightbox .image-viewer-stage img { max-width: calc(100vw - 24px); max-height: calc(100dvh - 104px); }
  .image-viewer-hint { display: none; }
  .image-viewer-toolbar { bottom: max(12px, env(safe-area-inset-bottom)); }
}

/* Keep the hero image independent from reward copy at every window size. */
.contest-agent-shell .contest-hero {
  display: block;
  height: clamp(150px, 19vw, 230px);
  aspect-ratio: auto;
}

.contest-agent-shell .hero-copy {
  height: 100%;
  aspect-ratio: auto;
  border-radius: inherit;
}

.contest-agent-top .prompt-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 36px;
  grid-template-rows: auto auto;
  align-items: start;
  gap: 8px 14px;
  min-height: 82px;
  padding: 12px 14px;
}

.prompt-heading-row {
  min-width: 0;
  grid-column: 1;
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: 10px 12px;
  flex-wrap: wrap;
}

.contest-agent-top .prompt-band .section-label {
  grid-column: auto;
  grid-row: auto;
  flex: 0 0 auto;
}

.prompt-prize {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  padding-left: 12px;
  border-left: 1px solid #e4d9c7;
  color: #8d651f;
}

.prompt-prize-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}

.prompt-prize-name {
  flex: 0 0 auto;
  color: #746b60;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.prompt-prize > strong {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 6px;
  color: #2f3037;
  font-size: 13px;
  line-height: 1.35;
}

.prompt-prize .prize-summary-label {
  flex: 0 0 auto;
  color: #8c7351;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.prompt-prize .prize-summary-values {
  min-width: 0;
  color: #2f3037;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  white-space: nowrap;
}

.contest-agent-top .prompt-content {
  grid-column: 1;
  grid-row: 2;
}

.contest-agent-top .prompt-band .icon-button {
  grid-column: 2;
  grid-row: 1 / 3;
}

@media (max-width: 700px) {
  .contest-agent-shell .contest-hero {
    height: auto;
    aspect-ratio: var(--contest-hero-aspect);
  }
  .contest-agent-shell .hero-copy { border-radius: inherit; }
  .contest-agent-top .prompt-band {
    min-height: 0;
    gap: 8px 10px;
    padding: 10px 12px;
  }
  .prompt-heading-row { gap: 8px 10px; }
  .prompt-prize {
    flex: 1 1 190px;
    gap: 6px;
    padding-left: 10px;
  }
  .prompt-prize-name { display: none; }
  .prompt-prize > strong { gap: 5px; }
  .prompt-prize .prize-summary-label,
  .prompt-prize .prize-summary-values { font-size: 12px; }
}

/* Admin preview modes mirror the live wide, compact, and mobile hero canvases. */
.hero-preview-toolbar {
  justify-content: space-between;
  flex-wrap: wrap;
}

.hero-preview-viewport-switch {
  grid-template-columns: repeat(3, minmax(72px, 1fr));
}

.hero-style-preview-card {
  display: block;
  width: 100%;
  margin-right: auto;
  margin-left: auto;
}

.hero-style-preview-card .hero-style-preview {
  width: 100%;
  height: auto;
  border-radius: 9px;
}

.hero-style-preview-card[data-hero-preview-mode="desktop"] .hero-style-preview {
  aspect-ratio: 1328 / 230;
}

.hero-style-preview-card[data-hero-preview-mode="compact"] {
  width: min(100%, 586px);
}

.hero-style-preview-card[data-hero-preview-mode="compact"] .hero-style-preview {
  aspect-ratio: 586 / 150;
}

.hero-style-preview-card[data-hero-preview-mode="mobile"] {
  width: min(100%, 390px);
}

.hero-style-preview-card[data-hero-preview-mode="mobile"] .hero-style-preview {
  aspect-ratio: var(--contest-hero-aspect);
}

.hero-style-preview-card[data-hero-preview-mode="mobile"] .hero-preview-title {
  width: max-content;
  max-width: calc(100% - var(--hero-item-x, 5%) - 8px);
  overflow: hidden;
}

.hero-style-preview-card[data-hero-preview-mode="mobile"] .hero-preview-title h3 {
  overflow: hidden;
  overflow-wrap: normal;
  text-overflow: clip;
  white-space: nowrap;
  word-break: keep-all;
}

@media (max-width: 700px) {
  .hero-preview-toolbar { align-items: stretch; }
  .hero-preview-layer-switch,
  .hero-preview-viewport-switch { width: 100%; }
}

/* Admin toolbars keep all controls in explicit tracks after adding mode switching. */
.dashboard-admin .dashboard-toolbar {
  grid-template-columns: minmax(280px, 1fr) auto minmax(220px, 340px) 42px;
  align-items: end;
}

.dashboard-admin .dashboard-toolbar > div:first-child { grid-column: 1; }
.dashboard-admin .dashboard-mode-switch { grid-column: 2; width: max-content; justify-self: start; white-space: nowrap; }
.dashboard-admin #dashboardContestField, .dashboard-admin #dashboardWorkbenchRangeField { grid-column: 3; min-width: 0; }
.dashboard-admin #refreshDashboard { grid-column: 4; }
.workbench-dashboard-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.workbench-dashboard-kpis article { border-right: 1px solid var(--line); border-bottom: 0; }
.workbench-dashboard-kpis article:nth-child(4) { border-right: 0; }
.workbench-dashboard-kpis article:nth-child(8) { border-right: 0; }
.workbench-dashboard-kpis article:nth-child(-n+4) { border-bottom: 1px solid var(--line); }
.workbench-user-dashboard { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: var(--shadow-sm); }
.workbench-user-dashboard > header { min-height: 78px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.workbench-user-dashboard h3 { font-size: 20px; font-weight: 700; }
.workbench-user-dashboard header p { margin-top: 5px; color: var(--muted); font-size: 12px; }
.workbench-user-dashboard > header > span { flex: 0 0 auto; color: var(--muted); font-size: 12px; }
.workbench-user-usage-head, .workbench-user-usage-row { display: grid; grid-template-columns: 64px minmax(180px, 1.2fr) minmax(280px, 1fr) 120px; align-items: center; gap: 14px; padding: 0 20px; }
.workbench-user-usage-head { min-height: 42px; border-bottom: 1px solid var(--line); background: #f9fafb; color: var(--muted); font-size: 12px; font-weight: 600; }
.workbench-user-usage-row { min-height: 70px; border-bottom: 1px solid var(--line); }
.workbench-user-usage-row:last-child { border-bottom: 0; }
.workbench-user-usage-rank { color: var(--muted); font: 700 14px var(--mono); }
.workbench-user-usage-person { min-width: 0; display: grid; gap: 4px; }
.workbench-user-usage-person > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.workbench-user-usage-person small, .workbench-user-usage-stats small { color: var(--muted); font-size: 12px; }
.workbench-user-usage-stats { min-width: 0; display: grid; grid-template-columns: 72px 72px minmax(100px, 1fr); align-items: center; gap: 12px; }
.workbench-user-usage-stats > span { display: grid; gap: 4px; }
.workbench-user-usage-stats b { font-size: 13px; }
.workbench-user-usage-rate { min-width: 0; }
.workbench-user-usage-rate > b { font-variant-numeric: tabular-nums; }
.workbench-user-usage-rate progress { width: 100%; height: 5px; accent-color: var(--blue); }
.workbench-user-usage-cost { color: var(--ink); font-size: 14px; text-align: right; }

.usage-heading { grid-template-columns: minmax(280px, 1fr) auto minmax(220px, 340px) 42px; align-items: end; }
.usage-heading > div:first-child { grid-column: 1; }
.usage-heading .dashboard-mode-switch { grid-column: 2; width: max-content; white-space: nowrap; }
.usage-heading #usageContestField { grid-column: 3; min-width: 0; }
.usage-heading #refreshUsage { grid-column: 4; }

.workbench-trace-head-actions { display: flex; align-items: center; gap: 10px; }
.workbench-trace-head-actions > span { color: var(--muted); font-size: 12px; white-space: nowrap; }
.workbench-trace-head-actions .icon-button { width: 42px; height: 42px; flex: 0 0 42px; }

@media (max-width: 1180px) {
  .dashboard-admin .dashboard-toolbar { grid-template-columns: auto minmax(220px, 1fr) 42px; }
  .dashboard-admin .dashboard-toolbar > div:first-child { grid-column: 1 / -1; }
  .dashboard-admin .dashboard-mode-switch { grid-column: 1; }
  .dashboard-admin #dashboardContestField, .dashboard-admin #dashboardWorkbenchRangeField { grid-column: 2; }
  .dashboard-admin #refreshDashboard { grid-column: 3; }
  .usage-heading { grid-template-columns: auto minmax(220px, 1fr) 42px; }
  .usage-heading > div:first-child { grid-column: 1 / -1; }
  .usage-heading .dashboard-mode-switch { grid-column: 1; }
  .usage-heading #usageContestField { grid-column: 2; }
  .usage-heading #refreshUsage { grid-column: 3; }
  .workbench-dashboard-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workbench-dashboard-kpis article:nth-child(odd) { border-right: 1px solid var(--line); }
  .workbench-dashboard-kpis article:nth-child(2n) { border-right: 0; }
  .workbench-dashboard-kpis article:nth-child(-n+6) { border-bottom: 1px solid var(--line); }
}

@media (max-width: 700px) {
  .dashboard-admin .dashboard-toolbar { grid-template-columns: minmax(0, 1fr) 42px; }
  .dashboard-admin .dashboard-mode-switch { grid-column: 1 / -1; }
  .dashboard-admin #dashboardContestField, .dashboard-admin #dashboardWorkbenchRangeField { grid-column: 1; }
  .dashboard-admin #refreshDashboard { grid-column: 2; }
  .usage-heading { grid-template-columns: minmax(0, 1fr) 42px; }
  .usage-heading .dashboard-mode-switch { grid-column: 1 / -1; }
  .usage-heading #usageContestField { grid-column: 1; }
  .usage-heading #refreshUsage { grid-column: 2; }
  .workbench-dashboard-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workbench-dashboard-kpis article:nth-child(n) { min-height: 108px; border-right: 0; border-bottom: 1px solid var(--line); }
  .workbench-dashboard-kpis article:nth-child(odd) { border-right: 1px solid var(--line); }
  .workbench-dashboard-kpis article:nth-last-child(-n+2) { border-bottom: 0; }
  .workbench-user-dashboard > header { align-items: flex-start; flex-direction: column; gap: 4px; }
  .workbench-user-usage-head { display: none; }
  .workbench-user-usage-row { grid-template-columns: 38px minmax(0, 1fr) auto; gap: 7px 10px; padding: 10px 14px; }
  .workbench-user-usage-rank { grid-column: 1; grid-row: 1 / span 2; }
  .workbench-user-usage-person { grid-column: 2; grid-row: 1; }
  .workbench-user-usage-cost { grid-column: 3; grid-row: 1; }
  .workbench-user-usage-stats { grid-column: 2 / 4; grid-row: 2; grid-template-columns: 58px 58px minmax(90px, 1fr); gap: 10px; }
  .workbench-trace-head-actions { width: 100%; justify-content: space-between; }
}

@media (max-width: 480px) {
  .usage-date-range { grid-template-columns: 1fr; }
}

/* Shared custom select surface for the contest and admin static interfaces. */
.app-select { position: relative; min-width: 0; width: 100%; display: block; }
.app-native-select { position: absolute !important; width: 1px !important; height: 1px !important; min-height: 0 !important; margin: 0 !important; padding: 0 !important; overflow: hidden !important; clip: rect(0 0 0 0) !important; white-space: nowrap !important; opacity: 0 !important; pointer-events: none !important; }
.app-select-trigger { width: 100%; min-height: 42px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 11px; border: 1px solid #d9dbe1; border-radius: 7px; background: #fff; color: var(--ink); font-family: var(--body); font-size: 13px; font-weight: 500; line-height: 1.35; text-align: left; cursor: pointer; }
.app-select-trigger > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.generation-settings-dialog .app-select-trigger > span:first-child,
.generation-settings-dialog .app-select-option > span:first-child {
  overflow: visible;
  overflow-wrap: anywhere;
  word-break: break-word;
  text-overflow: clip;
  white-space: normal;
  line-height: 1.35;
}
.app-select-chevron { width: 16px; height: 16px; flex: 0 0 16px; color: #858996; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform 140ms ease; }
.app-select.is-open .app-select-chevron { transform: rotate(180deg); }
.app-select-trigger:hover:not(:disabled) { border-color: #babdc7; background: #fdfdfe; }
.app-select-trigger:focus-visible, .app-select.is-open .app-select-trigger { outline: 0; border-color: #8b80ec; box-shadow: 0 0 0 3px rgba(116, 104, 232, .12); }
.app-select-trigger:disabled { cursor: not-allowed; background: #f4f5f7; color: #9a9daa; }
.app-select-menu { position: fixed; z-index: 420; max-height: min(280px, calc(100vh - 16px)); padding: 5px; overflow-y: auto; border: 1px solid #d9dbe1; border-radius: 8px; background: #fff; box-shadow: 0 16px 38px rgba(32, 33, 42, .16), 0 3px 9px rgba(32, 33, 42, .07); }
.app-select-menu { touch-action: pan-y; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.app-select-menu[hidden] { display: none; }
.app-select-option { width: 100%; min-height: 37px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 9px; border: 0; border-radius: 6px; background: transparent; color: #696d7a; font-family: var(--body); font-size: 13px; font-weight: 500; line-height: 1.35; text-align: left; cursor: pointer; }
.app-select-option > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-select-option:hover:not(:disabled), .app-select-option:focus-visible { outline: 0; background: #f3f2ff; color: #5f57d7; }
.app-select-option[aria-selected="true"] { background: #f0edff; color: #5f57d7; font-weight: 600; }
.app-select-option:disabled { cursor: not-allowed; opacity: .45; }
.app-select-check { width: 16px; height: 16px; flex: 0 0 16px; color: #7468e8; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

@media (max-width: 700px) {
  .ranking-table-scroll { overflow-x: hidden; }
  .ranking-head,
  .ranking-row {
    min-width: 0;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    gap: 10px;
    padding-left: 14px;
    padding-right: 14px;
  }
  .ranking-head span:nth-child(3),
  .ranking-row > code { display: none; }
  .ranking-points-cell { min-width: 58px; gap: 4px; }
  .ranking-points-cell .points { display: block; min-width: 2ch; font-size: 18px; text-align: right; }
}

/* Keep native dialogs within the live mobile viewport and give long content one scroll owner. */
body:has(dialog[open]) { overflow: hidden; }
.score-detail-dialog,
.workbench-trace-detail-dialog { --dialog-max-block-size: 860px; }
.player-career-dialog,
.generation-settings-dialog { --dialog-max-block-size: 820px; }
.share-card-dialog,
.admin-profile-dialog,
.email-preview-dialog,
.confirm-dialog { --dialog-max-block-size: 100dvh; }
:where(
  .score-detail-dialog,
  .player-career-dialog,
  .generation-settings-dialog,
  .share-card-dialog,
  .workbench-trace-detail-dialog,
  .admin-profile-dialog,
  .email-preview-dialog,
  .confirm-dialog
) {
  box-sizing: border-box;
  max-height: min(var(--dialog-max-block-size), calc(100dvh - 32px));
}

/* Model summaries grow with their content and only yield space when the composer itself is tight. */
.composer-actions-right {
  min-width: 0;
  flex: 0 1 auto;
}
.composer-actions-right .composer-model-picker,
.composer-model-picker {
  width: fit-content;
  max-width: none;
  flex: 1 1 auto;
}
.composer-model-trigger {
  width: 100%;
}

@media (max-width: 700px) {
  .composer-actions-right {
    max-width: 100%;
  }
  .composer-actions-right .composer-model-picker,
  .composer-model-picker {
    width: fit-content;
    max-width: 100%;
  }
}
.player-career-dialog,
.share-card-dialog,
.email-preview-dialog,
.confirm-dialog,
#profileDialogContent,
.workbench-trace-detail-dialog > div,
.score-detail-body,
.generation-settings-dialog .entry-controls-grid {
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.player-career-dialog { overflow: hidden; }
.player-career-content {
  max-height: inherit;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.generation-settings-dialog {
  height: fit-content;
}
.generation-settings-dialog .settings-dialog-panel {
  height: auto;
  max-height: inherit;
}
.share-card-dialog[open],
.email-preview-dialog,
.confirm-dialog { overflow-y: auto; }
#profileDialogContent {
  max-height: inherit;
  overflow-y: auto;
}
.admin-profile-dialog-head {
  position: sticky;
  top: 0;
  z-index: 4;
}
.workbench-trace-detail-head {
  position: sticky;
  top: 0;
  z-index: 4;
  background: #fff;
}

@media (max-width: 700px) {
  :where(
    .score-detail-dialog,
    .player-career-dialog,
    .generation-settings-dialog,
    .share-card-dialog,
    .workbench-trace-detail-dialog,
    .admin-profile-dialog,
    .email-preview-dialog,
    .confirm-dialog
  ) {
    max-height: calc(100dvh - max(8px, env(safe-area-inset-top)) - max(8px, env(safe-area-inset-bottom)));
  }
  .generation-settings-dialog {
    height: calc(100dvh - max(8px, env(safe-area-inset-top)) - max(8px, env(safe-area-inset-bottom)));
  }
  .player-career-content { min-height: 0; }
  .player-career-card > footer { padding-bottom: max(20px, env(safe-area-inset-bottom)); }
  .score-detail-body { padding-bottom: max(18px, env(safe-area-inset-bottom)); }
  .settings-dialog-panel > footer { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .workbench-trace-detail-ids { padding-bottom: max(18px, env(safe-area-inset-bottom)); }
  .admin-profile-dialog-editor {
    max-height: none;
    overflow: visible;
  }
}

/* Career cards use the same compact scale on narrow screens as the rest of the leaderboard. */
@media (max-width: 700px) {
  .player-career-head {
    grid-template-columns: 46px minmax(0, 1fr);
    min-height: 0;
    gap: 10px 12px;
    padding: 18px 50px 18px 18px;
  }
  .player-career-mark,
  .player-career-mark.player-avatar {
    width: 46px;
    height: 46px;
    flex-basis: 46px;
    font-size: 14px;
  }
  .player-career-head > div {
    display: block;
  }
  .player-career-head h2 {
    margin-top: 3px;
    font-size: 17px;
  }
  .player-career-head p {
    margin-top: 5px;
  }
  .player-career-meta {
    margin-top: 5px;
  }
  .player-career-badge {
    grid-column: 2;
    align-self: start;
    justify-self: start;
    margin-top: -2px;
    padding: 5px 8px;
    font-size: 11px;
  }
  .player-career-stats > div {
    min-height: 88px;
    padding: 13px 14px;
  }
  .player-career-stats strong {
    margin-top: 5px;
    font-size: 21px;
  }
  .player-career-stats span {
    margin-top: 4px;
  }
  .career-reward-stat strong {
    font-size: 17px;
  }
  .player-career-awards {
    padding: 17px 18px 12px;
  }
  .player-career-awards h3 {
    font-size: 15px;
  }
  .career-award {
    grid-template-columns: 36px minmax(0, 1fr) auto;
    gap: 9px;
    min-height: 56px;
  }
  .career-award-rank {
    width: 32px;
    height: 32px;
  }
  .player-career-card > footer {
    padding: 0 18px max(18px, env(safe-area-inset-bottom));
  }
}

/* Final dark-mode normalization for late workspace rules that intentionally restyle contest pages. */
:root[data-theme="dark"] .icon-button,
:root[data-theme="dark"] .canvas-score-popover > header button,
:root[data-theme="dark"] .workbench-trace-detail-head > button,
:root[data-theme="dark"] .workbench-trace-prompt-heading button,
:root[data-theme="dark"] .workbench-trace-detail-ids button,
:root[data-theme="dark"] .workbench-trace-detail-button,
:root[data-theme="dark"] .app-select-trigger,
:root[data-theme="dark"] .app-select-option {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--ink);
  box-shadow: none;
}

:root[data-theme="dark"] .icon-button:hover:not(:disabled),
:root[data-theme="dark"] .canvas-score-popover > header button:hover,
:root[data-theme="dark"] .workbench-trace-detail-head > button:hover,
:root[data-theme="dark"] .workbench-trace-prompt-heading button:hover,
:root[data-theme="dark"] .workbench-trace-detail-ids button:hover,
:root[data-theme="dark"] .workbench-trace-detail-button:hover,
:root[data-theme="dark"] .app-select-trigger:hover:not(:disabled),
:root[data-theme="dark"] .app-select-option:hover:not(:disabled),
:root[data-theme="dark"] .app-select-option:focus-visible {
  border-color: #3a4254;
  background: #272d3a;
  color: var(--ink);
}

:root[data-theme="dark"] .generation-settings-dialog,
:root[data-theme="dark"] .generation-settings-dialog .settings-dialog-panel,
:root[data-theme="dark"] .generation-settings-dialog .entry-controls-grid,
:root[data-theme="dark"] .generation-settings-dialog .settings-block,
:root[data-theme="dark"] .settings-dialog-panel > header,
:root[data-theme="dark"] .settings-dialog-panel > footer {
  border-color: var(--line);
  background: var(--white);
  color: var(--ink);
}

:root[data-theme="dark"] .generation-settings-dialog {
  box-shadow: 0 26px 72px rgba(0, 0, 0, .44);
}

:root[data-theme="dark"] .generation-settings-dialog::backdrop {
  background: rgba(2, 4, 9, .64);
}

:root[data-theme="dark"] .settings-dialog-panel h2,
:root[data-theme="dark"] .settings-block-heading h3,
:root[data-theme="dark"] .generation-settings-dialog .judge-divider.settings-block-heading h3,
:root[data-theme="dark"] .generation-settings-dialog .provider-switch span,
:root[data-theme="dark"] .generation-settings-dialog .field > span {
  color: var(--ink);
}

:root[data-theme="dark"] .settings-dialog-panel header p,
:root[data-theme="dark"] .settings-block-heading p,
:root[data-theme="dark"] .generation-settings-dialog .judge-divider.settings-block-heading p,
:root[data-theme="dark"] .generation-settings-dialog .provider-switch small,
:root[data-theme="dark"] .generation-settings-dialog .field > small,
:root[data-theme="dark"] .settings-dialog-panel .key-note {
  color: var(--muted);
}

:root[data-theme="dark"] .settings-block-heading > span,
:root[data-theme="dark"] .generation-settings-dialog .judge-divider.settings-block-heading > span {
  background: var(--surface-soft);
  color: #c7c0ff;
}

:root[data-theme="dark"] .generation-settings-dialog .provider-switch label {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--ink);
  opacity: 1;
}

:root[data-theme="dark"] .generation-settings-dialog .provider-switch label:hover {
  border-color: #3a4254;
  background: #272d3a;
}

:root[data-theme="dark"] .generation-settings-dialog .provider-switch label:has(input:checked) {
  border-color: rgba(139, 124, 255, .5);
  background: rgba(139, 124, 255, .18);
  box-shadow: inset 0 0 0 1px rgba(139, 124, 255, .28);
}

:root[data-theme="dark"] .generation-settings-dialog input,
:root[data-theme="dark"] .generation-settings-dialog select,
:root[data-theme="dark"] .generation-settings-dialog .app-select-trigger,
:root[data-theme="dark"] .generation-settings-dialog .app-select-option {
  border-color: #3a4254;
  background: #1e2330;
  color: var(--ink);
}

:root[data-theme="dark"] .generation-settings-dialog input::placeholder,
:root[data-theme="dark"] .generation-settings-dialog textarea::placeholder {
  color: #838b9d;
}

:root[data-theme="dark"] .generation-settings-dialog .save-warning {
  border-color: rgba(229, 177, 95, .3);
  background: var(--amber-soft);
}

:root[data-theme="dark"] .generation-settings-dialog .save-warning strong,
:root[data-theme="dark"] .generation-settings-dialog .save-warning p {
  color: #f1c46f;
}

:root[data-theme="dark"] .contest-agent-shell .contest-hero,
:root[data-theme="dark"] .leaderboard-surface,
:root[data-theme="dark"] .ranking-list,
:root[data-theme="dark"] .profile-stack-panel,
:root[data-theme="dark"] .profile-account-stack,
:root[data-theme="dark"] .profile-award-lookup,
:root[data-theme="dark"] .workbench-user-dashboard,
:root[data-theme="dark"] .app-select-menu {
  border-color: var(--line);
  background: var(--white);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

:root[data-theme="dark"] .contest-agent-shell .prize-block {
  border-color: var(--line);
  background: var(--surface-soft);
}

:root[data-theme="dark"] .prize-icon {
  border-color: rgba(229, 177, 95, .3);
  background: var(--amber-soft);
  color: var(--amber);
}

:root[data-theme="dark"] .contest-agent-shell .prize-heading small,
:root[data-theme="dark"] .contest-agent-shell .prize-summary-label,
:root[data-theme="dark"] .prompt-prize-name,
:root[data-theme="dark"] .prompt-prize .prize-summary-label {
  color: var(--muted);
}

:root[data-theme="dark"] .contest-agent-shell .prize-summary-values,
:root[data-theme="dark"] .prompt-prize > strong,
:root[data-theme="dark"] .prompt-prize .prize-summary-values {
  color: var(--ink);
}

:root[data-theme="dark"] .prompt-prize {
  border-left-color: var(--line);
  color: var(--amber);
}

:root[data-theme="dark"] .ranking-rules {
  border-color: var(--line);
  background: var(--white);
}

:root[data-theme="dark"] .ranking-rules summary {
  color: var(--ink);
}

:root[data-theme="dark"] .ranking-rules summary::after {
  color: #b7aeff;
}

:root[data-theme="dark"] .ranking-rules div {
  border-color: var(--line);
  background: var(--surface-soft);
}

:root[data-theme="dark"] .ranking-rules p,
:root[data-theme="dark"] .leaderboard-head p,
:root[data-theme="dark"] .profile-page-head p,
:root[data-theme="dark"] .archive-heading p {
  color: var(--muted);
}

:root[data-theme="dark"] .leaderboard-head h2,
:root[data-theme="dark"] .profile-page-head h2,
:root[data-theme="dark"] .archive-heading h2 {
  color: var(--ink);
}

:root[data-theme="dark"] .ranking-head {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--muted);
}

:root[data-theme="dark"] .ranking-row,
:root[data-theme="dark"] .ranking-list .ranking-row,
:root[data-theme="dark"] .ranking-list .ranking-row.top-rank,
:root[data-theme="dark"] .ranking-list .ranking-row.rank-first,
:root[data-theme="dark"] .ranking-list .ranking-row.rank-second,
:root[data-theme="dark"] .ranking-list .ranking-row.rank-third {
  border-color: var(--line);
  background: var(--white);
  color: var(--ink);
  box-shadow: none;
}

:root[data-theme="dark"] .ranking-row:hover,
:root[data-theme="dark"] .ranking-list .ranking-row:hover {
  background: var(--surface-soft);
}

:root[data-theme="dark"] .ranking-row .rank,
:root[data-theme="dark"] .podium-rank-label {
  background: var(--surface-soft);
  color: var(--muted);
}

:root[data-theme="dark"] .ranking-list .ranking-row.rank-first .rank {
  background: rgba(229, 177, 95, .16);
  color: #f1c46f;
}

:root[data-theme="dark"] .ranking-list .ranking-row.rank-second .rank {
  background: rgba(174, 181, 194, .16);
  color: #c7cfdd;
}

:root[data-theme="dark"] .ranking-list .ranking-row.rank-third .rank {
  background: rgba(207, 141, 105, .16);
  color: #e8ad88;
}

:root[data-theme="dark"] .ranking-row .name,
:root[data-theme="dark"] .ranking-row .points,
:root[data-theme="dark"] .ranking-list .ranking-row.rank-first .points,
:root[data-theme="dark"] .ranking-list .ranking-row.rank-second .points,
:root[data-theme="dark"] .ranking-list .ranking-row.rank-third .points,
:root[data-theme="dark"] .podium-name,
:root[data-theme="dark"] .podium-score strong,
:root[data-theme="dark"] .podium-career-summary b {
  color: var(--ink);
}

:root[data-theme="dark"] .ranking-row code,
:root[data-theme="dark"] .podium-score span,
:root[data-theme="dark"] .podium-signature,
:root[data-theme="dark"] .podium-career-summary span {
  color: var(--muted);
}

:root[data-theme="dark"] .podium-card.rank-1,
:root[data-theme="dark"] .podium-card.rank-2,
:root[data-theme="dark"] .podium-card.rank-3 {
  border-color: var(--line);
  background: var(--white);
  box-shadow: none;
}

:root[data-theme="dark"] .podium-card.rank-1 { box-shadow: inset 0 3px 0 rgba(230, 189, 89, .8); }
:root[data-theme="dark"] .podium-card.rank-2 { box-shadow: inset 0 3px 0 rgba(174, 181, 194, .72); }
:root[data-theme="dark"] .podium-card.rank-3 { box-shadow: inset 0 3px 0 rgba(207, 141, 105, .72); }

:root[data-theme="dark"] .leaderboard-surface > .pagination {
  border-color: var(--line);
}

:root[data-theme="dark"] .canvas-score-trigger {
  border-color: var(--line);
  background: rgba(23, 27, 36, .96);
  color: var(--ink);
  box-shadow: 0 10px 24px rgba(0, 0, 0, .28);
}

:root[data-theme="dark"] .canvas-score-trigger:hover,
:root[data-theme="dark"] .canvas-score-trigger[aria-expanded="true"] {
  border-color: #3a4254;
  background: var(--surface-strong);
  color: var(--ink);
}

:root[data-theme="dark"] .canvas-score-popover,
:root[data-theme="dark"] .canvas-score-popover > header,
:root[data-theme="dark"] .canvas-score-popover .score-result,
:root[data-theme="dark"] .canvas-score-popover .score-item,
:root[data-theme="dark"] .canvas-score-popover .judge-comment {
  border-color: var(--line);
  background: var(--white);
  color: var(--ink);
}

:root[data-theme="dark"] .canvas-score-popover .score-total {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--ink);
}

:root[data-theme="dark"] .canvas-score-popover > header small,
:root[data-theme="dark"] .canvas-score-popover .score-item small,
:root[data-theme="dark"] .canvas-score-popover .judge-comment {
  color: var(--muted);
}

:root[data-theme="dark"] .canvas-score-popover .score-item strong {
  color: var(--ink);
}

:root[data-theme="dark"] .canvas-score-popover .score-total strong {
  color: var(--ink);
}

:root[data-theme="dark"] .app-header {
  border-color: var(--line);
  background: rgba(18, 22, 31, .96);
}

:root[data-theme="dark"] .header-leading h1,
:root[data-theme="dark"] .sidebar-brand-copy strong {
  color: var(--ink);
}

:root[data-theme="dark"] .header-leading p,
:root[data-theme="dark"] .sidebar-brand-copy small {
  color: var(--muted);
}

:root[data-theme="dark"] .composer-input-shell {
  border-color: var(--line);
  background: var(--white);
  box-shadow: 0 12px 28px rgba(0, 0, 0, .24);
}

:root[data-theme="dark"] .composer-input-shell:focus-within {
  border-color: rgba(139, 124, 255, .46);
  box-shadow: 0 0 0 2px rgba(139, 124, 255, .1), 0 12px 30px rgba(0, 0, 0, .28);
}

:root[data-theme="dark"] .agent-composer .prompt-adjustment-field {
  border-color: transparent;
  background: transparent;
  color: var(--ink);
}

:root[data-theme="dark"] .agent-composer .prompt-adjustment-heading,
:root[data-theme="dark"] .agent-composer .prompt-adjustment-title {
  background: transparent;
  color: #b4bcc9;
}

:root[data-theme="dark"] .agent-composer .prompt-adjustment-counter {
  color: #8791a2;
}

:root[data-theme="dark"] .agent-composer .prompt-adjustment-field textarea,
:root[data-theme="dark"] #promptAdjustment {
  border-color: transparent;
  background: transparent;
  color: var(--ink);
  box-shadow: none;
}

:root[data-theme="dark"] .agent-composer .prompt-adjustment-field textarea::placeholder {
  color: #8590a2;
}

:root[data-theme="dark"] .composer-actions {
  border-top-color: var(--line);
}

:root[data-theme="dark"] .composer-icon-button,
:root[data-theme="dark"] .save-ack-inline,
:root[data-theme="dark"] .composer-model-trigger {
  border-color: var(--line);
  background: var(--surface-soft);
  color: #b8c0cd;
  box-shadow: none;
}

:root[data-theme="dark"] .composer-icon-button:hover,
:root[data-theme="dark"] .save-ack-inline:hover,
:root[data-theme="dark"] .composer-model-trigger:hover,
:root[data-theme="dark"] .composer-model-trigger[aria-expanded="true"] {
  border-color: #3a4254;
  background: var(--surface-strong);
  color: var(--ink);
  box-shadow: none;
}

:root[data-theme="dark"] .composer-model-summary,
:root[data-theme="dark"] .composer-menu-copy strong,
:root[data-theme="dark"] .composer-menu-subhead strong {
  color: var(--ink);
}

:root[data-theme="dark"] .composer-model-trigger[data-ready="empty"] .composer-model-summary,
:root[data-theme="dark"] .composer-model-trigger[data-ready="keys"] .composer-model-summary,
:root[data-theme="dark"] .composer-menu-copy small,
:root[data-theme="dark"] .composer-menu-value,
:root[data-theme="dark"] .composer-menu-back,
:root[data-theme="dark"] .composer-menu-settings {
  color: var(--muted);
}

:root[data-theme="dark"] .composer-model-menu,
:root[data-theme="dark"] .composer-submenu,
:root[data-theme="dark"] .composer-menu-subhead,
:root[data-theme="dark"] .composer-model-subhead {
  border-color: var(--line);
  background: rgba(23, 27, 36, .98);
  color: var(--ink);
  box-shadow: 0 18px 42px rgba(0, 0, 0, .38);
}

:root[data-theme="dark"] .composer-menu-row {
  background: transparent;
  color: var(--ink);
}

:root[data-theme="dark"] .composer-menu-row:hover,
:root[data-theme="dark"] .composer-menu-item:hover > .composer-menu-row {
  background: var(--surface-strong);
  color: var(--ink);
}

:root[data-theme="dark"] .composer-menu-item.is-open > .composer-menu-row {
  border-color: var(--line);
  background: var(--surface-strong);
  color: var(--ink);
}

:root[data-theme="dark"] .composer-menu-item.is-open > .composer-menu-row .composer-menu-copy strong {
  color: var(--ink);
}

:root[data-theme="dark"] .composer-menu-settings,
:root[data-theme="dark"] .composer-menu-subhead,
:root[data-theme="dark"] .composer-model-subhead {
  border-color: var(--line);
}

:root[data-theme="dark"] .composer-model-subhead strong,
:root[data-theme="dark"] .composer-model-empty strong,
:root[data-theme="dark"] .composer-model-option {
  color: var(--ink);
}

:root[data-theme="dark"] .composer-model-option:hover,
:root[data-theme="dark"] .composer-model-option.is-selected {
  background: var(--surface-strong);
  color: var(--ink);
}

:root[data-theme="dark"] .composer-model-option small {
  color: var(--muted);
}

:root[data-theme="dark"] .composer-menu-back:hover {
  background: var(--surface-strong);
  color: var(--ink);
}

:root[data-theme="dark"] .composer-send-button:disabled {
  background: var(--surface-strong);
  color: #7f899a;
}

:root[data-theme="dark"] .composer-send-button:disabled[data-loading="true"] {
  background: var(--accent);
  color: #fff;
}

:root[data-theme="dark"] .local-history-note {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--muted);
}

:root[data-theme="dark"] .local-filters,
:root[data-theme="dark"] .local-submission-card,
:root[data-theme="dark"] .archive-edition,
:root[data-theme="dark"] .archive-edition > header,
:root[data-theme="dark"] .archive-winners,
:root[data-theme="dark"] .archive-work,
:root[data-theme="dark"] .archive-work figcaption {
  border-color: var(--line);
  background: var(--white);
  color: var(--ink);
  box-shadow: none;
}

:root[data-theme="dark"] .archive-edition > header,
:root[data-theme="dark"] .local-bulk-bar {
  border-color: var(--line);
  background: var(--surface-soft);
}

:root[data-theme="dark"] .archive-edition > header h3,
:root[data-theme="dark"] .local-submission-detail h3,
:root[data-theme="dark"] .local-select-all,
:root[data-theme="dark"] .local-select-all span {
  color: var(--ink);
}

:root[data-theme="dark"] .archive-edition > header small,
:root[data-theme="dark"] .archive-edition > header > span,
:root[data-theme="dark"] .archive-work figcaption > span,
:root[data-theme="dark"] .local-submission-detail > small,
:root[data-theme="dark"] .local-submission-detail > .local-model code,
:root[data-theme="dark"] #localSelectionMeta,
:root[data-theme="dark"] #localFilterMeta {
  color: var(--muted);
}

:root[data-theme="dark"] .local-filters select,
:root[data-theme="dark"] .local-filter-actions button,
:root[data-theme="dark"] .local-actions .download-command,
:root[data-theme="dark"] .local-actions .share-command,
:root[data-theme="dark"] .local-actions .retry-command,
:root[data-theme="dark"] .local-actions .local-detail-command {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--ink);
}

:root[data-theme="dark"] .local-actions .retry-command {
  border-color: rgba(229, 177, 95, .28);
  background: var(--amber-soft);
  color: #f1c46f;
}

:root[data-theme="dark"] .local-filter-actions button:hover,
:root[data-theme="dark"] .local-actions .download-command:hover,
:root[data-theme="dark"] .local-actions .share-command:hover,
:root[data-theme="dark"] .local-actions .retry-command:hover,
:root[data-theme="dark"] .local-actions .local-detail-command:hover,
:root[data-theme="dark"] .player-career-trigger:hover,
:root[data-theme="dark"] .archive-career-trigger:hover {
  border-color: rgba(139, 124, 255, .34);
  background: var(--blue-soft);
  color: #c7c0ff;
}

:root[data-theme="dark"] .local-select {
  background: rgba(23, 27, 36, .92);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .3);
}

:root[data-theme="dark"] .player-career-dialog,
:root[data-theme="dark"] .player-career-card,
:root[data-theme="dark"] .player-career-awards {
  border-color: var(--line);
  background: var(--white);
  color: var(--ink);
}

:root[data-theme="dark"] .player-career-close {
  border-color: var(--line);
  background: rgba(30, 35, 48, .94);
  color: #b8c0cd;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .24);
}

:root[data-theme="dark"] .player-career-close:hover {
  border-color: rgba(139, 124, 255, .38);
  background: var(--surface-strong);
  color: #c7c0ff;
}

:root[data-theme="dark"] .player-career-head {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--ink);
}

:root[data-theme="dark"] .player-career-head h2,
:root[data-theme="dark"] .player-career-awards h3,
:root[data-theme="dark"] .career-award strong {
  color: var(--ink);
}

:root[data-theme="dark"] .player-career-head small,
:root[data-theme="dark"] .player-career-head p,
:root[data-theme="dark"] .player-career-meta,
:root[data-theme="dark"] .player-career-stats span,
:root[data-theme="dark"] .player-career-card > footer {
  color: var(--muted);
}

:root[data-theme="dark"] .player-career-badge {
  border-color: rgba(91, 224, 174, .28);
  background: var(--green-soft);
  color: #7fe8bd;
}

:root[data-theme="dark"] .player-career-stats,
:root[data-theme="dark"] .player-career-stats > div,
:root[data-theme="dark"] .player-career-stats > div:last-child {
  border-color: var(--line);
  background: var(--white);
  color: var(--ink);
}

:root[data-theme="dark"] .player-career-stats > div:last-child {
  background: var(--surface-soft);
}

:root[data-theme="dark"] .career-reward-stat strong {
  color: #f1c46f;
}

:root[data-theme="dark"] .player-career-awards ol,
:root[data-theme="dark"] .career-award {
  border-color: var(--line);
}

:root[data-theme="dark"] .career-award-rank,
:root[data-theme="dark"] .career-award.rank-1 .career-award-rank,
:root[data-theme="dark"] .career-award.rank-2 .career-award-rank,
:root[data-theme="dark"] .career-award.rank-3 .career-award-rank {
  background: var(--surface-soft);
  color: var(--muted);
}

:root[data-theme="dark"] .career-award.rank-1 .career-award-rank { color: #f1c46f; }
:root[data-theme="dark"] .career-award.rank-2 .career-award-rank { color: #c7cfdd; }
:root[data-theme="dark"] .career-award.rank-3 .career-award-rank { color: #e8ad88; }

:root[data-theme="dark"] .career-award-value {
  color: #7fe8bd;
}

:root[data-theme="dark"] .ranking-score-breakdown {
  border-color: var(--line);
  background: var(--surface-soft);
}

:root[data-theme="dark"] .ranking-score-breakdown span {
  border-color: var(--line);
}

:root[data-theme="dark"] .ranking-head,
:root[data-theme="dark"] .ranking-row,
:root[data-theme="dark"] .ranking-rules,
:root[data-theme="dark"] .ranking-rules div,
:root[data-theme="dark"] .leaderboard-surface > .pagination {
  border-color: var(--line);
}

:root[data-theme="dark"] .workbench-trace-detail-head {
  background: var(--white);
}

/* Dialog families are defined throughout the legacy contest stylesheet. Keep
   the final dark treatment here so late light-mode component rules cannot win. */
:root[data-theme="dark"] .share-card-dialog,
:root[data-theme="dark"] .score-detail-dialog,
:root[data-theme="dark"] .workbench-trace-detail-dialog,
:root[data-theme="dark"] .admin-profile-dialog,
:root[data-theme="dark"] .email-preview-dialog,
:root[data-theme="dark"] .confirm-dialog {
  border-color: var(--line);
  background: var(--white);
  color: var(--ink);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .42);
}

:root[data-theme="dark"] .share-card-preview {
  border-color: var(--line);
  background: #10131a;
}

:root[data-theme="dark"] .share-card-controls h2 {
  color: var(--ink);
}

:root[data-theme="dark"] .share-card-controls p {
  color: var(--muted);
}

:root[data-theme="dark"] .share-card-controls button {
  border-color: #454d60;
  background: var(--surface-soft);
  color: var(--ink);
}

:root[data-theme="dark"] .share-card-controls button:first-child {
  border-color: #7468e8;
  background: #7468e8;
  color: #fff;
}

:root[data-theme="dark"] .share-card-controls button:hover:not(:disabled) {
  border-color: #6157cf;
  background: #6157cf;
  color: #fff;
}

:root[data-theme="dark"] .share-card-controls button:disabled {
  border-color: var(--line);
  background: #202633;
  color: #747d8e;
  opacity: 1;
  cursor: not-allowed;
}

:root[data-theme="dark"] .score-detail-head,
:root[data-theme="dark"] .workbench-trace-detail-head,
:root[data-theme="dark"] .admin-profile-dialog-head {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--ink);
}

:root[data-theme="dark"] .score-detail-head h2,
:root[data-theme="dark"] .score-detail-body h3,
:root[data-theme="dark"] .score-detail-prompts h4,
:root[data-theme="dark"] .score-detail-breakdown strong,
:root[data-theme="dark"] .score-detail-meta dd,
:root[data-theme="dark"] .local-detail-meta dd,
:root[data-theme="dark"] .local-detail-meta code {
  color: var(--ink);
}

:root[data-theme="dark"] .score-detail-head small {
  color: #b7aeff;
}

:root[data-theme="dark"] .score-detail-head p,
:root[data-theme="dark"] .score-detail-copy,
:root[data-theme="dark"] .score-detail-prompts p,
:root[data-theme="dark"] .score-detail-breakdown small,
:root[data-theme="dark"] .score-detail-breakdown i,
:root[data-theme="dark"] .score-detail-meta dt,
:root[data-theme="dark"] .local-detail-meta dt,
:root[data-theme="dark"] .local-detail-meta-sub {
  color: var(--muted);
}

:root[data-theme="dark"] .score-detail-head button,
:root[data-theme="dark"] .workbench-trace-detail-head > button,
:root[data-theme="dark"] .admin-profile-dialog-close {
  border-color: var(--line);
  background: #252b38;
  color: #c3cad6;
  box-shadow: none;
}

:root[data-theme="dark"] .score-detail-head button:hover,
:root[data-theme="dark"] .workbench-trace-detail-head > button:hover,
:root[data-theme="dark"] .admin-profile-dialog-close:hover {
  border-color: #454d60;
  background: #303746;
  color: var(--ink);
}

:root[data-theme="dark"] .score-detail-body,
:root[data-theme="dark"] .score-detail-body > section,
:root[data-theme="dark"] .workbench-trace-detail-dialog > div {
  border-color: var(--line);
  background: var(--white);
}

:root[data-theme="dark"] .score-detail-breakdown,
:root[data-theme="dark"] .score-detail-meta div,
:root[data-theme="dark"] .local-detail-meta,
:root[data-theme="dark"] .local-detail-meta > div,
:root[data-theme="dark"] .local-detail-meta > div:nth-child(odd) {
  border-color: var(--line);
  background: var(--surface-soft);
}

:root[data-theme="dark"] .score-detail-breakdown span,
:root[data-theme="dark"] .local-detail-meta > div {
  border-color: var(--line);
}

:root[data-theme="dark"] .score-detail-prompts > div {
  border-color: rgba(139, 124, 255, .34);
}

:root[data-theme="dark"] .local-detail-preview {
  border-color: var(--line);
  background: #10131a;
}

:root[data-theme="dark"] .score-detail-copy,
:root[data-theme="dark"] .score-detail-prompts p {
  scrollbar-color: var(--scrollbar-thumb) transparent;
}

:root[data-theme="dark"] .score-detail-copy::-webkit-scrollbar-thumb,
:root[data-theme="dark"] .score-detail-prompts p::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  background-clip: padding-box;
}

:root[data-theme="dark"] .score-detail-copy::-webkit-scrollbar-thumb:hover,
:root[data-theme="dark"] .score-detail-prompts p::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
  background-clip: padding-box;
}

@media (prefers-reduced-motion: reduce) {
  .theme-toggle-icon { transition: opacity 120ms linear; transform: none !important; }
}

:root[data-theme="dark"] .email-preview-value,
:root[data-theme="dark"] .admin-profile-dialog-editor,
:root[data-theme="dark"] .admin-profile-editor,
:root[data-theme="dark"] .admin-profile-assets,
:root[data-theme="dark"] .admin-profile-rewards form,
:root[data-theme="dark"] .admin-background-chip {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--ink);
}

:root[data-theme="dark"] .admin-profile-editor textarea,
:root[data-theme="dark"] .admin-profile-editor select,
:root[data-theme="dark"] .admin-background-editor input,
:root[data-theme="dark"] .admin-avatar-editor input,
:root[data-theme="dark"] .admin-profile-dialog-editor button:not(.primary) {
  border-color: #3a4254;
  background: #252b38;
  color: var(--ink);
}

:root[data-theme="dark"] .admin-profile-preview-signature {
  color: var(--ink);
}

:root[data-theme="dark"] .admin-profile-preview-body dl,
:root[data-theme="dark"] .admin-profile-preview-body dl div,
:root[data-theme="dark"] .admin-profile-preview-banner {
  border-color: var(--line);
}

:root[data-theme="dark"] .confirm-dialog p {
  color: var(--muted);
}

:root[data-theme="dark"] .confirm-actions button:not(#confirmActionButton) {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--ink);
}

:root[data-theme="dark"] .ranking-skeleton-row span {
  background: #252b38;
}

:root[data-theme="dark"] .ranking-skeleton-row span::after {
  background: linear-gradient(100deg, transparent 28%, rgba(255, 255, 255, .08) 48%, transparent 68%);
}

:root[data-theme="dark"] .contest-agent-shell.is-loading .contest-hero::before {
  background: linear-gradient(100deg, #181d27 0 36%, #252c39 48%, #181d27 60% 100%);
}

:root[data-theme="dark"] .contest-agent-shell.is-loading .contest-hero::after {
  background: linear-gradient(100deg, transparent 0, rgba(255, 255, 255, .08) 50%, transparent 100%);
}

:root[data-theme="dark"] .player-career-loading > span {
  border-color: #3a4254;
  border-top-color: var(--blue);
}

/* A creator may intentionally use a light career background in dark mode.
   Keep that personalization, but use text and badge colors that remain legible
   against the light custom surface. */
:root[data-theme="dark"] .player-career-head:not(.has-dark-background) h2 {
  color: #1d2738;
}

:root[data-theme="dark"] .player-career-head:not(.has-dark-background) small,
:root[data-theme="dark"] .player-career-head:not(.has-dark-background) p,
:root[data-theme="dark"] .player-career-head:not(.has-dark-background) .player-career-meta {
  color: #586579;
}

:root[data-theme="dark"] .player-career-head:not(.has-dark-background) .player-career-badge {
  border-color: rgba(31, 104, 73, .28);
  background: rgba(255, 255, 255, .58);
  color: #1f6849;
}

:root[data-theme="dark"] .profile-settings-nav button:hover:not(:disabled) {
  background: #272d3a;
  color: #d5dae4;
}

:root[data-theme="dark"] .profile-settings-nav button[aria-selected="true"],
:root[data-theme="dark"] .profile-settings-nav button[aria-selected="true"]:hover:not(:disabled) {
  border-color: rgba(139, 124, 255, .28);
  background: var(--blue-soft);
  color: #b7aeff;
  box-shadow: inset 0 0 0 1px rgba(139, 124, 255, .18);
}

:root[data-theme="dark"] .sidebar-nav button[aria-selected="true"] {
  background: #252b38;
  color: #eef1f8;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08), 0 2px 6px rgba(0, 0, 0, .22);
}

@media (prefers-reduced-motion: reduce) {
  .player-career-dialog[open],
  .workbench-trace-detail-dialog[open],
  .admin-profile-dialog[open] {
    animation: workspace-dialog-fade var(--motion-fast) ease-out both;
    transform: none;
  }

  .profile-unlock-panel.is-loading button::after,
  .player-career-loading > span,
  .composer-model-refresh.is-loading .nav-icon {
    animation: none;
  }

  .canvas-score-popover {
    transition: opacity var(--motion-fast) ease-out;
  }

  .canvas-score-popover.is-entering,
  .canvas-score-popover.is-closing {
    transform: none;
  }

  .archive-preview-button img,
  .archive-preview-button > span {
    transition: opacity var(--motion-fast) ease-out;
    transform: none;
  }
}
