:root {
  --ink: #121826;
  --night: #1b2336;
  --panel: #fff7df;
  --paper: #fffdf6;
  --line: #111827;
  --red: #dc2335;
  --gold: #ffd447;
  --cyan: #00b8d9;
  --green: #28a745;
  --muted: #677085;
  --shadow: 0 14px 0 rgba(17, 24, 39, 0.22);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    linear-gradient(135deg, rgba(255, 212, 71, 0.12) 0 12%, transparent 12% 100%),
    linear-gradient(45deg, transparent 0 84%, rgba(220, 35, 53, 0.25) 84% 100%),
    #152033;
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  font-family:
    "Microsoft YaHei",
    "PingFang SC",
    "Noto Sans CJK SC",
    Arial,
    sans-serif;
  background:
    radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.12) 1px, transparent 0) 0 0 / 18px 18px,
    linear-gradient(90deg, rgba(0, 184, 217, 0.14) 0 10px, transparent 10px 100%) 0 0 / 92px 92px;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.app-shell {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0 54px;
}

.hero-panel {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px;
  gap: 24px;
  min-height: 230px;
  padding: 34px;
  border: 4px solid var(--line);
  border-radius: 8px;
  background:
    url("./assets/hero-badge.png") right 34px center / 180px auto no-repeat,
    linear-gradient(115deg, #ffe16a 0 45%, #f64f4f 45% 65%, #1f9ec4 65% 100%);
  box-shadow: var(--shadow);
}

.hero-panel::before {
  content: "";
  position: absolute;
  inset: 12px;
  pointer-events: none;
  border: 2px dashed rgba(17, 24, 39, 0.35);
}

.hero-panel::after {
  content: "";
  position: absolute;
  left: -80px;
  bottom: 18px;
  width: 45%;
  height: 42px;
  transform: rotate(-10deg);
  background: repeating-linear-gradient(90deg, rgba(17, 24, 39, 0.88) 0 18px, transparent 18px 31px);
}

.hero-copy {
  position: relative;
  z-index: 1;
  max-width: 650px;
}

.eyebrow {
  display: inline-block;
  margin-bottom: 10px;
  padding: 6px 10px;
  border: 3px solid var(--line);
  background: var(--paper);
  color: var(--red);
  font-size: 0.82rem;
  font-weight: 900;
}

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

.hero-copy h1 {
  color: var(--paper);
  font-size: 3rem;
  line-height: 1.08;
  text-shadow: 4px 4px 0 var(--line);
}

.hero-copy p {
  margin-top: 14px;
  color: var(--paper);
  font-size: 1.12rem;
  font-weight: 800;
  text-shadow: 2px 2px 0 rgba(17, 24, 39, 0.75);
}

.hero-score {
  position: relative;
  z-index: 1;
  align-self: end;
  justify-self: end;
  display: grid;
  place-items: center;
  width: 150px;
  height: 150px;
  border: 5px solid var(--line);
  border-radius: 50%;
  background: var(--paper);
  box-shadow: 7px 7px 0 rgba(17, 24, 39, 0.34);
}

.hero-score span {
  display: block;
  color: var(--red);
  font-size: 2.25rem;
  font-weight: 1000;
  line-height: 1;
}

.hero-score small {
  display: block;
  margin-top: 8px;
  color: var(--ink);
  font-weight: 900;
}

.control-strip,
.summary-grid,
.score-grid,
.homework-grid {
  margin-top: 24px;
}

.control-strip {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 56px;
  gap: 12px;
  align-items: stretch;
}

.nav-btn,
.primary-action {
  min-height: 52px;
  border: 3px solid var(--line);
  border-radius: 8px;
  background: var(--gold);
  color: var(--line);
  font-weight: 1000;
  box-shadow: 4px 4px 0 rgba(17, 24, 39, 0.24);
}

.date-picker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 58px;
  padding: 10px 16px;
  border: 3px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 4px 4px 0 rgba(17, 24, 39, 0.18);
}

.date-picker span {
  font-size: 1.2rem;
  font-weight: 1000;
}

.date-picker input {
  width: 160px;
  max-width: 50%;
  min-height: 38px;
  border: 2px solid var(--line);
  border-radius: 6px;
  padding: 4px 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.summary-tile {
  min-height: 96px;
  padding: 16px;
  border: 3px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 4px 4px 0 rgba(17, 24, 39, 0.18);
}

.summary-tile span {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 900;
}

.summary-tile strong {
  display: block;
  margin-top: 7px;
  color: var(--red);
  font-size: 1.65rem;
  line-height: 1;
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.score-panel,
.homework-card {
  border: 3px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 6px 6px 0 rgba(17, 24, 39, 0.22);
}

.score-panel {
  padding: 18px;
}

.score-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink);
  font-weight: 1000;
}

.score-heading strong {
  color: var(--red);
}

.score-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px;
  gap: 12px;
  align-items: center;
  margin-top: 14px;
}

.score-control input[type="range"] {
  accent-color: var(--red);
}

.score-control input[type="number"] {
  min-height: 42px;
  border: 2px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
  background: var(--paper);
  font-weight: 900;
}

.homework-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.homework-card {
  overflow: hidden;
}

.homework-card.is-complete {
  background: #eaffef;
}

.card-topline {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 16px;
  border-bottom: 3px solid var(--line);
  background: var(--paper);
}

.comic-badge {
  display: grid;
  place-items: center;
  width: 58px;
  min-width: 58px;
  height: 58px;
  border: 3px solid var(--line);
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 1000;
  box-shadow: 3px 3px 0 var(--gold);
}

