:root {
  color-scheme: light;

  /* Color */
  --color-accent: #d1ed29;
  --color-ink: #090909;
  --color-page: #faf9f6;
  --color-surface: #fefefe;
  --color-muted: #6b6b75;
  --color-icon-surface: #f2f7d5;

  /* Layout and spacing */
  --page-max-width: 440px;
  --page-reference-height: 956px;
  --space-1: 8px;
  --space-grid: 12px;
  --space-page: 14px;
  --space-card: 16px;
  --space-module: 20px;
  --space-section: 24px;
  --space-header: 26px;

  /* Radius */
  --radius-card: 24px;
  --radius-feature: 28px;
  --radius-pill: 999px;

  /* Type */
  --font-sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    "Noto Sans CJK SC", sans-serif;
  --text-brand: 32px;
  --text-feature: 40px;
  --text-metric: 52px;
  --text-card-title: 20px;
  --text-category: 16px;
  --text-body: 16px;
  --text-meta: 14px;
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 700;
  --weight-heavy: 900;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: #efede7;
  font-family: var(--font-sans);
  color: var(--color-ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  margin: 0;
  background: #efede7;
}

.demo-workspace {
  display: flex;
  min-height: 100vh;
  align-items: flex-start;
  justify-content: center;
  padding: 32px;
}

.device-frame {
  position: relative;
  flex: none;
}

.device-hardware {
  position: relative;
  padding: 12px;
  border: 3px solid #171717;
  border-radius: 58px;
  background: #171717;
  box-shadow: 0 24px 60px rgba(9, 9, 9, 0.22);
}

.dynamic-island {
  position: absolute;
  top: 20px;
  left: 50%;
  z-index: 50;
  width: 124px;
  height: 32px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: #090909;
  pointer-events: none;
}

.device-screen {
  position: relative;
  width: 440px;
  height: 956px;
  transform: translateZ(0);
  border-radius: 45px;
  background: var(--color-page);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.device-status-bar {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 40;
  display: flex;
  width: 100%;
  height: 54px;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  color: var(--color-ink);
  pointer-events: none;
}

.device-status-bar time {
  min-width: 54px;
  font-size: 15px;
  font-weight: var(--weight-semibold);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.2px;
}

.device-status-icons {
  display: flex;
  align-items: center;
  gap: 7px;
}

.device-status-icons svg {
  display: block;
  overflow: visible;
  fill: currentColor;
}

.device-status-icons [data-status-icon="wifi"] {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.device-status-icons [data-status-icon="battery"] rect:first-child {
  fill: none;
  stroke: currentColor;
}

.device-status-icons [data-status-icon="battery"] path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
}

.device-screen:has(> dialog[open])::after {
  content: "";
  position: fixed;
  z-index: 55;
  inset: 0;
  background: rgba(9, 9, 9, 0.38);
}

#app {
  width: 100%;
  max-width: var(--page-max-width);
  min-height: 956px;
  margin: 0;
  padding: var(--space-section) var(--space-page);
  padding-top: 76px;
  padding-bottom: calc(112px + env(safe-area-inset-bottom));
  background: var(--color-page);
}

.home-header {
  padding-inline: var(--space-grid);
}

.brand-lockup {
  display: flex;
  align-items: flex-start;
  gap: 4px;
}

.home-header .text-brand {
  font-size: var(--text-brand);
  font-weight: var(--weight-heavy);
  letter-spacing: -1.5px;
}

.brand-spark {
  flex: none;
  margin-top: -2px;
  color: var(--color-accent);
}

.brand-spark path {
  stroke: currentColor;
  stroke-width: 3.5;
  stroke-linecap: round;
}

.current-date {
  display: block;
  margin-top: 6px;
  color: var(--color-muted);
  font-size: var(--text-meta);
  font-weight: var(--weight-medium);
  line-height: 1.25;
}

.overview-card {
  position: relative;
  min-height: 154px;
  margin-top: var(--space-1);
  padding: 24px;
  overflow: hidden;
  background: var(--color-ink);
  border-radius: var(--radius-feature);
}

.overview-title {
  position: relative;
  z-index: 1;
  margin: 0;
  color: var(--color-accent);
  font-size: var(--text-feature);
  font-weight: var(--weight-heavy);
  letter-spacing: -2px;
  line-height: 1.08;
}

.record-summary {
  position: absolute;
  z-index: 1;
  bottom: 21px;
  left: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--color-surface);
  font-size: var(--text-meta);
  font-weight: var(--weight-regular);
  line-height: 1.4;
}

.record-summary span {
  font-variant-numeric: tabular-nums;
}

