:root {
  color-scheme: light;
  --bg: #f9fafb;
  --panel: #ffffff;
  --text: #1f2933;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --shadow: 0 15px 35px rgba(15, 23, 42, 0.08);
}

:root.dark {
  color-scheme: dark;
  --bg: #0f172a;
  --panel: #111c32;
  --text: #f8fafc;
  --muted: #94a3b8;
  --border: #1e293b;
  --accent: #60a5fa;
  --accent-strong: #3b82f6;
  --shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
}

.container {
  width: min(960px, 92vw);
  margin: 0 auto;
  padding: 2rem 0 4rem;
  flex: 1 0 auto;
}

.app-header {
  padding: 1.5rem 0 0;
  background: radial-gradient(circle at 5% 10%, rgba(37, 99, 235, 0.2), transparent 50%), var(--bg);
}

.header-top {
  width: min(960px, 92vw);
  margin: 0 auto 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.anycoder-link {
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  background-color: rgba(37, 99, 235, 0.1);
  border: 1px solid rgba(37, 99, 235, 0.2);
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.anycoder-link:hover,
.anycoder-link:focus-visible {
  background-color: rgba(37, 99, 235, 0.2);
  transform: translateY(-1px);
}

.theme-toggle {
  border: none;
  background: var(--panel);
  color: var(--text);
  width: 44px;
  height: 44px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.theme-toggle .moon {
  display: none;
}

:root.dark .theme-toggle .sun {
  display: none;
}

:root.dark .theme-toggle .moon {
  display: inline;
}

.hero {
  width: min(960px, 92vw);
  margin: 0 auto;
  padding-bottom: 2rem;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2.2rem, 5vw, 3.5rem);
}

.subtitle {
  color: var(--muted);
  max-width: 520px;
}

.panel {
  background-color: var(--panel);
  border-radius: 1.5rem;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.todo-form {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.todo-form input {
  flex: 1 1 200px;
  padding: 0.95rem 1rem;
  border-radius: 1rem;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-size: 1rem;
}

.todo-form input:focus {
  outline: 2px solid rgba(37, 99, 235, 0.4);
  border-color: transparent;
}

.btn {
  border: none;
  border-radius: 1rem;
  padding: 0.9rem 1.4rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.3s ease;
}

.btn.primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.25);
}

.btn.primary:hover {
  background: var(--accent-strong);
}

.btn.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
}

.btn.ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.meta {
  margin-top: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  color: var(--muted);
  gap: 0.75rem;
}

.filters {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.filter-btn {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  padding: 0.4rem 1.1rem;
  cursor: pointer;
  color: var(--muted);
  font-weight: 500;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.filter-btn.active {
  color: var(--accent-strong);
  border-color: var(--accent-strong);
  background: rgba(37, 99, 235, 0.08);
}

.todo-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.todo-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.9rem 1rem;
  border-radius: 1rem;
  border: 1px solid var(--border);
  background-color: rgba(148, 163, 184, 0.07);
}

.todo-item.completed .todo-text {
  text-decoration: line-through;
  color: var(--muted);
}

.todo-text {
  margin: 0;
  word-break: break-word;
}

.todo-actions {
  display: flex;
  gap: 0.35rem;
}

.icon-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 0.35rem;
  border-radius: 0.6rem;
  cursor: pointer;
}

.icon-btn:hover {
  color: var(--accent);
  background: rgba(37, 99, 235, 0.1);
}

.checkbox-wrapper {
  position: relative;
}

.checkbox-wrapper input {
  width: 1.2rem;
  height: 1.2rem;
  accent-color: var(--accent);
  cursor: pointer;
}

.empty-state {
  text-align: center;
  color: var(--muted);
  margin-top: 1.5rem;
  display: none;
}

.site-footer {
  padding: 1.5rem 0;
  text-align: center;
  color: var(--muted);
  border-top: 1px solid var(--border);
}

.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;
}

@media (max-width: 600px) {
  .todo-item {
    grid-template-columns: 1fr auto;
  }

  .checkbox-wrapper {
    grid-column: 1 / -1;
    justify-self: flex-start;
  }
}