:root {
  color-scheme: light;
  --background: #fafafa;
  --paper: #ffffff;
  --text: #111111;
  --muted: #6b6b6b;
  --meta: #9b9b9b;
  --line: #ededed;
  --line-strong: #d8d8d8;
  --accent: #111111;
  --paste: #fff3d8;
  --delete: #f1f1f1;
  --insert: #eaf0f3;
}

[hidden] {
  display: none !important;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--background);
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  letter-spacing: 0;
}

a {
  color: inherit;
}

button,
input,
textarea,
select {
  font: inherit;
  letter-spacing: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto minmax(120px, 1fr);
  align-items: center;
  gap: 18px;
  min-height: 58px;
  padding: 0 28px;
  background: rgba(250, 250, 250, 0.96);
  border-bottom: 1px solid var(--line);
}

.brand {
  justify-self: start;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
}

.topbar-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
}

.quiet-link {
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
  white-space: nowrap;
}

.quiet-link:hover {
  color: var(--text);
}

.topbar-button {
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--paper);
  color: var(--text);
  cursor: pointer;
}

.account-link {
  display: inline-flex;
  align-items: center;
  justify-self: end;
  gap: 9px;
  min-height: 34px;
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
  white-space: nowrap;
}

.account-link:hover {
  color: var(--text);
}

.account-icon {
  position: relative;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--paper);
}

.account-icon::before,
.account-icon::after {
  position: absolute;
  left: 50%;
  background: var(--muted);
  content: "";
  transform: translateX(-50%);
}

.account-icon::before {
  top: 7px;
  width: 7px;
  height: 7px;
  border-radius: 999px;
}

.account-icon::after {
  bottom: 6px;
  width: 14px;
  height: 7px;
  border-radius: 999px 999px 6px 6px;
}

.home-shell,
.editor-shell,
.replay-shell,
.auth-shell,
.admin-shell,
.posts-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 24px 0 80px;
}

.write-shell {
  padding-top: 28px;
}

.home-intro,
.editor-intro,
.replay-heading,
.posts-heading {
  max-width: 720px;
  margin-bottom: 22px;
}

.home-intro {
  max-width: 980px;
}

.home-intro-row {
  display: grid;
  grid-template-columns: minmax(280px, 0.7fr) minmax(280px, 0.8fr);
  align-items: end;
  gap: 28px;
}

.kicker {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 14px;
}

h1,
h2 {
  margin: 0;
  font-weight: 560;
  letter-spacing: 0;
}

h1 {
  max-width: 780px;
  font-size: clamp(28px, 3.6vw, 40px);
  line-height: 1.08;
  overflow-wrap: anywhere;
}

h2 {
  margin-top: 28px;
  font-size: 17px;
}

.intro-copy {
  max-width: 660px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
}

.library-section {
  margin: 0;
  padding: 18px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.library-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.library-header h2 {
  margin: 0;
}

.library-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.segmented-control {
  display: inline-grid;
  grid-template-columns: repeat(2, auto);
  min-height: 34px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fbfbfb;
}

.segmented-control button {
  min-height: 32px;
  padding: 0 12px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
}

.segmented-control button[aria-pressed="true"] {
  background: var(--accent);
  color: #ffffff;
}

.writing-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
}

.writing-card {
  display: grid;
  gap: 8px;
  min-height: 152px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfbfb;
}

.writing-card[data-active="true"] {
  border-color: #b8c1c7;
  background: #ffffff;
}

.writing-list[data-view="list"] {
  grid-template-columns: 1fr;
  gap: 8px;
}

.writing-card[data-view="list"] {
  min-height: 0;
  grid-template-columns: minmax(172px, auto) minmax(150px, 0.8fr) minmax(220px, 1.2fr) minmax(220px, 1fr) minmax(244px, auto);
  align-items: center;
  gap: 14px;
}

.writing-card h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 560;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.writing-card[data-view="list"] h3 {
  font-size: 14px;
}

.writing-preview {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.writing-card:not([data-view="list"]) .writing-preview {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.writing-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: fit-content;
  min-height: 25px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}

.writing-status[data-status="published"] {
  border-color: #d7c691;
  background: #fff8e8;
  color: #6f5b25;
}

.writing-meta {
  margin: 0;
  color: var(--meta);
  font-size: 12px;
  line-height: 1.45;
}

.writing-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  align-self: end;
}

.writing-card[data-view="list"] .writing-actions {
  justify-self: end;
  align-self: center;
  justify-content: flex-end;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  min-width: 34px;
  height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--paper);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  line-height: 1;
}

