/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #f6f8fb;
  --surface:   #ffffff;
  --surface2:  #f1f5f9;
  --border:    #d9e2ee;
  --accent:    #2563eb;
  --accent-h:  #1d4ed8;
  --success:   #0f9f6e;
  --danger:    #dc2626;
  --warning:   #c97912;
  --text:      #172033;
  --muted:     #697586;
  --radius:    10px;
  --radius-lg: 16px;
  font-size: 15px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Microsoft YaHei", sans-serif;
  min-height: 100vh;
  padding-bottom: 80px;
}

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 32px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.92);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-icon {
  font-size: 18px;
  color: var(--accent);
}

.logo-text {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  background: rgba(91, 110, 245, 0.18);
  color: var(--accent-h);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.env-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.3px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: var(--surface2);
}
.env-badge.local {
  color: #8a4b00;
  border-color: rgba(201, 121, 18, 0.35);
  background: rgba(255, 199, 86, 0.18);
}
.env-badge.cloud {
  color: #075985;
  border-color: rgba(14, 116, 144, 0.28);
  background: rgba(125, 211, 252, 0.18);
}

.header-spacer { flex: 1; }
.auth-area {
  display: flex;
  align-items: center;
  gap: 10px;
}
.auth-status {
  color: var(--muted);
  font-size: 13px;
}
.auth-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 7px 12px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  min-width: 64px;
  white-space: nowrap;
}
.auth-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.auth-pending #inputSection,
.auth-pending #publishSection,
.auth-pending #taskSection,
.auth-pending #systemTaskSection,
.auth-locked #inputSection,
.auth-locked #publishSection,
.auth-locked #taskSection,
.auth-locked #systemTaskSection {
  display: none;
}

body:not(.auth-locked):not(.auth-pending) #loginRequiredCard {
  display: none;
}

body:not(.auth-admin) #systemTaskCard,
body:not(.auth-admin) #systemTaskSection {
  display: none;
}

/* ============================================================
   LAYOUT
   ============================================================ */
.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 28px;
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
  padding: 42px 0 24px;
  text-align: left;
}

.hero-title {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1.2;
  color: var(--text);
}

.hero-sub {
  margin-top: 14px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

.login-required-card {
  margin-bottom: 22px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
}

.login-required-card h2 {
  font-size: 20px;
  line-height: 1.3;
}

.login-required-card p {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.5;
}

.login-entry-btn {
  width: auto;
  min-width: 120px;
  margin-top: 0;
}

/* ============================================================
   INPUT SECTION
   ============================================================ */
.input-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.input-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  transition: border-color 0.2s;
  box-shadow: 0 10px 24px rgba(16, 24, 40, 0.05);
}

.input-card:focus-within {
  border-color: var(--accent);
}

.input-card.disabled {
  opacity: 0.55;
  pointer-events: none;
}

.input-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.main-input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 15px;
  line-height: 1.65;
  resize: none;
  font-family: inherit;
}

.main-input::placeholder {
  color: var(--muted);
}

.main-input:disabled,
.main-input[readonly] {
  cursor: default;   /* 保持默认光标，允许文字选中复制 */
}

.input-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.char-count {
  font-size: 12px;
  color: var(--muted);
}

.input-hint {
  font-size: 12px;
  color: var(--muted);
}

/* ============================================================
   ACTION BUTTON
   ============================================================ */
.action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 15px 24px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.3px;
  transition: background 0.18s, transform 0.1s, opacity 0.2s;
}

.action-btn:hover:not(:disabled) {
  background: var(--accent-h);
}

.action-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.action-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.action-btn.loading .btn-icon {
  display: inline-block;
  animation: spin 0.8s linear infinite;
}

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

/* ============================================================
   系统任务卡片（playable 任务下方 · 2026-05-03）
   ============================================================ */
