:root {
  color-scheme: light dark;
  font-family: "Inter", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --bg: #f5f7fb;
  --text: #1f2933;
  --muted: #4b5563;
  --card-bg: #ffffffcc;
  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.12);
  --border: #d1d5db;
  --danger: #dc2626;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.1);
}

body {
  margin: 0;
  background: radial-gradient(circle at top, #eef2ff 0%, #f8fafc 60%, #f1f5f9 100%);
  color: var(--text);
  min-height: 100vh;
}

.app {
  max-width: 960px;
  margin: 0 auto;
  padding: 48px 24px 80px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.app__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
}

.app__header h1 {
  margin: 0 0 8px;
  font-size: clamp(1.75rem, 2.5vw, 2.4rem);
}

.app__subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.accuracy-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  font-weight: 600;
  min-width: 160px;
  text-align: center;
  box-shadow: var(--shadow);
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  padding: 24px;
  background: var(--card-bg);
  border-radius: 20px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.year-controls,
.timezone-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 260px;
}

.timezone-controls__actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.timezone-summary {
  font-size: 0.85rem;
  color: var(--muted);
}

@media (min-width: 640px) {
  .timezone-controls__actions {
    flex-direction: row;
    align-items: center;
    gap: 12px;
  }
}

.visibility-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  flex: 1 1 260px;
  font-size: 0.95rem;
}

.visibility-controls__label {
  font-weight: 600;
}

.visibility-controls__option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.visibility-controls__option input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.year-controls label,
.timezone-controls label {
  font-weight: 600;
}

.year-controls__inputs {
  display: flex;
  gap: 8px;
  align-items: center;
}

input[type="number"],
select {
  font: inherit;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  min-width: 120px;
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type="number"]:focus,
select:focus,
button:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}

button {
  font: inherit;
  border: none;
  cursor: pointer;
}

.ghost-button {
  padding: 10px 12px;
  background: transparent;
  border-radius: 10px;
  border: 1px solid transparent;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.ghost-button:hover {
  background: rgba(37, 99, 235, 0.1);
  border-color: rgba(37, 99, 235, 0.3);
}

.secondary-button {
  padding: 10px 16px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--accent);
  color: var(--accent);
  transition: background 0.2s ease, color 0.2s ease;
}

.secondary-button:hover {
  background: var(--accent);
  color: #fff;
}

.help-text {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
}

.card {
  background: var(--card-bg);
  border-radius: 24px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.card__header {
  padding: 20px 24px 0;
}

.card__header h2 {
  margin: 0;
}

.table-wrapper {
  padding: 0 24px 24px;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 320px;
}

thead th {
  text-align: left;
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 600;
  padding: 12px 8px;
}

tbody td {
  padding: 10px 8px;
  border-top: 1px solid rgba(209, 213, 219, 0.6);
}

.data-row--alt td {
  background: rgba(148, 163, 184, 0.08);
}

.table-group-divider td {
  padding: 4px 0;
  border-top: none;
}

.table-group-divider__line {
  display: block;
  height: 1px;
  background: rgba(148, 163, 184, 0.5);
  border-radius: 999px;
}

.phase-group-divider td {
  padding: 8px 0;
}

.phase-group-divider .table-group-divider__line {
  background: rgba(37, 99, 235, 0.35);
}

.placeholder {
  text-align: center;
  color: var(--muted);
}

.error-message {
  padding: 14px 18px;
  border-radius: 12px;
  border: 1px solid rgba(220, 38, 38, 0.3);
  background: rgba(254, 226, 226, 0.8);
  color: var(--danger);
  font-weight: 600;
}

.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.overlay[hidden] {
  display: none;
}

.overlay__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.3);
  backdrop-filter: blur(4px);
}

.panel {
  position: relative;
  background: #fff;
  border-radius: 24px;
  width: min(720px, 90vw);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(209, 213, 219, 0.6);
}

.panel__body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  padding: 24px;
  overflow-y: auto;
}

.panel--timezone {
  width: min(820px, 94vw);
}

.panel__body--timezone {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.timezone-panel__list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}

.timezone-panel__group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.timezone-panel__group h3 {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted);
}

.timezone-panel__options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.timezone-panel__options button {
  border-radius: 12px;
  padding: 12px 14px;
  text-align: left;
  background: rgba(148, 163, 184, 0.14);
  color: var(--text);
  border: 1px solid transparent;
  line-height: 1.4;
  word-break: break-word;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.timezone-panel__options button:hover {
  background: rgba(37, 99, 235, 0.16);
  border-color: rgba(37, 99, 235, 0.25);
}

.timezone-panel__options button.active {
  background: rgba(37, 99, 235, 0.85);
  color: #fff;
}

.panel__section h3 {
  margin-top: 0;
  font-size: 1rem;
}

.button-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 8px;
}

.year-grid {
  grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
}

.button-grid button {
  border-radius: 10px;
  padding: 10px 12px;
  background: rgba(148, 163, 184, 0.12);
  color: var(--text);
  border: 1px solid transparent;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.button-grid button:hover {
  background: rgba(37, 99, 235, 0.18);
}

.button-grid button.active {
  background: rgba(37, 99, 235, 0.85);
  color: #fff;
}

@media (max-width: 640px) {
  .app {
    padding: 32px 16px 60px;
  }

  .controls {
    padding: 20px;
  }

  .accuracy-badge {
    align-self: flex-start;
  }
}