.summary-spark {
  flex: none;
  color: var(--color-accent);
}

.summary-spark path {
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linejoin: round;
}

.overview-illustration {
  position: absolute;
  top: 22px;
  right: 13px;
  width: 132px;
  height: 114px;
  color: var(--color-accent);
}

.overview-illustration path {
  stroke: currentColor;
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.category-filter {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.category-filter::-webkit-scrollbar {
  display: none;
}

.filter-button {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  color: var(--color-ink);
  font: inherit;
  font-size: var(--text-category);
  font-weight: var(--weight-semibold);
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.filter-button[aria-pressed="true"] {
  background: var(--color-accent);
  color: var(--color-ink);
}

.filter-button:focus-visible {
  outline: 2px solid var(--color-ink);
  outline-offset: -2px;
}

.record-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 12px;
  row-gap: 12px;
  margin-top: 16px;
}

.record-card {
  position: relative;
  height: 216px;
  min-height: 216px;
  min-width: 0;
  padding: 16px;
  overflow: hidden;
  border: 0;
  border-radius: 24px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.record-card:focus-visible {
  outline: 3px solid var(--color-ink);
  outline-offset: -3px;
}

.record-card--white {
  background: var(--color-surface);
  box-shadow: 0 8px 24px rgba(26, 26, 20, 0.06);
}

.record-card--accent {
  background: var(--color-accent);
  box-shadow: none;
}

.record-card[hidden] {
  display: none;
}

.record-card-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
}

.record-icon {
  display: grid;
  width: 40px;
  height: 40px;
  flex: none;
  place-items: center;
  border-radius: 50%;
  background: rgba(254, 254, 254, 0.62);
  overflow: hidden;
}

.record-icon-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.record-type-name {
  margin: 0;
  font-size: var(--text-category);
  font-weight: var(--weight-semibold);
  line-height: 1.2;
}

.record-card-content {
  position: static;
  margin-top: 12px;
}

.record-card[data-record-type="note"] .record-card-content {
  padding-bottom: 64px;
}

.record-title {
  margin: 0;
  font-size: 21px;
  font-weight: var(--weight-heavy);
  letter-spacing: -0.7px;
  line-height: 1.25;
}

.record-card[data-record-type="note"] .record-title {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.record-title--muted {
  color: var(--color-muted);
  font-size: 19px;
  font-weight: var(--weight-semibold);
}

.record-title--compact {
  font-size: 18px;
}

.record-original-date {
  display: block;
  margin-top: 3px;
  color: var(--color-muted);
  font-size: 12px;
  font-style: normal;
  font-weight: var(--weight-medium);
  line-height: 1.2;
}

.record-detail {
  margin: 3px 0 0;
  color: var(--color-muted);
  font-size: var(--text-meta);
  line-height: 1.35;
}

.record-detail--note {
  display: -webkit-box;
  margin-top: 8px;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.record-metric {
  margin: 8px 0 0;
  font-size: 42px;
  font-weight: var(--weight-heavy);
  letter-spacing: -2.5px;
  line-height: 1;
  white-space: nowrap;
}

.record-metric--currency {
  font-size: 38px;
}

.record-metric-unit {
  margin-left: -4px;
  font-size: 22px;
  font-weight: var(--weight-heavy);
  letter-spacing: -1px;
}

.record-meta {
  position: absolute;
  bottom: 15px;
  left: 16px;
  z-index: 2;
  margin: 0;
  color: var(--color-muted);
  font-size: 13px;
  font-style: normal;
  font-weight: var(--weight-medium);
  line-height: 1.3;
}

.record-meta--ink {
  color: var(--color-ink);
}

.record-art {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 1;
  display: block;
  width: 54px;
  height: 54px;
  object-fit: contain;
  pointer-events: none;
}

.floating-add {
  position: fixed;
  right: 24px;
  bottom: calc(30px + env(safe-area-inset-bottom));
  z-index: 10;
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--color-ink);
  box-shadow: 0 10px 24px rgba(9, 9, 9, 0.2);
  color: var(--color-accent);
  font: inherit;
  font-size: 36px;
  font-weight: var(--weight-regular);
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.floating-add:focus-visible,
.quick-entry-close:focus-visible,
.quick-entry-submit:focus-visible,
.quick-entry-form input:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

.quick-entry-dialog {
  position: fixed;
  z-index: 60;
  right: 0;
  bottom: 0;
  left: 0;
  width: min(100%, var(--page-max-width));
  max-width: var(--page-max-width);
  max-height: calc(100% - 16px);
  margin: auto auto 0;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
  border: 0;
  border-radius: 28px 28px 0 0;
  background: var(--color-page);
  color: var(--color-ink);
  overflow-y: auto;
  box-shadow: 0 -8px 32px rgba(9, 9, 9, 0.12);
}

.quick-entry-dialog::backdrop {
  background: rgba(9, 9, 9, 0.38);
}

.quick-entry-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-grid);
}

.quick-entry-header h2 {
  margin: 0;
  font-size: 24px;
  font-weight: var(--weight-heavy);
  line-height: 1.2;
}

.quick-entry-close {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--color-surface);
  color: var(--color-ink);
  font: inherit;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

.quick-entry-note {
  margin: 12px 0 0;
  color: var(--color-muted);
  font-size: var(--text-meta);
  line-height: 1.5;
}

.quick-entry-form {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

.quick-entry-form label {
  font-size: var(--text-body);
  font-weight: var(--weight-semibold);
}

.quick-entry-form input {
  width: 100%;
  min-height: 52px;
  padding: 0 14px;
  border: 1px solid rgba(9, 9, 9, 0.16);
  border-radius: 14px;
  background: var(--color-surface);
  color: var(--color-ink);
  font: inherit;
  font-size: var(--text-body);
}

.quick-entry-submit {
  min-height: 52px;
  margin-top: 6px;
  border: 0;
  border-radius: 14px;
  background: var(--color-accent);
  color: var(--color-ink);
  font: inherit;
  font-size: var(--text-body);
  font-weight: var(--weight-semibold);
  cursor: pointer;
}

.quick-entry-result {
  margin-top: 18px;
  padding: 16px;
  border-radius: 20px;
  background: var(--color-surface);
  box-shadow: 0 8px 24px rgba(26, 26, 20, 0.06);
}

.quick-entry-result[hidden] {
  display: none;
}

.quick-entry-save-feedback {
  margin: 0 0 6px;
  color: var(--color-ink);
  font-size: var(--text-body);
  font-weight: var(--weight-heavy);
}

.quick-entry-result-title {
  margin: 0 0 12px;
  color: var(--color-muted);
  font-size: var(--text-meta);
  font-weight: var(--weight-semibold);
}

.quick-entry-result-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.quick-entry-result-item {
  padding: 12px;
  border: 1px solid rgba(9, 9, 9, 0.08);
  border-radius: 14px;
  background: var(--color-page);
}

.quick-entry-result dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

.quick-entry-result dl div {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 8px;
}

.quick-entry-result dt {
  color: var(--color-muted);
  font-size: var(--text-meta);
}

.quick-entry-result dd {
  min-width: 0;
  margin: 0;
  color: var(--color-ink);
  font-size: var(--text-meta);
  font-weight: var(--weight-medium);
  overflow-wrap: anywhere;
}

.save-toast {
  position: fixed;
  left: 50%;
  bottom: calc(104px + env(safe-area-inset-bottom));
  z-index: 40;
  max-width: calc(var(--page-max-width) - 40px);
  padding: 10px 16px;
  transform: translateX(-50%);
  border-radius: var(--radius-pill);
  background: rgba(9, 9, 9, 0.86);
  box-shadow: 0 8px 24px rgba(9, 9, 9, 0.14);
  color: var(--color-surface);
  font-size: var(--text-meta);
  font-weight: var(--weight-semibold);
  line-height: 1.4;
  pointer-events: none;
  animation: save-toast-in 180ms ease-out both;
}

.save-toast[hidden] {
  display: none;
}

@keyframes save-toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 6px);
  }

  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

.record-detail-dialog {
  position: fixed;
  z-index: 60;
  inset: 0;
  width: min(100%, var(--page-max-width));
  max-width: var(--page-max-width);
  height: 100%;
  max-height: 100%;
  margin: auto;
  padding: 20px 14px calc(20px + env(safe-area-inset-bottom));
  border: 0;
  background: var(--color-page);
  color: var(--color-ink);
  overflow-x: hidden;
  overflow-y: auto;
}

.record-detail-dialog::backdrop {
  background: rgba(9, 9, 9, 0.38);
}

.record-detail-header {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  padding-inline: 8px;
}

.record-detail-header h1 {
  margin: 0;
  font-size: 22px;
  font-weight: var(--weight-heavy);
}

.record-detail-close {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--color-surface);
  color: var(--color-ink);
  font: inherit;
  font-size: 28px;
  cursor: pointer;
}