.icon-button:hover {
  border-color: var(--accent);
}

.status-copy-button {
  width: 22px;
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  font-size: 11px;
}

.empty-list {
  display: grid;
  gap: 12px;
  justify-items: start;
  margin: 0;
  color: var(--meta);
  font-size: 13px;
}

.empty-list p {
  margin: 0;
}

.auth-shell {
  width: min(720px, calc(100% - 40px));
  padding-top: 48px;
}

.admin-shell {
  width: min(980px, calc(100% - 40px));
  padding-top: 40px;
}

.auth-panel,
.admin-panel {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.auth-form {
  display: grid;
  gap: 14px;
  max-width: 460px;
  margin-top: 22px;
}

.auth-form label,
.field-label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.auth-form input,
.inline-form input,
.settings-block select {
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fbfbfb;
  color: var(--text);
  outline: none;
}

.auth-form input:focus,
.inline-form input:focus,
.settings-block select:focus {
  outline: 2px solid #9aa8b1;
  outline-offset: 2px;
}

.page-message {
  margin: 18px 0 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfbfb;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.page-message[data-mode="ready"] {
  border-color: #cbd9cf;
  background: #f7fbf8;
  color: #4c6d57;
}

.page-message[data-mode="error"] {
  border-color: #e6c7c7;
  background: #fff7f7;
  color: #8a4a4a;
}

.inline-actions,
.pagination {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.settings-block {
  display: grid;
  gap: 12px;
  padding-top: 20px;
  margin-top: 20px;
  border-top: 1px solid var(--line);
}

.settings-block h2 {
  margin: 0;
}

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

.section-title-row select {
  width: auto;
  min-width: 150px;
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 8px;
}

.admin-table {
  display: grid;
  gap: 8px;
}

.admin-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 80px 100px 110px;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.admin-row strong,
.admin-row span {
  display: block;
}

.admin-row strong {
  color: var(--text);
}

.posts-list {
  display: grid;
  gap: 12px;
}

.post-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.post-card-header {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.author-avatar {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #f7f7f7;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}

.post-author {
  margin: 0;
  color: var(--text);
  font-size: 14px;
}

.post-author a {
  text-decoration: none;
}

.post-card h2 {
  margin: 0;
  font-size: 18px;
}

.post-card p,
.moderation-card p {
  color: var(--muted);
  line-height: 1.55;
}

.post-preview {
  white-space: pre-line;
}

.post-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}

.post-metrics span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
}

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

.moderation-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.moderation-card h3 {
  margin: 0;
  font-size: 16px;
}

.moderation-card p {
  margin: 8px 0 0;
}

.moderation-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  max-width: 300px;
}

.writer-layout,
.replay-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  align-items: start;
  gap: 24px;
}

.paper-wrap,
.replay-main {
  min-width: 0;
}

.title-input {
  display: block;
  width: 100%;
  min-height: 54px;
  margin-bottom: 10px;
  padding: 0 22px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  color: var(--text);
  outline: none;
  font-size: 19px;
  font-weight: 500;
}

.title-input::placeholder {
  color: #c4c4c4;
}

.paper-editor {
  position: relative;
  min-width: 0;
}

.paper-input,
.replay-paper,
.final-text {
  width: 100%;
  min-height: min(58vh, 560px);
  padding: 54px 58px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font-family: ui-serif, Georgia, "Times New Roman", serif;
  font-size: 22px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.paper-input {
  display: block;
  position: relative;
  z-index: 1;
  resize: vertical;
  outline: none;
  background: var(--paper);
}

.paper-input:focus,
.title-input:focus,
.segmented-control button:focus-visible,
.mini-actions button:focus-visible,
.social-option input:focus-visible,
.transport-button:focus-visible,
.topbar-button:focus-visible,
.button:focus-visible,
.timeline-range:focus-visible {
  outline: 2px solid #9aa8b1;
  outline-offset: 2px;
}

.paper-input::placeholder {
  color: #c4c4c4;
}

.paper-input[readonly],
.title-input[readonly] {
  background: #fbfbfb;
  color: var(--muted);
}

.indicator-layer,
.indicator-mirror {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.indicator-layer {
  z-index: 2;
  overflow: hidden;
}

.indicator-mirror {
  z-index: 0;
  width: 100%;
  min-height: min(58vh, 560px);
  padding: 54px 58px;
  border: 1px solid transparent;
  color: transparent;
  font-family: ui-serif, Georgia, "Times New Roman", serif;
  font-size: 22px;
  line-height: 1.65;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  visibility: hidden;
}

.social-marker {
  position: absolute;
  display: inline-flex;
  align-items: flex-start;
  transform: translateY(-2px);
}

.social-marker-line {
  display: block;
  width: 2px;
  height: 1.65em;
  border-radius: 999px;
  background: var(--marker-color);
  opacity: 0.88;
}

.social-marker-label {
  position: absolute;
  top: calc(-21px - var(--marker-label-offset, 0px));
  left: 6px;
  max-width: 126px;
  padding: 2px 6px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--marker-color);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 10.5px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-panel {
  position: sticky;
  top: 82px;
  padding: 20px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 24px;
  color: var(--text);
  font-size: 14px;
}

.status-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: #b9b9b9;
}

.status-dot[data-mode="ready"] {
  background: #5e7b67;
}

.status-dot[data-mode="busy"] {
  background: #a88842;
}

.status-dot[data-mode="error"] {
  background: #9c4c4c;
}

.panel-copy {
  margin: 14px 0 20px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.social-panel,
.copy-post-panel {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

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

.panel-section-header h2 {
  margin: 0;
}

.mini-actions {
  display: flex;
  gap: 6px;
}

.mini-actions button {
  min-height: 26px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fbfbfb;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
}

.mini-actions button:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.panel-hint {
  margin: 8px 0 12px;
  color: var(--meta);
  font-size: 12px;
  line-height: 1.45;
}

.social-options {
  display: grid;
  gap: 9px;
}

.social-option {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.3;
}

.social-option input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--accent);
}

.platform-swatch {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 999px;
}

.locked-notice {
  margin: 0 0 18px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfbfb;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.compact-stats,
.stats-list {
  margin: 0;
}

.compact-stats div,
.stats-list div {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

dt {
  color: var(--muted);
  font-size: 13px;
}

dd {
  margin: 0;
  color: var(--text);
  font-size: 13px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 42px;
  margin-top: 10px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--paper);
  color: var(--text);
  cursor: pointer;
}

.button:hover {
  border-color: #bdbdbd;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.button.disabled {
  border-color: var(--line);
  color: var(--meta);
  cursor: default;
  opacity: 0.68;
}

.button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.button.secondary {
  background: #fbfbfb;
}

.button.danger {
  border-color: #e6c7c7;
  color: #8a4a4a;
}

.button.compact {
  width: auto;
  min-height: 34px;
  margin-top: 0;
  font-size: 13px;
  white-space: nowrap;
}

.link-panel {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.link-panel a {
  display: block;
  margin: 6px 0 12px;
  color: var(--text);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.meta-label {
  margin: 0;
  color: var(--meta);
  font-size: 13px;
}

.publish-dialog {
  width: min(460px, calc(100% - 36px));
  padding: 26px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--text);
}

.publish-dialog::backdrop {
  background: rgba(17, 17, 17, 0.22);
}

.publish-dialog p {
  color: var(--muted);
  line-height: 1.55;
}

.dialog-summary {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfbfb;
}

.privacy-confirmation {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  margin: 18px 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
}

.privacy-confirmation input {
  margin-top: 3px;
}

.auth-secondary,
.replay-details,
.replay-history {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.auth-secondary summary,
.replay-details summary,
.replay-history summary {
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
}

.prose h2 {
  margin: 30px 0 8px;
  font-size: 20px;
}

.prose p {
  color: var(--muted);
  line-height: 1.65;
}

.replay-history > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  max-width: min(360px, calc(100% - 32px));
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(17, 17, 17, 0.92);
  color: #ffffff;
  font-size: 13px;
  line-height: 1.4;
  box-shadow: 0 12px 30px rgba(17, 17, 17, 0.12);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.dialog-actions .button {
  width: auto;
}

.replay-paper {
  min-height: 58vh;
}

.device-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.device-icon {
  position: relative;
  width: 12px;
  height: 18px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: var(--paper);
}

.device-badge[data-device="desktop"] .device-icon {
  width: 18px;
  height: 13px;
  border-radius: 2px;
}

.device-badge[data-device="desktop"] .device-icon::after {
  position: absolute;
  left: 6px;
  bottom: -5px;
  width: 5px;
  height: 4px;
  background: var(--line-strong);
  content: "";
}

.pause-note {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--muted);
  font-size: 13px;
}

.pause-clock {
  position: relative;
  width: 14px;
  height: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
}

.pause-clock::before,
.pause-clock::after {
  position: absolute;
  left: 6px;
  top: 3px;
  width: 1px;
  height: 4px;
  background: var(--muted);
  content: "";
}

.pause-clock::after {
  top: 6px;
  width: 4px;
  height: 1px;
}

.replay-controls {
  display: grid;
  grid-template-columns: 72px repeat(4, 52px) 46px 140px;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.replay-progress {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.replay-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.replay-legend span::before {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 6px;
  border-radius: 2px;
  background: var(--insert);
  content: "";
}

.replay-legend span[data-kind="paste"]::before {
  background: var(--paste);
}

.replay-legend span[data-kind="delete"]::before {
  background: var(--delete);
}

.replay-disclaimer {
  max-width: 760px;
}

.stats-summary dd {
  font-weight: 600;
}

.replay-controls .button {
  margin-top: 0;
}

.transport-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--paper);
  color: var(--text);
  cursor: pointer;
}

.transport-button.primary,
.transport-button[data-active="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.timeline-range {
  width: 100%;
  margin: 16px 0 8px;
  accent-color: #111111;
}

.trace-paste {
  background: var(--paste);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.trace-delete {
  background: var(--delete);
  color: var(--muted);
  text-decoration: line-through;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.trace-insert {
  background: var(--insert);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.jump-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.timeline-list {
  max-height: 360px;
  margin: 8px 0 0;
  padding: 0;
  overflow: auto;
  list-style: none;
  border-top: 1px solid var(--line);
}

.timeline-list li {
  border-bottom: 1px solid var(--line);
}

.timeline-list button {
  display: block;
  width: 100%;
  padding: 10px 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
  font-size: 13px;
}

.timeline-list li[data-kind="paste"] button {
  color: #7b6531;
}

.timeline-list li[data-kind="delete"] button {
  color: #6f6f6f;
  text-decoration: line-through;
}

.timeline-list li[data-kind="pause"] button {
  color: #6a7480;
  font-style: italic;
}

.timeline-list li[aria-current="step"] button {
  color: var(--text);
}

.final-section {
  margin-top: 42px;
}

.final-section h2 {
  margin-bottom: 14px;
}

.final-text {
  min-height: 260px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 900px) {
  .home-shell,
  .editor-shell,
  .replay-shell {
    width: min(100% - 24px, 720px);
    padding-top: 36px;
  }

  .home-intro-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .writer-layout,
  .replay-layout {
    grid-template-columns: 1fr;
  }

  .side-panel {
    position: static;
  }

  .paper-input,
  .indicator-mirror,
  .replay-paper,
  .final-text {
    min-height: 52vh;
    padding: 34px 28px;
    font-size: 19px;
  }

  .writing-card[data-view="list"] {
    grid-template-columns: 118px minmax(140px, 0.9fr) minmax(180px, 1.2fr);
  }

  .writing-card[data-view="list"] .writing-meta,
  .writing-card[data-view="list"] .writing-actions {
    grid-column: 2 / -1;
  }

  .writing-card[data-view="list"] .writing-actions {
    justify-self: start;
    flex-wrap: wrap;
  }

  .replay-controls {
    grid-template-columns: 72px repeat(4, minmax(44px, 1fr));
  }

  #show-final {
    grid-column: span 3;
  }
}

@media (max-width: 560px) {
  .topbar {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 10px;
    padding: 0 16px;
  }

  .topbar-nav {
    justify-content: flex-start;
    gap: 14px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .topbar-nav::-webkit-scrollbar {
    display: none;
  }

  .account-text {
    display: none;
  }

  h1 {
    font-size: 32px;
  }

  .intro-copy {
    font-size: 16px;
  }

  .paper-input,
  .indicator-mirror,
  .replay-paper,
  .final-text {
    min-height: 48vh;
    padding: 26px 20px;
    font-size: 18px;
  }

  .title-input {
    min-height: 48px;
    padding: 0 16px;
    font-size: 17px;
  }

  .library-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .library-actions {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .writing-card[data-view="list"] {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .writing-card[data-view="list"] .writing-meta,
  .writing-card[data-view="list"] .writing-actions {
    grid-column: auto;
  }

  .inline-form,
  .admin-row,
  .moderation-card {
    grid-template-columns: 1fr;
  }

  .section-title-row,
  .moderation-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .section-title-row select,
  .moderation-actions .button {
    width: 100%;
  }

  .topbar-button {
    display: none;
  }

  .replay-controls {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  #show-final {
    grid-column: span 2;
  }

  .replay-controls .transport-button,
  .replay-controls .button {
    width: 100%;
  }

  .dialog-actions {
    flex-direction: column-reverse;
  }

  .dialog-actions .button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
