* {
  box-sizing: border-box;
}

:root {
  --navy: #17345f;
  --navy-dark: #102744;
  --blue: #2d67a8;
  --gold: #c79a45;
  --gold-light: #f7f0e2;
  --text: #243247;
  --muted: #6f7b8b;
  --line: #dfe5ec;
  --background: #f5f7fa;
  --white: #ffffff;
}

body {
  margin: 0;
  font-family:
    "Noto Sans TC",
    "Microsoft JhengHei",
    "PingFang TC",
    Arial,
    sans-serif;
  color: var(--text);
  background: var(--background);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

/* =========================
   Page
========================= */

.page {
  width: min(920px, calc(100% - 32px));
  margin: 0 auto;
  padding: 50px 0 70px;
}

/* =========================
   Header
========================= */

.header {
  text-align: center;
  margin-bottom: 32px;
}

.brand {
  display: inline-block;
  margin-bottom: 13px;
  color: var(--gold);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.brand-logo {
  display: block;
  width: min(300px, 72vw);
  height: auto;
  margin: 0 auto 18px;
}

.header h1 {
  margin: 0;
  color: var(--navy);
  font-size: 32px;
  line-height: 1.35;
  font-weight: 800;
}

.subtitle {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 15px;
}

/* =========================
   Query
========================= */

.query-card {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 16px;
  align-items: end;

  padding: 24px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 16px;

  box-shadow: 0 8px 28px rgba(26, 48, 78, 0.06);
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.input-group label {
  color: var(--navy);
  font-size: 14px;
  font-weight: 700;
}

.input-group input {
  width: 100%;
  height: 46px;
  padding: 0 13px;

  color: var(--text);
  background: #fff;

  border: 1px solid #ccd5df;
  border-radius: 9px;
  outline: none;
}

.input-group input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(45, 103, 168, 0.1);
}

#queryButton {
  height: 46px;
  min-width: 120px;
  padding: 0 24px;

  color: #fff;
  background: var(--navy);

  border: 0;
  border-radius: 9px;

  font-weight: 700;
  transition: 0.18s ease;
}

#queryButton:hover {
  background: var(--navy-dark);
  transform: translateY(-1px);
}

/* =========================
   Results
========================= */

.result-section {
  margin-top: 34px;
}

.result-section h2,
.quick-section h2 {
  margin: 0 0 16px;
  color: var(--navy);
  font-size: 18px;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.result-card {
  min-height: 245px;
  padding: 20px 15px;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 14px;

  box-shadow: 0 5px 20px rgba(26, 48, 78, 0.045);
}

.result-label {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.result-card strong {
  margin: 10px 0 8px;

  color: var(--navy);
  font-size: 30px;
  line-height: 1;
  letter-spacing: 0.08em;
}

.result-note {
  color: #9aa3af;
  font-size: 12px;
}

.transformations {
  width: 100%;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);

  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px 10px;
}

.transformations div {
  display: flex;
  align-items: center;
  justify-content: space-between;

  padding: 6px 8px;
  background: #f8fafc;
  border-radius: 6px;
}

.transformations span {
  color: var(--gold);
  font-size: 13px;
  font-weight: 700;
}

.transformations b {
  color: var(--navy);
  font-size: 13px;
  font-weight: 700;
}


/* =========================
   Quick navigation
========================= */

.quick-section {
  margin-top: 34px;
}

.day-navigation {
  display: flex;
  justify-content: center;
  gap: 10px;

  margin-bottom: 30px;
}

.day-navigation button {
  min-height: 40px;
  padding: 0 17px;

  color: var(--navy);
  background: var(--white);

  border: 1px solid var(--line);
  border-radius: 8px;

  font-size: 14px;
  font-weight: 600;
}

.day-navigation button:hover {
  border-color: #aebdcd;
  background: #fafbfd;
}

/* =========================
   12 時辰
========================= */

.shichen-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 7px;
  width: 100%;
}

.shichen-grid button {
  height: 44px;

  color: var(--navy);
  background: var(--white);

  border: 1px solid var(--line);
  border-radius: 8px;

  font-size: 15px;
  font-weight: 700;

  transition: 0.15s ease;
}

.shichen-grid button {
  height: 62px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  min-width: 0;

}

.shichen-grid button span {
  font-size: 16px;
  font-weight: 700;
}

.shichen-grid button small {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}

.shichen-grid button.active small {
  color: rgba(255, 255, 255, 0.82);
}

.shichen-grid button:hover {
  color: var(--navy-dark);
  background: var(--gold-light);
  border-color: #dbc28e;
}

.shichen-grid button.active {
  color: #fff;
  background: var(--navy);
  border-color: var(--navy);
}

/* =========================
   Mobile
========================= */

@media (max-width: 760px) {
  .page {
    width: min(100% - 24px, 600px);
    padding-top: 32px;
  }

  .header h1 {
    font-size: 25px;
  }

  .query-card {
    grid-template-columns: 1fr 1fr;
  }

  #queryButton {
    grid-column: 1 / -1;
    width: 100%;
  }

  .result-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .shichen-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

@media (max-width: 430px) {
  .query-card {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  #queryButton {
    grid-column: auto;
  }

  .result-card {
    min-height: 130px;
  }

  .result-card strong {
    font-size: 27px;
  }

  .day-navigation {
    gap: 6px;
  }

  .day-navigation button {
    flex: 1;
    padding: 0 8px;
    font-size: 13px;
  }

  .shichen-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}