.system-task-card {
  margin-top: 16px;
  padding: 16px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.system-task-card .input-label {
  margin-bottom: 0;
}
.action-btn.secondary-btn {
  align-self: flex-start;
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}
.action-btn.secondary-btn:hover:not(:disabled) {
  background: var(--surface);
  border-color: var(--accent);
}

/* ============================================================
   PROGRESS SECTION
   ============================================================ */
.progress-section {
  margin-top: 36px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Timer bar */
.timer-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
}

.timer-left {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 120px;
}

.timer-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--muted);
}

.timer-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.5px;
}

.progress-track {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-h) 100%);
  border-radius: 99px;
  transition: width 0.5s ease;
}

.progress-pct {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-h);
  min-width: 36px;
  text-align: right;
}

/* Steps */
.steps-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.steps-header {
  padding: 14px 22px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

.steps-list {
  list-style: none;
  padding: 6px 0;
}

.step-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 13px 22px;
  border-bottom: 1px solid var(--border);
  animation: stepIn 0.3s ease;
}

.step-item:last-child {
  border-bottom: none;
}

@keyframes stepIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.step-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 11px;
  margin-top: 1px;
}

.step-icon.pending {
  border: 2px solid var(--border);
  color: var(--muted);
}

.step-icon.running {
  border: 2px solid var(--accent);
  color: var(--accent);
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(91, 110, 245, 0.4); }
  50%       { box-shadow: 0 0 0 5px rgba(91, 110, 245, 0); }
}

.step-icon.done {
  background: rgba(62, 207, 142, 0.15);
  border: 2px solid var(--success);
  color: var(--success);
}

.step-icon.error {
  background: rgba(245, 101, 101, 0.12);
  border: 2px solid var(--danger);
  color: var(--danger);
}

.step-body {
  flex: 1;
  min-width: 0;
}

.step-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
}

.step-name.muted { color: var(--muted); }

.step-detail {
  margin-top: 3px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.step-tag {
  display: inline-block;
  margin-top: 5px;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 4px;
  font-weight: 500;
}

.step-tag.agent  { background: rgba(91,110,245,0.15); color: #8a96ff; }
.step-tag.art    { background: rgba(246,173,85,0.12); color: #f6ad55; }
.step-tag.code   { background: rgba(62,207,142,0.12); color: #3ecf8e; }
.step-tag.test   { background: rgba(245,101,101,0.12); color: #f56565; }

.step-time {
  font-size: 11px;
  color: var(--muted);
  margin-top: 1px;
}

/* ============================================================
   ERROR SECTION
   ============================================================ */
.error-section {
  margin-top: 36px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
}

.error-card {
  width: 100%;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  background: rgba(245, 101, 101, 0.06);
  border: 1px solid rgba(245, 101, 101, 0.3);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
}

.error-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(245,101,101,0.15);
  color: var(--danger);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
}

.error-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--danger);
}

.error-detail {
  margin-top: 5px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}

/* ============================================================
   DONE SECTION
   ============================================================ */
.done-section {
  margin-top: 36px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
}

.done-card {
  width: 100%;
  display: flex;
  gap: 16px;
  align-items: center;
  background: rgba(62, 207, 142, 0.06);
  border: 1px solid rgba(62, 207, 142, 0.3);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
}

.done-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(62, 207, 142, 0.15);
  color: var(--success);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  flex-shrink: 0;
}

.done-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--success);
}

.done-sub {
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
}

.done-actions {
  display: flex;
  gap: 12px;
  width: 100%;
}

