:root {
  --ink: #18221d;
  --ink-soft: #4e5b54;
  --paper: #f4f0e6;
  --paper-deep: #e8e1d2;
  --white: #fffdf8;
  --accent: #d9614c;
  --accent-dark: #aa4232;
  --sage: #b9c3b0;
  --sage-light: #dce2d7;
  --line: rgba(24, 34, 29, 0.16);
  --line-strong: rgba(24, 34, 29, 0.28);
  --success: #2b7550;
  --warning: #a66a20;
  --danger: #a64036;
  --shadow: 0 22px 70px rgba(24, 34, 29, 0.11);
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", sans-serif;
  --serif: "Iowan Old Style", "Yu Mincho", "Hiragino Mincho ProN", "Noto Serif JP", Georgia, serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--sans);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(217, 97, 76, 0.35);
  outline-offset: 3px;
}

.hidden {
  display: none !important;
}

.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;
}

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

.section-shell {
  width: min(1180px, calc(100% - 48px));
  margin-inline: auto;
}

.site-header {
  position: relative;
  z-index: 20;
  min-height: 76px;
  padding: 16px clamp(24px, 4vw, 64px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(244, 240, 230, 0.93);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.brand-mark {
  width: 35px;
  height: 35px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--paper);
  background: var(--ink);
  font-family: var(--serif);
  font-size: 1rem;
  letter-spacing: 0;
}

.header-actions,
.hero-actions,
.proof-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.button {
  min-height: 46px;
  padding: 10px 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  font-weight: 700;
  transition: transform 160ms ease, background 160ms ease, color 160ms ease, border-color 160ms ease, opacity 160ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

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

.button-small {
  min-height: 40px;
  padding: 8px 17px;
  font-size: 0.88rem;
}

.button-primary {
  color: #fff;
  background: var(--accent);
  box-shadow: 0 8px 24px rgba(217, 97, 76, 0.23);
}

.button-primary:hover:not(:disabled) {
  background: var(--accent-dark);
}

.button-secondary {
  color: var(--paper);
  background: var(--ink);
}

.button-ghost {
  color: var(--ink);
  border-color: var(--line-strong);
  background: transparent;
}

.button-ghost:hover:not(:disabled) {
  background: rgba(24, 34, 29, 0.06);
}

.text-link,
.text-button {
  color: var(--ink);
  font-weight: 700;
  text-underline-offset: 4px;
}

.text-button {
  padding: 0;
  border: 0;
  cursor: pointer;
  background: transparent;
  text-decoration: underline;
}

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

.eyebrow {
  margin: 0 0 16px;
  color: var(--accent-dark);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.hero {
  min-height: 560px;
  padding-block: clamp(70px, 10vw, 130px);
}

.hero h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(3.2rem, 7vw, 6.9rem);
  font-weight: 500;
  line-height: 1.02;
  letter-spacing: -0.055em;
}

.hero-lead {
  max-width: 880px;
  margin: 30px 0 0;
  color: var(--ink-soft);
  font-size: clamp(1rem, 1.5vw, 1.2rem);
  line-height: 2;
}

.hero-actions {
  margin-top: 38px;
  gap: 24px;
  flex-wrap: wrap;
}

.recording-dot,
.status-dot {
  width: 10px;
  height: 10px;
  display: inline-block;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 5px rgba(217, 97, 76, 0.14);
}

.recording-dot.paused,
.status-dot.paused {
  background: var(--warning);
  box-shadow: 0 0 0 5px rgba(166, 106, 32, 0.13);
}

.recording-dot.verified,
.status-dot.verified {
  background: var(--success);
  box-shadow: 0 0 0 5px rgba(43, 117, 80, 0.13);
}

.principles {
  padding-block: 42px 100px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--line);
}

.principles article {
  padding: 34px 38px;
  border-right: 1px solid var(--line);
}

.principles article:first-child {
  padding-left: 0;
}

.principles article:last-child {
  padding-right: 0;
  border-right: 0;
}

.principle-number {
  color: var(--accent-dark);
  font-family: var(--serif);
  font-size: 0.85rem;
}

.principles h2 {
  margin: 14px 0 9px;
  font-family: var(--serif);
  font-size: 1.55rem;
  font-weight: 600;
}

.principles p {
  margin: 0;
  color: var(--ink-soft);
}

.articles-section {
  padding-block: 100px;
}

.section-heading {
  margin-bottom: 42px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 40px;
}

.section-heading h2,
.process-intro h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(2.1rem, 4vw, 3.9rem);
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.03em;
}

