:root {
  --ink: #1f1b18;
  --paper: #f4efe3;
  --paper-2: #fffaf0;
  --accent: #17624f;
  --accent-2: #cf5b2e;
  --muted: #6f6558;
  --line: #d7cdbd;
  --ok: #1f8e61;
  --miss: #bda892;
  --shadow: 0 14px 34px rgba(39, 27, 10, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: radial-gradient(1000px 400px at 10% 0%, #fff6d8 0, transparent 70%),
    radial-gradient(900px 500px at 100% 20%, #f9e6d8 0, transparent 70%),
    var(--paper);
  font-family: "Avenir Next", "Gill Sans", "Trebuchet MS", sans-serif;
  min-height: 100vh;
}

.background-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(to right, rgba(0, 0, 0, 0.02) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0, 0, 0, 0.02) 1px, transparent 1px);
  background-size: 36px 36px;
}

.app-header,
.tabs,
main {
  position: relative;
  z-index: 1;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  max-width: 1100px;
  margin: 2rem auto 1rem;
  padding: 0 1rem;
}

h1 {
  font-family: "Palatino", "Book Antiqua", serif;
  font-size: clamp(2rem, 4.2vw, 3.3rem);
  margin: 0;
}

h2,
h3 {
  margin: 0;
}

p {
  margin: 0;
}

.header-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.6rem;
  color: var(--muted);
}

.ghost-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  cursor: pointer;
}

.tabs {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.tab {
  border: 1px solid var(--line);
  border-bottom: none;
  background: rgba(255, 255, 255, 0.55);
  padding: 0.7rem 1rem;
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
  cursor: pointer;
}

.tab.active {
  background: var(--paper-2);
  color: var(--accent);
  font-weight: 700;
}

main {
  max-width: 1100px;
  margin: 0 auto 2rem;
  padding: 0 1rem;
}

.panel {
  display: none;
  border: 1px solid var(--line);
  background: var(--paper-2);
  border-radius: 0 14px 14px 14px;
  box-shadow: var(--shadow);
  padding: 1rem;
}

.panel.active {
  display: block;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}

.task-form {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

input[type="text"] {
  width: min(450px, 70vw);
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

button[type="submit"] {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  padding: 0.65rem 0.9rem;
  cursor: pointer;
}

.task-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.task-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  background: #fffdf6;
}

.task-main {
  display: grid;
  grid-template-columns: 94px 1fr;
  gap: 1rem;
  align-items: center;
}

.task-check {
  position: relative;
  width: 94px;
  height: 94px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: #f2ebdb;
}

.task-check input {
  opacity: 0;
  position: absolute;
  inset: 0;
}

.checkmark {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  border: 3px solid var(--accent);
  display: grid;
  place-items: center;
  background: #fff;
  font-size: 2.2rem;
  font-weight: 700;
  color: transparent;
}

.task-check input:checked + .checkmark {
  background: radial-gradient(circle at 30% 30%, #8cf0c5, var(--ok));
  border-color: var(--ok);
  color: #fff;
}

.task-check input:checked + .checkmark::before {
  content: "X";
}

.task-title {
  font-size: clamp(1.4rem, 2.6vw, 2rem);
  letter-spacing: 0.02em;
}

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

.history-dots {
  margin-top: 0.55rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
}

.task-item .task-meta,
.task-item .history-dots {
  display: none;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--miss);
}

.dot.ok {
  background: var(--ok);
}

.dot.today {
  outline: 2px solid var(--accent-2);
  outline-offset: 1px;
}

.delete-btn {
  border: 1px solid #ebd8c7;
  background: #fff1e7;
  color: #8f3a1d;
  border-radius: 8px;
  padding: 0.55rem 0.8rem;
  cursor: pointer;
}

.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.7rem;
}

.summary-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.65rem;
  background: #fff;
}

.summary-card strong {
  font-size: 1.2rem;
}

.chart-wrap {
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 0.7rem;
}

#trend-chart {
  width: 100%;
  height: 260px;
}

.badge-shelf {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}

.badge {
  width: 94px;
  height: 94px;
  border-radius: 50%;
  border: 3px solid #e1b043;
  background: radial-gradient(circle at 30% 20%, #fff8d0, #eeb242);
  display: grid;
  place-content: center;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(115, 84, 25, 0.2);
}

.settings-form {
  display: grid;
  gap: 0.7rem;
  margin-bottom: 1rem;
}

.task-manager {
  margin: 1rem 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 0.8rem;
}

.task-manager h3 {
  margin-bottom: 0.4rem;
}

.manage-task-list {
  list-style: none;
  margin: 0.6rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.manage-task-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.7rem;
  border: 1px solid #eee2d5;
  border-radius: 8px;
  padding: 0.5rem 0.6rem;
}

.manage-task-name {
  font-weight: 600;
}

.news-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 0.8rem;
  margin-bottom: 0.8rem;
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 1.2rem;
  background: #fff;
}

.hidden {
  display: none;
}

@media (max-width: 720px) {
  .app-header {
    flex-direction: column;
  }

  .header-meta {
    align-items: flex-start;
  }

  .task-list {
    grid-template-columns: 1fr;
  }

  .task-item {
    grid-template-columns: 1fr;
    gap: 0.7rem;
  }

  .task-main {
    grid-template-columns: 76px 1fr;
    gap: 0.75rem;
  }

  .task-check {
    width: 76px;
    height: 76px;
  }

  .checkmark {
    width: 58px;
    height: 58px;
    font-size: 1.7rem;
  }

  input[type="text"] {
    width: 100%;
  }
}
