:root {
  color-scheme: light;
  --bg: #f5f2ea;
  --panel: #fff9f1;
  --ink: #2c2b28;
  --muted: #6a655d;
  --accent: #d96c45;
  --accent-dark: #a14c31;
  --border: #e4d9c7;
}

.theme-dark {
  color-scheme: dark;
  --bg: #151512;
  --panel: #1f1f1a;
  --ink: #f0eadf;
  --muted: #b7b0a3;
  --accent: #e07a4f;
  --accent-dark: #f4a07e;
  --border: #34312b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Georgia", "Times New Roman", serif;
  background: radial-gradient(circle at top, #fff6e4, var(--bg));
  color: var(--ink);
}

.theme-dark {
  background: radial-gradient(circle at top, #2a241a, var(--bg));
}

.page {
  max-width: 980px;
  margin: 0 auto;
  padding: 32px 20px 60px;
}

.hero {
  text-align: left;
  margin-bottom: 24px;
}

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

.hero-nav {
  display: flex;
  gap: 12px;
}

.hero-nav a {
  color: var(--accent-dark);
  text-decoration: none;
  font-weight: 600;
}

.hero-nav form {
  margin: 0;
}

.hero-nav form button {
  background: transparent;
  color: var(--accent-dark);
  border: none;
  padding: 0;
  font: inherit;
  cursor: pointer;
  font-weight: 600;
}

.hero-nav form button:hover {
  text-decoration: underline;
}

.hero-nav a:hover {
  text-decoration: underline;
}

.hero h1 {
  font-size: 2.4rem;
  margin: 0 0 8px;
}

.hero p {
  margin: 0;
  color: var(--muted);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: 0 10px 24px rgba(54, 39, 21, 0.08);
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.task-form {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.settings-form {
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
}

.task-form input {
  flex: 1;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 1rem;
}

.task-form select {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 1rem;
  background: #fff;
}

.theme-dark .task-form select,
.theme-dark .task-form input,
.theme-dark .config-form input,
.theme-dark .config-form select {
  background: #26231e;
  color: var(--ink);
}

button {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
}

button:hover {
  background: var(--accent-dark);
}

.task-list ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}

.task {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.theme-dark .task {
  background: #26231e;
}

.config-row {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px dashed var(--border);
}

.config-title {
  font-weight: 600;
}

.config-edit {
  margin-right: auto;
}

.config-edit summary {
  list-style: none;
}

.config-edit summary::-webkit-details-marker {
  display: none;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.form-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.profile-view {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
}

.label {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 4px;
}

.button-link {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  padding: 8px 12px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 600;
}

.button-link:hover {
  background: var(--accent-dark);
}

.weight-update {
  margin-top: 16px;
}

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

.task form input[type="text"] {
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.theme-dark .task form input[type="text"] {
  background: #26231e;
  color: var(--ink);
}

.inline-form input {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.theme-dark .inline-form input {
  background: #26231e;
  color: var(--ink);
}

.history-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}

.history-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
}

.streak-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #fff;
}

.streak-count {
  font-size: 2.2rem;
  font-weight: 700;
}

.streak-label {
  color: var(--muted);
  font-weight: 600;
}

.theme-dark .streak-card {
  background: #26231e;
}

.character-summary {
  padding: 16px 18px;
}

.xp-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.xp-bar {
  flex: 1;
  height: 10px;
  border-radius: 999px;
  background: #efe6d6;
  border: 1px solid var(--border);
  overflow: hidden;
}

.xp-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-dark));
}

.theme-dark .xp-bar {
  background: #2a251f;
}

.theme-dark .history-list li {
  background: #26231e;
}

.button-like {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
}

.button-like:hover {
  background: var(--accent-dark);
}

.milestones {
  padding: 8px 0 0 0;
}

.milestones h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.milestone-list {
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
  display: grid;
  gap: 6px;
}

.milestone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
}

.milestone.done {
  opacity: 0.7;
  text-decoration: line-through;
}

.milestone-actions {
  display: flex;
  gap: 8px;
}

.milestone-list.dashboard {
  margin: 6px 0 12px;
  padding-left: 16px;
}

.theme-dark .milestone {
  background: #26231e;
}

.config-row:last-child {
  border-bottom: none;
}

.config-form {
  display: flex;
  gap: 10px;
  align-items: center;
  flex: 1;
}

.config-form input,
.config-form select {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.danger {
  background: #9b3a2f;
}

.danger:hover {
  background: #7a2b23;
}

.danger-zone {
  border-color: #c96f63;
}

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

.task.done {
  opacity: 0.7;
  text-decoration: line-through;
}

.task .meta {
  color: var(--muted);
  font-size: 0.85rem;
}

.task .status {
  color: var(--accent-dark);
  font-weight: 600;
}

.empty {
  margin: 0;
  color: var(--muted);
}

@media (max-width: 720px) {
  .panel-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-nav {
    flex-wrap: wrap;
  }

  .task-form {
    flex-direction: column;
  }

  .config-row {
    flex-direction: column;
    align-items: stretch;
  }

  .config-form {
    flex-direction: column;
    align-items: stretch;
  }

  .config-edit {
    margin-right: 0;
    width: 100%;
  }

  .milestone-actions {
    width: 100%;
    flex-direction: column;
  }

  .history-list li {
    flex-direction: column;
    align-items: flex-start;
  }

  button {
    width: 100%;
  }

  .task {
    flex-direction: column;
    align-items: flex-start;
  }
}