.record-detail-panel {
  display: flex;
  min-height: calc(100% - 84px - env(safe-area-inset-bottom));
  margin-top: 12px;
  padding: 24px 20px 20px;
  border-radius: 28px;
  background: var(--color-surface);
  box-shadow: 0 8px 28px rgba(26, 26, 20, 0.07);
}

.record-detail-content,
.record-detail-view,
.record-edit-form {
  display: flex;
  width: 100%;
  min-width: 0;
  flex-direction: column;
}

.record-detail-category {
  align-self: flex-start;
  margin: 0;
  padding: 7px 12px;
  border-radius: var(--radius-pill);
  background: var(--color-accent);
  font-size: var(--text-meta);
  font-weight: var(--weight-semibold);
}

.record-detail-view h2,
.record-edit-form h2 {
  margin: 20px 0 0;
  font-size: 30px;
  font-weight: var(--weight-heavy);
  letter-spacing: -1px;
}

.record-detail-fields {
  display: grid;
  gap: 0;
  margin: 24px 0 0;
}

.record-detail-row {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid rgba(9, 9, 9, 0.08);
}

.record-detail-row dt {
  color: var(--color-muted);
  font-size: var(--text-meta);
}

.record-detail-row dd {
  min-width: 0;
  margin: 0;
  font-size: var(--text-body);
  font-weight: var(--weight-medium);
  overflow-wrap: anywhere;
}

