:root {
  --bg: #f5f5f7;
  --text: #0b0b0f;
  --muted: #8e8e93;
  --red: #ff3b30;
  --line: #d8d8de;
  --blue-bg: #bfe3f8;
  --blue-text: #1e5a80;
  --blue-dot: #32a7f2;
  --green-bg: #e7f4dc;
  --green-text: #356f2a;
  --green-border: #cde7bd;
  --orange-bg: #fff0d9;
  --orange-text: #a96000;
  --orange-border: #f4c775;
  --past-bg: #f1f1f3;
  --shadow: 0 18px 48px rgba(0,0,0,0.06);
}

* { box-sizing: border-box; }

html,
body {
  margin: 0;
  padding: 0;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "PingFang SC", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.topbar,
main,
footer {
  width: min(1480px, 96vw);
  margin: 0 auto;
}

.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(245,245,247,0.88);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid rgba(216,216,222,0.7);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--red);
  font-size: 22px;
  font-weight: 650;
}

.back-mark {
  font-size: 46px;
  line-height: 1;
  font-weight: 280;
}

nav {
  display: flex;
  gap: 28px;
}

nav a {
  color: var(--red);
  text-decoration: none;
  font-size: 17px;
}

.hero {
  padding: 38px 0 18px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: end;
}

.hero h1 {
  margin: 0;
  font-size: clamp(58px, 8vw, 104px);
  line-height: 0.88;
  letter-spacing: -0.07em;
  font-weight: 850;
}

.hero p {
  margin: 18px 0 0;
  max-width: 940px;
  color: var(--muted);
  font-size: 20px;
  line-height: 1.45;
}

.summary-card {
  min-width: 330px;
  background: rgba(255,255,255,0.78);
  border: 1px solid rgba(216,216,222,0.9);
  border-radius: 24px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
}

.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
}

.summary-row + .summary-row {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #eeeef2;
}

.summary-row span {
  color: var(--muted);
  font-size: 13px;
}

.summary-row strong {
  font-size: 18px;
  text-align: right;
}

.control-bar,
.optimal-summary,
.rules,
.legend-bar {
  margin-bottom: 18px;
  border-radius: 24px;
  background: rgba(255,255,255,0.82);
  border: 1px solid rgba(216,216,222,0.9);
  box-shadow: var(--shadow);
  padding: 16px;
}

.control-grid {
  display: grid;
  grid-template-columns: 0.8fr 1fr 1fr;
  gap: 12px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

select,
input {
  height: 48px;
  border: 1px solid #d9d9df;
  border-radius: 15px;
  background: #fff;
  padding: 0 14px;
  font-size: 17px;
  color: var(--text);
  outline: none;
}

.leave-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
}

.leave-row span {
  color: var(--muted);
  font-weight: 700;
}

.action-row {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.primary-btn {
  border: none;
  border-radius: 999px;
  background: #111;
  color: white;
  padding: 12px 20px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
}

.primary-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.action-row p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.data-status {
  display: none;
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 16px;
  background: #fff7e6;
  color: #8a5a00;
  border: 1px solid #f2d28b;
  font-size: 14px;
  line-height: 1.55;
}

.data-status.show {
  display: block;
}

.summary-title {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
}

.summary-title h2 {
  margin: 0;
  font-size: 30px;
  letter-spacing: -0.03em;
}

.summary-title p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  max-width: 840px;
}

.score-badge {
  flex: 0 0 auto;
  border-radius: 999px;
  background: #111;
  color: white;
  padding: 10px 16px;
  font-weight: 800;
  font-size: 14px;
}

.optimal-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 14px;
}

.total-card,
.node-card {
  background: white;
  border: 1px solid #e2e2e7;
  border-radius: 22px;
  padding: 16px;
}