.open-btn {
  flex: 1;
  padding: 13px 20px;
  background: var(--success);
  color: #ffffff;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.open-btn:hover { opacity: 0.88; }

.restart-btn {
  padding: 13px 24px;
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.restart-btn:hover {
  border-color: var(--muted);
  background: var(--surface);
}

.restart-btn.secondary {
  min-width: 140px;
}

/* ============================================================
   INPUT MODE BADGES
   ============================================================ */
.mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.2px;
}

.mode-badge.video-mode {
  background: rgba(246, 173, 85, 0.12);
  color: #f6ad55;
  border: 1px solid rgba(246, 173, 85, 0.25);
}

.mode-badge.url-mode {
  background: rgba(91, 110, 245, 0.12);
  color: var(--accent-h);
  border: 1px solid rgba(91, 110, 245, 0.25);
}

/* ============================================================
   FORM ROW (3 输入字段共用 · 2026-05-01)
   ============================================================ */
.form-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.form-row + .form-row {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px dashed var(--border);
}

.input-label .label-hint {
  display: inline-block;
  margin-left: 6px;
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
  line-height: 1.45;
}

.input-line {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 11px 14px;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.input-line::placeholder { color: var(--muted); }
.input-line:focus {
  border-color: var(--accent);
  background: var(--surface);
}

.field-meta {
  min-height: 20px;
  font-size: 12px;
}
.field-warn {
  display: inline-block;
  font-size: 12px;
  color: var(--warning);
}

.input-hint.warn {
  color: var(--warning);
  font-weight: 600;
}

/* ============================================================
   SELECT (美术风格 / 关卡设计)
   ============================================================ */
.select-line {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 11px 14px;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='%237a82a0' d='M0 0l5 6 5-6z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}
.select-line:focus {
  border-color: var(--accent);
  background-color: var(--surface);
}

.form-row-twin {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
@media (max-width: 720px) {
  .site-header {
    padding: 12px 16px;
    gap: 8px;
  }
  .logo-text {
    font-size: 14px;
    line-height: 1.15;
  }
  .badge {
    display: none;
  }
  .auth-status {
    max-width: 74px;
    font-size: 12px;
    line-height: 1.2;
  }
  .auth-btn {
    padding: 7px 10px;
    min-width: 58px;
  }
  .container {
    padding: 0 16px;
  }
  .hero {
    padding: 28px 0 18px;
  }
  .hero-title {
    font-size: 30px;
  }
  .hero-sub {
    font-size: 14px;
  }
  .input-card {
    padding: 18px 16px;
  }
  .form-row-twin { grid-template-columns: 1fr; }
}
.form-half { display: flex; flex-direction: column; gap: 6px; }

/* ============================================================
   UPLOAD DROPZONE
   ============================================================ */
.upload-dropzone {
  margin-top: 6px;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  padding: 22px 18px;
  text-align: center;
  background: var(--surface2);
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.upload-dropzone:hover,
.upload-dropzone:focus {
  border-color: var(--accent);
  color: var(--text);
  outline: none;
}
.upload-dropzone.dragover {
  border-color: var(--accent);
  background: rgba(91, 110, 245, 0.08);
  color: var(--text);
}
.upload-dropzone-icon {
  font-size: 24px;
  margin-bottom: 6px;
  color: var(--accent);
  font-weight: 600;
}
.upload-dropzone-main {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 4px;
  color: var(--text);
}
.upload-dropzone-sub {
  font-size: 12px;
  color: var(--muted);
}
.upload-dropzone-sub a {
  color: var(--accent);
  text-decoration: none;
}
.upload-dropzone-sub a:hover { text-decoration: underline; }

.upload-file-list {
  list-style: none;
  margin: 0 0 10px 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.upload-file-list[hidden] { display: none; }
.upload-file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
}
.upload-file-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--accent);
  flex-shrink: 0;
  overflow: hidden;
}
.upload-file-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.upload-file-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.upload-file-size {
  color: var(--muted);
  font-size: 12px;
  flex-shrink: 0;
}
.upload-file-remove {
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 0 4px;
  transition: color 0.1s;
}
.upload-file-remove:hover { color: var(--danger); }
.upload-file-error {
  color: var(--danger);
  font-size: 11px;
  margin-left: 8px;
}

/* ============================================================
   TASK LIST
   ============================================================ */
.task-list-section {
  margin-top: 32px;
  padding: 0 4px;
}
.task-list-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}
.task-list-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}
.task-list-meta {
  font-size: 13px;
  color: var(--muted);
}
.task-list-meta .server-down {
  color: var(--warning);
  font-weight: 600;
}

.task-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.task-empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  font-size: 14px;
}