.section-heading > p {
  margin: 0 0 8px;
  color: var(--ink-soft);
}

.article-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.article-card,
.loading-card,
.empty-card {
  min-height: 260px;
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 253, 248, 0.55);
}

.article-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.article-card:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  box-shadow: 0 18px 40px rgba(24, 34, 29, 0.08);
}

.article-card-top,
.article-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.article-card-top {
  color: var(--ink-soft);
  font-size: 0.8rem;
}

.article-card h3 {
  margin: 28px 0 12px;
  font-family: var(--serif);
  font-size: clamp(1.5rem, 3vw, 2.3rem);
  font-weight: 600;
  line-height: 1.35;
}

.article-card p {
  margin: 0;
  color: var(--ink-soft);
}

.article-card-footer {
  margin-top: auto;
  padding-top: 30px;
  font-size: 0.82rem;
}

.evidence-pill {
  /*padding: 5px 10px;*/
  /*border-radius: 999px;*/
  /*color: var(--ink-soft);*/
  /*background: rgba(43, 117, 80, 0.1);*/
  /*font-weight: 700;*/
}

.evidence-pill.invalid {
  color: var(--danger);
  background: rgba(166, 64, 54, 0.1);
}

.empty-card {
  grid-column: 1 / -1;
  min-height: 220px;
  display: grid;
  place-items: center;
  text-align: center;
}

.disclaimer,
.evidence-disclaimer {
  margin-bottom: 100px;
  padding: 28px 32px;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 30px;
  border: 1px solid var(--line);
  border-radius: 18px;
  color: var(--ink-soft);
  background: rgba(185, 195, 176, 0.16);
}

.disclaimer strong,
.evidence-disclaimer strong {
  color: var(--ink);
}

.disclaimer p,
.evidence-disclaimer p {
  margin: 0;
}

.site-footer {
  min-height: 120px;
  padding-block: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.82rem;
  letter-spacing: 0.1em;
}

/* Editor */
.editor-page {
  height: 100vh;
  overflow: hidden;
  background: #ddd8cc;
}

.editor-header {
  position: sticky;
  top: 0;
  height: 70px;
  min-height: 70px;
  padding-inline: 24px;
  background: rgba(244, 240, 230, 0.97);
}

