:root {
  --bg: #f3efe7;
  --bg-accent: #e4edf8;
  --panel: rgba(255, 252, 246, 0.92);
  --panel-strong: #fffdf9;
  --line: #d9d2c7;
  --text: #1f2937;
  --muted: #5f6f86;
  --primary: #2359c8;
  --primary-dark: #173a7b;
  --primary-soft: #e6eeff;
  --success: #2f9e5d;
  --success-soft: #dff3df;
  --danger: #d94848;
  --danger-soft: #fde4e4;
  --warning: #b76a00;
  --warning-soft: #fff2d8;
  --shadow: 0 24px 60px rgba(31, 41, 55, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding:
    max(28px, env(safe-area-inset-top))
    18px
    max(40px, env(safe-area-inset-bottom))
    18px;
  font-family: "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 218, 165, 0.9), transparent 24%),
    radial-gradient(circle at top right, rgba(114, 159, 255, 0.22), transparent 28%),
    linear-gradient(180deg, var(--bg-accent), var(--bg));
}

button,
input {
  font: inherit;
}

.page {
  max-width: 980px;
  margin: 0 auto;
  display: grid;
  gap: 22px;
}

.hero,
.panel {
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  animation: rise-in 0.55s ease both;
}

.hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(240px, 0.9fr);
  gap: 18px;
  padding: 30px;
  background:
    radial-gradient(circle at 85% 20%, rgba(255, 227, 182, 0.45), transparent 22%),
    linear-gradient(135deg, #17314e, #2359c8 62%, #5f8ef0);
  color: #ffffff;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -70px -90px auto;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
}

.hero-copy,
.hero-card {
  position: relative;
  z-index: 1;
}

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

.eyebrow {
  margin: 0 0 10px;
  font-size: 13px;
  letter-spacing: 0.14em;
  color: rgba(255, 255, 255, 0.76);
}

.today-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.92);
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(32px, 5vw, 48px);
  line-height: 1.05;
  letter-spacing: -0.03em;
}

h2 {
  font-size: 24px;
  line-height: 1.1;
}

.tip,
.panel-text {
  margin-top: 10px;
  max-width: 34em;
  line-height: 1.7;
}

.tip {
  color: rgba(255, 255, 255, 0.86);
}

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

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 22px;
}

.stat-card {
  display: grid;
  gap: 6px;
  padding: 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.stat-label {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.74);
}

.stat-value {
  font-size: clamp(28px, 4vw, 36px);
  line-height: 1;
}

.hero-card {
  align-self: end;
  display: grid;
  gap: 8px;
  padding: 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.hero-card-label,
.panel-tag,
.list-note {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
}

.hero-card-label {
  color: rgba(255, 255, 255, 0.88);
  background: rgba(255, 255, 255, 0.14);
}

.hero-card strong {
  font-size: 20px;
  line-height: 1.2;
}

.hero-card span:last-child {
  color: rgba(255, 255, 255, 0.86);
  line-height: 1.6;
}

.progress-card {
  margin-top: 10px;
  display: grid;
  gap: 10px;
}

.progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: rgba(255, 255, 255, 0.84);
  font-size: 14px;
}

.progress-track {
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.16);
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ffd478, #fff0b6);
  transition: width 0.3s ease;
}

.install-tip {
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.76);
  font-size: 14px;
}

.panel {
  padding: 24px;
  background: var(--panel);
}

.panel-header,
.list-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.panel-tag,
.list-note {
  color: var(--primary-dark);
  background: var(--primary-soft);
}

.input-area {
  margin-top: 22px;
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1.2fr) auto;
  gap: 14px;
  align-items: end;
}

.field {
  display: grid;
  gap: 9px;
}

.field-label {
  font-size: 14px;
  color: var(--muted);
}

input {
  width: 100%;
  min-height: 54px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel-strong);
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

input:focus {
  outline: none;
  border-color: rgba(35, 89, 200, 0.6);
  box-shadow: 0 0 0 4px rgba(35, 89, 200, 0.12);
  transform: translateY(-1px);
}

.date-group {
  display: grid;
  grid-template-columns: minmax(88px, 104px) auto minmax(70px, 88px) auto minmax(70px, 88px) auto;
  align-items: center;
  gap: 8px;
}

.date-group span {
  color: var(--muted);
}

button {
  min-height: 54px;
  padding: 12px 18px;
  border: none;
  border-radius: 18px;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

button:hover {
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

#add-button {
  background: linear-gradient(135deg, var(--primary), #4b7cf0);
  color: #ffffff;
  box-shadow: 0 16px 26px rgba(35, 89, 200, 0.2);
}

ul {
  display: grid;
  gap: 12px;
  list-style: none;
  margin: 20px 0 0;
  padding: 0;
}

li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border: 1px solid rgba(35, 89, 200, 0.08);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(248, 250, 255, 0.96), rgba(241, 246, 255, 0.92));
  animation: rise-in 0.28s ease both;
}

.homework-item.is-completed {
  background: linear-gradient(180deg, #eef7ee, #e7f3e7);
}

.homework-text {
  min-width: 0;
  line-height: 1.5;
}

.homework-name {
  display: block;
  font-size: 18px;
  line-height: 1.35;
}

.homework-name.is-completed {
  color: #6f7f6f;
  text-decoration: line-through;
}

.homework-date {
  margin-top: 6px;
  color: var(--muted);
}

.countdown-text {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin-top: 10px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 13px;
  background: var(--primary-soft);
  color: var(--primary);
}

.countdown-text.is-today {
  background: var(--warning-soft);
  color: var(--warning);
}

.countdown-text.is-overdue {
  background: var(--danger-soft);
  color: #b42323;
}

.countdown-text.is-completed {
  background: var(--success-soft);
  color: #237a23;
}

.item-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.toggle-button {
  background: linear-gradient(135deg, var(--success), #54b77d);
  color: #ffffff;
}

.toggle-button.is-completed {
  background: linear-gradient(135deg, #7f8ca7, #97a3ba);
}

.delete-button {
  background: linear-gradient(135deg, var(--danger), #ef6666);
  color: #ffffff;
}

.empty-message {
  margin-top: 18px;
  padding: 18px 20px;
  border: 1px dashed rgba(35, 89, 200, 0.18);
  border-radius: 18px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.4);
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 860px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .hero-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .input-area {
    grid-template-columns: 1fr;
  }

  #add-button {
    width: 100%;
  }
}

@media (max-width: 640px) {
  body {
    padding:
      max(14px, env(safe-area-inset-top))
      12px
      max(28px, env(safe-area-inset-bottom))
      12px;
  }

  .hero,
  .panel {
    padding: 18px;
    border-radius: 22px;
  }

  .panel-header,
  .list-header,
  li {
    flex-direction: column;
    align-items: stretch;
  }

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

  .hero-stats {
    grid-template-columns: 1fr;
  }

  .date-group {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 0.8fr) auto minmax(0, 0.8fr) auto;
  }

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

  .item-actions button {
    width: 100%;
  }
}