.total-card {
  background: linear-gradient(135deg, #fff, #f2fbf3);
  border-color: #9ed4b1;
}

.total-number {
  font-size: 48px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: -0.06em;
  margin-top: 12px;
}

.total-number span {
  font-size: 16px;
  letter-spacing: 0;
}

.total-meta,
.node-meta {
  color: var(--muted);
  margin-top: 8px;
  font-size: 14px;
}

.node-list {
  display: grid;
  gap: 10px;
}

.node-card {
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease;
}

.node-card:hover {
  transform: translateY(-2px);
  border-color: #9ed4b1;
}

.node-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.node-head strong {
  font-size: 17px;
}

.badge {
  background: #e8f5df;
  color: #2f7a3d;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.leave-date-list {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.leave-date-chip {
  border-radius: 999px;
  padding: 5px 9px;
  background: var(--green-bg);
  color: var(--green-text);
  font-size: 12px;
  font-weight: 760;
  border: 1px solid var(--green-border);
}

.legend-bar {
  display: flex;
  gap: 18px;
  color: var(--muted);
  font-size: 14px;
  flex-wrap: wrap;
}

.legend-chip {
  display: inline-block;
  width: 18px;
  height: 11px;
  border-radius: 999px;
  margin-right: 5px;
  vertical-align: -1px;
}

.holiday-chip-demo {
  background: var(--blue-bg);
}

.work-chip-demo {
  background: var(--orange-bg);
  border: 1px solid var(--orange-border);
}

.leave-chip-demo {
  background: var(--green-bg);
  border: 1px solid var(--green-border);
}

.past-chip-demo {
  background: var(--past-bg);
  border: 1px solid #dedee5;
}

.calendar-list {
  display: grid;
  gap: 18px;
}

.month-panel {
  background: #fff;
  border: 1px solid rgba(216,216,222,0.9);
  border-radius: 28px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.month-head {
  padding: 22px 24px 10px;
}

.month-head h2 {
  margin: 0;
  font-size: 48px;
  letter-spacing: -0.04em;
  font-weight: 820;
}

.month-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  padding: 8px 0 9px;
  border-bottom: 1px solid var(--line);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.calendar-cell {
  min-height: 126px;
  padding: 8px 6px 10px;
  border-right: 1px solid #eeeef2;
  border-bottom: 1px solid #eeeef2;
  position: relative;
  overflow: hidden;
}

.calendar-cell:nth-child(7n) {
  border-right: none;
}

.calendar-cell.past {
  background: #f6f6f8;
  opacity: 0.68;
}

.date-top {
  min-height: 34px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  position: relative;
}

.date-num {
  font-size: 23px;
  line-height: 1;
  font-weight: 760;
  letter-spacing: -0.02em;
}

.calendar-cell.other-month .date-num {
  color: #a9a9af;
}

.calendar-cell.weekend .date-num {
  color: #7d7d84;
}

.calendar-cell.has-holiday .date-num {
  color: #111;
}

.today-ring .date-num {
  background: rgba(17, 17, 17, 0.12);
  color: #111;
  border: 1px solid rgba(17, 17, 17, 0.22);
  border-radius: 999px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
}

.calendar-cell.has-workday {
  background: linear-gradient(180deg, rgba(255,240,217,0.26), rgba(255,240,217,0.4));
}

.work-mini {
  position: absolute;
  right: 10px;
  top: 0;
  color: var(--orange-text);
  font-size: 13px;
  font-weight: 800;
}

.calendar-cell.recommended {
  background: linear-gradient(180deg, rgba(231,244,220,0.38), rgba(231,244,220,0.78));
}

.calendar-cell.recommended::after {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(143,188,115,0.34);
  border-radius: 16px;
  pointer-events: none;
}

.holiday-list {
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: flex-start;
}

.holiday-pill,
.work-pill {
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px 4px 6px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 760;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.holiday-pill {
  background: var(--blue-bg);
  color: var(--blue-text);
}

.holiday-pill::before {
  content: "★";
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  flex: 0 0 16px;
  border-radius: 50%;
  background: var(--blue-dot);
  color: #fff;
  font-size: 10px;
}

.work-pill {
  background: var(--orange-bg);
  color: var(--orange-text);
  border: 1px solid var(--orange-border);
}

.leave-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 5px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--green-bg);
  border: 1px solid var(--green-border);
  color: var(--green-text);
  font-size: 12px;
  font-weight: 760;
}

.leave-tag::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #6baa4f;
}

