:root {
  --ink: #173044;
  --muted: #5d7484;
  --line: #d7e7ef;
  --paper: #f7fbfd;
  --soft: #eaf4f8;
  --accent: #2f89a8;
  --accent-dark: #0f5f7a;
  --gold: #c88a2a;
  --white: #ffffff;
  --shadow: 0 18px 45px rgba(23, 48, 68, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    linear-gradient(rgba(247, 251, 253, 0.95), rgba(247, 251, 253, 0.97)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180'%3E%3Cg fill='none' stroke='%23c8dfe9' stroke-width='1' opacity='.72'%3E%3Cpath d='M25 90c25-38 61-38 90 0 15 20 28 29 40 26'/%3E%3Cpath d='M-8 130c25-38 61-38 90 0 15 20 28 29 40 26'/%3E%3Cpath d='M82 32c14 19 31 25 52 18'/%3E%3C/g%3E%3C/svg%3E");
  font-family: "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  padding: 10px clamp(18px, 4vw, 56px);
  border-bottom: 1px solid rgba(215, 231, 239, 0.9);
  background: rgba(247, 251, 253, 0.92);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-logo {
  width: min(290px, 38vw);
  height: 50px;
  object-fit: contain;
  object-position: left center;
}

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

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.top-nav {
  display: grid;
  width: 100%;
  min-width: 0;
  gap: 7px;
}

.nav-row {
  display: grid;
  width: 100%;
  min-width: 0;
  gap: 8px;
}

.nav-regions {
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

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

.top-nav a,
.nav-button,
.back-link {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--accent-dark);
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}

.nav-button {
  cursor: pointer;
  font-family: inherit;
}

.top-nav .signup-link {
  border-color: var(--accent-dark);
  color: var(--white);
  background: var(--accent-dark);
}

main {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
  padding: 26px 0 64px;
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
  align-items: center;
  overflow: visible;
  min-height: 300px;
  margin-bottom: 32px;
  padding: clamp(24px, 4vw, 42px);
  border: 1px solid rgba(215, 231, 239, 0.78);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(236, 247, 252, 0.96), rgba(255, 252, 244, 0.86)),
    radial-gradient(circle at 12% 15%, rgba(47, 137, 168, 0.16), transparent 30%),
    radial-gradient(circle at 88% 10%, rgba(200, 138, 42, 0.13), transparent 28%),
    linear-gradient(0deg, rgba(15, 95, 122, 0.06), transparent 45%);
  box-shadow: 0 18px 45px rgba(23, 48, 68, 0.08);
}

.hero-copy {
  max-width: 740px;
}

.hero-copy h1 {
  margin-bottom: 18px;
  color: var(--accent-dark);
  font-size: clamp(42px, 5vw, 64px);
}

.hero-copy p:last-child {
  max-width: 640px;
  color: var(--muted);
  font-size: 19px;
  line-height: 1.8;
}

.hero-stats {
  display: flex;
  min-height: 205px;
  flex-direction: column;
  justify-content: center;
  border: 1px solid rgba(47, 137, 168, 0.18);
  border-radius: 8px;
  padding: 28px;
  color: var(--white);
  background: var(--accent-dark);
  box-shadow: 0 18px 35px rgba(15, 95, 122, 0.18);
}

.hero-stats span,
.hero-stats small {
  color: rgba(255, 255, 255, 0.78);
}

.hero-stats strong {
  margin: 10px 0;
  font-size: 68px;
  line-height: 1;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  grid-column: 1 / -1;
  justify-content: flex-start;
  gap: 10px;
}

.hero-actions a {
  min-width: 148px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 12px 18px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--accent-dark);
  font-weight: 900;
  text-align: center;
}

.hero-actions .primary-action {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
  color: var(--white);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  max-width: 760px;
  margin-bottom: 18px;
  font-size: clamp(38px, 6vw, 76px);
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(28px, 4vw, 42px);
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 20px;
}

.intro-copy p:last-child,
.page-title p {
  max-width: 720px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.8;
}

.intro-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-radius: 8px;
  padding: 26px;
  color: var(--white);
  background: var(--accent-dark);
}

.intro-panel span,
.intro-panel small {
  color: rgba(255, 255, 255, 0.78);
}

.intro-panel strong {
  margin: 8px 0;
  font-size: 72px;
  line-height: 1;
}

.notice-section,
.home-search-section,
.region-section,
.schedule,
.weekly-detail,
.detail-layout,
.tools {
  margin-top: 44px;
}

.home-search-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.78);
}