.card-topline h2 {
  font-size: 1.2rem;
  line-height: 1.15;
}

.card-topline p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.task-list {
  display: grid;
  gap: 0;
}

.task-row {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.task-row + .task-row {
  border-top: 2px solid rgba(17, 24, 39, 0.16);
}

.task-copy {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.task-dot {
  width: 24px;
  height: 24px;
  margin-top: 2px;
  border: 3px solid var(--line);
  border-radius: 50%;
  background: #fff;
}

.task-dot.done {
  background: var(--green);
  box-shadow: inset 0 0 0 4px #fff;
}

.task-copy h3 {
  font-size: 1rem;
  line-height: 1.35;
}

.task-copy p {
  margin-top: 5px;
  color: var(--red);
  font-size: 0.86rem;
  font-weight: 900;
}

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

.status-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 3px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--paper);
}

.status-btn {
  min-height: 46px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 1000;
}

.status-btn + .status-btn {
  border-left: 3px solid var(--line);
}

.status-btn[aria-pressed="true"].status-btn-complete {
  background: var(--green);
  color: #fff;
}

.status-btn[aria-pressed="true"].status-btn-incomplete {
  background: var(--red);
  color: #fff;
}

.image-tools {
  display: grid;
  grid-template-columns: 120px 62px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.upload-btn {
  display: grid;
  place-items: center;
  min-height: 42px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: var(--cyan);
  color: #fff;
  font-size: 0.92rem;
  font-weight: 1000;
  text-align: center;
}

.upload-btn input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.image-thumb {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  padding: 0;
  border: 2px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--paper);
}

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

.image-thumb-empty {
  border-style: dashed;
  background: rgba(255, 255, 255, 0.52);
}

.upload-state {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-state small {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-state.is-success {
  color: var(--green);
}

.upload-state.is-uploading {
  color: var(--cyan);
}

.upload-state.is-failed {
  color: var(--red);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(18, 24, 38, 0.72);
}

.modal-backdrop[hidden],
.toast[hidden] {
  display: none;
}

.image-modal {
  position: relative;
  width: min(900px, 100%);
  max-height: calc(100vh - 44px);
  padding: 18px;
  border: 4px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 10px 10px 0 rgba(0, 0, 0, 0.28);
}

.image-modal img {
  display: block;
  width: 100%;
  max-height: calc(100vh - 150px);
  object-fit: contain;
  border: 2px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.image-modal p {
  margin-top: 10px;
  color: var(--muted);
  font-weight: 900;
}

.modal-close {
  position: absolute;
  top: -18px;
  right: -18px;
  width: 42px;
  height: 42px;
  border: 3px solid var(--line);
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  font-weight: 1000;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  max-width: min(360px, calc(100% - 36px));
  padding: 12px 14px;
  border: 3px solid var(--line);
  border-radius: 8px;
  background: var(--gold);
  color: var(--line);
  font-weight: 1000;
  box-shadow: 5px 5px 0 rgba(17, 24, 39, 0.26);
}

.app-message {
  min-height: 100vh;
  display: grid;
  align-items: center;
}

.danger-panel {
  background:
    url("./assets/hero-badge.png") right 34px center / 180px auto no-repeat,
    linear-gradient(115deg, #f85b5b 0 55%, #ffd447 55% 100%);
}

.primary-action {
  display: inline-grid;
  place-items: center;
  min-width: 128px;
  margin-top: 18px;
  padding: 0 18px;
  background: var(--paper);
}

@media (max-width: 820px) {
  .app-shell {
    width: min(100% - 18px, 680px);
    padding-top: 16px;
  }

  .hero-panel {
    grid-template-columns: 1fr;
    min-height: 260px;
    padding: 24px;
    background:
      url("./assets/hero-badge.png") right 16px bottom 16px / 132px auto no-repeat,
      linear-gradient(125deg, #ffe16a 0 42%, #f64f4f 42% 66%, #1f9ec4 66% 100%);
  }

  .hero-copy h1 {
    max-width: 260px;
    font-size: 2.2rem;
  }

  .hero-score {
    width: 116px;
    height: 116px;
    justify-self: start;
  }

  .hero-score span {
    font-size: 1.8rem;
  }

  .summary-grid,
  .score-grid,
  .homework-grid {
    grid-template-columns: 1fr;
  }

  .control-strip {
    grid-template-columns: 48px minmax(0, 1fr) 48px;
  }

  .date-picker {
    display: grid;
  }

  .date-picker input {
    width: 100%;
    max-width: 100%;
  }

  .score-control,
  .image-tools {
  display: grid;
  grid-template-columns: 120px 62px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.upload-btn {
  display: grid;
  place-items: center;
  min-height: 42px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: var(--cyan);
  color: #fff;
  font-size: 0.92rem;
  font-weight: 1000;
  text-align: center;
}

.upload-btn input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.image-thumb {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  padding: 0;
  border: 2px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--paper);
}

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

.image-thumb-empty {
  border-style: dashed;
  background: rgba(255, 255, 255, 0.52);
}

.upload-state {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-state small {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-state.is-success {
  color: var(--green);
}

.upload-state.is-uploading {
  color: var(--cyan);
}

.upload-state.is-failed {
  color: var(--red);
}

@media (max-width: 420px) {
  .hero-panel {
    padding: 20px;
  }

  .hero-copy h1 {
    font-size: 2rem;
  }

  .card-topline {
    align-items: start;
  }

  .comic-badge {
    width: 50px;
    min-width: 50px;
    height: 50px;
  }
}
