:root {
  /* Static fallbacks only. theme.js overrides --bg/--panel/--accent/... at
     runtime with a palette derived from country + time of day + season.
     These neutral slate values are what you see if JS is disabled. */
  --bg: #111418;
  --panel: #1b2027;
  --panel-2: #232a33;
  --border: #2f3742;
  --text: #e7ebf0;
  --text-dim: #9aa4b2;
  --accent: #2f7d8c;
  --accent-2: #3f9fb0;
  --accent-contrast: #ffffff;
  --accent-soft: rgba(63, 159, 176, 0.16);
  --danger: #ef4444;
  --warn: #f59e0b;
  --ok: #22c55e;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 16px 48px;
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: env(safe-area-inset-top);
}

.topbar h1 {
  font-size: 1.4rem;
  margin: 12px 0;
}

.hint {
  color: var(--text-dim);
  font-size: 0.9rem;
  margin: 4px 0 16px;
}

.add-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.add-form input[type="text"] {
  flex: 1 1 100%;
}

.add-form input[type="datetime-local"] {
  flex: 1 1 auto;
  min-width: 0;
}

input[type="text"],
input[type="datetime-local"] {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 1rem;
}

input:focus {
  outline: 2px solid var(--accent-2);
}

.btn {
  border: none;
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-contrast);
}

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

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

.btn-ghost:hover { background: var(--panel-2); }

.btn-primary:disabled,
.btn-ghost:disabled { opacity: 0.55; cursor: default; }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.btn-small {
  padding: 8px 10px;
  font-size: 0.82rem;
}

.section-title {
  font-size: 1rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 12px;
}

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

.todo-item {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  gap: 12px;
  align-items: center;
}

.todo-thumb {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  background: var(--panel-2);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  overflow: hidden;
}

.todo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.todo-main {
  flex: 1;
  min-width: 0;
}

.todo-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.todo-title {
  font-weight: 600;
  font-size: 1.02rem;
  word-break: break-word;
}

.todo-title.done {
  text-decoration: line-through;
  color: var(--text-dim);
}

.badge {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-pending { background: var(--accent-soft); color: var(--accent-2); }
.badge-snoozed-0 { background: rgba(245, 158, 11, 0.18); color: var(--warn); }
.badge-snoozed-1 { background: rgba(245, 158, 11, 0.25); color: #fbbf24; }
.badge-snoozed-2 { background: rgba(239, 68, 68, 0.2); color: #f87171; }
.badge-snoozed-3, .badge-snoozed-4 { background: rgba(239, 68, 68, 0.3); color: var(--danger); }
.badge-done { background: rgba(34, 197, 94, 0.18); color: var(--ok); }

.todo-meta {
  color: var(--text-dim);
  font-size: 0.82rem;
  margin-top: 2px;
}

.todo-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: stretch;
}

.todo-actions .btn { white-space: nowrap; }

.footnote {
  margin-top: 32px;
  color: var(--text-dim);
  font-size: 0.85rem;
  text-align: center;
}

/* Advertising contact strip */
.ad-banner {
  margin-top: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  text-align: center;
  padding: 14px 16px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--text);
  font-size: 0.9rem;
}

.ad-banner strong { color: var(--accent-2); }

.ad-banner a {
  color: var(--accent-2);
  font-weight: 700;
  text-decoration: none;
}

.ad-banner a:hover { text-decoration: underline; }

.mode-note {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.75rem;
  letter-spacing: 0.03em;
  margin: 18px 0 0;
  opacity: 0.8;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 1000;
}

.modal-overlay.hidden { display: none; }

.modal {
  background: var(--panel);
  border-radius: 18px;
  max-width: 480px;
  width: 100%;
  padding: 20px;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: pop-in 0.18s ease-out;
}

@keyframes pop-in {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-kicker {
  color: var(--text-dim);
  font-size: 0.8rem;
  margin: 0 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.modal-title {
  margin: 0 0 12px;
  font-size: 1.4rem;
}

.modal-image-wrap {
  border-radius: 12px;
  overflow: hidden;
  background: var(--panel-2);
  margin-bottom: 12px;
  aspect-ratio: 3 / 2;
}

.modal-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.modal-body {
  color: var(--text);
  margin: 0 0 18px;
  line-height: 1.4;
}

.modal-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.modal-actions .btn { flex: 1 1 auto; }

@media (max-width: 420px) {
  .todo-item { flex-wrap: wrap; }
  .todo-actions { flex-direction: row; flex-wrap: wrap; width: 100%; }
  .todo-actions .btn { flex: 1 1 auto; }
}