.editor-status {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.editor-status .status-dot {
  width: 7px;
  height: 7px;
  box-shadow: none;
}

.editor-layout {
  height: calc(100vh - 70px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 370px;
}

.writing-pane {
  overflow: auto;
  padding: 54px clamp(28px, 6vw, 92px) 100px;
}

.writing-paper {
  width: min(820px, 100%);
  min-height: calc(100vh - 170px);
  margin-inline: auto;
  padding: clamp(42px, 7vw, 84px) clamp(34px, 8vw, 90px);
  border: 1px solid rgba(24, 34, 29, 0.08);
  background: var(--white);
  box-shadow: 0 14px 50px rgba(24, 34, 29, 0.08);
}

.title-input,
.body-input {
  width: 100%;
  padding: 0;
  border: 0;
  outline: none;
  resize: none;
  color: var(--ink);
  background: transparent;
}

.title-input {
  min-height: 112px;
  overflow: hidden;
  font-family: var(--serif);
  font-size: clamp(2.15rem, 5vw, 4.25rem);
  font-weight: 600;
  line-height: 1.17;
  letter-spacing: -0.04em;
}

.title-input::placeholder,
.body-input::placeholder {
  color: rgba(24, 34, 29, 0.26);
}

.title-rule {
  width: 64px;
  height: 3px;
  margin: 30px 0 40px;
  background: var(--accent);
}

.body-input {
  min-height: 900px;
  font-family: var(--serif);
  font-size: 1.08rem;
  line-height: 2.15;
}

.title-input:disabled,
.body-input:disabled {
  color: var(--ink);
  -webkit-text-fill-color: var(--ink);
  opacity: 1;
}

.editor-sidebar {
  overflow-y: auto;
  padding: 24px;
  border-left: 1px solid var(--line);
  background: var(--paper);
}

.side-card {
  margin-bottom: 16px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(255, 253, 248, 0.62);
}

.side-card h2 {
  margin: 0;
  font-size: 0.93rem;
}

.side-card > p {
  margin: 10px 0 0;
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.side-card-heading {
  display: flex;
  align-items: center;
  gap: 11px;
}

.split-heading {
  justify-content: space-between;
}

.split-heading span {
  color: var(--ink-soft);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.metric-list {
  margin: 20px 0 0;
}

.metric-list > div {
  padding: 9px 0;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
}

.metric-list > div:last-child {
  border-bottom: 0;
}

.metric-list dt {
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.metric-list dd {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 800;
}

.hash-chip {
  margin-top: 16px;
  padding: 13px;
  border-radius: 11px;
  background: rgba(24, 34, 29, 0.06);
}

.hash-chip span {
  display: block;
  color: var(--ink-soft);
  font-size: 0.68rem;
}

.hash-chip code {
  display: block;
  margin-top: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.72rem;
  white-space: nowrap;
}

.field-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.76rem;
  font-weight: 800;
}

.text-field {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: var(--ink);
  background: var(--white);
}

.field-help {
  margin: 7px 0 0;
  color: var(--ink-soft);
  font-size: 0.72rem;
}

.preview-card {
  min-height: 270px;
}

.preview-body {
  max-height: 420px;
  margin-top: 18px;
  overflow-y: auto;
  font-size: 0.82rem;
}

.evidence-note {
  background: rgba(185, 195, 176, 0.22);
}

.toast {
  position: fixed;
  z-index: 80;
  left: 50%;
  bottom: 28px;
  max-width: min(460px, calc(100% - 40px));
  padding: 12px 18px;
  border-radius: 999px;
  color: #fff;
  background: var(--ink);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 180ms ease, transform 180ms ease;
  font-size: 0.85rem;
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.error {
  background: var(--danger);
}

.modal-backdrop {
  position: fixed;
  z-index: 100;
  inset: 0;
  padding: 24px;
  display: grid;
  place-items: center;
  background: rgba(24, 34, 29, 0.5);
  backdrop-filter: blur(9px);
}

.modal-card {
  width: min(480px, 100%);
  padding: 38px;
  border-radius: 22px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.modal-card h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 2.2rem;
}

.modal-card > p:not(.eyebrow) {
  margin: 12px 0 24px;
  color: var(--ink-soft);
}

.modal-card .button {
  width: 100%;
  margin: 14px 0;
}

.modal-card .text-link {
  display: block;
  text-align: center;
  font-size: 0.82rem;
}

/* Published article */
.post-shell {
  width: min(1120px, calc(100% - 48px));
  margin-inline: auto;
}

.post-loading {
  min-height: 70vh;
  display: grid;
  place-items: center;
  color: var(--ink-soft);
}

.published-article {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: clamp(80px, 11vw, 150px) 0 130px;
}

.article-header {
  margin-bottom: 68px;
  text-align: center;
}

.article-header h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(2.7rem, 7vw, 5.9rem);
  font-weight: 600;
  line-height: 1.14;
  letter-spacing: -0.05em;
}

.article-byline {
  margin-top: 28px;
  display: flex;
  justify-content: center;
  gap: 9px;
  color: var(--ink-soft);
  font-size: 0.86rem;
}

.markdown-body {
  overflow-wrap: anywhere;
}

.markdown-body > :first-child {
  margin-top: 0;
}

.markdown-body > :last-child {
  margin-bottom: 0;
}

.markdown-body p,
.markdown-body li {
  font-family: var(--serif);
}

.markdown-body p {
  margin: 0 0 1.7em;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
  margin: 2.2em 0 0.7em;
  font-family: var(--serif);
  line-height: 1.35;
}

.markdown-body h1 {
  font-size: 2.1em;
}

.markdown-body h2 {
  font-size: 1.65em;
}

.markdown-body h3 {
  font-size: 1.25em;
}

.markdown-body a {
  color: var(--accent-dark);
  text-underline-offset: 4px;
}

.markdown-body blockquote {
  margin: 2em 0;
  padding: 0.25em 0 0.25em 1.25em;
  border-left: 3px solid var(--accent);
  color: var(--ink-soft);
  font-family: var(--serif);
}

.markdown-body pre {
  margin: 2em 0;
  padding: 20px;
  overflow-x: auto;
  border-radius: 12px;
  color: var(--paper);
  background: var(--ink);
  font-size: 0.84em;
  line-height: 1.65;
}

.markdown-body code:not(pre code) {
  padding: 0.12em 0.35em;
  border-radius: 5px;
  background: rgba(24, 34, 29, 0.08);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.86em;
}

.article-content {
  font-size: clamp(1.02rem, 1.6vw, 1.17rem);
  line-height: 2.15;
}

.process-section {
  margin-bottom: 110px;
  padding: clamp(40px, 7vw, 82px);
  border-radius: 32px;
  background: var(--ink);
  color: var(--paper);
}

.process-intro {
  margin-bottom: 40px;
}

.process-intro .eyebrow {
  color: #ef957f;
}

.process-intro p:last-child {
  margin: 14px 0 0;
  color: rgba(244, 240, 230, 0.68);
}

.proof-stats {
  margin: 28px 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid rgba(244, 240, 230, 0.14);
  border-radius: 16px;
  overflow: hidden;
}

.proof-stats > div {
  padding: 24px;
  border-right: 1px solid rgba(244, 240, 230, 0.14);
}

.proof-stats > div:last-child {
  border-right: 0;
}

.proof-stats span,
.proof-definition-list dt {
  display: block;
  color: rgba(244, 240, 230, 0.56);
  font-size: 0.72rem;
}

.proof-stats strong {
  display: block;
  margin-top: 8px;
  font-family: var(--serif);
  font-size: 1.65rem;
  font-weight: 500;
}

.replay-card {
  overflow: hidden;
  border: 1px solid rgba(244, 240, 230, 0.18);
  border-radius: 20px;
  background: var(--paper);
  color: var(--ink);
}

.replay-toolbar {
  padding: 17px 19px;
  display: flex;
  align-items: center;
  gap: 15px;
  border-bottom: 1px solid var(--line);
}

.play-button {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  color: #fff;
  background: var(--accent);
}

.replay-position {
  min-width: 0;
  display: grid;
}

.replay-position strong {
  font-size: 0.84rem;
}

.replay-position span {
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 0.73rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.speed-control {
  margin-left: auto;
  color: var(--ink-soft);
  font-size: 0.72rem;
}

.speed-control select {
  margin-left: 6px;
  padding: 5px 7px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--ink);
  background: var(--white);
}

.timeline {
  width: 100%;
  height: 4px;
  margin: 0;
  display: block;
  appearance: none;
  background: var(--paper-deep);
}

.timeline::-webkit-slider-thumb {
  width: 16px;
  height: 16px;
  appearance: none;
  border: 3px solid var(--paper);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.timeline::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 3px solid var(--paper);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.replay-surface {
  min-height: 520px;
  padding: clamp(34px, 6vw, 72px);
  background: var(--white);
}

.replay-surface h3 {
  margin: 0 0 28px;
  font-family: var(--serif);
  font-size: clamp(1.8rem, 4vw, 3.7rem);
  line-height: 1.22;
  letter-spacing: -0.035em;
}

.replay-content {
  font-size: 0.98rem;
  line-height: 1.95;
}

.replay-footer {
  padding: 12px 18px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.68rem;
}

.proof-details {
  margin-top: 28px;
  padding: 26px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 32px;
  border: 1px solid rgba(244, 240, 230, 0.14);
  border-radius: 16px;
}

.proof-details h3 {
  margin: 0 0 16px;
  font-family: var(--serif);
  font-size: 1.35rem;
}

.proof-definition-list {
  margin: 0;
}

.proof-definition-list > div {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 16px;
  padding: 5px 0;
}

.proof-definition-list dd {
  min-width: 0;
  margin: 0;
  font-size: 0.78rem;
}

.proof-definition-list code {
  display: block;
  max-width: 450px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.process-section .button-ghost,
.process-section .text-button {
  color: var(--paper);
  border-color: rgba(244, 240, 230, 0.32);
}

.evidence-disclaimer {
  margin: 28px 0 0;
  border-color: rgba(244, 240, 230, 0.14);
  background: rgba(255, 255, 255, 0.045);
  color: rgba(244, 240, 230, 0.68);
}

.evidence-disclaimer strong {
  color: var(--paper);
}

.error-state {
  min-height: 65vh;
  display: grid;
  place-items: center;
  text-align: center;
}

.error-state h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 2.5rem;
}

.error-state p {
  color: var(--ink-soft);
}

@media (max-width: 1040px) {
  .editor-layout {
    grid-template-columns: minmax(0, 1fr) 320px;
  }

  .proof-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .proof-stats > div:nth-child(2) {
    border-right: 0;
  }

  .proof-stats > div:nth-child(-n+2) {
    border-bottom: 1px solid rgba(244, 240, 230, 0.14);
  }
}

@media (max-width: 820px) {
  .section-shell,
  .post-shell {
    width: min(100% - 32px, 1180px);
  }

  .site-header {
    min-height: 66px;
    padding: 12px 16px;
  }

  .brand {
    font-size: 0.78rem;
  }

  .brand-mark {
    width: 31px;
    height: 31px;
  }

  .principles,
  .article-grid {
    grid-template-columns: 1fr;
  }

  .principles article,
  .principles article:first-child,
  .principles article:last-child {
    padding: 28px 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .principles article:last-child {
    border-bottom: 0;
  }

  .section-heading {
    align-items: start;
    flex-direction: column;
    gap: 10px;
  }

  .disclaimer,
  .evidence-disclaimer {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .editor-page {
    height: auto;
    overflow: auto;
  }

  .editor-header {
    position: sticky;
    height: auto;
    min-height: 66px;
    flex-wrap: wrap;
  }

  .editor-header .brand span:last-child,
  .editor-status,
  #save-button {
    display: none;
  }

  .editor-header .header-actions {
    margin-left: auto;
    gap: 7px;
  }

  .editor-layout {
    height: auto;
    display: block;
  }

  .writing-pane {
    overflow: visible;
    padding: 20px 12px;
  }

  .writing-paper {
    min-height: 75vh;
    padding: 42px 28px;
  }

  .body-input {
    min-height: 65vh;
  }

  .editor-sidebar {
    overflow: visible;
    padding: 16px;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .preview-card {
    display: none;
  }

  .published-article {
    padding-top: 80px;
  }

  .process-section {
    width: calc(100% + 32px);
    margin-left: -16px;
    padding: 38px 20px;
    border-radius: 24px 24px 0 0;
  }

  .proof-details {
    align-items: stretch;
    flex-direction: column;
  }

  .proof-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .proof-definition-list > div {
    grid-template-columns: 100px minmax(0, 1fr);
  }

  .replay-surface {
    min-height: 400px;
    padding: 32px 24px;
  }
}

@media (max-width: 560px) {
  .hero {
    min-height: auto;
    padding-block: 72px 48px;
  }

  .hero h1 {
    font-size: clamp(3rem, 16vw, 4.4rem);
  }

  .articles-section {
    padding-block: 70px;
  }

  .article-card,
  .loading-card,
  .empty-card {
    padding: 24px;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 7px;
  }

  .header-actions .button-small {
    padding-inline: 12px;
  }

  .article-header h1 {
    font-size: clamp(2.55rem, 13vw, 4rem);
  }

  .proof-stats {
    grid-template-columns: 1fr 1fr;
  }

  .proof-stats > div {
    padding: 18px;
  }

  .proof-stats strong {
    font-size: 1.32rem;
  }

  .replay-toolbar {
    flex-wrap: wrap;
  }

  .speed-control {
    margin-left: 0;
  }

  .replay-footer {
    flex-direction: column;
    gap: 2px;
  }
}

/* notAI added functions */
body.modal-open {
  overflow: hidden;
}

img {
  display: block;
  max-width: 100%;
}

.cover-editor {
  width: 100%;
  min-height: 130px;
  margin: 0 0 42px;
  padding: 0;
  overflow: hidden;
  border: 1px dashed var(--line-strong);
  border-radius: 16px;
  color: inherit;
  background: rgba(232, 225, 210, 0.38);
  cursor: pointer;
}

.cover-editor:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.cover-placeholder {
  min-height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--ink-soft);
}

.cover-placeholder-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  font-size: 1.35rem;
}

.cover-placeholder strong,
.cover-placeholder small {
  display: block;
  text-align: left;
}

.cover-placeholder small {
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 0.74rem;
  font-weight: 400;
}

.cover-selected {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
}

.cover-selected img,
.article-cover-frame img,
.publish-cover-thumb img,
.art-item img,
.crop-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cover-overlay {
  position: absolute;
  right: 14px;
  bottom: 14px;
  padding: 7px 11px;
  border-radius: 999px;
  color: #fff;
  background: rgba(24, 34, 29, 0.78);
  font-size: 0.72rem;
}

.cover-caption {
  color: var(--ink-soft);
  font-size: 0.72rem;
  line-height: 1.65;
}

.editor-cover-caption {
  margin: -30px 0 38px;
}

.switch-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--ink-soft);
  font-size: 0.72rem;
  white-space: nowrap;
}

.switch-label input {
  position: relative;
  width: 34px;
  height: 19px;
  appearance: none;
  border-radius: 999px;
  background: var(--paper-deep);
  cursor: pointer;
  transition: background 160ms ease;
}

.switch-label input::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--white);
  box-shadow: 0 1px 4px rgba(24, 34, 29, 0.22);
  transition: transform 160ms ease;
}

.switch-label input:checked {
  background: var(--accent);
}

.switch-label input:checked::after {
  transform: translateX(15px);
}

.strong-switch {
  color: var(--paper);
  font-weight: 700;
}

.side-kicker {
  display: block;
  color: var(--ink-soft);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.recording-dot.idle,
.status-dot.idle {
  background: #9a9a8f;
  box-shadow: 0 0 0 5px rgba(24, 34, 29, 0.08);
}

.status-dot.error {
  background: var(--danger);
  box-shadow: 0 0 0 5px rgba(166, 64, 54, 0.13);
}

.compact-metrics > div {
  padding-block: 8px;
}

.publication-card {
  border-color: rgba(43, 117, 80, 0.22);
  background: rgba(43, 117, 80, 0.08);
}

.publication-card p {
  margin: 9px 0 0;
  color: var(--ink-soft);
  font-size: 0.78rem;
  line-height: 1.65;
}

.origin-note,
.origin-explanation {
  color: #6f5516;
  font-size: 0.75rem;
  line-height: 1.7;
}

.paste-origin {
  padding: 0 0.03em;
  border-bottom: 1px solid #c7a72d;
  border-radius: 2px;
  color: inherit;
  background: rgba(242, 217, 117, 0.5);
}

.modal-header {
  min-height: 82px;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}

.compact-modal-header {
  min-height: auto;
  padding: 0 0 22px;
}

.modal-header h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.9rem;
  line-height: 1.35;
}

.icon-button {
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  font-size: 1.45rem;
  line-height: 1;
}

.icon-button:hover {
  background: rgba(24, 34, 29, 0.06);
}

.art-picker-modal {
  width: min(1380px, calc(100vw - 40px));
  height: min(900px, calc(100vh - 40px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 26px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.art-picker-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
}

.art-browser {
  min-width: 0;
  overflow: auto;
  padding: 24px;
}

.art-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.search-field input {
  min-height: 46px;
}

.category-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 22px;
}

.category-chip {
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  background: transparent;
  cursor: pointer;
  font-size: 0.72rem;
}

.category-chip.active {
  color: var(--paper);
  border-color: var(--ink);
  background: var(--ink);
}

.art-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.art-item {
  position: relative;
  aspect-ratio: 4 / 3;
  padding: 0;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 10px;
  background: var(--paper-deep);
  cursor: pointer;
}

.art-item img {
  transition: transform 220ms ease;
}

.art-item:hover img {
  transform: scale(1.03);
}

.art-item.selected {
  border-color: var(--accent);
}

.art-item-label {
  position: absolute;
  inset: auto 0 0;
  padding: 22px 9px 8px;
  color: #fff;
  background: linear-gradient(transparent, rgba(24, 34, 29, 0.72));
  opacity: 0;
  text-align: left;
  font-size: 0.66rem;
  transition: opacity 140ms ease;
}

.art-item:hover .art-item-label,
.art-item.selected .art-item-label {
  opacity: 1;
}

.art-loading,
.art-empty {
  grid-column: 1 / -1;
  min-height: 240px;
  display: grid;
  place-items: center;
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.art-more {
  margin: 20px auto 4px;
}

.art-selection {
  min-width: 0;
  padding: 24px;
  overflow: auto;
  border-left: 1px solid var(--line);
  background: var(--paper);
}

.selection-empty {
  min-height: 300px;
  display: grid;
  place-items: center;
  color: var(--ink-soft);
  text-align: center;
  font-size: 0.86rem;
  line-height: 1.8;
}

.crop-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 12px;
  background: var(--paper-deep);
  cursor: grab;
  touch-action: none;
}

.crop-frame:active {
  cursor: grabbing;
}

.crop-frame img {
  transform-origin: center;
  user-select: none;
  pointer-events: none;
}

.selected-art-meta {
  display: grid;
  gap: 5px;
  margin: 15px 0 22px;
}

.selected-art-meta strong {
  font-family: var(--serif);
  font-size: 1.08rem;
  line-height: 1.45;
}

.selected-art-meta span {
  color: var(--ink-soft);
  font-size: 0.72rem;
}

.crop-controls {
  display: grid;
  gap: 18px;
}

.segmented-control {
  display: inline-flex;
  padding: 3px;
  border-radius: 11px;
  background: rgba(244, 240, 230, 0.14);
}

.segmented-control button {
  min-height: 34px;
  padding: 0 13px;
  border: 0;
  border-radius: 9px;
  color: var(--ink-soft);
  background: transparent;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 700;
}

.segmented-control button.active {
  color: var(--ink);
  background: var(--white);
  box-shadow: 0 1px 4px rgba(24, 34, 29, 0.12);
}

.range-field {
  display: grid;
  grid-template-columns: 42px 1fr;
  align-items: center;
  gap: 10px;
  color: var(--ink-soft);
  font-size: 0.72rem;
}

.range-field input {
  accent-color: var(--accent);
}

.selection-actions {
  margin-top: 26px;
  padding-top: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-top: 1px solid var(--line);
}

.publish-modal-card {
  width: min(590px, 100%);
}

.publish-summary {
  margin: 22px 0;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(232, 225, 210, 0.36);
}

.publish-cover-thumb {
  flex: 0 0 auto;
  width: 84px;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 8px;
  background: var(--paper-deep);
}

.publish-summary > div {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.publish-summary strong {
  overflow: hidden;
  font-family: var(--serif);
  font-size: 1.05rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.publish-summary span {
  color: var(--ink-soft);
  font-size: 0.72rem;
}

.slug-field {
  margin: 0 0 20px;
  display: grid;
  gap: 6px;
}

.slug-field label {
  font-size: 0.82rem;
  font-weight: 800;
}

.slug-input-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
}

.slug-input-row:has(input:focus-visible) {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(217, 97, 76, 0.1);
}

.slug-prefix {
  color: var(--ink-soft);
  font-size: 0.86rem;
}

.slug-input-row input {
  flex: 1;
  min-width: 0;
  padding: 10px 0;
  border: 0;
  background: transparent;
  font-size: 0.86rem;
  color: var(--ink);
}

.slug-input-row input:focus-visible {
  outline: none;
}

.slug-input-row input:disabled {
  color: var(--ink-soft);
}

.slug-hint {
  color: var(--ink-soft);
  font-size: 0.72rem;
  line-height: 1.5;
}

.slug-hint.slug-hint-error {
  color: #b3392c;
}

.history-options {
  margin: 0;
  padding: 0;
  display: grid;
  gap: 9px;
  border: 0;
}

.history-options legend {
  margin-bottom: 10px;
  font-size: 0.82rem;
  font-weight: 800;
}

.history-option {
  padding: 14px;
  display: flex;
  gap: 11px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--white);
  cursor: pointer;
}

.history-option:has(input:checked) {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(217, 97, 76, 0.1);
}

.history-option input {
  margin-top: 3px;
  accent-color: var(--accent);
}

.history-option span {
  display: grid;
  gap: 4px;
}

.history-option strong {
  font-size: 0.86rem;
}

.history-option small {
  color: var(--ink-soft);
  font-size: 0.74rem;
  line-height: 1.5;
}

.session-select-row {
  margin: -1px 0 4px 36px;
  display: grid;
  grid-template-columns: 120px 1fr;
  align-items: center;
  gap: 10px;
  color: var(--ink-soft);
  font-size: 0.74rem;
}

.session-select-row select {
  min-height: 38px;
}

.privacy-note {
  margin: 17px 0 0;
  color: #755d28;
  font-size: 0.72rem;
  line-height: 1.65;
}

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

.article-cover {
  width: min(1040px, calc(100vw - 48px));
  margin: 0 0 56px 50%;
  transform: translateX(-50%);
}

.article-cover-frame {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 18px;
  background: var(--paper-deep);
}

.article-cover figcaption {
  margin-top: 9px;
  color: var(--ink-soft);
  font-size: 0.72rem;
  line-height: 1.6;
}

.article-cover figcaption a {
  text-underline-offset: 3px;
}

.process-entry {
  margin-bottom: 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
}

.process-entry .eyebrow {
  color: #ef957f;
}

.process-entry h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(2.1rem, 4vw, 3.9rem);
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.03em;
}

.process-entry p:last-child,
.history-visibility-note,
.history-private {
  color: rgba(244, 240, 230, 0.68);
}

.process-panel {
  margin-top: 28px;
}

.history-visibility-note,
.history-private {
  margin-bottom: 18px;
  padding: 15px 17px;
  border: 1px solid rgba(244, 240, 230, 0.14);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.045);
  font-size: 0.78rem;
  line-height: 1.7;
}

