:root {
  --blue: #0a82ff;
  --cyan: #24d7dd;
  --purple: #8a4dff;
  --ink: #202938;
  --muted: #728096;
  --line: rgba(98, 119, 148, 0.16);
  --soft: rgba(243, 249, 255, 0.88);
  --card: rgba(255, 255, 255, 0.86);
  --shadow: 0 20px 50px rgba(46, 91, 153, 0.16);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: #eaf3ff;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

body {
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

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

button {
  cursor: pointer;
}

.app-root {
  min-height: 100dvh;
}

.app-shell {
  position: relative;
  min-height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(circle at 12% 28%, rgba(255, 255, 255, 0.62), transparent 30%),
    linear-gradient(180deg, #e8f7ff 0%, #f8fbff 44%, #f0f5ff 100%);
}

.app-shell::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  z-index: 0;
  height: 248px;
  background:
    radial-gradient(circle at 74% 24%, rgba(255, 255, 255, 0.26), transparent 18%),
    radial-gradient(circle at 103% 36%, rgba(95, 239, 229, 0.62), transparent 28%),
    linear-gradient(135deg, #0879ff 0%, #10b8ff 55%, #27e3d6 100%);
}

.app-shell.tall-head::before {
  height: 310px;
}

.top-safe {
  position: relative;
  z-index: 2;
  padding: max(16px, env(safe-area-inset-top)) 24px 0;
  color: #fff;
}

.app-title {
  margin: 38px 0 0;
}

.app-title.center {
  text-align: center;
}

.app-title h1 {
  margin: 0;
  font-size: clamp(28px, 8vw, 36px);
  line-height: 1.08;
  font-weight: 850;
  letter-spacing: 0;
}

.app-title p {
  margin: 9px 0 0;
  color: rgba(255, 255, 255, 0.88);
  font-size: 15px;
  font-weight: 650;
}

.page {
  position: relative;
  z-index: 2;
  min-height: 100dvh;
  padding: 0 24px calc(98px + env(safe-area-inset-bottom));
}

.page.compact {
  padding-top: 16px;
}

.glass-card,
.white-card {
  border: 1px solid rgba(255, 255, 255, 0.84);
  border-radius: 24px;
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.glass-card {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(244, 253, 255, 0.74));
}

.white-card {
  background: rgba(255, 255, 255, 0.92);
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  min-height: 54px;
  padding: 6px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.7);
}

.tab {
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 19px;
  color: #536176;
  background: transparent;
  font-size: 15px;
  font-weight: 800;
}

.tab.active {
  color: #fff;
  background: linear-gradient(135deg, #087cff, #22c4eb);
  box-shadow: 0 8px 18px rgba(8, 124, 255, 0.26);
}

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

.muted {
  color: var(--muted);
}

.pill {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  width: fit-content;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(20, 146, 255, 0.12);
  color: #127ee5;
  font-size: 12px;
  font-weight: 850;
}

.pill.green {
  background: rgba(38, 186, 111, 0.12);
  color: #18985a;
}

.pill.red {
  background: rgba(255, 86, 99, 0.12);
  color: #e44c58;
}

.record-card {
  margin-top: 12px;
  padding: 16px;
}

.record-main {
  margin-top: 12px;
}

.record-main .row {
  align-items: center;
}

.record-main h2 {
  margin: 0;
  font-size: 32px;
  line-height: 1.1;
  font-weight: 950;
}

.record-main p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.45;
}

.timer-panel {
  display: grid;
  justify-items: end;
  align-content: center;
  min-width: 142px;
  min-height: 92px;
  padding: 12px 14px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.82);
}

.timer {
  color: var(--blue);
  font-size: clamp(30px, 8vw, 36px);
  line-height: 1;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}

.timer-panel small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-align: right;
}

