:root {
  --paper: oklch(0.975 0.008 88);
  --paper-raised: oklch(0.99 0.006 88);
  --paper-hover: oklch(0.945 0.018 150);
  --ink: oklch(0.25 0.028 255);
  --ink-soft: oklch(0.44 0.022 255);
  --ink-muted: oklch(0.52 0.018 255);
  --rule: oklch(0.86 0.012 255 / 72%);
  --rule-strong: oklch(0.69 0.028 255 / 80%);
  --accent: oklch(0.42 0.075 245);
  --accent-soft: oklch(0.92 0.035 150);
  --focus: oklch(0.58 0.13 245);
  --radius-control: 8px;
  --radius-row: 10px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

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

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

body {
  min-height: 100%;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans Thai", "Leelawadee UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
}

.library-shell {
  width: calc(100% - 48px);
  max-width: 920px;
  margin: 0 auto;
  padding: 32px 0 56px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--rule);
}

.identity {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  text-decoration: none;
}

.identity-owner {
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 760;
  letter-spacing: 0.14em;
}

.identity-name {
  color: var(--ink-soft);
  font-size: 0.92rem;
  font-weight: 560;
}

.private-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  gap: 8px;
  padding: 8px 13px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.84rem;
  font-weight: 650;
  text-decoration: none;
  transition: color 180ms var(--ease-out), background-color 180ms var(--ease-out), border-color 180ms var(--ease-out);
}

.private-button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.private-button:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--paper-raised);
}

.private-button:active {
  background: var(--accent-soft);
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 48px;
  padding: 64px 0 56px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--ink-muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  color: var(--ink);
  font-size: 3rem;
  font-weight: 720;
  line-height: 1.12;
  letter-spacing: -0.045em;
}

.intro-copy {
  max-width: 42rem;
  margin: 16px 0 0;
  color: var(--ink-soft);
  line-height: 1.7;
}

.library-count {
  display: grid;
  min-width: 116px;
  padding: 14px 16px;
  border-top: 1px solid var(--rule-strong);
}

.count-number {
  color: var(--ink);
  font-size: 1.8rem;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.count-label {
  margin-top: 4px;
  color: var(--ink-muted);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 16px;
}

.section-heading h2 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.3;
}

.section-heading p {
  margin: 0;
  color: var(--ink-muted);
  font-size: 0.8rem;
}

.deck-list {
  border-top: 1px solid var(--rule);
}

.deck-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto 24px;
  align-items: center;
  min-height: 84px;
  gap: 16px;
  margin: 0 -12px;
  padding: 12px;
  border-bottom: 1px solid var(--rule);
  border-radius: var(--radius-row);
  transition: background-color 180ms var(--ease-out), transform 180ms var(--ease-out);
}

.deck-row:hover {
  background: var(--paper-hover);
  transform: translateX(3px);
}

.deck-number {
  color: var(--ink-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}

.deck-main {
  display: grid;
  min-width: 0;
  gap: 3px;
  color: var(--ink);
  text-decoration: none;
}

.deck-main:hover {
  color: var(--accent);
}

.deck-title {
  overflow: hidden;
  font-size: 0.98rem;
  font-weight: 620;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.deck-file {
  overflow: hidden;
  color: var(--ink-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.69rem;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.format-links {
  display: inline-flex;
  gap: 6px;
}

.format-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 7px 9px;
  border: 1px solid var(--rule);
  border-radius: 7px;
  background: var(--paper-raised);
  color: var(--ink-soft);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-decoration: none;
}

.format-links a:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.format-links a:active {
  background: var(--accent-soft);
}

.deck-arrow {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--ink-muted);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.deck-row:hover .deck-arrow {
  stroke: var(--accent);
}

a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--rule);
  color: var(--ink-muted);
  font-size: 0.76rem;
}

.site-footer a {
  color: var(--ink-soft);
  font-weight: 620;
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--accent);
}

@media (max-width: 680px) {
  .library-shell {
    width: calc(100% - 32px);
    padding-top: 20px;
  }

  .topbar {
    padding-bottom: 18px;
  }

  .private-button {
    min-height: 44px;
  }

  .identity {
    display: grid;
    gap: 1px;
  }

  .identity-name {
    font-size: 0.8rem;
  }

  .intro {
    grid-template-columns: 1fr;
    gap: 28px;
    padding: 48px 0 44px;
  }

  h1 {
    font-size: 2.35rem;
  }

  .library-count {
    grid-template-columns: auto 1fr;
    align-items: baseline;
    gap: 8px;
    min-width: 0;
    padding: 12px 0 0;
  }

  .count-number {
    font-size: 1.25rem;
  }

  .section-heading {
    display: block;
  }

  .section-heading p {
    margin-top: 4px;
  }

  .deck-row {
    grid-template-columns: 28px minmax(0, 1fr) 20px;
    gap: 10px;
    min-height: 0;
    margin-inline: -8px;
    padding: 15px 8px;
  }

  .deck-main {
    grid-column: 2;
  }

  .deck-title {
    font-size: 0.94rem;
    white-space: normal;
  }

  .format-links {
    grid-column: 2;
    margin-top: 4px;
  }

  .format-links a {
    min-height: 44px;
    padding-inline: 12px;
  }

  .deck-arrow {
    grid-column: 3;
    grid-row: 1;
  }

  .site-footer {
    display: grid;
    gap: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .private-button,
  .deck-row {
    transition: none;
  }

  .deck-row:hover {
    transform: none;
  }
}
