:root {
  color-scheme: dark;
  --font-scale: 1;
  --bg: #0f1411;
  --surface: #171e19;
  --surface-soft: #1d2620;
  --line: rgba(232, 244, 235, 0.1);
  --text: #eef4ef;
  --muted: #95a298;
  --green: #a4e8bd;
  --green-strong: #53c582;
  --amber: #efc36e;
  --red: #ef8c80;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.24);
  font-family: "SF Pro Display", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background:
    radial-gradient(circle at 12% 0%, rgba(58, 118, 78, 0.15), transparent 28rem),
    radial-gradient(circle at 92% 16%, rgba(166, 132, 61, 0.1), transparent 24rem),
    var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.board-shell {
  min-height: 100vh;
  padding: clamp(20px, 2.3vw, 42px);
  display: flex;
  flex-direction: column;
  gap: clamp(18px, 2vw, 30px);
}

.topbar {
  display: grid;
  grid-template-columns: minmax(260px, 1.1fr) minmax(260px, 0.8fr) auto;
  align-items: end;
  gap: clamp(22px, 3vw, 56px);
}

.eyebrow,
.column-kicker {
  margin: 0 0 8px;
  color: var(--green);
  font-size: calc(0.82rem * var(--font-scale));
  font-weight: 760;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.date-line {
  display: flex;
  align-items: baseline;
  gap: 18px;
}

.date-line h1 {
  margin: 0;
  font-size: calc(clamp(2.15rem, 3.7vw, 4.25rem) * var(--font-scale));
  line-height: 0.98;
  letter-spacing: -0.06em;
}

#clock {
  color: var(--muted);
  font-size: calc(clamp(1.35rem, 2.3vw, 2.3rem) * var(--font-scale));
  font-variant-numeric: tabular-nums;
  font-weight: 620;
}

.summary {
  padding-bottom: 4px;
}

.summary-copy {
  display: flex;
  justify-content: space-between;
  margin-bottom: 11px;
  color: var(--muted);
  font-size: calc(0.9rem * var(--font-scale));
}

.summary-copy strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.progress-track {
  width: 100%;
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green-strong), var(--green));
  transition: width 450ms ease;
}

.controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.icon-button,
.text-button,
.refresh-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: background 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.icon-button {
  width: 44px;
  font-weight: 760;
}

.text-button,
.refresh-button {
  padding: 0 15px;
}

.refresh-button {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: var(--green);
  border-color: transparent;
  color: #102016;
  font-weight: 760;
}

.refresh-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #1b6a39;
}

.refresh-button.is-loading .refresh-dot {
  animation: pulse 900ms infinite alternate;
}

.icon-button:hover,
.text-button:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.text-button.active {
  border-color: rgba(164, 232, 189, 0.38);
  color: var(--green);
}

.notice {
  border: 1px solid rgba(239, 195, 110, 0.26);
  border-radius: 14px;
  padding: 12px 16px;
  background: rgba(239, 195, 110, 0.08);
  color: #f2d49a;
  font-size: calc(0.92rem * var(--font-scale));
}

.task-grid {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 0.86fr) minmax(0, 1fr) minmax(0, 1.1fr);
  gap: clamp(14px, 1.45vw, 24px);
  min-height: 0;
}

.task-column {
  min-height: 340px;
  padding: clamp(16px, 1.65vw, 28px);
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(23, 30, 25, 0.86);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.column-header h2 {
  margin: 0;
  font-size: calc(clamp(1.35rem, 1.75vw, 2rem) * var(--font-scale));
  letter-spacing: -0.035em;
}

.column-kicker {
  color: var(--muted);
  font-size: calc(0.68rem * var(--font-scale));
}

.count-badge {
  min-width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--muted);
  font-size: calc(0.92rem * var(--font-scale));
  font-weight: 760;
  font-variant-numeric: tabular-nums;
}

.overdue-column .count-badge {
  background: rgba(239, 140, 128, 0.1);
  color: var(--red);
}

