* { box-sizing: border-box; }

:root {
  --accent: #4f46e5;
  --accent-2: #7c3aed;
  --accent-soft: #eef2ff;
  --ink: #111827;
  --ink-2: #374151;
  --muted: #6b7280;
  --line: #e5e7eb;
  --surface: #ffffff;
  --canvas: #f7f8fc;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--canvas);
  color: var(--ink);
}

a { color: var(--accent); }

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

.lang-select {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.lang-select:hover { border-color: #c7d2fe; color: var(--accent); }
.lang-select:focus { outline: none; border-color: #818cf8; box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.14); }

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
  padding: 40px;
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.login-card .lang-switcher { justify-content: center; margin-bottom: 18px; }

.login-card h1 {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 600;
}

.login-card .sub {
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 14px;
}

.login-card #googleBtn {
  display: flex;
  justify-content: center;
}

.msg {
  min-height: 20px;
  margin: 20px 0 0;
  color: #dc2626;
  font-size: 13px;
}

.email-section input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0 16px;
  color: #9ca3af;
  font-size: 12px;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.code-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.code-row input { flex: 1; }

.code-row button {
  white-space: nowrap;
  padding: 0 14px;
  border: 1px solid var(--accent);
  background: var(--surface);
  color: var(--accent);
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}

.code-row button:disabled { opacity: 0.5; cursor: default; }

.primary-btn {
  width: 100%;
  margin-top: 10px;
  padding: 10px 12px;
  border: none;
  background: var(--accent);
  color: var(--surface);
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
}

.app-body {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 236px;
  flex: 0 0 236px;
  background: #0f1222;
  color: #e8eaf2;
  display: flex;
  flex-direction: column;
  transition: width 0.2s ease, flex-basis 0.2s ease;
  overflow: hidden;
}

.sidebar.collapsed {
  width: 72px;
  flex-basis: 72px;
}

.sidebar-head {
  height: 64px;
  display: flex;
  align-items: center;
  padding: 0 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  flex: 0 0 auto;
}

.logo {
  display: flex;
  align-items: center;
  gap: 11px;
  color: #ffffff;
  text-decoration: none;
  min-width: 0;
}

.logo-mark {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  filter: drop-shadow(0 3px 8px rgba(99, 102, 241, 0.45));
}

.logo-text {
  font-size: 16px;
  font-weight: 800;
  white-space: nowrap;
  letter-spacing: 1.2px;
  background: linear-gradient(90deg, #ffffff, #b9c2ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.sidebar-toggle {
  margin-left: auto;
  border: none;
  background: transparent;
  color: #8b90a8;
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  display: flex;
  align-items: center;
}

.sidebar-toggle svg { width: 18px; height: 18px; }
.sidebar-toggle:hover { background: rgba(255, 255, 255, 0.08); color: #ffffff; }

.sidebar-nav {
  flex: 1;
  padding: 16px 10px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 12px 13px;
  margin-bottom: 5px;
  border-radius: 10px;
  color: #a9aec4;
  text-decoration: none;
  font-size: 14px;
  white-space: nowrap;
  position: relative;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-item.active {
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.35);
}

.nav-item:not(.active):not(.disabled):hover { background: rgba(255, 255, 255, 0.07); color: #ffffff; }
.nav-item.disabled { color: #5b6079; cursor: default; }

.nav-icon {
  width: 22px;
  flex: 0 0 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-icon svg { width: 19px; height: 19px; }
.nav-label { flex: 1; }

.nav-tag {
  font-size: 11px;
  color: #7c82a0;
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 7px;
  border-radius: 10px;
}

.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-tag,
.sidebar.collapsed .sidebar-user { display: none; }

.sidebar.collapsed .sidebar-head { justify-content: center; padding: 0; }
.sidebar.collapsed .sidebar-toggle { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 12px 0; }

.sidebar-foot {
  padding: 16px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  font-size: 13px;
  color: #7c82a0;
}

.sidebar-user {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 64px;
  flex: 0 0 64px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 5;
}

.topbar-title { font-size: 15px; font-weight: 700; color: var(--ink); }

.user-area {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: var(--ink-2);
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--line);
}

.user-area button {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
  transition: all 0.15s ease;
}

.user-area button:hover { border-color: #c7d2fe; color: var(--accent); background: var(--accent-soft); }

.main {
  width: 100%;
  max-width: 1760px;
  margin: 0 auto;
  padding: 30px 36px 56px;
}

.hero {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-radius: 18px;
  padding: 34px 40px;
  color: #ffffff;
  background: linear-gradient(120deg, #4338ca 0%, #6366f1 48%, #8b5cf6 100%);
  box-shadow: 0 14px 34px rgba(79, 70, 229, 0.28);
}

.hero::before,
.hero::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.09);
  pointer-events: none;
}

.hero::before { width: 260px; height: 260px; right: -70px; top: -130px; }
.hero::after { width: 180px; height: 180px; right: 120px; bottom: -120px; }

.hero-content { position: relative; z-index: 1; flex: 1; min-width: 0; }

.hero-kicker {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #c7d2fe;
  margin-bottom: 12px;
}

.hero h1 {
  margin: 0 0 10px;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.hero p {
  margin: 0;
  max-width: 760px;
  font-size: 14px;
  line-height: 1.7;
  color: #e0e7ff;
}

.hero-features {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.hero-feature {
  font-size: 12px;
  font-weight: 500;
  padding: 6px 13px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.hero-art {
  position: relative;
  z-index: 1;
  flex: 0 0 150px;
  width: 150px;
  opacity: 0.95;
}

.hero-art svg { width: 100%; height: auto; }

.page-head { margin: 30px 0 18px; }
.page-head h2 { font-size: 20px; font-weight: 700; margin: 0 0 6px; }

.task-form,
.result-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 30px 34px;
  box-shadow: 0 8px 30px rgba(17, 24, 39, 0.05);
}

.form-field { margin-bottom: 20px; }

.form-field label,
.field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 9px;
}

.form-field input[type="text"],
.form-field input[type="number"],
.form-field textarea,
.form-field select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #d7dbe3;
  border-radius: 9px;
  font-size: 14px;
  font-family: inherit;
  color: var(--ink);
  background: #fcfcfe;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.form-field input[type="text"]:focus,
.form-field input[type="number"]:focus,
.form-field textarea:focus,
.form-field select:focus {
  outline: none;
  border-color: #818cf8;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.14);
}

.form-field textarea { resize: vertical; }

.form-row {
  display: flex;
  gap: 18px;
}

.form-row .form-field { flex: 1; }

.character-list {
  max-height: 210px;
  overflow-y: auto;
  border: 1px solid #d7dbe3;
  border-radius: 9px;
  padding: 10px 14px;
  background: #fcfcfe;
}

.character-option {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 4px;
  font-size: 14px;
  color: var(--ink-2);
  cursor: pointer;
  border-bottom: 1px solid #f1f2f6;
}

.character-option:last-child { border-bottom: none; }

.character-checkbox {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--accent);
}

.form-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid #eef0f5;
}

.type-badge {
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 7px 12px;
  border-radius: 8px;
}

.form-foot .primary-btn {
  width: auto;
  margin-top: 0;
  padding: 12px 32px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.5px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.3);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.form-foot .primary-btn:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(79, 70, 229, 0.38); }
.form-foot .primary-btn:disabled { opacity: 0.6; cursor: default; transform: none; }

.msg.error { color: #dc2626; }

.secondary-btn {
  border: 1px solid var(--accent);
  background: var(--surface);
  color: var(--accent);
  border-radius: 9px;
  padding: 9px 18px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease;
}

.secondary-btn:hover { background: var(--accent-soft); }
.secondary-btn:disabled { opacity: 0.5; cursor: default; }

.result-panel { margin-top: 24px; }
.result-panel h3 { margin: 0 0 14px; font-size: 17px; font-weight: 700; }
.result-line { margin: 8px 0; font-size: 14px; color: var(--ink-2); }

.result-line code {
  background: #f3f4f6;
  padding: 3px 8px;
  border-radius: 5px;
  font-size: 13px;
}

.status-tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 12px;
  background: #f3f4f6;
  color: var(--ink-2);
}

.status-pending { background: #fef3c7; color: #92400e; }
.status-processing { background: #dbeafe; color: #1e40af; }
.status-success { background: #dcfce7; color: #166534; }
.status-failed { background: #fee2e2; color: #991b1b; }

.query-result { margin-top: 18px; }

.subtask-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 12px;
  background: #fafbfe;
}

.subtask-head { margin: 0 0 10px; font-size: 13px; font-weight: 600; }

.subtask-text {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
}

@media (max-width: 900px) {
  .hero-art { display: none; }
  .main { padding: 24px 20px 48px; }
  .task-form, .result-panel { padding: 24px 20px; }
}

@media (max-width: 640px) {
  .sidebar { width: 72px; flex-basis: 72px; }
  .sidebar .logo-text,
  .sidebar .nav-label,
  .sidebar .nav-tag,
  .sidebar .sidebar-user { display: none; }
  .sidebar .nav-item { justify-content: center; padding: 12px 0; }
  .sidebar .sidebar-head { justify-content: center; padding: 0; }
  .sidebar .sidebar-toggle { display: none; }
  .form-row { flex-direction: column; gap: 0; }
  .hero { padding: 26px 22px; }
  .hero h1 { font-size: 23px; }
  .topbar { padding: 0 18px; }
}