.task-row {
  display: flex;
  align-items: stretch;
  gap: 14px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.2s, transform 0.1s;
}
.task-row:hover { border-color: var(--accent); }

.task-row-left {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.task-row-right {
  display: flex;
  align-items: center;
}

.task-row-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 2px;
}
.task-game-name {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
  letter-spacing: 0.2px;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-row-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.task-ordinal {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  background: var(--surface2);
  padding: 1px 7px;
  border-radius: 4px;
}

.task-id {
  font-family: ui-monospace, "JetBrains Mono", "SF Mono", monospace;
  font-size: 12px;
  color: var(--muted);
}

.task-step {
  font-size: 12px;
  color: var(--accent);
  font-weight: 500;
}

.status-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
  letter-spacing: 0.2px;
}
.status-badge.done {
  background: rgba(62, 207, 142, 0.14);
  color: var(--success);
  border: 1px solid rgba(62, 207, 142, 0.30);
}
.status-badge.failed {
  background: rgba(245, 101, 101, 0.14);
  color: var(--danger);
  border: 1px solid rgba(245, 101, 101, 0.30);
}
.status-badge.running {
  background: rgba(91, 110, 245, 0.14);
  color: var(--accent-h);
  border: 1px solid rgba(91, 110, 245, 0.30);
  animation: pulse-running 1.6s ease-in-out infinite;
}
.status-badge.slow {
  background: rgba(201, 121, 18, 0.12);
  color: var(--warning);
  border: 1px solid rgba(201, 121, 18, 0.32);
}
.status-badge.stalled {
  background: rgba(255, 165, 0, 0.14);
  color: #ffa500;
  border: 1px solid rgba(255, 165, 0, 0.40);
  cursor: help;
}
.status-badge.unknown {
  background: var(--surface2);
  color: var(--muted);
  border: 1px solid var(--border);
}

@keyframes pulse-running {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.55; }
}

/* engine badge — cocos / phaser / canvas */
.engine-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.2px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--muted);
}
.engine-badge.engine-cocos {
  border-color: rgba(155, 89, 246, 0.40);
  color: #b084fa;
  background: rgba(155, 89, 246, 0.08);
}
.engine-badge.engine-phaser {
  border-color: rgba(91, 110, 245, 0.40);
  color: var(--accent-h);
  background: rgba(91, 110, 245, 0.08);
}
.engine-badge.engine-canvas {
  border-color: var(--border);
  color: var(--muted);
}
.engine-badge.engine-canvas-failed {
  border-color: rgba(245, 101, 101, 0.40);
  color: var(--danger);
  background: rgba(245, 101, 101, 0.06);
}

/* 迭代版本徽章（v2/v3...） */
.iter-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(62, 207, 142, 0.14);
  color: var(--success);
  border: 1px solid rgba(62, 207, 142, 0.40);
  font-family: ui-monospace, "JetBrains Mono", "SF Mono", monospace;
}

