:root {
  --bg: #0a0e14;
  --bg-soft: #11161f;
  --card: #151c28;
  --card-border: #232d3d;
  --accent: #6ee7ff;
  --accent-2: #a78bfa;
  --text: #e6edf6;
  --text-dim: #8b98ab;
  --mono: "JetBrains Mono", "Fira Code", ui-monospace, "Cascadia Code", Menlo, Consolas, monospace;
  --sans: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --radius: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  padding-bottom: env(safe-area-inset-bottom);
}

/* --- фоновое свечение --- */
.glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.16;
  pointer-events: none;
  z-index: 0;
}
.glow-1 {
  width: 480px; height: 480px;
  background: var(--accent);
  top: -180px; left: -120px;
}
.glow-2 {
  width: 420px; height: 420px;
  background: var(--accent-2);
  bottom: -160px; right: -100px;
}

.container {
  position: relative;
  z-index: 1;
  max-width: 860px;
  margin: 0 auto;
  padding: 48px 20px 32px;
}

/* --- шапка --- */
.hero { text-align: center; margin-bottom: 36px; }

.logo {
  font-family: var(--mono);
  font-size: clamp(28px, 6vw, 44px);
  font-weight: 800;
  letter-spacing: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.logo span { animation: blink 1.1s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }

.subtitle {
  margin-top: 12px;
  color: var(--text-dim);
  font-size: 15px;
  line-height: 1.5;
}

/* --- поиск --- */
.search-box {
  display: flex;
  gap: 10px;
  margin-bottom: 22px;
}

#kim-input {
  flex: 1;
  min-width: 0;
  background: var(--bg-soft);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--mono);
  font-size: 15px;
  padding: 14px 16px;
  min-height: 48px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
#kim-input::placeholder { color: #556274; }
#kim-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(110, 231, 255, 0.12);
}

#search-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 22px;
  border: none;
  border-radius: var(--radius);
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: #06121a;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.15s, filter 0.2s;
}
#search-btn:hover { filter: brightness(1.1); }
#search-btn:active { transform: scale(0.97); }
#search-btn:disabled { opacity: 0.6; cursor: wait; }

.btn-loader {
  width: 16px; height: 16px;
  border: 2px solid rgba(6, 18, 26, 0.3);
  border-top-color: #06121a;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- статус/ошибка --- */
.status {
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 120, 120, 0.35);
  background: rgba(255, 90, 90, 0.08);
  color: #ffb4b4;
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 20px;
}
.status.info {
  border-color: var(--card-border);
  background: var(--bg-soft);
  color: var(--text-dim);
}

/* --- результаты --- */
.result-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin: 8px 0 18px;
}
#result-title { font-size: 20px; font-weight: 700; }
#result-desc { color: var(--text-dim); font-size: 14px; margin-top: 4px; }

.ghost-btn {
  min-height: 44px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: transparent;
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.ghost-btn:hover { border-color: var(--accent); background: rgba(110, 231, 255, 0.06); }

.tasks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.task-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.2s, transform 0.2s;
}
.task-card:hover { border-color: #334156; transform: translateY(-2px); }

.task-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.task-number {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-2);
  background: rgba(167, 139, 250, 0.1);
  border: 1px solid rgba(167, 139, 250, 0.25);
  padding: 4px 10px;
  border-radius: 999px;
}

.task-id {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
  text-decoration: none;
  border-bottom: 1px dashed transparent;
}
a.task-id:hover { color: var(--accent); border-bottom-color: var(--accent); }

.task-answer {
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.55;
  white-space: pre-wrap;       /* важно: сохраняем \n из ответа */
  word-break: break-word;
  background: #0d131c;
  border: 1px solid #1c2635;
  border-radius: 10px;
  padding: 12px 14px;
  color: #b6f3c8;
  user-select: all;
}
.task-answer.empty { color: #556274; font-style: italic; }

.task-comment {
  font-size: 12px;
  color: var(--text-dim);
}

.copy-btn {
  align-self: flex-end;
  min-height: 36px;
  padding: 0 12px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
  background: transparent;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.copy-btn:hover { color: var(--accent); border-color: var(--accent); }

/* --- тост --- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: #1c2735;
  border: 1px solid var(--card-border);
  color: var(--text);
  font-size: 14px;
  padding: 12px 20px;
  border-radius: 999px;
  z-index: 10;
  animation: toast-in 0.25s ease;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.footer {
  margin-top: 40px;
  text-align: center;
  color: #4a576c;
  font-size: 12.5px;
}

/* --- мобильная адаптация --- */
@media (max-width: 560px) {
  .container { padding: 32px 14px 24px; }
  .search-box { flex-direction: column; }
  #search-btn { width: 100%; }
  .tasks-grid { grid-template-columns: 1fr; }
}