.task-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.task-card {
  position: relative;
  display: grid;
  grid-template-columns: 5px 1fr;
  gap: 15px;
  overflow: hidden;
  padding: clamp(15px, 1.35vw, 22px);
  border: 1px solid rgba(255, 255, 255, 0.065);
  border-radius: 17px;
  background: var(--surface-soft);
}

.priority-mark {
  width: 5px;
  height: 100%;
  min-height: 56px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.task-card[data-priority="5"] .priority-mark {
  background: var(--red);
}

.task-card[data-priority="3"] .priority-mark {
  background: var(--amber);
}

.task-card[data-priority="1"] .priority-mark {
  background: #76a5ef;
}

.task-meta {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 20px;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: calc(0.77rem * var(--font-scale));
  font-weight: 650;
}

.task-time {
  color: var(--green);
  font-variant-numeric: tabular-nums;
}

.task-project {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.task-project::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--project-color, #7a897f);
}

.task-title {
  margin: 0;
  font-size: calc(clamp(1.05rem, 1.3vw, 1.4rem) * var(--font-scale));
  line-height: 1.38;
  letter-spacing: -0.018em;
  overflow-wrap: anywhere;
}

.task-content {
  display: -webkit-box;
  margin: 8px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: calc(0.82rem * var(--font-scale));
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.empty-state {
  min-height: 120px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 9px;
  border: 1px dashed rgba(255, 255, 255, 0.09);
  border-radius: 17px;
  color: var(--muted);
}

.empty-state span {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(164, 232, 189, 0.09);
  color: var(--green);
}

.empty-state p {
  margin: 0;
  font-size: calc(0.87rem * var(--font-scale));
}

.board-footer {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.loading-state,
.connect-state {
  flex: 1;
  min-height: 380px;
  place-content: center;
  justify-items: center;
  text-align: center;
}

.loading-state:not([hidden]),
.connect-state:not([hidden]) {
  display: grid;
}

.loading-pulse {
  width: 50px;
  height: 50px;
  border: 3px solid rgba(164, 232, 189, 0.18);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 900ms linear infinite;
}

.loading-state p,
.connect-state p {
  color: var(--muted);
}

.connect-state h2 {
  margin: 2px 0 0;
  font-size: clamp(2rem, 4vw, 4rem);
}

.centered-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.gate-card {
  width: min(100%, 480px);
  padding: clamp(28px, 5vw, 52px);
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(23, 30, 25, 0.92);
  box-shadow: var(--shadow);
}

.gate-card h1 {
  margin: 0 0 14px;
  font-size: clamp(2rem, 7vw, 3.2rem);
  letter-spacing: -0.055em;
}

.gate-card > p:not(.eyebrow):not(.privacy-note) {
  margin: 0 0 28px;
  color: var(--muted);
  line-height: 1.7;
}

.gate-card form {
  display: grid;
  gap: 10px;
}

.gate-card label {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 650;
}

.gate-card input {
  width: 100%;
  height: 52px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 13px;
  outline: none;
  padding: 0 15px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
}

.gate-card input:focus {
  border-color: rgba(164, 232, 189, 0.55);
  box-shadow: 0 0 0 4px rgba(164, 232, 189, 0.08);
}

.primary-button {
  height: 52px;
  margin-top: 7px;
  border: 0;
  border-radius: 13px;
  background: var(--green);
  color: #102016;
  font-weight: 780;
  cursor: pointer;
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.form-error {
  margin: 2px 0 !important;
  color: var(--red) !important;
  font-size: 0.86rem;
}

.privacy-note {
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.6;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  to { opacity: 0.3; }
}

@media (max-width: 1080px) {
  .topbar {
    grid-template-columns: 1fr auto;
  }

  .summary {
    grid-column: 1 / -1;
    grid-row: 2;
  }

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

  .allday-column {
    grid-column: 1 / -1;
  }
}

@media (max-width: 700px) {
  .board-shell {
    padding: 18px;
  }

  .topbar,
  .task-grid {
    grid-template-columns: 1fr;
  }

  .controls {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .allday-column {
    grid-column: auto;
  }

  .task-column {
    min-height: auto;
  }

  .board-footer {
    flex-direction: column;
    gap: 5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