/* 删除按钮（软删除 · 2026-05-09） */
.task-delete-btn {
  font-size: 13px;
  margin-left: 4px;
  padding: 2px 7px;
  border-radius: 4px;
  background: transparent;
  color: var(--muted, #888);
  border: 1px solid transparent;
  cursor: pointer;
  opacity: 0.45;
  transition: all 0.15s;
  line-height: 1.2;
}
.task-row-title:hover .task-delete-btn {
  opacity: 0.8;
}
.task-delete-btn:hover {
  opacity: 1;
  background: rgba(255, 80, 80, 0.18);
  color: #ff7070;
  border-color: rgba(255, 80, 80, 0.40);
}

/* 同游戏多版本短链（v1 v2 ... vN · 2026-05-09） */
.task-version-list {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-left: 6px;
  align-items: center;
}
.task-version-link {
  font-size: 10px;
  font-family: ui-monospace, "JetBrains Mono", "SF Mono", monospace;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(120, 130, 150, 0.12);
  color: var(--muted, #9aa);
  border: 1px solid rgba(120, 130, 150, 0.25);
  text-decoration: none;
  line-height: 1.4;
  transition: all 0.15s;
}
.task-version-link:hover {
  background: rgba(120, 130, 150, 0.25);
  color: var(--text, #ddd);
}
.task-version-link.is-latest {
  background: rgba(62, 207, 142, 0.18);
  color: var(--success);
  border-color: rgba(62, 207, 142, 0.45);
  font-weight: 700;
}
.task-version-list.saved {
  color: var(--muted, #9aa);
  font-size: 10px;
}
.task-version-link.is-saved {
  background: rgba(90, 160, 255, 0.14);
  color: #8fbfff;
  border-color: rgba(90, 160, 255, 0.34);
}

.task-row-inputs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.input-tag {
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 4px;
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
a.input-tag {
  cursor: pointer;
}
a.input-tag:hover {
  background: var(--surface);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.input-tag.promoted {
  border-color: rgba(91, 110, 245, 0.4);
  color: var(--accent-h);
}
.input-tag.reference.video {
  border-color: rgba(246, 173, 85, 0.4);
  color: var(--warning);
}
.input-tag.reference.store {
  border-color: rgba(62, 207, 142, 0.35);
  color: var(--success);
}
.input-tag.extra {
  border-color: var(--border);
  color: var(--muted);
}

/* 鼠标 / 键盘聚焦 → 显示完整说明 tooltip */
.input-tag.has-tooltip {
  position: relative;
  cursor: help;
  outline: none;
  overflow: visible;     /* 覆盖 .input-tag 的 hidden，让 tooltip 不被裁 */
}
.input-tag.has-tooltip .tooltip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  z-index: 30;
  display: none;
  min-width: 240px;
  max-width: 480px;
  padding: 10px 12px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 10px 24px rgba(16, 24, 40, 0.12);
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  text-align: left;
  pointer-events: none;
}
.input-tag.has-tooltip .tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 18px;
  border: 6px solid transparent;
  border-top-color: var(--border);
}
.input-tag.has-tooltip:hover .tooltip,
.input-tag.has-tooltip:focus-visible .tooltip {
  display: block;
}

.task-row-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--muted);
}

.task-error {
  font-size: 12px;
  color: var(--danger);
  background: rgba(245, 101, 101, 0.08);
  padding: 6px 10px;
  border-radius: 6px;
  border-left: 2px solid var(--danger);
  word-break: break-word;
}

.task-play-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  padding: 9px 16px;
  border-radius: 8px;
  text-decoration: none;
  transition: background 0.15s, transform 0.1s;
  white-space: nowrap;
}
.task-play-btn:hover {
  background: var(--accent-h);
  transform: translateY(-1px);
}

.task-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface2);
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
  padding: 9px 14px;
  margin-left: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  white-space: nowrap;
  cursor: pointer;
}
.task-download-btn:hover {
  background: var(--surface);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.task-row.task-status-failed {
  background: rgba(245, 101, 101, 0.04);
}

/* ============================================================
   TOAST
   ============================================================ */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 12px 28px rgba(16, 24, 40, 0.14);
  z-index: 100;
  animation: toast-slide-in 0.25s ease-out;
}
.toast.toast-success { border-color: rgba(62, 207, 142, 0.45); color: var(--success); }
.toast.toast-error   { border-color: rgba(245, 101, 101, 0.50); color: var(--danger); }
.toast.toast-info    { border-color: var(--border); color: var(--text); }
.toast.toast-warning { border-color: rgba(201, 121, 18, 0.45); color: var(--warning); }

