:root {
  color-scheme: light;
  --ink: #101820;
  --muted: #5a6875;
  --soft: rgba(255, 255, 255, 0.7);
  --glass: rgba(255, 255, 255, 0.62);
  --glass-strong: rgba(255, 255, 255, 0.82);
  --line: rgba(12, 28, 39, 0.12);
  --shadow: 0 18px 48px rgba(38, 61, 80, 0.14);
  --cyan: #3dbce4;
  --mint: #29c48d;
  --coral: #ff765e;
  --violet: #7765d8;
  --danger: #d94e4e;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #f7fbff;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
  background:
    linear-gradient(180deg, rgba(247, 251, 255, 0.84), rgba(255, 255, 255, 0.72)),
    url("/assets/liquid-lines.svg") center top / cover fixed;
}

button,
input {
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(110deg, rgba(61, 188, 228, 0.12), transparent 34%),
    linear-gradient(250deg, rgba(255, 118, 94, 0.12), transparent 38%);
  mix-blend-mode: multiply;
}

.app-shell {
  position: relative;
  min-height: 100vh;
}

.topbar {
  z-index: 20;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  width: min(1160px, calc(100% - 28px));
  margin: 14px auto 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.74);
  box-shadow: 0 10px 30px rgba(31, 55, 74, 0.12);
  backdrop-filter: blur(22px) saturate(1.22);
}

.topbar.is-fixed {
  position: sticky;
  top: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid rgba(16, 24, 32, 0.08);
  border-radius: 50%;
  color: #06141d;
  font-size: 21px;
  font-weight: 900;
  background: conic-gradient(from 210deg, #83e3ff, #8df0c4, #ffd1c6, #83e3ff);
  box-shadow: inset 0 1px 12px rgba(255, 255, 255, 0.9), 0 8px 24px rgba(61, 188, 228, 0.22);
}

.brand-mark.large {
  width: 64px;
  height: 64px;
  font-size: 38px;
}

.brand-name {
  font-size: 18px;
  font-weight: 900;
}

.main-nav {
  display: flex;
  justify-content: center;
  min-width: 0;
  gap: 6px;
  overflow-x: auto;
}

.nav-btn,
.mode-tab,
.range-tab {
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  white-space: nowrap;
}

.nav-btn {
  padding: 0 14px;
}

.nav-btn.is-active,
.mode-tab.is-active,
.range-tab.is-active {
  color: var(--ink);
  border-color: rgba(16, 24, 32, 0.08);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.88), 0 8px 18px rgba(49, 83, 104, 0.1);
}

.account-area {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
}

.user-pill {
  display: inline-flex;
  align-items: center;
  max-width: 210px;
  min-width: 0;
  gap: 8px;
  padding: 4px 8px 4px 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
}

