:root {
  color-scheme: light;
  --bg: #f8f7f2;
  --ink: #1f2a33;
  --muted: #5f6b73;
  --accent: #ff7a59;
  --accent-dark: #e45c3e;
  --secondary: #4fa3a5;
  --card: #ffffff;
  --shadow: 0 18px 45px rgba(31, 42, 51, 0.12);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Noto Sans TC", "PingFang TC", sans-serif;
  background: var(--bg);
  color: var(--ink);
}

.background {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
}

.blob {
  position: absolute;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  filter: blur(10px);
  opacity: 0.65;
}

.blob-1 {
  top: -120px;
  left: -80px;
  background: radial-gradient(circle at 30% 30%, #ffe6a7, #f7a278);
}

.blob-2 {
  bottom: -160px;
  right: -120px;
  background: radial-gradient(circle at 70% 30%, #c7f2ed, #7cc9c6);
}

.grid {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(31, 42, 51, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31, 42, 51, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  opacity: 0.4;
}

.hero {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 32px;
  padding: 64px 8vw 32px;
  align-items: center;
}

.hero h1 {
  font-family: "ZCOOL KuaiLe", "Noto Sans TC", sans-serif;
  font-size: clamp(2.4rem, 3vw, 3.5rem);
  margin: 12px 0 16px;
  line-height: 1.1;
}

.hero .unit {
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--secondary);
}

.subtitle {
  font-size: 1.1rem;
  color: var(--muted);
  max-width: 520px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  flex-wrap: wrap;
}

button {
  border: none;
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  display: none;
  animation: spin 0.8s linear infinite;
  margin-left: 8px;
}

.loading .spinner {
  display: inline-block;
}

.loading .button-text {
  opacity: 0.85;
}

.primary {
  background: var(--accent);
  color: #fff;
}

.ghost {
  background: transparent;
  border: 2px solid var(--secondary);
  color: var(--secondary);
}

.danger {
  background: #ff4d4d;
  color: #fff;
}

.hero-card {
  background: var(--card);
  padding: 24px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero-card h2 {
  margin-top: 0;
}

.hero-card ul {
  padding-left: 18px;
  color: var(--muted);
}

.circuit-illustration {
  margin-top: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.battery,
.bulb {
  width: 60px;
  height: 28px;
  border-radius: 12px;
  background: linear-gradient(135deg, #222, #555);
  position: relative;
}

.battery::after {
  content: "";
  position: absolute;
  right: -8px;
  top: 6px;
  width: 8px;
  height: 16px;
  background: #d9d9d9;
  border-radius: 4px;
}

.bulb {
  background: linear-gradient(135deg, #ffe066, #ffb703);
  border-radius: 50% 50% 40% 40%;
}

.wire {
  flex: 1;
  height: 6px;
  background: #222;
  border-radius: 999px;
}

main {
  padding: 24px 8vw 80px;
}

section {
  margin-top: 48px;
}

.section-title {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 24px;
}

.section-title p {
  color: var(--muted);
}

.steps {
  background: var(--card);
  padding: 32px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.photo-strip {
  background: var(--card);
  padding: 32px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.photo-grid figure {
  margin: 0;
  background: #fff9f2;
  border-radius: 18px;
  overflow: hidden;
}

.photo-grid img {
  width: 100%;
  height: 210px;
  object-fit: cover;
  display: block;
}

.photo-grid figcaption {
  padding: 12px 14px;
  color: var(--muted);
  font-weight: 600;
}

.step-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}

.step-grid article {
  background: #fdf4ea;
  padding: 18px;
  border-radius: 18px;
}

.step-grid h3 {
  margin-top: 0;
}

.experiment {
  background: var(--card);
  padding: 32px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.record-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.teacher-note {
  background: #eef6ff;
  border-left: 4px solid var(--secondary);
  padding: 12px 14px;
  border-radius: 12px;
  color: var(--muted);
  font-size: 0.95rem;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 600;
}

input,
select {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1.5px solid #d1d9df;
  font-size: 1rem;
}

.items {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.item-card {
  background: #f1f6f7;
  padding: 16px;
  border-radius: 18px;
}

.photo-upload {
  background: #f7f4ff;
  padding: 16px;
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.photo-upload input[type="file"] {
  padding: 10px;
  border-radius: 12px;
  border: 1.5px dashed #c3b7e6;
  background: #fff;
}

.photo-preview {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.photo-preview img {
  width: 90px;
  height: 90px;
  object-fit: cover;
  border-radius: 12px;
  border: 2px solid #fff;
  box-shadow: 0 6px 16px rgba(31, 42, 51, 0.12);
}

.progress {
  width: 100%;
  height: 10px;
  background: #e7edf2;
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #4fa3a5, #86d1c6);
  transition: width 0.2s ease;
}

.upload-status {
  font-size: 0.95rem;
  color: var(--muted);
}

.conclusion {
  background: #fff4d6;
  border-radius: 18px;
  padding: 16px;
}

.form-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.records {
  background: var(--card);
  padding: 32px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hidden {
  display: none;
}

.record-tools {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.record-tools input {
  flex: 1;
  min-width: 220px;
}

.tool-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.summary {
  margin: 18px 0;
  padding: 12px 16px;
  background: #edf7ff;
  border-radius: 14px;
  color: var(--muted);
}

.table-wrapper {
  overflow-x: auto;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid #e2e8ee;
  text-align: left;
  font-size: 0.95rem;
}

.thumbs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.thumbs img {
  width: 42px;
  height: 42px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #d6dce3;
}

.thumbs .thumb {
  position: relative;
}

.thumbs .delete-photo {
  position: absolute;
  top: -6px;
  right: -6px;
  border: none;
  background: #ff4d4d;
  color: #fff;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 18px;
  cursor: pointer;
  padding: 0;
}

.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: #1f2a33;
  color: #fff;
  padding: 12px 18px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  z-index: 10;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
}

th {
  background: #f6f7fb;
  position: sticky;
  top: 0;
}

footer {
  text-align: center;
  padding: 24px 16px 40px;
  color: var(--muted);
}

@media (max-width: 720px) {
  .hero {
    padding-top: 48px;
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
