:root {
  --bg: #f4efe7;
  --paper: rgba(255, 252, 246, 0.94);
  --ink: #17303a;
  --muted: #5d6e75;
  --brand: #114b5f;
  --accent: #2a9d8f;
  --danger: #9b2226;
  --line: rgba(17, 75, 95, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Noto Sans TC", "PingFang TC", sans-serif;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  background:
    radial-gradient(circle at top left, rgba(42, 157, 143, 0.18), transparent 30%),
    radial-gradient(circle at bottom right, rgba(17, 75, 95, 0.14), transparent 28%),
    var(--bg);
  color: var(--ink);
}

input,
textarea,
select {
  user-select: text;
  -webkit-user-select: text;
  -webkit-touch-callout: default;
}

.festival-backdrop {
  display: none;
}

html.mid-autumn-theme body {
  min-height: 100vh;
  overflow-x: hidden;
  background:
    linear-gradient(
      180deg,
      rgba(255, 224, 165, 0.94) 0%,
      rgba(225, 174, 145, 0.88) 30%,
      rgba(116, 113, 145, 0.9) 67%,
      rgba(45, 59, 91, 0.98) 100%
    );
  background-attachment: fixed;
}

#teacher-account-confirm[hidden] {
  display: none;
}

#teacher-account-tools summary {
  cursor: pointer;
  font-weight: 700;
  padding: 8px 0;
}

#teacher-account-tools input,
#teacher-account-tools button {
  max-width: 100%;
}

html.school-theme body {
  min-height: 100vh;
  overflow-x: hidden;
  background:
    linear-gradient(rgba(255, 231, 139, 0.08), rgba(47, 100, 61, 0.14)),
    url("/jns-school-theme-clean.png?v=20260909-original-v2") center center / cover fixed no-repeat;
}

html.school-theme .shell {
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.4);
}

html.school-theme .eyebrow {
  color: #1d725f;
}

html.school-theme .card {
  border-color: rgba(255, 255, 255, 0.56);
  background: rgba(255, 252, 239, 0.82);
  box-shadow: 0 18px 45px rgba(39, 77, 54, 0.16);
  -webkit-backdrop-filter: blur(18px) saturate(112%);
  backdrop-filter: blur(18px) saturate(112%);
}

html.mid-autumn-theme .festival-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: block;
  overflow: hidden;
  pointer-events: none;
}