.avatar {
  display: grid;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  color: #07141c;
  font-size: 13px;
  font-weight: 900;
  background: linear-gradient(135deg, #91e8ff, #ffe0d8);
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-name {
  min-width: 0;
  overflow: hidden;
  font-size: 14px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.main {
  width: min(1160px, calc(100% - 28px));
  margin: 28px auto 0;
  padding-bottom: 42px;
}

.auth-screen {
  display: grid;
  min-height: calc(100vh - 140px);
  place-items: center;
}

.auth-card {
  width: min(420px, 100%);
}

.auth-title {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.auth-title h1 {
  margin: 0;
  font-size: 32px;
}

.auth-title p {
  margin: 3px 0 0;
  color: var(--muted);
}

.workspace[hidden],
.auth-screen[hidden],
[hidden] {
  display: none !important;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.glass-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(145deg, var(--glass-strong), var(--glass));
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px) saturate(1.24);
}

.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 18px;
}

.hero-panel {
  display: grid;
  min-height: 560px;
  align-content: start;
  justify-items: center;
  padding: 30px;
  overflow: hidden;
}

.hero-copy {
  width: 100%;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--cyan);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1,
h2,
h3 {
  letter-spacing: 0;
}

.hero-copy h1 {
  max-width: 560px;
  margin: 0;
  font-size: 40px;
  line-height: 1.12;
}

.mode-tabs,
.range-tabs {
  display: inline-flex;
  max-width: 100%;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.46);
  overflow-x: auto;
}

.mode-tab,
.range-tab {
  padding: 0 16px;
}

.dao-button {
  display: grid;
  width: min(330px, 76vw);
  aspect-ratio: 1;
  margin: 38px auto 22px;
  place-items: center;
  border: 1px solid rgba(16, 24, 32, 0.12);
  border-radius: 50%;
  color: #06141d;
  background:
    radial-gradient(circle at 36% 24%, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.08) 33%),
    conic-gradient(from 180deg, #7fe1ff, #91efc2, #ffd0c5, #bdb6ff, #7fe1ff);
  box-shadow:
    inset 0 2px 22px rgba(255, 255, 255, 0.92),
    inset 0 -22px 42px rgba(38, 79, 105, 0.12),
    0 30px 70px rgba(45, 109, 129, 0.24);
  transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

.dao-button:hover {
  transform: translateY(-2px);
  filter: saturate(1.06);
}

.dao-button:active {
  transform: translateY(1px) scale(0.992);
}

.dao-button.is-running {
  background:
    radial-gradient(circle at 36% 24%, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.08) 33%),
    conic-gradient(from 180deg, #ff9a85, #ffe08c, #8df0c4, #ff9a85);
}

.dao-button span {
  max-width: 84%;
  color: rgba(6, 20, 29, 0.95);
  font-size: 72px;
  font-weight: 1000;
  line-height: 1;
  text-align: center;
}

.dao-button.is-running span {
  font-size: 46px;
}

.manual-fields {
  width: min(470px, 100%);
}

.side-stack {
  display: grid;
  align-content: start;
  gap: 18px;
}

.timer-status,
.today-summary {
  padding: 20px;
}

.timer-time {
  min-height: 46px;
  font-size: 34px;
  font-weight: 900;
  line-height: 1.1;
}

.timer-meta {
  min-height: 24px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
}

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

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

.summary-row strong {
  font-size: 28px;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-head h2 {
  margin: 0;
  font-size: 32px;
}

.record-list {
  display: grid;
  gap: 12px;
}

.record-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.68);
  box-shadow: 0 10px 28px rgba(43, 75, 97, 0.08);
}

.record-main {
  min-width: 0;
}

.record-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-weight: 900;
}

.record-meta {
  color: var(--muted);
  font-size: 14px;
}

.record-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: end;
  gap: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  color: #0d3d32;
  font-size: 12px;
  font-weight: 900;
  background: rgba(41, 196, 141, 0.16);
}

.badge.is-muted {
  color: #5d6570;
  background: rgba(90, 104, 117, 0.12);
}

.leader-total {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
  padding: 18px;
}

.total-metric {
  min-width: 0;
}

.total-metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.total-metric strong {
  display: block;
  margin-top: 4px;
  font-size: 30px;
  line-height: 1.12;
}

.leader-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.leader-card {
  padding: 18px;
}

.leader-card.span-two {
  grid-column: span 2;
}

.leader-card h3,
.settings-grid h3 {
  margin: 0 0 14px;
  font-size: 20px;
}

.rank-list {
  display: grid;
  gap: 9px;
}

.rank-row {
  display: grid;
  grid-template-columns: 34px auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 8px 10px;
  border: 1px solid rgba(16, 24, 32, 0.08);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.52);
}

.rank-index {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  color: #0c1e2a;
  font-weight: 900;
  background: rgba(61, 188, 228, 0.15);
}