.home-search-results {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.home-search-results[hidden] {
  display: none;
}

.heading-line {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px 18px;
}

.heading-line p {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
}

.day-tabs {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.day-tabs button {
  min-height: 44px;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 10px;
  color: var(--accent-dark);
  background: rgba(255, 255, 255, 0.74);
  font: inherit;
  font-size: 14px;
  font-weight: 900;
}

.day-tabs button.active {
  border-color: var(--accent-dark);
  color: var(--white);
  background: var(--accent-dark);
}

.section-heading {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 4px;
  margin-bottom: 18px;
}

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

.notice-card,
.region-card,
.day-section,
.course-card,
.course-facts,
.course-detail,
.week-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 10px 26px rgba(23, 48, 68, 0.06);
}

.notice-card {
  overflow: hidden;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.notice-card:hover {
  border-color: rgba(47, 137, 168, 0.55);
  box-shadow: var(--shadow);
  transform: translateY(-3px);
}

.notice-card summary {
  display: flex;
  min-height: 96px;
  cursor: pointer;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding: 22px;
  list-style: none;
}

.notice-card summary::-webkit-details-marker {
  display: none;
}

.notice-card summary strong {
  font-size: 22px;
}

.notice-content {
  display: none;
}

.notice-grid span {
  color: var(--gold);
  font-size: 13px;
  font-weight: 800;
}

.notice-grid p,
.notice-grid li,
.course-card p,
.course-detail p,
.week-card p {
  color: var(--muted);
  line-height: 1.7;
}

.notice-content h3 {
  margin: 18px 0 8px;
  color: var(--accent-dark);
  font-size: 17px;
}

.notice-content h4 {
  margin: 14px 0 6px;
  color: var(--ink);
  font-size: 15px;
}

.notice-content ul {
  margin: 0;
  padding-left: 1.2em;
}

.notice-content p {
  margin-bottom: 0;
}

.notice-table-wrap {
  overflow-x: auto;
}

.notice-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  margin: 10px 0 16px;
  font-size: 14px;
}

.notice-table th,
.notice-table td {
  border: 1px solid var(--line);
  padding: 10px;
  text-align: center;
  vertical-align: middle;
}

.notice-table th {
  background: var(--soft);
  color: var(--accent-dark);
}

body.modal-open {
  overflow: hidden;
}

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

.notice-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
}

.notice-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 37, 51, 0.54);
}

.notice-modal-panel {
  position: relative;
  width: min(920px, 100%);
  max-height: min(760px, calc(100vh - 48px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: clamp(24px, 4vw, 42px);
  background: var(--paper);
  box-shadow: 0 30px 80px rgba(10, 37, 51, 0.28);
}

.notice-modal-panel h2 {
  margin-bottom: 18px;
}

.notice-modal-body .notice-content {
  display: block;
  padding: 0;
}

.notice-modal-body h3 {
  margin: 20px 0 8px;
  color: var(--accent-dark);
  font-size: 19px;
}

.notice-modal-body h4 {
  margin: 16px 0 6px;
  font-size: 16px;
}

.notice-modal-body p,
.notice-modal-body li {
  color: var(--muted);
  line-height: 1.8;
}

.notice-modal-body a {
  color: var(--accent-dark);
  font-weight: 900;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.notice-modal-body ul {
  margin: 0;
  padding-left: 1.3em;
}

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

.contact-grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.72);
}

.contact-grid h3 {
  margin-bottom: 12px;
  color: var(--accent-dark);
}

.contact-grid p {
  color: var(--muted);
  line-height: 1.7;
}

.line-contact {
  display: inline-flex;
  margin-top: 16px;
  border-radius: 999px;
  padding: 12px 18px;
  color: var(--white);
  background: var(--accent-dark);
  font-weight: 900;
}

.modal-close {
  position: sticky;
  top: 0;
  float: right;
  display: grid;
  width: 42px;
  height: 42px;
  cursor: pointer;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--accent-dark);
  background: var(--white);
  font-size: 28px;
  line-height: 1;
}

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

.region-card {
  display: flex;
  min-height: 245px;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 18px 16px 16px;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.region-card:hover {
  border-color: rgba(47, 137, 168, 0.55);
  box-shadow: var(--shadow);
  transform: translateY(-3px);
}

.region-card img {
  width: min(150px, 100%);
  aspect-ratio: 1;
  object-fit: contain;
}

.region-card-text {
  width: 100%;
  border-top: 1px solid var(--line);
  padding-top: 12px;
  text-align: center;
}

.region-card-text strong {
  display: block;
  color: var(--ink);
  font-size: 24px;
  line-height: 1.2;
}

.region-card .course-count {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 800;
}

.page-title {
  padding: 6px 0 6px;
}

.area-overview {
  display: grid;
  grid-template-columns: minmax(300px, 0.8fr) minmax(520px, 1.2fr);
  gap: clamp(24px, 4vw, 56px);
  align-items: end;
}

.page-title h1 {
  margin-top: 10px;
}

.page-title .back-link {
  display: inline-block;
  margin-bottom: 10px;
}

.detail-title .eyebrow {
  margin-top: 22px;
}

.tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 14px;
  align-items: end;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.area-overview .tools {
  margin-top: 0;
}

.tools label {
  display: grid;
  gap: 7px;
  color: var(--accent-dark);
  font-size: 14px;
  font-weight: 800;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 14px;
  background: var(--white);
  color: var(--ink);
  font: inherit;
}

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

.day-section {
  padding: 18px;
}

.day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.day-header h2 {
  font-size: 24px;
}

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

.period-column {
  min-width: 0;
}

.period-title {
  margin-bottom: 10px;
  color: var(--accent-dark);
  font-size: 15px;
  font-weight: 900;
}

.course-stack {
  display: grid;
  gap: 10px;
}

.course-card {
  display: block;
  padding: 16px;
}

.course-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 0;
  margin-bottom: 10px;
}

