:root {
  --text: #1d1d1f;
  --muted: #6e6e73;
  --line: #d2d2d7;
  --line-soft: #e6e6e6;
  --wash: #f5f5f7;
  --track: #f2f2f2;
  --accent: #0071e3;
  --prop-time: #0a66c2;
  --prop-money: #0e7a45;
  --prop-watch: #b45309;
  --prop-make: #6941c6;
  --prop-none: #1d1d1f;
  --row-h: 44px;
  --move: 280ms;
  --fade: 200ms;
  color-scheme: light;
}

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

html {
  background: #fff;
}

body {
  margin: 0;
  background: #fff;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", Inter, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

[hidden] {
  display: none !important;
}

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

button {
  cursor: pointer;
}

a {
  color: var(--accent);
  text-underline-offset: 2px;
}

a:hover {
  text-decoration-thickness: 1px;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.skip {
  position: absolute;
  left: 8px;
  top: 8px;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid var(--line);
  transform: translateY(-150%);
  z-index: 5;
}

.skip:focus {
  transform: none;
}

.wrap {
  max-width: 980px;
  margin: 0 auto;
  padding-left: 24px;
  padding-right: 24px;
}

.site-title {
  padding-top: 48px;
  padding-bottom: 20px;
}

h1 {
  font-size: 40px;
  font-weight: 600;
  letter-spacing: -0.022em;
  line-height: 1.1;
}

.tabs-bar {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.tabs {
  display: flex;
  gap: 24px;
}

.tabs button {
  appearance: none;
  background: none;
  border: 0;
  border-bottom: 1px solid transparent;
  margin-bottom: -1px;
  padding: 10px 0 12px;
  color: var(--muted);
}

.tabs button[aria-selected="true"] {
  color: var(--text);
  border-bottom-color: var(--text);
}

main {
  padding-top: 28px;
  padding-bottom: 12px;
}

.empty {
  margin: 48px 0;
  color: var(--muted);
}

.segment {
  display: inline-flex;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  gap: 0;
  padding: 2px;
  border-radius: 9px;
  background: var(--wash);
  -webkit-overflow-scrolling: touch;
}

.segment button {
  appearance: none;
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  border-radius: 7px;
  padding: 6px 12px;
  font-size: 13px;
  line-height: 1.2;
  white-space: nowrap;
  color: var(--text);
}

.segment button[aria-checked="true"] {
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--line);
}

.caption,
.count {
  margin: 16px 0 12px;
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.chart {
  position: relative;
  height: calc(var(--row-h) * 15);
}

.chart-empty {
  margin: 0;
  color: var(--muted);
}

.row,
.fill {
  transition-property: transform, opacity;
  transition-duration: var(--move), var(--fade);
  transition-timing-function: cubic-bezier(0.22, 0.8, 0.24, 1), linear;
}

.no-move,
.no-move .fill {
  transition: none;
}

.row {
  position: absolute;
  left: 0;
  right: 0;
  top: 4px;
  height: calc(var(--row-h) - 8px);
  display: grid;
  grid-template-columns: 1.75rem minmax(14rem, 23rem) minmax(4rem, 1fr) 4.5rem 4.5rem;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  margin: 0;
  padding: 0 6px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  text-align: left;
  touch-action: manipulation;
}

.row:hover,
.row.is-on {
  background: var(--wash);
}

.row[data-leaving="1"] {
  pointer-events: none;
}

.rank,
.share {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.rank {
  text-align: right;
}

.name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.count,
.share {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.track {
  display: block;
  height: 8px;
  background: var(--track);
  border-radius: 1px;
  overflow: hidden;
}

.fill {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--prop-none);
  border-radius: 1px;
  transform: scaleX(0);
  transform-origin: left center;
}

.row[data-prop="time"] .fill { background: var(--prop-time); }
.row[data-prop="money"] .fill { background: var(--prop-money); }
.row[data-prop="watch"] .fill { background: var(--prop-watch); }
.row[data-prop="make"] .fill { background: var(--prop-make); }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 13px;
}

.legend li {
  display: flex;
  align-items: center;
  gap: 6px;
}

.swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--prop-none);
}

.swatch[data-prop="time"] { background: var(--prop-time); }
.swatch[data-prop="money"] { background: var(--prop-money); }
.swatch[data-prop="watch"] { background: var(--prop-watch); }
.swatch[data-prop="make"] { background: var(--prop-make); }

.use-mark {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 5px;
  border-radius: 2px;
  background: var(--prop-none);
  vertical-align: 0.05em;
}

.use-mark[data-prop="time"] { background: var(--prop-time); }
.use-mark[data-prop="money"] { background: var(--prop-money); }
.use-mark[data-prop="watch"] { background: var(--prop-watch); }
.use-mark[data-prop="make"] { background: var(--prop-make); }

#tab-topic {
  max-width: 16rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#topic-title {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

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

.card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-top-width: 3px;
  border-top-color: var(--prop-none);
  border-radius: 12px;
  background: #fff;
  color: inherit;
  text-decoration: none;
}

.card[data-prop="time"] { border-top-color: var(--prop-time); }
.card[data-prop="money"] { border-top-color: var(--prop-money); }
.card[data-prop="watch"] { border-top-color: var(--prop-watch); }
.card[data-prop="make"] { border-top-color: var(--prop-make); }

a.card:hover {
  background: var(--wash);
}

.card-meta,
.card-foot {
  color: var(--muted);
  font-size: 13px;
}

.card-quote {
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.card-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
}

.card-date {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}

.card-actions,
.saved-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.text-btn {
  appearance: none;
  border: 0;
  background: none;
  padding: 0;
  color: var(--accent);
  font-size: 13px;
}

.text-btn[aria-pressed="true"] {
  color: var(--text);
  font-weight: 600;
}