.end-record-btn {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 50px;
  margin-top: 22px;
  border: 0;
  border-radius: 19px;
  color: #fff;
  background: linear-gradient(135deg, #ff4d62, #ff8a3d);
  box-shadow: 0 14px 28px rgba(255, 84, 88, 0.24);
  font-size: 16px;
  font-weight: 900;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.primary-btn,
.ghost-btn,
.danger-btn {
  display: inline-grid;
  place-items: center;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 18px;
  font-weight: 850;
  text-decoration: none;
}

.primary-btn {
  color: #fff;
  background: linear-gradient(135deg, #0585ff, #9748ff);
  box-shadow: 0 12px 24px rgba(81, 95, 255, 0.26);
}

.ghost-btn {
  color: #0b7bed;
  background: rgba(236, 245, 255, 0.92);
}

.danger-btn {
  color: #ef4a54;
  background: rgba(255, 239, 242, 0.98);
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
  margin-top: 12px;
  padding: 12px;
}

.category-tile {
  display: grid;
  gap: 6px;
  justify-items: center;
  min-height: 70px;
  padding: 8px 4px;
  border: 0;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  font-size: 12px;
  font-weight: 850;
}

.category-tile.active {
  color: #087cff;
  box-shadow: inset 0 0 0 2px #0d88ff;
}

.category-tile.hidden {
  opacity: 0.55;
}

.icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 15px;
  background: var(--icon-bg, linear-gradient(135deg, #eaf6ff, #dff4ff));
  color: var(--icon-color, #1d6fe8);
  font-size: 20px;
  font-weight: 900;
}

.timeline,
.ranking,
.result-card,
.settings-card {
  margin-top: 12px;
  padding: 12px 16px 6px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 15px;
  font-weight: 900;
}

.entry {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 0;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  color: inherit;
  text-align: left;
}

.entry:first-of-type {
  border-top: 0;
}

.entry h3 {
  margin: 0;
  overflow: hidden;
  font-size: 16px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry p {
  margin: 4px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.duration {
  color: #0b7bed;
  text-align: right;
  font-size: 13px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.fab {
  position: fixed;
  right: 24px;
  bottom: calc(86px + env(safe-area-inset-bottom));
  z-index: 10;
  width: 76px;
  height: 76px;
  border: 0;
  border-radius: 28px;
  color: #fff;
  background: linear-gradient(145deg, #00a9ff, #9b48ff);
  box-shadow: 0 18px 34px rgba(56, 104, 255, 0.34);
  font-size: 30px;
}

.fab span {
  display: block;
  margin-top: -5px;
  font-size: 11px;
  font-weight: 900;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  min-height: calc(78px + env(safe-area-inset-bottom));
  padding: 9px 16px calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(155, 171, 192, 0.2);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(18px);
}

.nav-item {
  display: grid;
  gap: 4px;
  justify-items: center;
  align-content: center;
  border: 0;
  background: transparent;
  color: #647086;
  font-size: 11px;
  font-weight: 800;
}

.nav-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 12px;
  font-size: 18px;
}

.nav-item.active {
  color: #087cff;
}

.nav-item.active .nav-icon {
  color: #fff;
  background: linear-gradient(135deg, #087cff, #22bffc);
}

.chart-card {
  margin-top: 16px;
  padding: 18px 16px 16px;
}

.donut-wrap {
  position: relative;
  height: 322px;
  margin-top: 4px;
}

.donut-viz {
  position: absolute;
  left: 50%;
  top: 56px;
  display: grid;
  place-items: center;
  width: 232px;
  height: 232px;
  border-radius: 50%;
  transform: translateX(-50%);
  background: var(--segments);
  box-shadow:
    0 16px 36px rgba(40, 99, 167, 0.18),
    inset 0 0 0 2px rgba(255, 255, 255, 0.7);
}

.donut-viz::after {
  content: "";
  position: absolute;
  inset: 58px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.9);
}

.donut-center {
  position: relative;
  z-index: 2;
  text-align: center;
}

.donut-center strong {
  display: block;
  font-size: 23px;
  font-weight: 950;
}

.donut-center span {
  color: #748094;
  font-size: 12px;
  font-weight: 750;
}

.slice-label {
  position: absolute;
  z-index: 3;
  color: #fff;
  font-size: 15px;
  font-weight: 950;
  line-height: 1;
  text-shadow: 0 1px 4px rgba(26, 41, 66, 0.28);
  transform: translate(-50%, -50%);
}

.chart-link {
  position: absolute;
  z-index: 1;
  width: var(--w);
  height: 0;
  border-top: 2px dashed rgba(88, 203, 229, 0.55);
  transform: rotate(var(--r));
  transform-origin: left center;
}

.chart-tag {
  position: absolute;
  z-index: 4;
  display: grid;
  justify-items: center;
  gap: 5px;
  width: 68px;
  color: #202938;
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.tag-bubble {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 22px rgba(41, 85, 143, 0.14);
  font-size: 22px;
}

.rank-row {
  display: grid;
  grid-template-columns: 24px 38px minmax(0, 1fr) 64px;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.rank-row:first-of-type {
  border-top: 0;
}

.rank-index {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #e8eef6;
  color: #6b7688;
  font-size: 11px;
  font-weight: 900;
}

.rank-row:nth-of-type(1) .rank-index {
  background: #ff5a66;
  color: #fff;
}

.rank-row:nth-of-type(2) .rank-index {
  background: #2495ff;
  color: #fff;
}

.rank-row:nth-of-type(3) .rank-index {
  background: #37c9c9;
  color: #fff;
}

.rank-label strong {
  display: block;
  overflow: hidden;
  font-size: 15px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar {
  position: relative;
  height: 6px;
  margin-top: 7px;
  overflow: hidden;
  border-radius: 6px;
  background: #edf1f7;
}

.bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #087cff, #24cde1);
}

.rank-time {
  text-align: right;
  font-size: 13px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.searchbar,
.input-box {
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  border: 0;
  border-radius: 22px;
  outline: none;
  background: rgba(255, 255, 255, 0.36);
  color: #fff;
  font-weight: 800;
}

.searchbar::placeholder {
  color: rgba(255, 255, 255, 0.78);
}

.filter-card,
.export-card {
  margin-top: 14px;
  padding: 14px 16px;
}

.seg-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 12px;
}

.seg {
  display: grid;
  place-items: center;
  min-height: 38px;
  border: 0;
  border-radius: 16px;
  background: rgba(248, 250, 253, 0.9);
  color: #4f5d72;
  font-size: 13px;
  font-weight: 850;
}

.seg.active {
  color: #fff;
  background: linear-gradient(135deg, #087cff, #24c9e5);
}

.date-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin-top: 12px;
}

.date-box,
.select-box {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 0 12px;
  border: 0;
  border-radius: 16px;
  outline: none;
  background: rgba(248, 250, 253, 0.92);
  color: var(--ink);
  text-align: center;
  font-size: 16px;
  font-weight: 800;
}

.select-box {
  appearance: none;
  text-align: left;
}

.export-hero {
  position: absolute;
  right: 28px;
  top: 96px;
  display: grid;
  place-items: center;
  width: 120px;
  height: 96px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 56px;
  font-weight: 900;
  transform: rotate(3deg);
}

.check-row {
  display: grid;
  grid-template-columns: 28px 36px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 9px 0;
  border-top: 1px solid var(--line);
}

.check-row:first-child {
  border-top: 0;
}

.checkbox {
  display: grid;
  place-items: center;
  width: 23px;
  height: 23px;
  border-radius: 8px;
  color: #fff;
  background: #1286ff;
  font-size: 14px;
  font-weight: 950;
}

.file-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  margin-top: 10px;
  padding: 9px 12px;
  border-radius: 16px;
  background: rgba(248, 250, 253, 0.9);
  font-size: 13px;
}

.file-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.privacy-card {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin-top: 18px;
  padding: 18px;
}

.privacy-card h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 900;
}

.privacy-card p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.category-manage-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.manage-card {
  padding: 15px;
  border: 0;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 14px 34px rgba(60, 95, 153, 0.11);
  color: var(--ink);
  text-align: left;
}

.status-tag {
  display: inline-grid;
  place-items: center;
  min-width: 42px;
  height: 24px;
  margin-top: 8px;
  border-radius: 999px;
  background: rgba(36, 190, 109, 0.13);
  color: #18a259;
  font-size: 12px;
  font-weight: 900;
}

.status-tag.off {
  background: rgba(255, 91, 91, 0.12);
  color: #e55757;
}

.drag {
  margin-left: auto;
  color: #a9b1bf;
  font-size: 20px;
}

.notice {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 17px;
  background: rgba(32, 151, 255, 0.09);
  color: #1e6db5;
  font-size: 12px;
  line-height: 1.45;
}

.notice.warn {
  background: rgba(255, 181, 63, 0.16);
  color: #9a6300;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  align-items: end;
  background: rgba(19, 37, 60, 0.24);
  backdrop-filter: blur(6px);
}

.modal {
  max-height: calc(92dvh - env(safe-area-inset-top));
  overflow: auto;
  margin: 0;
  padding: 20px 24px calc(24px + env(safe-area-inset-bottom));
  border-radius: 28px 28px 0 0;
  background:
    radial-gradient(circle at 16% 10%, rgba(52, 194, 255, 0.18), transparent 26%),
    rgba(255, 255, 255, 0.96);
  box-shadow: 0 -24px 55px rgba(32, 62, 100, 0.18);
}

.modal h2 {
  margin: 0 0 14px;
  font-size: 24px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.form-field {
  display: grid;
  gap: 6px;
}

.form-field.full {
  grid-column: 1 / -1;
}

.form-field label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.form-field input,
.form-field textarea,
.form-field select {
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  border: 0;
  border-radius: 16px;
  outline: none;
  background: #f3f7fc;
  color: var(--ink);
  font-weight: 800;
}

.form-field textarea {
  min-height: 86px;
  padding-top: 12px;
  resize: vertical;
}

.toast {
  position: fixed;
  left: 24px;
  right: 24px;
  bottom: calc(96px + env(safe-area-inset-bottom));
  z-index: 60;
  padding: 13px 16px;
  border-radius: 18px;
  background: rgba(27, 43, 67, 0.92);
  color: #fff;
  box-shadow: 0 18px 40px rgba(25, 43, 71, 0.22);
  font-size: 13px;
  font-weight: 800;
}

.empty {
  padding: 28px 18px;
  color: var(--muted);
  text-align: center;
  font-size: 14px;
}

.backup-banner {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  color: #1767b0;
  font-size: 13px;
  font-weight: 800;
}

.hidden-input {
  display: none;
}

@media (min-width: 720px) {
  body {
    display: grid;
    place-items: start center;
  }

  .app-root {
    width: 430px;
    min-height: 100dvh;
  }

  .app-shell {
    width: 430px;
    min-height: 956px;
    box-shadow: 0 26px 80px rgba(26, 78, 140, 0.22);
  }

  .app-shell::before {
    width: 430px;
    left: 50%;
    transform: translateX(-50%);
  }

  .bottom-nav {
    left: 50%;
    width: 430px;
    transform: translateX(-50%);
  }

  .fab {
    left: calc(50% + 115px);
    right: auto;
  }

  .modal-backdrop {
    left: 50%;
    width: 430px;
    transform: translateX(-50%);
  }
}

@media (max-width: 380px) {
  .page {
    padding-left: 16px;
    padding-right: 16px;
  }

  .category-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .timer {
    font-size: 30px;
  }

  .timer-panel {
    min-width: 126px;
  }

  .category-manage-grid {
    grid-template-columns: 1fr;
  }
}
