:root {
  color-scheme: light;
  --bg: #eef9ff;
  --surface: #f8fcff;
  --surface-strong: #ffffff;
  --ink: #133244;
  --muted: #5e7484;
  --line: #c8e7f5;
  --green: #0284c7;
  --green-dark: #0369a1;
  --blue: #0ea5e9;
  --yellow: #38bdf8;
  --coral: #f97373;
  --water-light: #bae6fd;
  --water-mid: #7dd3fc;
  --water-deep: #075985;
  --shadow: 0 16px 42px rgba(14, 116, 144, 0.12);
  font-family: Inter, "Microsoft YaHei", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 8%, rgba(125, 211, 252, 0.5), transparent 20rem),
    radial-gradient(circle at 86% 4%, rgba(186, 230, 253, 0.62), transparent 22rem),
    linear-gradient(180deg, #e0f7ff 0%, #f5fbff 44%, #eef9ff 100%),
    var(--bg);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(100%, 920px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 16px 92px;
}

.topbar,
.section-heading,
.panel-heading,
.modal-heading,
.button-row,
.focus-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar {
  padding: 8px 2px 18px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.05;
}

h2 {
  font-size: 26px;
}

h3 {
  font-size: 17px;
}

.eyebrow {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0;
}

.view {
  display: none;
}

.view.active {
  display: grid;
  gap: 16px;
}

.section-heading {
  margin-bottom: 2px;
}

.page-heading,
.focus-heading {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
}

.page-icon,
.small-icon {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  color: #075985;
  background: #dff5ff;
}

.page-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
}

.page-icon svg {
  width: 25px;
  height: 25px;
}

.small-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
}

.small-icon svg {
  width: 17px;
  height: 17px;
}

.page-icon svg,
.small-icon svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.title-with-icon {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.section-heading.page-heading .add-circle-button {
  margin-left: auto;
}

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

.metric-card,
.panel,
.item,
.focus-screen,
.modal-content {
  border: 1px solid rgba(200, 231, 245, 0.86);
  border-radius: 8px;
  background: rgba(248, 252, 255, 0.94);
  box-shadow: var(--shadow);
}

.metric-card {
  min-height: 82px;
  padding: 14px;
}

.metric-button {
  display: block;
  width: 100%;
  text-align: left;
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  font-size: 22px;
  line-height: 1.1;
}

.panel {
  padding: 14px;
}

.panel-heading {
  margin-bottom: 12px;
}

.count-pill {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  margin-left: 6px;
  padding: 0 8px;
  border-radius: 999px;
  color: #075985;
  background: #dff5ff;
  font-size: 13px;
  font-weight: 760;
  vertical-align: middle;
}

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

.list.collapsed {
  display: none;
}

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

.item {
  position: relative;
  display: grid;
  gap: 10px;
  padding: 12px;
  background: var(--surface-strong);
  box-shadow: none;
}

.item.done {
  opacity: 0.68;
}

.item-title {
  padding-right: 24px;
  overflow-wrap: anywhere;
  font-weight: 720;
}

.item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.item-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 70px;
}

.status-button {
  display: grid;
  place-items: center;
  align-self: center;
  min-width: 92px;
  min-height: 58px;
  border: 0;
  border-radius: 8px;
  color: #075985;
  background: #dff5ff;
  font-size: 22px;
  font-weight: 780;
}

.status-button.done {
  color: #ffffff;
  background: var(--green);
}

.countdown-badge {
  display: grid;
  place-items: center;
  align-self: center;
  min-width: 112px;
  min-height: 68px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #075985;
  background: #dff5ff;
  font-size: 24px;
  font-weight: 780;
  line-height: 1.12;
  text-align: center;
}