.process-toolbar-top {
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.replay-mode {
  background: rgba(244, 240, 230, 0.14);
}

.process-stats {
  margin: 18px 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  overflow: hidden;
  border: 1px solid rgba(244, 240, 230, 0.14);
  border-radius: 16px;
}

.process-stats > div {
  padding: 24px;
  border-right: 1px solid rgba(244, 240, 230, 0.14);
}

.process-stats > div:last-child {
  border-right: 0;
}

.process-stats span {
  display: block;
  color: rgba(244, 240, 230, 0.56);
  font-size: 0.72rem;
}

.process-stats strong {
  display: block;
  margin-top: 8px;
  font-family: var(--serif);
  font-size: 1.65rem;
  font-weight: 500;
}

.technical-details {
  margin-top: 26px;
  border-top: 1px solid rgba(244, 240, 230, 0.14);
}

.technical-details summary {
  padding: 18px 0;
  color: var(--paper);
  cursor: pointer;
  font-weight: 800;
}

.technical-details-inner {
  padding: 4px 0 20px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 30px;
}

@media (max-width: 1040px) {
  .art-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .art-picker-layout {
    grid-template-columns: minmax(0, 1fr) 330px;
  }

  .process-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .process-stats > div:nth-child(2) {
    border-right: 0;
  }

  .process-stats > div:nth-child(-n+2) {
    border-bottom: 1px solid rgba(244, 240, 230, 0.14);
  }
}

@media (max-width: 820px) {
  .cover-editor {
    margin-bottom: 32px;
  }

  .art-picker-modal {
    width: 100%;
    height: 100%;
    max-height: none;
    border-radius: 0;
  }

  .art-picker-layout {
    display: block;
    overflow: auto;
  }

  .art-browser,
  .art-selection {
    overflow: visible;
  }

  .art-selection {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .process-entry {
    align-items: flex-start;
    flex-direction: column;
  }

  .process-entry .button {
    width: 100%;
  }

  .process-toolbar-top {
    align-items: stretch;
    flex-direction: column;
  }

  .technical-details-inner {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .art-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .art-browser,
  .art-selection {
    padding: 16px;
  }

  .art-search-row {
    grid-template-columns: 1fr;
  }

  .crop-frame {
    aspect-ratio: 16 / 10;
  }

  .session-select-row {
    margin-left: 0;
    grid-template-columns: 1fr;
  }
}
