:root {
  --bg: #e8f3f7;
  --bg-deep: #0b3d4a;
  --surface: rgba(255, 255, 255, 0.88);
  --ink: #12323a;
  --muted: #5a7380;
  --accent: #0f8a8a;
  --accent-deep: #0a5f63;
  --open: #1f7a4c;
  --closed: #8a4b4b;
  --warn: #9a6b16;
  --line: rgba(18, 50, 58, 0.12);
  --shadow: 0 18px 40px rgba(11, 61, 74, 0.12);
  --radius: 18px;
  --font-display: "Fraunces", "Noto Serif TC", serif;
  --font-body: "Manrope", "Noto Sans TC", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, #b8e6ef 0%, transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 0%, #7fc8c4 0%, transparent 50%),
    linear-gradient(180deg, #d7eef4 0%, var(--bg) 40%, #f4fafb 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.35;
  background-image: radial-gradient(rgba(15, 138, 138, 0.08) 1px, transparent 1px);
  background-size: 18px 18px;
}

.site {
  position: relative;
  width: min(980px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.5rem 0 3rem;
}

.hero {
  padding: 1.5rem 0 1.25rem;
  animation: rise 0.55s ease both;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.75rem;
}

.brand-mark {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 30%, #dff7f5, #0f8a8a 55%, #0a5f63);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.35);
}

.brand-text {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.tagline {
  margin: 0;
  max-width: 36rem;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  margin-top: 1.1rem;
}

.btn {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 0.7rem 1.1rem;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: var(--accent-deep);
  color: #f4fffe;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.75);
  color: var(--ink);
  border: 1px solid var(--line);
}

.meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.section {
  margin-top: 1.4rem;
  padding: 1.2rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  animation: rise 0.65s ease both;
}

.section:nth-of-type(2) {
  animation-delay: 0.08s;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: baseline;
  margin-bottom: 1rem;
}

.section h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 650;
}

.section p.hint {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.grid {
  display: grid;
  gap: 0.85rem;
}

.pool-card {
  display: grid;
  gap: 0.55rem;
  padding: 1rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff 0%, #f5fbfc 100%);
}

.pool-card-top {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: start;
}

.pool-name {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 700;
}

.pool-sub {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.badge {
  flex-shrink: 0;
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: #fff;
}

.badge-open {
  background: var(--open);
}

.badge-closed {
  background: var(--closed);
}

.badge-maint {
  background: var(--warn);
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
}

.stat {
  padding: 0.55rem 0.6rem;
  border-radius: 10px;
  background: rgba(15, 138, 138, 0.08);
}

.stat-label {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  margin-bottom: 0.15rem;
}

.stat-value {
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.occupancy {
  height: 0.45rem;
  border-radius: 999px;
  background: rgba(18, 50, 58, 0.08);
  overflow: hidden;
}

.occupancy > span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #1f7a4c, #d4a017 70%, #8a4b4b);
  transition: width 0.45s ease;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.btn-tiny {
  padding: 0.45rem 0.8rem;
  font-size: 0.85rem;
}

.empty,
.status-msg {
  padding: 1rem;
  border-radius: 12px;
  background: rgba(15, 138, 138, 0.08);
  color: var(--muted);
}

.error {
  background: rgba(138, 75, 75, 0.12);
  color: #6d3030;
}

.picker {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.9rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
}

.picker-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}

select,
input[type="search"] {
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.65rem 0.8rem;
  min-width: min(100%, 16rem);
}

.footer {
  margin-top: 1.5rem;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
}

.footer a {
  color: var(--accent-deep);
}

.schedule-line {
  margin: 0.35rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.schedule-line.is-today {
  color: var(--accent-deep);
  font-weight: 700;
}

.schedule-hint {
  margin: 0.25rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.schedule-alert {
  margin: 0.45rem 0 0;
  padding: 0.45rem 0.6rem;
  border-radius: 10px;
  background: rgba(138, 75, 75, 0.12);
  color: #6d3030;
  font-size: 0.88rem;
}

.schedule-alert.mild {
  background: rgba(154, 107, 22, 0.14);
  color: #6d4e12;
}

.tag-today {
  display: inline-block;
  margin-left: 0.25rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.75rem;
}

.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(10, 35, 42, 0.45);
}

.modal-card {
  width: min(720px, 100%);
  max-height: min(80vh, 720px);
  overflow: auto;
  background: #fff;
  border-radius: 16px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 1rem 1.1rem 1.2rem;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 0.75rem;
}

.modal-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
}

.modal-body h4 {
  margin: 0.9rem 0 0.45rem;
  font-size: 1rem;
}

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

.notice-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.notice-table th,
.notice-table td {
  border: 1px solid var(--line);
  padding: 0.45rem 0.5rem;
  vertical-align: top;
  text-align: left;
}

.notice-table tr.notice-active {
  background: rgba(154, 107, 22, 0.12);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 640px) {
  .stats {
    grid-template-columns: 1fr;
  }

  .pool-card-top {
    flex-direction: column;
  }
}