.countdown-badge small {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.delete-x {
  position: absolute;
  top: 1px;
  right: 3px;
  width: 28px;
  min-height: 28px;
  border: 0;
  border-radius: 50%;
  color: var(--muted);
  background: transparent;
  font-size: 20px;
  line-height: 1;
}

.delete-x:hover {
  color: white;
  background: var(--coral);
}

.empty-state {
  padding: 22px 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.primary-button,
.secondary-button,
.danger-button,
.text-button,
.icon-button,
.nav-button,
.chip-button {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.primary-button {
  padding: 0 16px;
  color: white;
  background: var(--green);
}

.primary-button:hover {
  background: var(--green-dark);
}

.add-circle-button {
  width: 48px;
  min-height: 48px;
  flex: 0 0 48px;
  border: 0;
  border-radius: 50%;
  color: white;
  background: linear-gradient(145deg, #7dd3fc, #0284c7);
  box-shadow: 0 12px 26px rgba(14, 165, 233, 0.28);
  font-size: 30px;
  font-weight: 760;
  line-height: 1;
}

.add-circle-button:hover {
  background: linear-gradient(145deg, #a5e7ff, #0369a1);
}

.secondary-button {
  padding: 0 14px;
  color: var(--ink);
  background: #d8f1fb;
}

.danger-button {
  padding: 0 14px;
  color: white;
  background: var(--coral);
}

.text-button {
  padding: 0 8px;
  color: var(--blue);
  background: transparent;
}

.chip-button {
  min-height: 34px;
  padding: 0 11px;
  color: var(--ink);
  background: #e0f7ff;
}

.icon-button {
  width: 40px;
  flex: 0 0 40px;
  color: var(--ink);
  background: #d8f1fb;
  font-size: 22px;
  line-height: 1;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.bottom-nav {
  position: fixed;
  right: max(12px, calc((100vw - 920px) / 2 + 12px));
  bottom: 12px;
  left: max(12px, calc((100vw - 920px) / 2 + 12px));
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  padding: 8px;
  border: 1px solid rgba(200, 231, 245, 0.94);
  border-radius: 8px;
  background: rgba(248, 252, 255, 0.96);
  box-shadow: 0 18px 46px rgba(7, 89, 133, 0.14);
  backdrop-filter: blur(18px);
}

.nav-button {
  min-width: 0;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
}

.nav-button.active {
  color: white;
  background: var(--green);
}

.field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  color: var(--ink);
  background: white;
}

.field textarea {
  min-height: 104px;
  resize: vertical;
}

.focus-screen {
  min-height: calc(100vh - 166px);
  display: grid;
  align-content: center;
  gap: 18px;
  padding: 20px;
  background:
    radial-gradient(circle at 50% 18%, rgba(125, 211, 252, 0.28), transparent 16rem),
    rgba(248, 252, 255, 0.94);
}

.focus-screen.fullscreen {
  min-height: 100vh;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.timer {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 22px 10px;
}

.timer span {
  font-variant-numeric: tabular-nums;
  font-size: clamp(46px, 12vw, 82px);
  font-weight: 780;
  line-height: 1;
}

.timer small,
.focus-meta {
  color: var(--muted);
}

.focus-meta {
  justify-content: center;
}

.button-row {
  justify-content: center;
  flex-wrap: wrap;
}

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

.focus-actions {
  display: grid;
  justify-items: center;
  gap: 14px;
}

.chart {
  display: grid;
  grid-template-columns: repeat(var(--bar-count, 7), minmax(34px, 1fr));
  gap: 6px;
  min-height: 190px;
  overflow-x: auto;
  padding: 10px 0 2px;
}

.bar-item {
  display: grid;
  grid-template-rows: 24px 124px 22px;
  align-items: stretch;
  gap: 8px;
  min-width: 0;
}

.bar {
  align-self: end;
  width: 100%;
  min-height: 4px;
  border-radius: 8px 8px 3px 3px;
  background: linear-gradient(180deg, #7dd3fc, #0284c7);
}

.bar-label,
.bar-value {
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.bar-value {
  align-self: end;
  color: var(--ink);
  font-weight: 700;
}

.month-calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 7px;
}

.calendar-weekday {
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
  text-align: center;
}

.calendar-day {
  display: grid;
  align-content: space-between;
  min-height: 58px;
  padding: 8px;
  border: 1px solid rgba(200, 231, 245, 0.82);
  border-radius: 8px;
  color: var(--ink);
  background: #f7fcff;
}

.calendar-day.blank {
  border-color: transparent;
  background: transparent;
}

.calendar-date {
  font-size: 13px;
  font-weight: 760;
}

.calendar-minutes {
  color: var(--water-deep);
  font-size: 11px;
  font-weight: 720;
}

.calendar-day.level-1 {
  background: #e0f7ff;
}

.calendar-day.level-2 {
  background: #bae6fd;
}

.calendar-day.level-3 {
  background: #7dd3fc;
}

.calendar-day.level-4 {
  color: white;
  background: #0ea5e9;
}

.calendar-day.level-4 .calendar-minutes {
  color: white;
}

.placeholder-panel {
  min-height: 260px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 8px;
  text-align: center;
}

.placeholder-panel p {
  max-width: 28rem;
  color: var(--muted);
}

.muted-copy {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.muted-copy code {
  color: var(--water-deep);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.stack-form {
  display: grid;
  gap: 12px;
}

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

.group-select-field {
  margin-top: 14px;
}

.user-view.active {
  gap: 14px;
}

.user-profile-card,
.user-menu-panel,
.subpage-heading {
  border: 1px solid rgba(200, 231, 245, 0.86);
  border-radius: 8px;
  background: rgba(248, 252, 255, 0.96);
  box-shadow: var(--shadow);
}

.user-profile-card {
  padding: 16px;
}

.profile-main {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
}

.profile-avatar {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  color: white;
  background: linear-gradient(145deg, #7dd3fc 0%, #0ea5e9 58%, #075985 100%);
  box-shadow: 0 12px 24px rgba(14, 165, 233, 0.26);
  font-size: 24px;
  font-weight: 780;
}

.profile-copy {
  min-width: 0;
}

.profile-copy h2 {
  font-size: 22px;
}

.profile-copy p,
.profile-copy span,
.menu-copy small,
.subpage-heading p {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.user-menu-panel {
  overflow: hidden;
}

.menu-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  width: 100%;
  min-height: 68px;
  padding: 12px 14px;
  border: 0;
  border-bottom: 1px solid rgba(200, 231, 245, 0.74);
  color: var(--ink);
  background: transparent;
  text-align: left;
}

.menu-row:last-child {
  border-bottom: 0;
}

.menu-row:not(:disabled):hover {
  background: rgba(223, 245, 255, 0.68);
}

.menu-row:disabled {
  cursor: default;
  opacity: 0.62;
}

.menu-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  color: #075985;
  background: #dff5ff;
}

.menu-icon svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.group-detail-heading {
  justify-content: flex-start;
  align-items: center;
}

.guide-panel {
  display: grid;
  gap: 14px;
}

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

.guide-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  min-height: 112px;
  padding: 14px;
  border: 1px solid rgba(200, 231, 245, 0.82);
  border-radius: 8px;
  background: var(--surface-strong);
}

.guide-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  color: #075985;
  background: #dff5ff;
}

.guide-icon svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.guide-card h4 {
  margin: 0 0 5px;
  font-size: 16px;
}

.guide-card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.menu-copy {
  min-width: 0;
}

.menu-copy strong {
  display: block;
  font-size: 16px;
}

.menu-arrow {
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
}

.subpage-heading {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 12px;
}

.subpage-heading h2 {
  font-size: 22px;
}

.member-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.member-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.stat-chip {
  min-width: 82px;
  padding: 8px 10px;
  border-radius: 8px;
  color: #075985;
  background: #dff5ff;
  font-size: 13px;
  font-weight: 720;
  text-align: center;
}

.rank-badge {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-right: 8px;
  border-radius: 50%;
  color: white;
  background: var(--green);
  font-size: 13px;
  font-weight: 780;
}

.start-button {
  width: min(52vw, 178px);
  height: min(52vw, 178px);
  max-width: 178px;
  max-height: 178px;
  min-width: 132px;
  min-height: 132px;
  border: 0;
  border-radius: 50%;
  color: white;
  background:
    radial-gradient(circle at 32% 24%, rgba(255, 255, 255, 0.9), transparent 0 18%),
    linear-gradient(145deg, #7dd3fc 0%, #0ea5e9 54%, #0369a1 100%);
  box-shadow:
    0 22px 44px rgba(14, 165, 233, 0.34),
    inset 0 -12px 24px rgba(3, 105, 161, 0.28);
  font-size: 30px;
  font-weight: 780;
  letter-spacing: 0;
}

.start-button:hover {
  transform: translateY(-1px);
  background:
    radial-gradient(circle at 32% 24%, rgba(255, 255, 255, 0.92), transparent 0 18%),
    linear-gradient(145deg, #a5e7ff 0%, #0ea5e9 50%, #075985 100%);
}

.start-button:disabled {
  opacity: 0.82;
}

.modal {
  width: min(92vw, 480px);
  border: 0;
  padding: 0;
  background: transparent;
}

.modal::backdrop {
  background: rgba(23, 28, 24, 0.42);
}

.modal-content {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.image-preview,
.card-image {
  width: 100%;
  max-height: 260px;
  border-radius: 8px;
  object-fit: cover;
  background: #dff5ff;
}

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

.card-face {
  min-height: 220px;
  align-content: start;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.card-deck {
  display: grid;
  gap: 12px;
}

.card-stage {
  position: relative;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 48px;
  align-items: center;
  gap: 10px;
}

.card-stack {
  position: relative;
  cursor: grab;
  touch-action: pan-y;
}

.card-stack:active {
  cursor: grabbing;
}

.card-stack::before,
.card-stack::after {
  content: "";
  position: absolute;
  inset: 14px 22px -12px;
  z-index: 0;
  border: 1px solid rgba(125, 211, 252, 0.52);
  border-radius: 8px;
  background: rgba(248, 252, 255, 0.72);
}

.card-stack::after {
  inset: 26px 42px -24px;
  opacity: 0.58;
}

.card-stack .card-face {
  position: relative;
  z-index: 1;
}

.deck-arrow {
  width: 44px;
  min-height: 44px;
  border: 0;
  border-radius: 50%;
  color: #075985;
  background: #d8f1fb;
  box-shadow: 0 10px 22px rgba(14, 116, 144, 0.12);
  font-size: 30px;
  line-height: 1;
}

.deck-arrow:hover {
  color: white;
  background: var(--green);
}

.card-position {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 86px;
  max-width: min(420px, calc(100vw - 32px));
  transform: translateX(-50%) translateY(20px);
  padding: 12px 14px;
  border-radius: 8px;
  color: white;
  background: rgba(32, 36, 33, 0.92);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 680px) {
  .app-shell {
    padding-inline: 12px;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .section-heading {
    align-items: flex-start;
  }

  .section-heading .primary-button {
    min-width: 94px;
  }

  .chart {
    gap: 6px;
  }

  .month-calendar {
    gap: 5px;
  }

  .calendar-day {
    min-height: 50px;
    padding: 6px;
  }

  .calendar-minutes {
    font-size: 10px;
  }

  .card-stage {
    grid-template-columns: 1fr;
  }

  .deck-arrow {
    display: none;
  }

  .two-column,
  .member-row {
    grid-template-columns: 1fr;
  }

  .profile-main {
    grid-template-columns: 52px minmax(0, 1fr);
  }

  .profile-main .text-button {
    grid-column: 2;
    justify-self: start;
    min-height: 32px;
    padding: 0;
  }

  .profile-avatar {
    width: 52px;
    height: 52px;
    font-size: 22px;
  }

  .guide-grid {
    grid-template-columns: 1fr;
  }

  .member-stats {
    justify-content: flex-start;
  }
}

@media (min-width: 681px) {
  .view.active {
    grid-template-columns: 1fr;
  }

  .panel {
    padding: 16px;
  }
}