.rules {
  margin-top: 18px;
}

.rules h3 {
  margin: 0;
  font-size: 22px;
}

.rules ol {
  margin: 12px 0 0;
  padding-left: 20px;
}

.rules li {
  color: var(--muted);
  margin: 8px 0;
  line-height: 1.55;
}

.empty-state {
  border: 1px dashed #d7d7de;
  border-radius: 20px;
  padding: 18px;
  color: var(--muted);
  background: white;
}

footer {
  padding: 22px 0 34px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}

@media (max-width: 1180px) {
  nav {
    display: none;
  }

  .hero,
  .control-grid,
  .optimal-grid {
    grid-template-columns: 1fr;
  }

  .action-row,
  .summary-title {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 760px) {
  main,
  .topbar,
  footer {
    width: 100%;
    padding-left: 12px;
    padding-right: 12px;
  }

  .hero h1 {
    font-size: 56px;
  }

  .summary-card {
    min-width: unset;
  }

  .month-panel {
    border-radius: 0;
    margin-left: -12px;
    margin-right: -12px;
    border-left: none;
    border-right: none;
  }

  .month-head h2 {
    font-size: 42px;
  }

  .calendar-cell {
    min-height: 112px;
    padding: 7px 3px;
  }

  .date-num {
    font-size: 21px;
  }

  .holiday-pill,
  .work-pill {
    font-size: 11px;
    padding: 3px 7px 3px 4px;
  }

  .holiday-pill::before {
    width: 14px;
    height: 14px;
    flex-basis: 14px;
    font-size: 9px;
  }

  .leave-tag {
    font-size: 11px;
    padding: 3px 7px;
  }
}


.five-cols {
  grid-template-columns: repeat(5, 1fr);
}

.country-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.country-badge #countryFlag {
  font-size: 20px;
}

.helper-text {
  min-height: 20px;
}