@keyframes toast-slide-in {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* 移动端适配 */
@media (max-width: 720px) {
  .task-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .task-row-right {
    width: 100%;
  }
  .task-play-btn {
    width: 100%;
    justify-content: center;
  }
}

/* ============================================================
   FEEDBACK BUTTON (任务行 · 2026-05-01)
   ============================================================ */
.task-fb-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--surface2);
  color: var(--muted);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  margin-right: 8px;
  white-space: nowrap;
}
.task-fb-btn:hover {
  border-color: var(--accent);
  color: var(--accent-h);
  background: var(--surface);
}
.task-fb-btn.has-feedback {
  border-color: rgba(91, 110, 245, 0.45);
  color: var(--accent-h);
  background: rgba(91, 110, 245, 0.06);
}
.task-fb-btn .fb-count {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  margin-left: 2px;
  min-width: 16px;
  text-align: center;
}

/* ============================================================
   FEEDBACK MODAL
   ============================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 16px;
  animation: modal-bg-in 0.2s ease-out;
}
@keyframes modal-bg-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: calc(100dvh - 32px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 60px rgba(16, 24, 40, 0.18);
  animation: modal-card-in 0.22s cubic-bezier(0.34, 1.4, 0.64, 1);
}
@keyframes modal-card-in {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}
.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.modal-close:hover {
  background: var(--surface2);
  color: var(--text);
}

.modal-body {
  padding: 16px 18px;
  overflow-y: auto;
}
.modal-meta {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 16px;
  padding: 10px 12px;
  background: var(--surface2);
  border-radius: 8px;
  border-left: 3px solid var(--accent);
}
.modal-meta strong {
  color: var(--text);
  font-family: ui-monospace, "JetBrains Mono", "SF Mono", monospace;
}
.fb-meta-inputs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
.fb-meta-tag {
  font-size: 11px;
  background: var(--surface);
  color: var(--text);
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.fb-cat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.fb-cat-opt {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text);
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface2);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.fb-cat-opt:hover { border-color: var(--accent); }
.fb-cat-opt input[type="radio"] {
  margin: 0;
  accent-color: var(--accent);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.modal-submit { min-width: 130px; }

/* 移动端 */
@media (max-width: 720px) {
  .modal-card { max-width: 100%; }
  .fb-cat-row { flex-direction: column; }
  .fb-cat-opt { justify-content: flex-start; }
  .task-fb-btn { width: 100%; justify-content: center; margin-right: 0; margin-bottom: 6px; }
  .task-download-btn { width: 100%; justify-content: center; margin-left: 0; margin-bottom: 6px; }
}

/* 复刻度评分（RECREATE_ONLY_MODE） */
.task-recreation-score {
  color: #4ade80;
  font-weight: 600;
  font-size: 12px;
}

/* P7 (2026-05-12) 规则理解不足红点 */
.task-fb-btn.needs-rule-clarification {
  position: relative;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.35);
}
.fb-rule-dot {
  display: inline-block;
  background: #ef4444;
  color: #fff;
  font-weight: 700;
  font-size: 11px;
  width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  border-radius: 50%;
  margin-left: 4px;
  vertical-align: middle;
  animation: rule-dot-pulse 1.5s ease-in-out infinite;
}
@keyframes rule-dot-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

.fb-rule-banner {
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 6px;
  padding: 10px 12px;
  margin-top: 10px;
  color: #78350f;
  font-size: 13px;
  line-height: 1.6;
}
.fb-rule-banner strong { color: #92400e; }
.fb-rule-banner em { color: #92400e; font-style: normal; font-weight: 600; }
.fb-rule-clarif {
  display: inline-block;
  background: rgba(255,255,255,0.6);
  padding: 4px 8px;
  border-radius: 4px;
  margin-top: 4px;
  font-family: monospace;
  font-size: 11px;
}

/* ============================================================
   UTILS
   ============================================================ */
.hidden { display: none !important; }