html.mid-autumn-theme .festival-backdrop::before {
  position: absolute;
  inset: 0;
  content: "";
  opacity: 0.58;
  background-image:
    radial-gradient(circle at 8% 55%, #fff5c2 0 1px, transparent 2px),
    radial-gradient(circle at 24% 74%, #fff5c2 0 1.3px, transparent 2.3px),
    radial-gradient(circle at 47% 58%, #fff5c2 0 1px, transparent 2px),
    radial-gradient(circle at 67% 83%, #fff5c2 0 1.4px, transparent 2.4px),
    radial-gradient(circle at 88% 64%, #fff5c2 0 1px, transparent 2px);
  background-size: 150px 170px, 190px 220px, 130px 180px, 220px 250px, 170px 210px;
}

html.mid-autumn-theme .festival-moon {
  position: absolute;
  top: 164px;
  left: 43%;
  width: 124px;
  height: 124px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 31%, rgba(213, 167, 70, 0.18) 0 8%, transparent 9%),
    radial-gradient(circle at 65% 59%, rgba(213, 167, 70, 0.16) 0 12%, transparent 13%),
    radial-gradient(circle at 48% 76%, rgba(213, 167, 70, 0.13) 0 6%, transparent 7%),
    linear-gradient(145deg, #fffbd8, #ffd36f);
  box-shadow:
    0 0 0 14px rgba(255, 222, 132, 0.12),
    0 0 75px rgba(255, 213, 102, 0.62);
}

html.mid-autumn-theme .festival-cloud {
  position: absolute;
  width: 220px;
  height: 34px;
  border-radius: 999px;
  background: rgba(255, 239, 211, 0.23);
  filter: blur(1px);
}

html.mid-autumn-theme .festival-cloud-one {
  top: 54vh;
  left: -82px;
}

html.mid-autumn-theme .festival-cloud-two {
  top: 82vh;
  right: 48px;
  width: 250px;
  opacity: 0.7;
}

html.mid-autumn-theme .festival-rabbit {
  position: absolute;
  top: 150px;
  left: calc(43% - 38px);
  width: 90px;
  height: auto;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  filter: drop-shadow(0 10px 17px rgba(27, 38, 65, 0.2));
}

.shell {
  position: relative;
  z-index: 1;
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 64px;
}

.hero {
  margin-bottom: 20px;
}

.hero-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.hero-heading-row h1 {
  min-width: 0;
  margin: 0;
  cursor: default;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.school-logo {
  width: clamp(144px, 18vw, 192px);
  height: auto;
  flex: 0 0 auto;
  display: block;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
  border-radius: 50%;
  filter: drop-shadow(0 8px 18px rgba(23, 48, 58, 0.12));
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--accent);
  font-size: 0.75rem;
}

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

.stack {
  display: grid;
  gap: 18px;
}

.grid {
  display: grid;
  gap: 18px;
}

.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 20px;
  box-shadow: 0 22px 54px rgba(23, 48, 58, 0.08);
}

.card-head {
  margin-bottom: 16px;
}

.card-head h2,
.card-head h3,
.card-head p {
  margin: 0;
}

.card-head p {
  margin-top: 6px;
  color: var(--muted);
}

.mono-pill {
  color: var(--brand);
  font-family: "SFMono-Regular", "Menlo", "Monaco", monospace;
  letter-spacing: 0.08em;
}

.form-stack,
.list-stack,
.compact-grid {
  display: grid;
  gap: 12px;
}

.subtle-form {
  margin-top: 14px;
}

.compact-status-panel {
  padding: 16px 18px;
}

.compact-status-panel .card-head {
  margin-bottom: 10px;
}

.compact-status-panel .status-card {
  min-height: 0;
  padding: 14px 16px;
}

.compact-status-panel .action-row {
  margin-top: 10px;
}

.compact-status-panel .helper-text,
.compact-status-panel #pending-commands {
  margin-top: 10px;
}

.parent-settings-details {
  align-self: start;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 16px 18px;
  background: var(--paper);
  box-shadow: 0 22px 54px rgba(23, 48, 58, 0.08);
}

.parent-settings-details summary {
  display: grid;
  gap: 4px;
  cursor: pointer;
  list-style: none;
  color: var(--brand);
  font-weight: 700;
}

.parent-settings-details summary::-webkit-details-marker {
  display: none;
}

.parent-settings-summary-note {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 500;
}

.parent-settings-body {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.compact-directory-details .list-stack {
  margin-top: 12px;
}

.parent-access-code-card {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  color: var(--muted);
}

label {
  display: grid;
  gap: 6px;
}

input,
select,
button {
  font: inherit;
}

input,
select {
  width: 100%;
  border: 1px solid rgba(17, 75, 95, 0.18);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.88);
  padding: 12px 14px;
}

button {
  border: none;
  border-radius: 999px;
  padding: 12px 16px;
  cursor: pointer;
}

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

.secondary-button {
  background: rgba(17, 75, 95, 0.1);
  color: var(--brand);
}

.ghost-button {
  background: rgba(23, 48, 58, 0.08);
  color: var(--ink);
}

.action-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.teacher-entry-footnote {
  display: flex;
  justify-content: center;
  padding: 2px 0 10px;
}

.parent-logout-row {
  justify-content: center;
  padding-top: 2px;
}

.teacher-entry-link {
  border: none;
  background: transparent;
  padding: 0;
  color: rgba(93, 110, 117, 0.9);
  font-size: 0.88rem;
  line-height: 1.4;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.teacher-entry-link:hover {
  color: rgba(23, 48, 58, 0.88);
}

.gate-helper {
  margin-top: 14px;
}

.session-strip,
.session-banner,
.status-card,
.history-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.7);
}

.status-card.empty-state {
  color: var(--muted);
}

.status-card.status-spotlight {
  border-color: rgba(42, 157, 143, 0.45);
  box-shadow:
    0 0 0 3px rgba(42, 157, 143, 0.14),
    0 18px 38px rgba(42, 157, 143, 0.14);
}

.history-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

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

.stat-card {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  display: grid;
  gap: 6px;
}

.stat-card span {
  color: var(--muted);
  font-size: 0.92rem;
}

.stat-card strong {
  font-size: 1.9rem;
  color: var(--brand);
}

.pickup-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.78);
  display: grid;
  gap: 10px;
}

