.sharing-page {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 28px 0 64px;
  color: var(--ws-text);
  letter-spacing: 0;
  overflow-wrap: anywhere;
}
.sharing-page *, .sharing-preview * { box-sizing: border-box; }
.sharing-header, .sharing-actions, .sharing-meta, .sharing-editor-summary,
.sharing-block-header, .sharing-preview-header, .sharing-pagination {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.sharing-header { justify-content: space-between; margin-bottom: 20px; }
.sharing-page h1, .sharing-preview h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.45;
  font-weight: 650;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}
.sharing-header h1 { flex: 1 1 200px; min-width: 0; }
.sharing-actions { gap: 8px; }
.sharing-reader-actions { display: grid; gap: 8px; width: 114px; }
.sharing-header:has(.sharing-reader-actions) { align-items: flex-start; }
.sharing-header:has(.sharing-reader-actions) > .sharing-actions { align-items: flex-start; }
.sharing-copy-status { min-height: 18px; font-size: 12px; line-height: 1.5; color: var(--ws-text-secondary); text-align: center; }
.sharing-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  max-width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--ws-border-strong);
  border-radius: 6px;
  background: var(--ws-surface);
  color: var(--ws-text);
  font: inherit;
  font-size: 14px;
  line-height: 1.4;
  letter-spacing: 0;
  white-space: normal;
  cursor: pointer;
}
.sharing-button svg { flex: 0 0 18px; }
@media (hover: hover) and (pointer: fine) {
  .sharing-button:hover:not(:disabled) { background: var(--ws-surface-muted); border-color: var(--ws-brand); }
}
.sharing-button:disabled, .sharing-editor fieldset:disabled .sharing-button { opacity: .5; cursor: not-allowed; }
.sharing-button.sharing-primary { background: var(--ws-brand); color: var(--ws-on-brand); border-color: var(--ws-brand); }
@media (hover: hover) and (pointer: fine) {
  .sharing-button.sharing-primary:hover:not(:disabled) { background: var(--ws-brand-hover); }
}
.sharing-button.sharing-icon { width: 38px; height: 38px; flex: 0 0 38px; padding: 8px; }
.sharing-page :focus-visible, .sharing-preview :focus-visible { outline: 2px solid var(--ws-brand); outline-offset: 3px; }
.sharing-access, .sharing-meta, .sharing-editor-summary, .sharing-status { color: var(--ws-text-secondary); font-size: 13px; }
.sharing-access { margin: 0 0 16px; }
.sharing-list { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--ws-border); }
.sharing-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 100px;
  align-items: baseline;
  gap: 12px;
  padding: 18px 0;
  border-bottom: 1px solid var(--ws-border);
}
.sharing-management-list .sharing-row { grid-template-columns: minmax(0, 1fr) 100px 60px; }
.sharing-title-link {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ws-text);
  font: inherit;
  font-size: 16px;
  font-weight: 550;
  line-height: 1.6;
  text-align: left;
  overflow-wrap: anywhere;
  cursor: pointer;
}
@media (hover: hover) and (pointer: fine) {
  .sharing-title-link:hover { color: var(--ws-brand); text-decoration: underline; text-underline-offset: 4px; }
}
.sharing-row time { color: var(--ws-text-secondary); font-size: 13px; font-variant-numeric: tabular-nums; }
.sharing-state { padding: 36px 0; color: var(--ws-text-secondary); line-height: 1.7; }
.sharing-state p { margin: 0 0 16px; }
.sharing-pagination { justify-content: center; margin: 24px 0 0; color: var(--ws-text-secondary); font-size: 14px; }
.sharing-prose { margin-top: 28px; font-size: 16px; line-height: 1.9; color: var(--ws-text); }
.sharing-scroll-nav {
  position: fixed;
  right: max(24px, env(safe-area-inset-right));
  top: 50%;
  transform: translateY(-50%);
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sharing-scroll-nav .sharing-button { width: 44px; height: 44px; flex-basis: 44px; box-shadow: 0 2px 8px rgb(0 0 0 / .08); }
body:has(.sharing-scroll-nav, .sharing-editor) .back-to-top-btn { display: none; }
@media (max-width: 900px) {
  /* Floats over the page corner instead of reserving a column, so phone text keeps its full width. */
  .sharing-scroll-nav {
    top: auto;
    bottom: calc(var(--ws-mobile-nav) + env(safe-area-inset-bottom) + 12px);
    right: max(12px, env(safe-area-inset-right));
    transform: none;
  }
  .sharing-scroll-nav .sharing-button { width: 40px; height: 40px; flex-basis: 40px; opacity: .88; }
  .sharing-scroll-nav { transition: opacity .2s ease, visibility .2s; }
  .sharing-scroll-nav.is-near-comments { opacity: 0; visibility: hidden; pointer-events: none; }
}
.sharing-prose p { white-space: pre-wrap; margin: 0 0 22px; }
.sharing-prose a { color: var(--ws-brand); text-decoration: underline; text-underline-offset: 3px; overflow-wrap: anywhere; }
.sharing-code {
  margin: 0 0 22px;
  padding: 14px 16px;
  border: 1px solid var(--ws-border);
  border-radius: 6px;
  background: var(--ws-surface-muted);
  color: var(--ws-text);
  font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre;
  overflow-x: auto;
  overflow-wrap: normal;
  tab-size: 4;
}
.sharing-code code { font: inherit; }
.sharing-prose h2 { font-size: 20px; line-height: 1.5; margin: 32px 0 16px; letter-spacing: 0; white-space: pre-wrap; }
.sharing-prose figure { margin: 24px 0; }
.sharing-prose figcaption { margin-top: 8px; font-size: 13px; line-height: 1.6; color: var(--ws-text-secondary); white-space: pre-wrap; }
.sharing-image-slot { max-width: 100%; min-height: 48px; display: grid; justify-items: start; align-items: center; gap: 10px; color: var(--ws-text-secondary); font-size: 14px; }
.sharing-image-slot img { display: block; max-width: 100%; height: auto; width: auto; border-radius: 4px; }
.sharing-editor fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.sharing-editor-meta { display: grid; grid-template-columns: minmax(0, 1fr) 165px; gap: 16px; align-items: start; }
.sharing-editor label { display: grid; gap: 8px; min-width: 0; font-size: 14px; color: var(--ws-text-secondary); }
.sharing-editor input:not([type=file]), .sharing-editor textarea {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--ws-border-strong);
  border-radius: 6px;
  background: var(--ws-surface);
  color: var(--ws-text);
  font: inherit;
  font-size: 16px;
  line-height: 1.6;
  letter-spacing: 0;
}
.sharing-editor textarea { resize: vertical; min-height: 64px; overflow: hidden; }
.sharing-editor textarea[data-single-line] { min-height: 48px; resize: none; }
.sharing-editor textarea.sharing-code-input { font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre; overflow-x: auto; }
.sharing-editor select {
  min-height: 40px; padding: 6px 10px; border: 1px solid var(--ws-border-strong); border-radius: 6px;
  background: var(--ws-surface); color: var(--ws-text); font: inherit; font-size: 15px;
}
/* Two classes, so the fieldset reset above (.sharing-editor fieldset) does not win. */
.sharing-editor .sharing-settings { display: grid; gap: 14px; margin: 18px 0 0; padding: 16px; border: 1px solid var(--ws-border); border-radius: 6px; }
.sharing-settings legend { padding: 0 6px; font-size: 14px; font-weight: 600; color: var(--ws-text); }
.sharing-editor .sharing-check { display: flex; align-items: center; gap: 8px; color: var(--ws-text); }
.sharing-editor .sharing-check input { width: 18px; height: 18px; flex: 0 0 18px; }
.sharing-block-label { display: inline-flex; align-items: center; gap: 6px; }
.sharing-editor .sharing-block-type { display: inline-flex; }
.sharing-editor input[type=date] { min-height: 48px; }
.sharing-editor input:disabled, .sharing-editor textarea:disabled { opacity: .65; }
.sharing-editor-summary { margin: 16px 0; }
.sharing-block { border-top: 1px solid var(--ws-border); padding: 18px 0; }
.sharing-block-header { justify-content: space-between; margin-bottom: 12px; font-size: 13px; color: var(--ws-text-secondary); }
.sharing-block .sharing-image-slot { margin-bottom: 12px; }
.sharing-block .sharing-image-slot img { max-height: 420px; object-fit: contain; }
.sharing-add-actions { padding: 18px 0; border-top: 1px solid var(--ws-border); }
.sharing-save-actions { padding-top: 20px; border-top: 1px solid var(--ws-border); }
/* Long articles: saving stays reachable without scrolling past the whole text. */
.sharing-editor .sharing-save-actions { position: sticky; bottom: 0; z-index: 5; padding-bottom: 14px; background: var(--ws-page); }
@media (max-width: 900px) {
  .sharing-editor .sharing-save-actions { bottom: calc(var(--ws-mobile-nav) + env(safe-area-inset-bottom)); }
}
.sharing-notice { min-height: 24px; margin: 16px 0 0; font-size: 14px; line-height: 1.7; color: var(--ws-text-secondary); }
.sharing-error, .sharing-image-error { color: var(--ws-danger); }
.sharing-preview {
  width: min(820px, calc(100% - 32px));
  max-width: calc(100% - 32px);
  max-height: calc(100dvh - 40px);
  margin: auto;
  padding: 0;
  border: 1px solid var(--ws-border-strong);
  border-radius: 8px;
  background: var(--ws-surface);
  color: var(--ws-text);
  overflow: auto;
  overflow-wrap: anywhere;
  letter-spacing: 0;
}
.sharing-preview::backdrop { background: rgb(0 0 0 / .55); }
.sharing-preview-header { position: sticky; top: 0; z-index: 1; justify-content: space-between; padding: 12px 20px; background: var(--ws-surface); border-bottom: 1px solid var(--ws-border); color: var(--ws-text-secondary); font-size: 14px; }
.sharing-preview-content { padding: 24px; }
.sharing-preview-content > time { display: block; margin-top: 12px; color: var(--ws-text-secondary); font-size: 13px; }
.sharing-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; }
body:has(.sharing-index) { background: var(--ws-surface); }
body:has(.sharing-index) .bg-deco { display: none; }
.sharing-index { width: min(100%, 960px); padding-top: 40px; }
.sharing-index > .sharing-header { margin-bottom: 40px; }
.sharing-index .sharing-list { border-top: 0; }
.sharing-index .sharing-row { display: block; padding: 40px 0 48px; }
.sharing-index .sharing-row:first-child { padding-top: 12px; }
.sharing-index .sharing-row time { display: block; margin-bottom: 12px; font-size: 15px; font-weight: 600; color: #767676; }
.sharing-index .sharing-row h2 { margin: 0; }
.sharing-index .sharing-title-link { font-size: 30px; line-height: 1.5; font-weight: 650; color: #171717; }
@media (hover: hover) and (pointer: fine) {
  .sharing-index .sharing-title-link:hover { color: var(--ws-brand); }
}
[data-theme="dark"] .sharing-index .sharing-row time { color: #a3a3a3; }
[data-theme="dark"] .sharing-index .sharing-title-link { color: var(--ws-text); }
@media (hover: hover) and (pointer: fine) {
  [data-theme="dark"] .sharing-index .sharing-title-link:hover { color: var(--ws-brand); }
}
@media (max-width: 560px) {
  .sharing-page { padding: 18px 0 40px; }
  .sharing-page h1, .sharing-preview h1 { font-size: 22px; }
  .sharing-editor-meta { grid-template-columns: minmax(0, 1fr); }
  .sharing-row, .sharing-management-list .sharing-row { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
  .sharing-title-link { grid-column: 1 / -1; }
  .sharing-status { text-align: right; }
  .sharing-preview-content { padding: 20px 16px; }
  .sharing-block-header { gap: 8px; }
  .sharing-index > .sharing-header { margin-bottom: 28px; }
  .sharing-index .sharing-row { padding: 28px 0 34px; }
  .sharing-index .sharing-row time { margin-bottom: 10px; font-size: 14px; }
  .sharing-index .sharing-title-link { font-size: 22px; line-height: 1.55; }
  .sharing-reader-actions { display: flex; flex-wrap: wrap; align-items: center; width: auto; }
  .sharing-copy-status:empty { display: none; }
  .sharing-code { font-size: 12px; padding: 12px; }
}

.sharing-comments { margin-top: 44px; padding-top: 28px; border-top: 1px solid var(--ws-border); }
.sharing-comments h2 { margin: 0 0 20px; font-size: 20px; }
.sharing-comment-form { display: grid; gap: 10px; }
.sharing-comment-form label { font-size: 14px; font-weight: 600; }
.sharing-comment-form textarea {
  width: 100%; resize: vertical; min-height: 90px; padding: 12px;
  border: 1px solid var(--ws-border-strong); border-radius: 6px;
  background: var(--ws-surface); color: var(--ws-text); font: inherit; line-height: 1.6;
}
.sharing-comment-form textarea:disabled { opacity: .6; }
.sharing-comment-form .sharing-button { justify-self: start; }
.sharing-comment-access, .sharing-comment-notice { font-size: 14px; color: var(--ws-text-secondary); line-height: 1.6; }
.sharing-comment-notice:empty { display: none; }
.sharing-comment-notice.sharing-error { color: var(--ws-danger, #c33); }
.sharing-comment-list { list-style: none; padding: 0; margin: 20px 0; }
.sharing-comment { display: flex; gap: 12px; padding: 18px 0; border-bottom: 1px solid var(--ws-border); }
.sharing-comment-avatar { position: relative; width: 40px; height: 40px; flex: 0 0 40px; border-radius: 50%; overflow: hidden; background: var(--ws-surface-muted); }
.sharing-comment-avatar > span { display: grid; width: 100%; height: 100%; place-items: center; color: var(--ws-text-secondary); }
.sharing-comment-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.sharing-comment-detail { flex: 1; min-width: 0; }
.sharing-comment-author { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; font-size: 13px; color: var(--ws-text-secondary); }
.sharing-comment-author strong { color: var(--ws-text); font-size: 14px; }
.sharing-comment-author time { margin-left: auto; }
.sharing-comment-detail > p { margin: 8px 0 0; white-space: pre-wrap; line-height: 1.7; overflow-wrap: anywhere; }
@media (max-width: 520px) {
  .sharing-comment-author time { flex-basis: 100%; margin-left: 0; }
  .sharing-comment { gap: 10px; }
}

.sharing-badge { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 12px; line-height: 1.6; font-weight: 600; }
.sharing-badge-author { background: var(--ws-brand); color: var(--ws-on-brand); }
.sharing-badge-authorized { border: 1px solid var(--ws-success, #16a34a); color: var(--ws-success, #16a34a); }
.sharing-comment-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.sharing-comment-tools .sharing-button { min-height: 32px; padding: 4px 10px; font-size: 13px; }
.sharing-comment-tools [data-sharing-action="delete-comment"] { color: var(--ws-danger); }
.sharing-comment-tools [data-sharing-action="remove-reply"] { color: var(--ws-danger); }
/* The owner's reply, under the comment it answers. */
.sharing-comment-reply { margin-top: 10px; padding: 10px 12px; border-left: 3px solid var(--ws-brand); border-radius: 0 8px 8px 0; background: var(--ws-brand-soft); }
.sharing-comment-reply > p { margin: 6px 0 0; white-space: pre-wrap; line-height: 1.7; overflow-wrap: anywhere; color: var(--ws-text); }
.sharing-comment-reply-form { display: grid; gap: 8px; margin-top: 10px; }
.sharing-comment-reply-form textarea { width: 100%; box-sizing: border-box; font: inherit; padding: 8px 10px; border: 1px solid var(--ws-border); border-radius: 8px; background: var(--ws-surface-raised); color: var(--ws-text); resize: vertical; }
.sharing-comment-reply-form .sharing-comment-tools { margin-top: 0; }