@media (max-width: 1280px) {
  .five-cols {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 840px) {
  .five-cols {
    grid-template-columns: 1fr;
  }
}


/* Apple-like CN-only polish */
body {
  background:
    radial-gradient(circle at top left, rgba(255,255,255,0.9), rgba(245,245,247,0.96) 30%, #f5f5f7 100%);
}

.topbar {
  width: 100%;
  padding: 0 max(18px, calc((100vw - min(1480px, 96vw)) / 2));
  border-bottom: 1px solid rgba(210,210,215,0.72);
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 24px;
  color: var(--red);
  font-size: 30px;
  line-height: 1;
}

.toolbar-icon {
  font-weight: 500;
  font-size: 30px;
  transform: translateY(-1px);
}

.toolbar-plus {
  font-size: 38px;
  font-weight: 300;
}

.apple-hero {
  padding-top: 46px;
}

.apple-hero h1 {
  font-size: clamp(64px, 8.4vw, 112px);
  letter-spacing: -0.075em;
}

.apple-card,
.month-panel,
.summary-card {
  background: rgba(255,255,255,0.9);
  border-color: rgba(210,210,215,0.86);
  box-shadow: 0 22px 58px rgba(0,0,0,0.055);
}

.apple-summary {
  backdrop-filter: blur(18px);
}

.four-cols {
  grid-template-columns: 0.85fr 0.85fr 1fr 1fr;
}

select,
input {
  background: rgba(255,255,255,0.92);
  border-color: #d2d2d7;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.85);
}

.primary-btn {
  background: #050505;
  min-width: 172px;
}

.score-badge {
  background: #050505;
}

.month-panel {
  border-radius: 30px;
}

.month-head {
  padding-top: 28px;
}

.month-head h2 {
  font-size: 54px;
  letter-spacing: -0.055em;
}

.calendar-weekdays {
  color: #8a8a91;
  font-size: 15px;
  padding: 12px 0;
}

.calendar-cell {
  min-height: 132px;
}

.holiday-pill {
  background: #bfe6fb;
}

.leave-tag {
  box-shadow: 0 1px 0 rgba(255,255,255,0.75) inset;
}

nav {
  display: none;
}

@media (max-width: 1180px) {
  .four-cols {
    grid-template-columns: repeat(2, 1fr);
  }

  .toolbar-actions {
    gap: 18px;
  }
}

@media (max-width: 760px) {
  .four-cols {
    grid-template-columns: 1fr;
  }

  .toolbar-actions {
    display: none;
  }

  .apple-hero h1 {
    font-size: 58px;
  }
}


/* v2 adjustments: top-right language, simpler country card, peak explanation */
.top-lang-select {
  height: 38px;
  min-width: 108px;
  border-radius: 999px;
  border: 1px solid #d2d2d7;
  padding: 0 14px;
  font-size: 15px;
  background: rgba(255,255,255,0.82);
  color: #ff3b30;
  font-weight: 650;
  outline: none;
}

.compact-country-card {
  min-width: 300px;
  align-self: end;
}

.compact-country-card .summary-row {
  min-height: 56px;
}

.three-cols {
  grid-template-columns: 0.8fr 1fr 1fr;
}

.peak-help {
  grid-column: 3 / 4;
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

@media (max-width: 1180px) {
  .three-cols {
    grid-template-columns: 1fr;
  }

  .peak-help {
    grid-column: auto;
  }
}

@media (max-width: 760px) {
  .top-lang-select {
    min-width: 92px;
    height: 34px;
    font-size: 14px;
  }

  .toolbar-actions {
    display: flex;
  }

  .toolbar-icon,
  .toolbar-plus {
    display: none;
  }
}


/* China-only simplification */
.app-icon {
  font-size: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: rgba(255,255,255,0.78);
  border: 1px solid rgba(210,210,215,0.8);
}

.three-cols {
  grid-template-columns: 0.85fr 1fr 1fr;
}

.peak-help {
  grid-column: 3 / 4;
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.compact-country-card {
  min-width: 300px;
  align-self: end;
}

.compact-country-card .summary-row {
  min-height: 56px;
}

@media (max-width: 1180px) {
  .three-cols {
    grid-template-columns: 1fr;
  }

  .peak-help {
    grid-column: auto;
  }
}

@media (max-width: 760px) {
  .toolbar-icon,
  .toolbar-plus {
    display: none;
  }

  .toolbar-actions {
    display: flex;
  }
}


/* No-topbar version */
main {
  padding-top: 28px;
}

.apple-hero {
  padding-top: 28px;
}

.topbar {
  display: none;
}

@media (max-width: 760px) {
  main {
    padding-top: 18px;
  }

  .apple-hero {
    padding-top: 18px;
  }
}


/* Month slider version */
.month-head-with-nav {
  display: grid;
  grid-template-columns: 56px 1fr 56px;
  align-items: center;
  gap: 12px;
}

.month-title {
  min-width: 0;
}

.month-nav-btn {
  width: 52px;
  height: 52px;
  border-radius: 999px;
  border: 1px solid #d2d2d7;
  background: rgba(255,255,255,0.92);
  color: var(--red);
  font-size: 38px;
  line-height: 1;
  cursor: pointer;
  font-weight: 300;
  display: grid;
  place-items: center;
  justify-self: center;
}

.month-nav-btn:disabled {
  opacity: 0.28;
  cursor: not-allowed;
}

.month-head-with-nav .month-title {
  text-align: center;
  display: grid;
  gap: 4px;
}

.month-head-with-nav h2 {
  overflow-wrap: anywhere;
}

.month-head-with-nav p {
  color: var(--muted);
}

.calendar-slider {
  display: block;
  position: relative;
  padding: 0;
}

.calendar-slider .month-panel {
  animation: monthFadeIn 0.18s ease-out;
}

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

@media (max-width: 760px) {
  .month-head-with-nav {
    grid-template-columns: 44px 1fr 44px;
    gap: 8px;
    padding-left: 12px;
    padding-right: 12px;
  }

  .month-nav-btn {
    width: 42px;
    height: 42px;
    font-size: 30px;
  }

  .month-head-with-nav h2 {
    font-size: clamp(28px, 9vw, 42px);
  }
}


/* Minimal style refinements */
main {
  --calendar-nav-rail: 58px;
  width: min(1180px, calc(100vw - 112px));
}

.hero {
  padding: 18px 0 12px;
  align-items: center;
}

.apple-hero {
  padding-top: 18px;
}

.hero h1,
.apple-hero h1 {
  font-size: clamp(28px, 2.7vw, 32px);
  line-height: 1.15;
  letter-spacing: 0;
  font-weight: 700;
}

.hero .compact-country-card {
  width: 172px;
  min-width: 172px;
  height: 34px;
  align-self: center;
  padding: 0 14px;
  border-radius: 999px;
  box-shadow: none;
}

.hero .compact-country-card .summary-row {
  min-height: 100%;
  height: 100%;
  gap: 10px;
}

.hero .compact-country-card .summary-row span {
  font-size: 12px;
}

.hero .compact-country-card .summary-row strong {
  font-size: 14px;
}

.hero .country-badge {
  gap: 5px;
}

.control-bar,
.optimal-summary,
.legend-bar,
.summary-card,
.month-panel,
.apple-card {
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.035);
}

.primary-btn,
.score-badge {
  background: #1d1d1f;
}

.total-card {
  background: #fbfdfb;
  border-color: #cfe8d4;
}

.node-card:hover {
  transform: none;
}

.month-panel {
  position: relative;
  overflow: hidden;
}

.month-head,
.month-head-with-nav {
  display: block;
  padding: 18px 72px 12px;
  text-align: center;
}

.month-head h2,
.month-head-with-nav h2 {
  font-size: clamp(24px, 3.6vw, 34px);
  line-height: 1.15;
  letter-spacing: 0;
  font-weight: 720;
}

.month-head p,
.month-head-with-nav p {
  margin-top: 2px;
  font-size: 13px;
}

.month-nav-btn {
  z-index: 2;
  width: 44px;
  height: 44px;
  border-color: rgba(210,210,215,0.9);
  background: rgba(255,255,255,0.86);
  color: #d04453;
  font-size: 30px;
  box-shadow: 0 8px 22px rgba(0,0,0,0.08);
}

.calendar-side-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}

#prevMonthBtn {
  left: calc(-1 * var(--calendar-nav-rail));
}

#nextMonthBtn {
  right: calc(-1 * var(--calendar-nav-rail));
}