mark.hl {
  background: #f6e7b2;
  color: inherit;
  padding: 0 2px;
  border-radius: 2px;
}

#panel-saved h2 {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.saved-find {
  margin: 0 0 16px;
}

.saved-find input {
  display: block;
  width: min(100%, 280px);
  margin-top: 4px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

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

.saved-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  border-top-width: 3px;
  border-top-color: var(--prop-none);
}

.saved-card[data-prop="time"] { border-top-color: var(--prop-time); }
.saved-card[data-prop="money"] { border-top-color: var(--prop-money); }
.saved-card[data-prop="watch"] { border-top-color: var(--prop-watch); }
.saved-card[data-prop="make"] { border-top-color: var(--prop-make); }

.saved-highlight {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.014em;
  line-height: 1.35;
}

.saved-note {
  white-space: pre-wrap;
}

.saved-card .card-quote {
  color: var(--muted);
  font-size: 14px;
}

#save-dialog {
  width: min(560px, calc(100vw - 32px));
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: inherit;
}

#save-dialog::backdrop {
  background: rgba(0, 0, 0, 0.32);
}

#save-dialog h2 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}

.save-quote {
  max-height: 9rem;
  overflow: auto;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--wash);
  line-height: 1.45;
  user-select: text;
}

#save-dialog label {
  display: block;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

#save-dialog input,
#save-dialog textarea {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}

#save-dialog textarea {
  resize: vertical;
}

.save-hint {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.dialog-actions button {
  appearance: none;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 14px;
}

#save-confirm {
  background: var(--text);
  border-color: var(--text);
  color: #fff;
}

#save-remove {
  margin-right: auto;
}

.topic-more {
  margin: 16px 0 0;
}

.scrub {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.play,
.pager button {
  appearance: none;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
  line-height: 1;
}

.play:disabled,
.pager button:disabled {
  color: var(--muted);
  cursor: default;
}

.scrub input[type="range"] {
  flex: 1;
  min-width: 0;
  height: 32px;
  margin: 0;
  appearance: none;
  background: transparent;
  accent-color: var(--text);
  cursor: pointer;
}

.scrub input[type="range"]:focus-visible {
  outline: none;
}

.scrub input[type="range"]::-webkit-slider-runnable-track {
  height: 2px;
  background: var(--line);
}

.scrub input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -7px;
  border: 0;
  border-radius: 50%;
  background: var(--text);
}

.scrub input[type="range"]:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--accent);
}

.scrub input[type="range"]::-moz-range-track {
  height: 2px;
  background: var(--line);
  border: 0;
}

.scrub input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: 0;
  border-radius: 50%;
  background: var(--text);
}

.scrub input[type="range"]:focus-visible::-moz-range-thumb {
  box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--accent);
}

.scrub-date {
  min-width: 6.5rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  align-items: flex-end;
}

.filters label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

.filters select,
.filters input {
  min-width: 9rem;
  padding: 6px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  font-size: 16px;
  color: var(--text);
}

.filters input {
  min-width: 14rem;
  flex: 1;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 10px 12px 0;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: top;
}

th {
  font-weight: 600;
  white-space: nowrap;
}

th button {
  appearance: none;
  padding: 0;
  border: 0;
  background: none;
  font-weight: 600;
  text-align: left;
}

th[aria-sort="ascending"] button::after {
  content: " \2191";
}

th[aria-sort="descending"] button::after {
  content: " \2193";
}

td.nowrap {
  white-space: nowrap;
}

.quote {
  max-width: 36rem;
  white-space: pre-wrap;
}

.author {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.pager {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.page-label {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}

footer {
  margin-top: 48px;
  padding-top: 8px;
  padding-bottom: 72px;
  border-top: 1px solid var(--line);
}

footer section + section,
footer .updated {
  margin-top: 28px;
}

footer h2 {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 8px;
}

#method {
  max-width: 66ch;
  white-space: pre-wrap;
}

#product-list,
#changelog {
  list-style: none;
  margin: 0;
  padding: 0;
}

#product-list li,
#changelog li {
  padding: 10px 0;
  border-top: 1px solid var(--line-soft);
}

.product-meta,
.change-date,
.note,
.updated {
  color: var(--muted);
}

.note {
  margin-top: 4px;
}

.change-date {
  display: inline-block;
  min-width: 7rem;
  margin-right: 8px;
  font-variant-numeric: tabular-nums;
}

.updated {
  font-variant-numeric: tabular-nums;
}

@media (max-width: 640px) {
  :root {
    --row-h: 76px;
  }

  .wrap {
    padding-left: 16px;
    padding-right: 16px;
  }

  .site-title {
    padding-top: 28px;
  }

  h1 {
    font-size: 32px;
  }

  .segment {
    display: flex;
  }

  .row {
    grid-template-columns: 1.4rem minmax(0, 1fr) auto auto;
    grid-template-rows: 2.5rem 8px;
    align-content: center;
    column-gap: 0.5rem;
    row-gap: 6px;
  }

  .name {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.2;
  }

  .rank { grid-column: 1; grid-row: 1; }
  .name { grid-column: 2; grid-row: 1; }
  .count { grid-column: 3; grid-row: 1; }
  .share { grid-column: 4; grid-row: 1; }
  .track { grid-column: 1 / -1; grid-row: 2; }

  .scrub-date {
    min-width: 0;
  }

  .filters input,
  .filters select {
    width: 100%;
  }

  .filters label {
    flex: 1 1 100%;
  }

  #topic-title,
  #panel-saved h2 {
    font-size: 24px;
  }

  .saved-find input {
    width: 100%;
  }
}

@media (max-width: 800px) {
  .board {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .board {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --move: 0ms;
  }
}