.course-badge {
  border-radius: 999px;
  padding: 4px 9px;
  color: var(--white);
  font-size: 13px;
  font-weight: 900;
}

.course-badge.new {
  background: #287f8f;
}

.course-badge.full {
  background: #b94444;
  padding: 8px 14px;
  font-size: 18px;
}

.course-badge.waitlist {
  background: #b98738;
}

.course-badge.closed {
  background: #6d7773;
}

.detail-badges {
  margin-top: 14px;
  margin-bottom: 0;
}

.course-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 18px;
  line-height: 1.35;
}

.course-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.course-meta span,
.fact {
  border-radius: 999px;
  padding: 5px 9px;
  background: var(--soft);
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 700;
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 16px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.48);
}

.detail-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.course-facts,
.course-detail {
  padding: 22px;
}

.course-facts {
  position: sticky;
  top: 92px;
  display: grid;
  gap: 12px;
}

.fact-row {
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.fact-row span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 13px;
}

.fact-row strong {
  line-height: 1.55;
}

.detail-block {
  margin-bottom: 26px;
}

.detail-block h2 {
  margin-bottom: 10px;
  font-size: 24px;
}

.detail-block p {
  white-space: pre-line;
}

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

.week-card {
  padding: 18px;
}

.week-card span {
  color: var(--gold);
  font-weight: 900;
}

.week-card p {
  margin-top: 10px;
  font-size: 18px;
  font-weight: 400;
  white-space: pre-line;
}

.floating-actions {
  position: fixed;
  right: 18px;
  bottom: 24px;
  z-index: 50;
  display: grid;
  gap: 8px;
}

.floating-actions a,
.floating-actions button {
  min-width: 132px;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 11px 14px;
  color: var(--accent-dark);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 24px rgba(23, 48, 68, 0.14);
  font: inherit;
  font-size: 14px;
  font-weight: 900;
  text-align: center;
}

.floating-actions a {
  color: var(--white);
  background: var(--accent-dark);
}

.loading {
  min-height: 280px;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.home-credit {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 32px;
  margin-top: 52px;
  border-top: 1px solid var(--line);
  padding: 24px 12px 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
  text-align: center;
}

@media (max-width: 920px) {
  .site-header {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .top-nav {
    gap: 6px;
  }

  .nav-regions {
    display: flex;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 2px;
  }

  .nav-regions::-webkit-scrollbar {
    display: none;
  }

  .nav-regions a {
    flex: 0 0 88px;
  }

  .day-tabs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .intro,
  .area-overview,
  .tools,
  .detail-layout {
    grid-template-columns: 1fr;
  }

  .notice-grid,
  .region-grid,
  .period-grid,
  .home-search-results,
  .week-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .course-facts {
    position: static;
  }

}

@media (max-width: 640px) {
  .site-header {
    align-items: stretch;
    padding: 8px 11px;
  }

  .brand-logo {
    width: min(270px, 88vw);
    height: 44px;
  }

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

  .nav-actions a,
  .nav-actions .nav-button {
    width: 100%;
    white-space: normal;
    line-height: 1.2;
  }

  .top-nav a,
  .nav-button {
    min-width: 0;
    padding: 8px 6px;
    font-size: 14px;
  }

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

  .top-nav a {
    text-align: center;
  }

  main {
    width: min(100% - 22px, 1180px);
    padding-top: 18px;
  }

  .intro {
    min-height: auto;
    padding: 22px;
  }

  .hero-copy h1 {
    font-size: 42px;
  }

  .hero-copy p:last-child {
    font-size: 17px;
  }

  .hero-stats {
    min-height: 170px;
  }

  .hero-stats strong {
    font-size: 58px;
  }

  .heading-line {
    display: block;
  }

  .heading-line p {
    margin-top: 8px;
    overflow-wrap: anywhere;
  }

  h1 {
    font-size: 40px;
  }

  .notice-grid,
  .region-grid,
  .period-grid,
  .home-search-results,
  .week-list,
  .contact-grid {
    grid-template-columns: 1fr;
  }

  .floating-actions {
    right: 10px;
    bottom: 12px;
  }

  .floating-actions a,
  .floating-actions button {
    min-width: 112px;
    padding: 10px 12px;
    font-size: 13px;
  }

  .region-card {
    min-height: 220px;
  }

  .home-credit {
    align-items: center;
    flex-direction: column;
    gap: 4px;
    margin-top: 38px;
  }
}