.calendar-weekdays {
  font-size: 13px;
  padding: 9px 0;
}

.calendar-cell {
  min-height: 118px;
}

@media (max-width: 760px) {
  main {
    --calendar-nav-rail: 44px;
    width: min(100%, calc(100vw - 72px));
  }

  .hero h1,
  .apple-hero h1 {
    font-size: 28px;
  }

  .hero .compact-country-card {
    width: 100%;
    min-width: 0;
    height: 34px;
  }

  .month-head,
  .month-head-with-nav {
    padding: 16px 60px 10px;
  }

  .month-head h2,
  .month-head-with-nav h2 {
    font-size: 26px;
  }

  .month-nav-btn {
    width: 38px;
    height: 38px;
    font-size: 26px;
  }

  #prevMonthBtn {
    left: calc(-1 * var(--calendar-nav-rail));
  }

  #nextMonthBtn {
    right: calc(-1 * var(--calendar-nav-rail));
  }
}

/* Static information pages */
.info-page {
  padding: 28px;
  margin: 10px 0 22px;
  color: #1d1d1f;
}

.info-page h2 {
  margin: 26px 0 10px;
  font-size: 22px;
  letter-spacing: -0.02em;
}

.info-page h2:first-child {
  margin-top: 0;
}

.info-page p,
.info-page li {
  color: #66666c;
  font-size: 16px;
  line-height: 1.8;
}

.info-page a,
.footer-links a {
  color: #1d1d1f;
  text-decoration: none;
}

.info-page a:hover,
.footer-links a:hover {
  text-decoration: underline;
}

.footer-links {
  display: inline-flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