.rank-name {
  min-width: 0;
  overflow: hidden;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-value {
  color: var(--muted);
  font-weight: 900;
  text-align: right;
  white-space: nowrap;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.settings-grid .glass-panel {
  padding: 18px;
}

.admin-panel {
  grid-column: span 2;
}

.stack {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

input {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(16, 24, 32, 0.14);
  border-radius: var(--radius);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.74);
  outline: none;
  padding: 0 12px;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

input:focus {
  border-color: rgba(61, 188, 228, 0.7);
  box-shadow: 0 0 0 4px rgba(61, 188, 228, 0.14);
  background: rgba(255, 255, 255, 0.92);
}

.duration-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.duration-grid.compact {
  padding: 14px;
  border: 1px solid rgba(16, 24, 32, 0.09);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.48);
}

.switch-line {
  display: flex;
  align-items: center;
  min-height: 42px;
  gap: 10px;
  color: var(--ink);
}

.switch-line input {
  width: 20px;
  min-height: 20px;
  accent-color: var(--mint);
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.icon-btn,
.danger-btn {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-weight: 900;
}

.primary-btn {
  color: #06141d;
  background: linear-gradient(135deg, #83e3ff, #90efc1 54%, #ffd1c6);
  box-shadow: 0 12px 24px rgba(51, 128, 132, 0.18);
}

.secondary-btn {
  color: var(--ink);
  border-color: rgba(16, 24, 32, 0.12);
  background: rgba(255, 255, 255, 0.72);
}

.ghost-btn {
  color: var(--muted);
  border-color: rgba(16, 24, 32, 0.1);
  background: rgba(255, 255, 255, 0.42);
}

.danger-btn {
  color: #fff;
  background: var(--danger);
}

.icon-btn {
  display: grid;
  width: 40px;
  padding: 0;
  place-items: center;
  color: var(--ink);
  border-color: rgba(16, 24, 32, 0.1);
  background: rgba(255, 255, 255, 0.58);
}

.full {
  width: 100%;
}

.user-list {
  display: grid;
  gap: 8px;
  margin-top: 4px;
}

.user-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 8px 0;
  border-top: 1px solid rgba(16, 24, 32, 0.08);
}

.confirm-dialog {
  width: min(460px, calc(100% - 28px));
  padding: 0;
  border: 1px solid var(--line);
}

.confirm-dialog::backdrop {
  background: rgba(6, 20, 29, 0.28);
  backdrop-filter: blur(5px);
}

.confirm-form {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.dialog-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

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

.dialog-actions {
  display: flex;
  justify-content: end;
  gap: 8px;
  margin: 4px 0 0;
  padding: 0;
}

.empty-state {
  padding: 24px;
  border: 1px dashed rgba(16, 24, 32, 0.18);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
  background: rgba(255, 255, 255, 0.38);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 50;
  max-width: min(360px, calc(100% - 36px));
  padding: 12px 14px;
  border: 1px solid rgba(16, 24, 32, 0.12);
  border-radius: var(--radius);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 160ms ease, transform 160ms ease;
  backdrop-filter: blur(18px);
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

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

  .main-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: start;
  }

  .account-area {
    justify-content: end;
  }

  .home-grid,
  .leader-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .leader-card.span-two,
  .admin-panel {
    grid-column: auto;
  }

  .hero-panel {
    min-height: auto;
  }

  .hero-copy h1 {
    font-size: 32px;
  }

  .dao-button span {
    font-size: 62px;
  }

  .dao-button.is-running span {
    font-size: 40px;
  }
}

@media (max-width: 560px) {
  .topbar,
  .main {
    width: min(100% - 16px, 1160px);
  }

  .topbar {
    margin-top: 8px;
  }

  .brand-name,
  .user-name {
    display: none;
  }

  .hero-panel,
  .timer-status,
  .today-summary,
  .leader-card,
  .settings-grid .glass-panel {
    padding: 14px;
  }

  .hero-copy h1,
  .section-head h2 {
    font-size: 26px;
  }

  .section-head {
    display: grid;
    align-items: start;
  }

  .leader-total,
  .duration-grid {
    grid-template-columns: 1fr;
  }

  .record-item {
    grid-template-columns: 1fr;
  }

  .record-actions,
  .dialog-actions {
    justify-content: stretch;
  }

  .record-actions button,
  .dialog-actions button {
    flex: 1;
  }

  .rank-row {
    grid-template-columns: 30px auto minmax(0, 1fr);
  }

  .rank-value {
    grid-column: 2 / -1;
    text-align: left;
  }
}