.pickup-card-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.pickup-card strong {
  font-size: 1.1rem;
}

.pickup-card .action-row {
  margin-top: 4px;
}

.history-meta {
  display: grid;
  gap: 4px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
}

.badge.arrived {
  background: rgba(42, 157, 143, 0.16);
  color: var(--accent);
}

.badge.nearby {
  background: rgba(42, 157, 143, 0.12);
  color: var(--brand);
}

.badge.on_the_way {
  background: rgba(17, 75, 95, 0.12);
  color: var(--brand);
}

.badge.completed {
  background: rgba(23, 48, 58, 0.08);
  color: var(--ink);
}

.teacher-stats-row .stat-card {
  padding: 14px 16px;
}

.teacher-stats-row .stat-card span {
  display: block;
  font-size: 0.86rem;
  line-height: 1.25;
}

.teacher-stats-row .stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 1.85rem;
  line-height: 1;
}

.teacher-bottom-strip {
  margin-top: 2px;
}

.teacher-pickup-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  grid-template-areas: "student meta voice";
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  touch-action: pan-y;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease;
}

.teacher-pickup-card.swipe-ready {
  background:
    linear-gradient(180deg, rgba(229, 245, 238, 0.76), rgba(217, 239, 229, 0.42)),
    radial-gradient(circle at 18% 16%, rgba(255, 255, 255, 0.86), transparent 40%);
  box-shadow:
    0 16px 32px rgba(45, 123, 97, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.pickup-student-line {
  display: block;
  min-width: 0;
  font-size: 0.96rem;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pickup-student-main {
  grid-area: student;
  display: grid;
  min-width: 0;
  gap: 2px;
}

.teacher-pickup-meta {
  grid-area: meta;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.pickup-student-subline {
  display: block;
  min-width: 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.teacher-status-badge {
  min-width: 0;
  padding: 6px 10px;
  font-size: 0.78rem;
  white-space: nowrap;
}

.pickup-inline-meta {
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

.pickup-inline-eta {
  font-weight: 700;
}

.teacher-voice-button {
  grid-area: voice;
  width: auto;
  min-height: 0;
  padding: 8px 12px;
  border-radius: 14px;
  font-size: 0.95rem;
  line-height: 1;
  white-space: nowrap;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  justify-content: flex-start;
  white-space: nowrap;
  justify-self: start;
  width: fit-content;
  max-width: 100%;
}

.inline-check span {
  flex: 0 0 auto;
}

.inline-check input {
  width: auto;
  margin: 0;
}

.parent-auto-login-check {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.94rem;
}

.pickup-student-field {
  display: grid;
  gap: 10px;
}

.pickup-student-field-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-weight: 600;
}

.pickup-student-selector {
  display: grid;
  gap: 8px;
}

.pickup-student-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.64);
}

.pickup-student-option input {
  width: auto;
  margin: 0;
}

.compact-button {
  padding: 8px 14px;
  font-size: 0.88rem;
}

.family-pickup-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.hidden {
  display: none !important;
}

.toast {
  position: sticky;
  top: 16px;
  z-index: 10;
  margin-bottom: 16px;
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(17, 75, 95, 0.9);
  color: #fff;
}

.parent-notice-open,
.parent-notice-open body {
  overflow: hidden;
}

.parent-notice-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding:
    max(16px, env(safe-area-inset-top))
    max(14px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom))
    max(14px, env(safe-area-inset-left));
  background: rgba(10, 25, 31, 0.76);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.parent-notice-modal[hidden] {
  display: none;
}

.parent-notice-dialog {
  position: relative;
  width: min(100%, 620px);
  max-height: calc(
    100dvh - max(32px, env(safe-area-inset-top)) - max(32px, env(safe-area-inset-bottom))
  );
  padding: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 24px;
  background: rgba(241, 250, 246, 0.98);
  box-shadow: 0 24px 70px rgba(8, 30, 37, 0.42);
}

.parent-notice-scroll {
  max-height: calc(
    100dvh - max(48px, env(safe-area-inset-top)) - max(48px, env(safe-area-inset-bottom))
  );
  overflow-y: auto;
  border-radius: 18px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.parent-notice-poster {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 18px;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}

.parent-notice-close {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 2;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  padding: 0 0 3px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  background: rgba(17, 75, 95, 0.94);
  box-shadow: 0 5px 18px rgba(8, 30, 37, 0.32);
  color: #fff;
  font: 500 2rem/1 "Noto Sans TC", "PingFang TC", sans-serif;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.parent-notice-close:focus-visible {
  outline: 3px solid #ffd166;
  outline-offset: 3px;
}

@media (max-width: 800px) {
  html.school-theme body {
    background-color: #719264;
    background-position: 48% -62px;
    background-size: auto 63vh;
  }

  html.school-theme .shell {
    padding-top: 22px;
  }

  html.school-theme #school-address {
    display: inline-block;
    margin-top: 10px;
    padding: 7px 11px;
    border-radius: 999px;
    background: rgba(255, 249, 220, 0.68);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
  }

  html.school-theme #login-card {
    background: rgba(255, 252, 239, 0.76);
  }

  html.mid-autumn-theme .festival-moon {
    top: 154px;
    left: 3%;
    width: 270px;
    height: 270px;
  }

  html.mid-autumn-theme .festival-rabbit {
    top: 144px;
    left: 1%;
    width: 110px;
  }

  html.mid-autumn-theme #school-address {
    margin-top: 96px;
  }

  html.mid-autumn-theme #login-card {
    background: rgba(255, 252, 246, 0.78);
    -webkit-backdrop-filter: blur(18px) saturate(118%);
    backdrop-filter: blur(18px) saturate(118%);
  }

  .two-col {
    grid-template-columns: 1fr;
  }

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

  #teacher-stats.teacher-stats-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
  }

  .teacher-stats-row .stat-card {
    padding: 12px 10px;
    border-radius: 18px;
  }

  .teacher-stats-row .stat-card span {
    font-size: 0.72rem;
  }

  .teacher-stats-row .stat-card strong {
    margin-top: 6px;
    font-size: 1.5rem;
  }

  .teacher-pickup-card {
    gap: 6px;
    padding: 9px 10px;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "student voice"
      "meta voice";
  }

  .teacher-pickup-meta {
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 4px 8px;
  }

  .teacher-voice-button {
    width: auto;
    padding: 7px 10px;
    font-size: 0.9rem;
  }

  .teacher-status-badge {
    padding: 5px 8px;
    font-size: 0.74rem;
  }

  .pickup-student-line {
    font-size: 0.9rem;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
  }

  .pickup-student-subline {
    font-size: 0.72rem;
  }

  .pickup-inline-meta {
    font-size: 0.78rem;
  }

  .shell {
    width: min(100% - 20px, 1100px);
    padding-top: 20px;
  }

  .hero-heading-row {
    gap: 12px;
  }

  .hero-heading-row h1 {
    font-size: clamp(1.5rem, 6.6vw, 1.8rem);
    line-height: 1.15;
  }

  .school-logo {
    width: clamp(124px, 36vw, 150px);
  }

  .parent-notice-modal {
    padding:
      max(8px, env(safe-area-inset-top))
      max(8px, env(safe-area-inset-right))
      max(8px, env(safe-area-inset-bottom))
      max(8px, env(safe-area-inset-left));
  }

  .parent-notice-dialog {
    width: 100%;
    max-height: calc(
      100dvh - max(16px, env(safe-area-inset-top)) - max(16px, env(safe-area-inset-bottom))
    );
    padding: 5px;
    border-radius: 20px;
  }

  .parent-notice-scroll {
    max-height: calc(
      100dvh - max(26px, env(safe-area-inset-top)) - max(26px, env(safe-area-inset-bottom))
    );
    border-radius: 16px;
  }

  .parent-notice-poster {
    border-radius: 16px;
  }

  .parent-notice-close {
    top: 13px;
    left: 13px;
  }
}