.record-detail-actions {
  display: grid;
  gap: 10px;
  margin-top: auto;
  padding-top: 24px;
}

.record-detail-actions button {
  min-height: 52px;
  border: 0;
  border-radius: 16px;
  font: inherit;
  font-size: var(--text-body);
  font-weight: var(--weight-semibold);
  cursor: pointer;
}

.record-detail-primary {
  background: var(--color-accent);
  color: var(--color-ink);
}

.record-detail-delete {
  background: transparent;
  color: #9c2d23;
}

.record-edit-cancel {
  background: var(--color-page);
  color: var(--color-ink);
}

.record-edit-errors {
  margin: 14px 0 0;
  color: #9c2d23;
  font-size: var(--text-meta);
  line-height: 1.45;
}

.record-edit-fields {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

.record-edit-fields label {
  display: grid;
  gap: 7px;
  font-size: var(--text-meta);
  font-weight: var(--weight-semibold);
}

.record-edit-fields input,
.record-edit-fields select,
.record-edit-fields textarea {
  width: 100%;
  min-height: 48px;
  padding: 11px 12px;
  border: 1px solid rgba(9, 9, 9, 0.16);
  border-radius: 13px;
  background: var(--color-page);
  color: var(--color-ink);
  font: inherit;
  font-size: var(--text-body);
}

.record-edit-fields textarea {
  min-height: 96px;
  resize: vertical;
}

.record-detail-close:focus-visible,
.record-detail-actions button:focus-visible,
.record-edit-fields input:focus-visible,
.record-edit-fields select:focus-visible,
.record-edit-fields textarea:focus-visible {
  outline: 2px solid var(--color-ink);
  outline-offset: 2px;
}

.text-brand,
.text-feature,
.text-metric,
.text-card-title,
.text-category,
.text-body,
.text-meta {
  margin: 0;
}

.text-brand {
  font-size: var(--text-brand);
  font-weight: var(--weight-heavy);
  line-height: 1.15;
}

.text-feature {
  font-size: var(--text-feature);
  font-weight: var(--weight-heavy);
  line-height: 1.1;
}

.text-metric {
  font-size: var(--text-metric);
  font-weight: var(--weight-heavy);
  line-height: 1;
}

.text-card-title {
  font-size: var(--text-card-title);
  font-weight: var(--weight-semibold);
  line-height: 1.3;
}

.text-category {
  font-size: var(--text-category);
  font-weight: var(--weight-semibold);
  line-height: 1.4;
}

.text-body {
  font-size: var(--text-body);
  font-weight: var(--weight-regular);
  line-height: 1.6;
}

.text-meta {
  color: var(--color-muted);
  font-size: var(--text-meta);
  font-weight: var(--weight-regular);
  line-height: 1.5;
}

@media (max-width: 340px) {
  .overview-title {
    font-size: 34px;
  }

  .overview-illustration {
    right: 8px;
    width: 108px;
    height: auto;
  }

  .record-card {
    padding: 13px;
  }

  .record-type-name {
    font-size: 14px;
  }

  .record-title {
    font-size: 18px;
  }

  .record-metric {
    font-size: 36px;
  }

  .record-meta {
    left: 13px;
  }

  .record-art {
    width: 44px;
    height: 44px;
  }

  .record-card[data-record-type="countdown"] .record-meta,
  .record-card[data-record-type="anniversary"] .record-meta {
    max-width: 70px;
    white-space: normal;
  }
}

@media (max-width: 820px) {
  .demo-workspace {
    align-items: center;
    flex-direction: column;
  }
}
