:root {
  font-family: "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  color: #24304b;
  background: #eef4ff;
  font-synthesis: none;
  --primary: #3158c9;
  --dark: #172554;
  --light: #edf2ff;
  --red: #ed5555;
  --blue: #3984e8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 24px 14px 40px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 10% 5%, #dce8ff 0, transparent 30%),
    radial-gradient(circle at 90% 40%, #e4edff 0, transparent 30%),
    #f3f6fc;
}

button,
select {
  font: inherit;
}

.game {
  width: min(100%, 680px);
  margin: auto;
}

.header {
  display: flex;
  align-items: center;
  gap: 17px;
  padding: 18px 8px 26px;
}

.logo {
  display: grid;
  place-items: center;
  width: 66px;
  height: 66px;
  flex-shrink: 0;
  border-radius: 20px;
  color: #fff;
  font-size: 35px;
  background: linear-gradient(135deg, #4777f2, #203da4);
  box-shadow: 0 7px 18px #3158c944;
}

.eyebrow {
  margin: 0 0 5px;
  color: #5270ba;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1px;
}

h1 {
  margin: 0;
  color: var(--dark);
  font-size: clamp(26px, 6vw, 36px);
  font-weight: 900;
}

.subtitle {
  margin: 5px 0 0;
  color: #64748b;
  font-size: 14px;
}

.panel {
  margin-bottom: 16px;
  padding: 22px;
  border: 1px solid #e2e9f5;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 5px 18px #233b6810;
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 15px;
}

.section-heading h2,
.knowledge-panel h2 {
  margin: 0;
  color: var(--dark);
  font-size: 19px;
  font-weight: 900;
}

.step {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 11px;
  color: #3158c9;
  background: #e9efff;
  font-size: 13px;
  font-weight: 900;
}

.mission > p {
  line-height: 1.8;
  margin: 0 0 14px;
}

.rules {
  display: grid;
  gap: 9px;
  padding: 14px;
  border-radius: 13px;
  background: #f5f7fc;
  font-size: 14px;
  line-height: 1.6;
}

.circuit {
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 8px;
  min-height: 210px;
  padding: 18px 8px;
  border-radius: 15px;
  background: #f4f7ff;
}

.battery {
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 0;
  min-width: 80px;
}

.battery-cap {
  width: 27px;
  height: 9px;
  border-radius: 4px 4px 0 0;
  background: #64748b;
}

.battery-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  width: 65px;
  padding: 10px 5px;
  border: 3px solid #71839f;
  border-radius: 9px;
  color: #fff;
  background: #37558d;
}

.battery-body span {
  font-size: 12px;
}

.battery-body strong {
  font-size: 20px;
}

.wire-demo {
  position: relative;
  width: 33%;
  min-width: 80px;
  height: 85px;
}

.wire {
  position: absolute;
  left: 0;
  width: 100%;
  height: 3px;
  border-radius: 5px;
}

.positive-wire {
  top: 22px;
  background: var(--red);
  transform: rotate(-13deg);
}

.negative-wire {
  top: 61px;
  background: var(--blue);
  transform: rotate(13deg);
}

.wire-label {
  position: absolute;
  left: 0;
  color: #64748b;
  font-size: 10px;
  white-space: nowrap;
}

.wire-label:nth-of-type(2) {
  top: 3px;
}

.wire-label:nth-of-type(4) {
  top: 72px;
}

.bulb-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 82px;
}

.bulb {
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: filter .3s, transform .3s;
}

.bulb-glass {
  position: relative;
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  border: 4px solid #8496b4;
  border-radius: 50% 50% 43% 43%;
  background: #fff;
  transition: background .3s, box-shadow .3s;
}

.filament {
  width: 21px;
  height: 22px;
  border: 2px solid #8496b4;
  border-top: 0;
  border-radius: 0 0 8px 8px;
  transform: rotate(180deg);
}

.bulb-base {
  width: 33px;
  height: 18px;
  border: 3px solid #8496b4;
  border-top: 0;
  border-radius: 0 0 6px 6px;
  background: #bdc8d9;
}

.bulb.lit .bulb-glass {
  border-color: #f1bd36;
  background: #fff2a6;
  box-shadow: 0 0 20px 9px #ffdb6a99;
}

.bulb.lit .filament {
  border-color: #e99b00;
}

.bulb.lit {
  transform: scale(1.08);
  filter: drop-shadow(0 0 8px #ffcf48);
}

.bulb-label {
  font-size: 12px;
  font-weight: 800;
}

.bulb-status {
  color: #64748b;
  font-size: 11px;
}

.bulb.lit + .bulb-label + .bulb-status {
  color: #c58b08;
  font-weight: 900;
}

.contact-info {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
}

.contact {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 11px 7px;
  border: 1px solid #e7edf7;
  border-radius: 11px;
  background: #fff;
}

.contact-dot,
.preview-dot {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  border-radius: 50%;
}

.bottom-dot {
  background: #e6ac35;
}

.side-dot {
  background: #8594ac;
}

.air-dot {
  background: #a5b4c8;
}

.contact strong,
.contact small {
  display: block;
}

.contact strong {
  font-size: 11px;
}

.contact small {
  margin-top: 4px;
  color: #8290a5;
  font-size: 9px;
  line-height: 1.4;
}

.hint {
  margin: -4px 0 15px;
  color: #718096;
  font-size: 13px;
  line-height: 1.7;
}

.prediction-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.choice {
  position: relative;
  cursor: pointer;
}

.choice input {
  position: absolute;
  opacity: 0;
}

.choice span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 58px;
  padding: 8px 4px;
  border: 2px solid #e2e9f5;
  border-radius: 12px;
  background: #fafbff;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
  transition: .2s;
}

