:root {
  color-scheme: light;
  --bg: #f7f4ef;
  --ink: #1f2328;
  --muted: #68707a;
  --line: #ded8cf;
  --paper: #fffdfa;
  --paper-strong: #ffffff;
  --accent: #236a8f;
  --accent-deep: #164f70;
  --accent-soft: #dcecf3;
  --done: #2f7d55;
  --done-soft: #dff0e7;
  --warn: #a85b22;
  --warn-soft: #f5e5d7;
  --shadow: 0 18px 50px rgba(52, 48, 42, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(247, 244, 239, 0.92)),
    var(--bg);
  color: var(--ink);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(100%, 980px);
  margin: 0 auto;
  padding: 22px 16px 42px;
}

.topbar,
.detail-heading,
.month-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar {
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-deep);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(28px, 8vw, 42px);
  line-height: 1.05;
}

h2 {
  margin-bottom: 0;
  font-size: 22px;
  line-height: 1.2;
}

.today-chip,
.progress-pill,
.month-toolbar p,
.subject-status,
.task-tags span {
  color: var(--muted);
  font-size: 13px;
}

.today-chip,
.progress-pill {
  flex: none;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.64);
  white-space: nowrap;
}

.calendar-band,
.detail-band {
  background: rgba(255, 253, 250, 0.88);
  border: 1px solid rgba(222, 216, 207, 0.86);
  box-shadow: var(--shadow);
}

.calendar-band {
  border-radius: 18px 18px 0 0;
  padding: 16px;
}

.detail-band {
  border-top: 0;
  border-radius: 0 0 18px 18px;
  padding: 18px 16px 20px;
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--paper-strong);
  color: var(--ink);
  font-size: 30px;
  line-height: 1;
  transition: 0.16s ease;
}

.icon-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.weekdays {
  margin-top: 18px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.weekdays span {
  padding: 6px 0;
}

.calendar-grid {
  gap: 6px;
}

.day-button {
  position: relative;
  min-height: 72px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--ink);
  text-align: left;
  transition: 0.16s ease;
}

.day-button:hover {
  border-color: var(--accent);
  background: var(--paper-strong);
}

.day-button.is-outside {
  color: #a7a098;
  background: rgba(255, 255, 255, 0.36);
}

.day-button.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.day-button.is-today .day-number {
  color: var(--accent-deep);
  font-weight: 900;
}

.day-button.is-done {
  background: var(--done-soft);
}

.day-number {
  display: block;
  margin-bottom: 8px;
  font-size: 17px;
  font-weight: 750;
}

.day-count {
  display: inline-flex;
  min-width: 0;
  height: 20px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0 7px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.is-done .day-count {
  background: rgba(255, 255, 255, 0.64);
  color: var(--done);
}

.detail-heading {
  margin-bottom: 16px;
}

.subject-list {
  display: grid;
  gap: 14px;
}

.subject-section {
  padding: 0 0 16px;
  border-bottom: 1px solid var(--line);
}

.subject-section:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

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

.task-list {
  display: grid;
  gap: 10px;
}

.task-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  padding: 14px;
  border: 1px solid #e6e0d8;
  border-radius: 8px;
  background: var(--paper-strong);
}

.task-card.is-complete {
  border-color: rgba(47, 125, 85, 0.28);
  background: linear-gradient(0deg, rgba(223, 240, 231, 0.42), rgba(255, 255, 255, 0.92));
}

.check-row,
.subject-check-row {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  cursor: pointer;
}

.subject-check-row {
  min-width: 0;
}

.complete-input,
.subject-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.checkbox-face {
  width: 24px;
  height: 24px;
  border: 2px solid #b9b0a6;
  border-radius: 6px;
  background: #fff;
}

.complete-input:checked + .checkbox-face,
.subject-input:checked + .checkbox-face {
  border-color: var(--done);
  background: var(--done);
}

.subject-input:indeterminate + .checkbox-face {
  border-color: var(--accent);
  background: var(--accent);
}

.complete-input:checked + .checkbox-face::after,
.subject-input:checked + .checkbox-face::after {
  display: block;
  color: #fff;
  content: "✓";
  font-size: 17px;
  font-weight: 900;
  line-height: 20px;
  text-align: center;
}

.subject-input:indeterminate + .checkbox-face::after {
  display: block;
  color: #fff;
  content: "-";
  font-size: 19px;
  font-weight: 900;
  line-height: 18px;
  text-align: center;
}

.task-title {
  min-width: 0;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.subject-name {
  min-width: 0;
  font-size: 18px;
  font-weight: 850;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.task-content {
  margin: 10px 0 0 35px;
  color: #3f454b;
  font-size: 15px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.task-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 10px 0 0 35px;
}

.task-tags span {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  border-radius: 999px;
  padding: 0 9px;
  background: #f2eee8;
}

.submit-area {
  min-width: 116px;
}

.submit-toggle {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 11px;
  background: #fff;
  color: var(--warn);
  font-size: 14px;
  font-weight: 750;
  cursor: pointer;
  white-space: nowrap;
}

.submit-toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--done);
}

.submit-toggle.is-submitted {
  border-color: rgba(47, 125, 85, 0.42);
  background: var(--done-soft);
  color: var(--done);
}

.empty-state {
  padding: 30px 8px;
  color: var(--muted);
  font-size: 15px;
  text-align: center;
}

@media (max-width: 680px) {
  .app-shell {
    padding: 16px 10px 30px;
  }

  .topbar {
    align-items: flex-start;
  }

  .today-chip {
    display: none;
  }

  .calendar-band,
  .detail-band {
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }

  .day-button {
    min-height: 58px;
    padding: 7px 6px;
  }

  .day-number {
    font-size: 15px;
  }

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

  .submit-area {
    min-width: 0;
    padding-left: 35px;
  }
}

@media (max-width: 390px) {
  .calendar-grid {
    gap: 4px;
  }

  .day-button {
    min-height: 52px;
  }

  .day-count {
    height: 18px;
    padding: 0 5px;
    font-size: 10px;
  }
}