.choice input:checked + span {
  border-color: var(--primary);
  color: var(--primary);
  background: #eef2ff;
}

.choice input:focus-visible + span {
  outline: 3px solid #86a5ff;
  outline-offset: 3px;
}

.wire-select {
  display: grid;
  gap: 9px;
  margin-bottom: 15px;
}

.wire-select label {
  font-size: 14px;
  font-weight: 900;
}

.wire-select select {
  width: 100%;
  min-height: 49px;
  padding: 10px 13px;
  border: 2px solid #dfe7f4;
  border-radius: 12px;
  outline: none;
  color: #253453;
  background: #f8faff;
  font-size: 15px;
  cursor: pointer;
}

.wire-select select:focus {
  border-color: var(--primary);
}

.selection-preview {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 13px;
  margin: 18px 0;
  border-radius: 12px;
  background: #f4f7fc;
  font-size: 12px;
}

.selection-preview > div {
  display: flex;
  align-items: center;
  gap: 7px;
}

.preview-dot.red {
  background: var(--red);
}

.preview-dot.blue {
  background: var(--blue);
}

.test-button,
.reset-button {
  display: block;
  width: 100%;
  min-height: 53px;
  border: 0;
  border-radius: 13px;
  font-size: 16px;
  font-weight: 900;
  cursor: pointer;
  transition: transform .15s, opacity .15s;
}

.test-button {
  color: white;
  background: linear-gradient(135deg, #4775eb, #294bb5);
  box-shadow: 0 5px 12px #3158c944;
}

.test-button:hover {
  transform: translateY(-2px);
}

.test-button:active,
.reset-button:active {
  transform: scale(.98);
}

.reset-button {
  margin-top: 10px;
  color: #52627c;
  background: #edf1f8;
  font-size: 14px;
}

.result {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 78px;
  margin-top: 17px;
  padding: 14px;
  border: 1px solid #e0e8f5;
  border-radius: 13px;
  background: #f7f9fd;
}

.result-icon {
  flex-shrink: 0;
  font-size: 27px;
}

.result p {
  margin: 0;
  color: #53627b;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.8;
}

.result.success {
  border-color: #a6ddbd;
  background: #edfff3;
}

.result.failure {
  border-color: #e9d5a0;
  background: #fff9e9;
}

.result.danger {
  border-color: #f1b4b4;
  background: #fff0f0;
}

.result.danger p {
  color: #b73535;
}

.result.success p {
  color: #23834b;
}

.records {
  display: grid;
  gap: 10px;
}

.empty-record {
  padding: 20px 10px;
  border-radius: 12px;
  color: #8492a8;
  background: #f6f8fc;
  font-size: 13px;
  text-align: center;
}

.record {
  padding: 14px;
  border: 1px solid #e3eaf5;
  border-radius: 12px;
  background: #fbfcff;
}

.record-header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 9px;
  font-size: 13px;
  font-weight: 900;
}

.record-badge {
  padding: 4px 8px;
  border-radius: 20px;
  color: #3158c9;
  background: #eaf0ff;
  font-size: 11px;
}

.record p {
  margin: 5px 0;
  color: #65738a;
  font-size: 12px;
  line-height: 1.7;
}

.record p strong {
  color: #344361;
}

.record.correct {
  border-left: 4px solid #48ad71;
}

.record.incorrect {
  border-left: 4px solid #e4a43d;
}

.knowledge-panel h2 {
  margin-bottom: 14px;
}

.knowledge {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 13px;
  background: #f4f7fc;
}

.knowledge p {
  margin: 0;
  color: #596981;
  font-size: 13px;
  line-height: 1.8;
}

.knowledge strong {
  color: #3158a8;
}

.safety {
  margin: 13px 0 0;
  color: #a26b25;
  font-size: 12px;
  line-height: 1.8;
}

footer {
  padding: 10px;
  color: #8794aa;
  font-size: 12px;
  text-align: center;
}

button:focus-visible,
select:focus-visible {
  outline: 3px solid #8eacff;
  outline-offset: 3px;
}

@media (max-width: 430px) {
  body {
    padding: 12px 10px 25px;
  }

  .panel {
    padding: 17px 14px;
    border-radius: 16px;
  }

  .header {
    gap: 12px;
    padding: 14px 5px 20px;
  }

  .logo {
    width: 55px;
    height: 55px;
    font-size: 29px;
  }

  .contact-info {
    gap: 5px;
  }

  .contact {
    gap: 4px;
    padding: 9px 4px;
  }

  .contact strong {
    font-size: 10px;
  }

  .contact small {
    font-size: 8px;
  }

  .circuit {
    gap: 3px;
    padding: 15px 4px;
  }

  .battery {
    min-width: 63px;
  }

  .battery-body {
    width: 55px;
  }

  .wire-demo {
    min-width: 60px;
  }

  .bulb-area {
    min-width: 73px;
  }

  .bulb-glass {
    width: 57px;
    height: 57px;
  }

  .choice span {
    font-size: 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}