:root {
  color-scheme: light;
  --paper: #e7dcc8;
  --ink: #241c16;
  --muted: #5e564e;
  --line: rgba(70, 48, 28, 0.16);
  --card: rgba(255, 252, 247, 0.92);
  --seal: #9d342c;
  --seal-ink: #fff8f3;
  --focus: #245c45;
  --danger: #8d2b24;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background-color: var(--paper);
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans JP", sans-serif;
  font-size: 16px;
  line-height: 1.65;
}

.page {
  width: min(740px, calc(100% - 32px));
  margin: 0 auto;
  padding: 44px 0 72px;
}

@media (min-height: 860px) {
  .page.auth-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
  }

  .auth-page > main {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    justify-content: safe center;
  }
}

.page:has(.official-label) {
  container-type: inline-size;
  container-name: home;
}

.masthead {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding-bottom: 22px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--line);
}

.masthead-text {
  flex: 1;
  min-width: 12rem;
}

.masthead-end {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.masthead:has(.official-label) .masthead-end {
  flex-direction: column;
  align-items: flex-end;
  align-self: flex-start;
  gap: 8px;
}

.official-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  line-height: 1.4;
}

.social {
  display: flex;
  align-items: center;
  gap: 8px;
}

.social a {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  background: rgba(255, 252, 247, 0.72);
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
}

.social a:active {
  color: var(--seal);
  border-color: var(--seal);
}

@media (hover: hover) and (pointer: fine) {
  .social a:hover {
    color: var(--seal);
    border-color: var(--seal);
  }
}

.social a:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.social svg {
  width: 16px;
  height: 16px;
  display: block;
}

.social .mark {
  font-family: "Yu Mincho", "Hiragino Mincho ProN", "Iowan Old Style", serif;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  line-height: 1;
}

.logout {
  margin: 0;
}

.logout button {
  min-height: 36px;
  padding: 0 14px;
  font-size: 0.85rem;
  white-space: nowrap;
}

.seal {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  margin: 0;
  display: grid;
  place-items: center;
  border: 2px solid var(--seal);
  color: var(--seal);
  border-radius: 4px;
  transform: rotate(-8deg);
  font-family: "Yu Mincho", "Hiragino Mincho ProN", "Iowan Old Style", serif;
  font-size: 24px;
  line-height: 1;
}

h1,
h2,
h3,
.word {
  font-family: "Yu Mincho", "Hiragino Mincho ProN", "Iowan Old Style", serif;
  font-weight: 500;
}

h1 {
  margin: 0;
  font-size: 2rem;
  letter-spacing: 0.06em;
  line-height: 1.2;
}

h2 {
  margin: 0;
  font-size: 1.25rem;
  letter-spacing: 0.08em;
}

.lead,
.section-note,
footer {
  color: var(--muted);
}

.lead {
  margin: 6px 0 0;
  font-size: 0.95rem;
}

.lead span {
  white-space: nowrap;
}

.site-note {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.45;
}

.site-note-mark {
  width: 1.2em;
  height: 1.2em;
  margin-right: 0.28em;
  vertical-align: -0.22em;
}

.block + .block {
  margin-top: 28px;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px 20px 16px;
  box-shadow: 0 16px 40px rgba(68, 40, 16, 0.05);
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px 20px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.section-note {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin: 0;
  font-size: 0.85rem;
}

.order {
  display: inline-flex;
  gap: 4px;
}

.order button {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
}

.order button[aria-pressed="true"] {
  border-color: var(--line);
  background: rgba(255, 252, 247, 0.8);
  color: var(--ink);
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 16px;
}

label,
.field-label {
  margin: 0;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
}

.author-name {
  margin: 0;
  line-height: 1.6;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.55);
  color: inherit;
  font: inherit;
  padding: 12px 12px;
}

textarea {
  min-height: 132px;
  resize: vertical;
  line-height: 1.75;
}

input:focus,
textarea:focus,
button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

button {
  appearance: none;
  border: 0;
  background: var(--seal);
  color: var(--seal-ink);
  font: inherit;
  letter-spacing: 0.06em;
  border-radius: 999px;
  min-height: 44px;
  padding: 0 20px;
  cursor: pointer;
}

button:disabled {
  opacity: 0.55;
  cursor: progress;
}

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

.status {
  margin: 0;
  min-height: 1.5em;
  color: var(--focus);
  font-size: 0.92rem;
}

.status.loading,
.loading {
  display: flex;
  align-items: center;
  gap: 8px;
}

.loading {
  justify-content: center;
  margin: 0;
  padding: 28px 16px;
  color: var(--muted);
}

.status.loading::before,
.loading::before {
  content: "";
  width: 0.9em;
  height: 0.9em;
  border: 2px solid var(--line);
  border-top-color: var(--seal);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex: none;
}

@media (prefers-reduced-motion: reduce) {
  .status.loading::before,
  .loading::before {
    animation: none;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.error {
  margin: 10px 0 0;
  color: var(--danger);
  font-size: 0.92rem;
}

.field-error {
  margin: 0;
}

input[aria-invalid="true"] {
  border-color: var(--danger);
}

#list {
  display: grid;
  gap: 12px;
}

.quote {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 18px 16px 20px;
}

.quote-link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.quote-link:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 4px;
  border-radius: 12px;
}

@media (hover: hover) and (pointer: fine) {
  .quote-link:hover .word {
    color: var(--seal);
  }
}

.back {
  margin: 0 0 18px;
}

.back a {
  color: var(--muted);
  text-decoration: none;
}

.back + .back {
  margin-top: -10px;
}

.auth-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 18px;
  margin: 18px 0 0;
  font-size: 0.92rem;
}

.auth-links a {
  color: var(--ink);
  text-underline-offset: 3px;
}

.auth-links a:hover,
.auth-links a:focus-visible {
  color: var(--seal);
}

.form-legal {
  margin: 14px 0 0;
  font-size: 0.85rem;
  text-align: center;
}

.form-legal a {
  color: var(--muted);
  text-underline-offset: 3px;
}

.form-legal a:hover,
.form-legal a:focus-visible {
  color: var(--seal);
}

.legal {
  --legal-bar: 3px;
  --legal-bar-gap: 0.55em;
  --legal-body: #3e352d;
}

.legal h2 {
  margin-top: 1.6em;
  font-size: 1.05rem;
  font-weight: 700;
}

.legal h2:not(:first-of-type) {
  display: flex;
  align-items: center;
  gap: var(--legal-bar-gap);
}

.legal h2:not(:first-of-type)::before {
  content: "";
  width: var(--legal-bar);
  height: 0.95em;
  background: var(--muted);
  flex: none;
}

.legal h2:first-of-type {
  margin-top: 0;
  font-size: 1.25rem;
}

.legal p,
.legal li {
  margin: 0.65em 0 0;
  line-height: 1.8;
}

.legal p:not(.legal-date),
.legal li {
  color: var(--legal-body);
}

.legal p:not(.legal-date) {
  padding-left: calc(var(--legal-bar) + var(--legal-bar-gap));
}

.legal ul {
  margin: 0.35em 0 0;
  padding-left: calc(var(--legal-bar) + var(--legal-bar-gap) + 1.3em);
}

.legal a {
  color: inherit;
  text-underline-offset: 3px;
}

.legal a:hover,
.legal a:focus-visible {
  color: var(--seal);
}

.legal-date {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.back a:hover,
.back a:focus-visible {
  color: var(--seal);
}

.missing {
  margin: 36px 0 0;
}

.missing .word {
  margin: 0;
  font-size: 1.8rem;
}

.missing .content {
  margin: 12px 0 0;
  color: var(--muted);
}

.quote.detail {
  padding: 22px 22px 20px 28px;
}

.quote.detail .word {
  margin: 0;
  font-size: 1.8rem;
}

.masthead:has(.official-label) {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "seal text official"
    "note note note";
  align-items: center;
  column-gap: 16px;
  row-gap: 4px;
  padding-bottom: 12px;
}

.masthead:has(.share) {
  grid-template-areas:
    "seal text official"
    "note note note"
    "share share share";
}

.masthead:has(.menu:not([hidden])) {
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  grid-template-areas:
    "seal text official menu"
    "note note note note";
}

.masthead:has(.menu:not([hidden])):has(.share) {
  grid-template-areas:
    "seal text official menu"
    "note note note note"
    "share share share share";
}

.menu {
  position: relative;
  grid-area: menu;
  align-self: center;
}

.menu.is-open {
  z-index: 30;
}

.menu[hidden] {
  display: none;
}

.menu-button {
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--ink);
}

.menu-bars,
.menu-bars::before,
.menu-bars::after {
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
}

.menu-bars {
  position: relative;
}

.menu-bars::before,
.menu-bars::after {
  content: "";
  position: absolute;
  left: 0;
}

.menu-bars::before {
  top: -6px;
}

.menu-bars::after {
  top: 6px;
}

.menu.is-open .menu-bars {
  background: transparent;
}

.menu.is-open .menu-bars::before,
.menu.is-open .menu-bars::after {
  top: 0;
}

.menu.is-open .menu-bars::before {
  transform: rotate(45deg);
}

.menu.is-open .menu-bars::after {
  transform: rotate(-45deg);
}

.session {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: auto;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  width: max-content;
  min-width: 14rem;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 16px 40px rgba(68, 40, 16, 0.08);
  font-size: 0.95rem;
}

.session[hidden] {
  display: none;
}

.session > * + * {
  border-top: 1px solid var(--line);
}

.session .who {
  padding: 12px 16px;
  color: var(--muted);
  font-size: 0.82rem;
}

.session .menu-item {
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: 100%;
  min-height: 44px;
  margin: 0;
  padding: 10px 16px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  letter-spacing: 0;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.session .menu-item:hover,
.session .menu-item:focus-visible {
  background: rgba(36, 28, 22, 0.05);
  color: var(--ink);
}

.menu-chevron {
  flex: none;
  width: 16px;
  height: 16px;
  color: var(--muted);
  display: block;
}

.masthead:has(.official-label) .session {
  grid-area: session;
}

.session form {
  margin: 0;
}

.page:has(.users) {
  width: min(920px, calc(100% - 32px));
}

.copy-source {
  position: fixed;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.is-copy-anchor {
  anchor-name: --copy-anchor;
}

.copy-tip {
  position: fixed;
  z-index: 40;
  margin: 0;
  padding: 6px 10px;
  border-radius: 8px;
  background: #241c16;
  color: #fff8f3;
  font-size: 0.82rem;
  line-height: 1.4;
  white-space: nowrap;
  box-shadow: 0 8px 24px rgba(68, 40, 16, 0.16);
  pointer-events: none;
  top: 16px;
  right: 16px;
}

@supports (anchor-name: --copy-anchor) {
  .copy-tip {
    position-anchor: --copy-anchor;
    top: anchor(bottom);
    left: anchor(left);
    right: auto;
    margin-top: 6px;
  }

  .copy-tip.is-end {
    left: auto;
    right: anchor(right);
  }
}

.copy-tip.is-error {
  background: var(--danger);
}

.copy-tip[hidden] {
  display: none;
}

.users-scroll {
  overflow-x: auto;
}

.users {
  width: 100%;
  border-collapse: collapse;
}

.users th,
.users td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

.users form {
  margin: 0;
}

.users td.row-actions {
  width: 1%;
  white-space: nowrap;
}

.users .row-actions-inner {
  display: grid;
  grid-template-columns: 36px 36px;
  gap: 2px;
  align-items: center;
  width: max-content;
  margin-left: auto;
}

.users td.row-actions form {
  display: none;
}

.users .row-cancel {
  display: none;
}

.users tr.is-editing .row-cancel {
  display: inline-flex;
}

.users tr.is-editing button.row-swap,
.users tr.is-editing button.row-withdraw,
.users tr.is-editing .row-withdraw-gap {
  display: none;
}

.users .row-withdraw-gap {
  width: 36px;
  height: 36px;
}

.reassign-list {
  max-height: min(320px, 46vh);
  margin: 0 0 16px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.reassign-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  min-height: 0;
  margin: 0;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font-size: 0.95rem;
  letter-spacing: 0;
  text-align: left;
  cursor: pointer;
}

.reassign-option:last-child {
  border-bottom: 0;
}

.reassign-option:focus {
  outline: none;
}

.reassign-option:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--focus);
}

.reassign-option small {
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0;
}

.reassign-option.is-selected {
  background: rgba(36, 92, 69, 0.12);
}

#reassign-chosen-email {
  color: var(--muted);
}

.users select,
.users input[name="name"] {
  width: auto;
  min-height: 36px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background-color: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  font: inherit;
  font-size: 0.85rem;
}

.users select {
  padding-right: 28px;
}

.users input[name="name"] {
  width: 12rem;
}

.users tr:not(.is-editing) input[name="name"],
.users tr:not(.is-editing) select.role-select,
.users .row-edit .icon-check,
.users tr.is-editing .row-edit .icon-pencil,
.users tr.is-editing .user-name-text,
.users tr.is-editing:has(select.role-select) .user-role-text {
  display: none;
}

.users tr.is-editing .row-edit .icon-check {
  display: block;
}

.users td.user-name {
  white-space: normal;
}

.users th.quote-count,
.users td.quote-count {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.user-name-field {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.users tr:not(.is-editing) .user-name-field .field-error {
  display: none;
}

.users button.row-edit,
.users button.row-cancel,
.users button.row-swap,
.users button.row-withdraw {
  align-items: center;
  justify-content: center;
  width: 36px;
  min-height: 36px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  letter-spacing: 0;
}

.users button.row-edit,
.users button.row-swap,
.users button.row-withdraw {
  display: inline-flex;
}

.users button.row-edit svg,
.users button.row-cancel svg,
.users button.row-swap svg,
.users button.row-withdraw svg {
  width: 18px;
  height: 18px;
}

.users button.row-edit:hover,
.users button.row-edit:focus-visible,
.users button.row-cancel:hover,
.users button.row-cancel:focus-visible,
.users button.row-swap:hover,
.users button.row-swap:focus-visible,
.users button.row-withdraw:hover,
.users button.row-withdraw:focus-visible {
  background: rgba(36, 28, 22, 0.06);
  color: var(--ink);
}

.users button.row-edit:disabled {
  cursor: not-allowed;
}

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

.users button.copy-id {
  appearance: none;
  min-height: 0;
  margin: 0;
  padding: 2px 4px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.78rem;
  letter-spacing: 0;
  text-align: left;
  white-space: nowrap;
  cursor: copy;
}

.users button.copy-id:hover,
.users button.copy-id:focus-visible {
  background: rgba(36, 28, 22, 0.06);
  color: var(--ink);
}

.auth-actions {
  justify-content: flex-end;
  margin-top: 4px;
}

.auth-actions button:disabled {
  cursor: not-allowed;
}

.password-wrapper {
  position: relative;
}

.password-wrapper input {
  padding-right: 44px;
}

.toggle-password {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 32px;
  min-height: 32px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
}

.toggle-password svg {
  width: 20px;
  height: 20px;
  display: block;
}

.toggle-password svg[hidden] {
  display: none;
}

.error-message,
.notice {
  margin: 0 0 16px;
  font-size: 0.92rem;
}

.error-message {
  color: var(--danger);
}

.notice {
  color: var(--focus);
}

.modal {
  width: min(420px, calc(100% - 32px));
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px 22px 16px;
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 16px 40px rgba(68, 40, 16, 0.16);
}

.modal::backdrop {
  background: rgba(36, 28, 22, 0.45);
}

.modal h2,
.modal p {
  margin: 0 0 12px;
}

.modal form {
  width: 100%;
}

.modal .actions {
  flex-wrap: wrap;
  margin-top: 4px;
}

.modal .actions button {
  letter-spacing: 0;
}

.masthead:has(.official-label) .seal {
  grid-area: seal;
}

.masthead:has(.official-label) .masthead-text {
  grid-area: text;
  min-width: 0;
}

.masthead:has(.official-label) .site-note {
  grid-area: note;
  margin-top: 8px;
  text-align: center;
}

.masthead:has(.official-label) .masthead-end {
  grid-area: official;
  align-self: start;
  margin-left: 0;
}

.masthead .share {
  grid-area: share;
  flex: 1 0 100%;
  margin-top: 12px;
}

.share {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
}

.share-label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  line-height: 1;
}

.share-bar {
  width: 1px;
  height: 16px;
  background: currentColor;
}

.share a {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  background: rgba(255, 252, 247, 0.72);
  color: var(--ink);
  text-decoration: none;
}

.share a.line {
  background: #06c755;
  border-color: #06c755;
  color: #fff;
}

.share a.facebook {
  background: #0866ff;
  border-color: #0866ff;
  color: #fff;
}

.share a:active {
  color: var(--seal);
  border-color: var(--seal);
}

.share a.line:active {
  color: #fff;
  background: #05a347;
  border-color: #05a347;
}

.share a.facebook:active {
  color: #fff;
  background: #0654d4;
  border-color: #0654d4;
}

@media (hover: hover) and (pointer: fine) {
  .share a:hover {
    color: var(--seal);
    border-color: var(--seal);
  }

  .share a.line:hover {
    color: #fff;
    background: #05a347;
    border-color: #05a347;
  }

  .share a.facebook:hover {
    color: #fff;
    background: #0654d4;
    border-color: #0654d4;
  }
}

.share a:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.share svg {
  width: 16px;
  height: 16px;
  display: block;
}

.quote::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 16px;
  bottom: 16px;
  width: 3px;
  border-radius: 3px;
  background: var(--seal);
}

.quote-top {
  display: grid;
  gap: 4px;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 16px;
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.meta a.author {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.meta a.author:hover,
.meta a.author:focus-visible {
  color: var(--seal);
}

#list-heading {
  overflow-wrap: anywhere;
}

.word {
  margin: 0;
  font-size: 1.45rem;
  letter-spacing: 0.04em;
  overflow-wrap: anywhere;
}

time {
  color: var(--muted);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.content {
  margin: 8px 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.content.clamp-1,
.content.clamp-2,
.pick .content {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: normal;
}

.content.clamp-1,
.pick .content.clamp-1 {
  -webkit-line-clamp: 1;
  line-clamp: 1;
}

.content.clamp-2 {
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.rank-lead,
.rank-note {
  margin: 0 0 14px;
  color: var(--muted);
}

.rank-note {
  margin-top: 8px;
  font-size: 0.92rem;
}

#rank-full {
  margin: 0;
}

.public-url {
  position: relative;
  margin: 0 0 16px;
}

.public-url[hidden] {
  display: none;
}

.public-url input {
  width: 100%;
  padding: 10px 84px 10px 12px;
  cursor: pointer;
}

.public-url.has-share input {
  padding-right: 118px;
}

#copy-url,
#share-url,
#open-url {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  letter-spacing: 0;
  text-decoration: none;
}

#copy-url {
  right: 42px;
}

#share-url,
#open-url {
  right: 8px;
}

.public-url.has-share #copy-url {
  right: 76px;
}

.public-url.has-share #share-url {
  right: 42px;
}

#share-url[hidden] {
  display: none;
}

.copy-icon,
.share-icon,
.globe-icon {
  display: block;
  width: 18px;
  height: 18px;
}

#share-dialog .share {
  justify-content: center;
}

#share-title {
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  line-height: 1;
}

.ranks {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

#ranks {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  overflow-anchor: none;
}

#ranks.is-dragging {
  touch-action: none;
}

.rank-slot,
button.rank-empty {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px 12px;
  align-items: start;
}

.rank-slot:has(.rank-handle) {
  grid-template-columns: auto auto minmax(0, 1fr);
}

button.rank-empty {
  width: 100%;
  min-height: 72px;
  padding: 14px 16px;
  border: 1px dashed var(--line);
  border-radius: 16px;
  background: rgba(255, 252, 247, 0.45);
  color: var(--muted);
  letter-spacing: 0.04em;
  text-align: left;
}

.rank-slot.is-selected,
button.rank-empty.is-selected {
  border-color: var(--seal);
}

.rank-slot {
  padding-right: 56px;
}

.ranks.is-dragging .rank-slot {
  transition: transform 180ms ease;
}

.ranks.is-dragging .rank-slot.is-source {
  opacity: 0.55;
  pointer-events: none;
  z-index: 2;
}

.rank-mark {
  display: inline-flex;
  align-items: baseline;
  gap: 0.04em;
  margin: 0;
  padding: 0;
  color: var(--seal);
  font-family: "Yu Mincho", "Hiragino Mincho ProN", "Iowan Old Style", serif;
  font-size: 1.6rem;
  line-height: 1;
}

.rank-num,
.rank-unit {
  line-height: 1;
}

.rank-unit {
  position: relative;
  top: -0.125em;
  font-size: 0.63em;
  letter-spacing: 0;
}

.rank-handle,
.rank-handle * {
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.rank-handle {
  display: grid;
  place-items: center;
  width: 32px;
  height: 36px;
  color: var(--muted);
  cursor: grab;
}

.ranks.is-dragging .rank-handle {
  cursor: grabbing;
}

.rank-grip {
  display: block;
  width: 18px;
  height: 18px;
}

.rank-body {
  min-width: 0;
}

.rank-body .word a {
  color: inherit;
  text-decoration: none;
}

.rank-dismiss {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  letter-spacing: 0;
}

.rank-dismiss-icon {
  display: block;
  width: 16px;
  height: 16px;
}

#pick-list {
  display: grid;
  gap: 12px;
}

button.pick {
  display: grid;
  gap: 4px;
  width: 100%;
  min-height: 0;
  padding: 16px 18px 16px 28px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  color: inherit;
  letter-spacing: 0;
  text-align: left;
}

button.pick:disabled {
  opacity: 1;
  cursor: default;
  background: #e4e2de;
}

.pick-rank {
  color: var(--seal);
  font-family: "Yu Mincho", "Hiragino Mincho ProN", "Iowan Old Style", serif;
}

.rank-save {
  margin: 0 0 16px;
}

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

#undo,
#redo {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  letter-spacing: 0;
}

.undo-icon {
  display: block;
  width: 20px;
  height: 20px;
}

#save:disabled,
#discard:disabled,
#undo:disabled,
#redo:disabled {
  opacity: 0.4;
  cursor: default;
}

#save.is-saving:disabled {
  cursor: progress;
}

.empty {
  margin: 0;
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 16px;
  background: rgba(255, 252, 247, 0.45);
}

.empty p {
  margin: 0;
}

.empty button {
  margin-top: 12px;
}

#list-status:empty {
  display: none;
}

.more {
  margin: 14px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  min-height: 1.5em;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.more[hidden] {
  display: none;
}

.quote-edit {
  margin-top: 12px;
}

.quote-edit textarea {
  min-height: 96px;
}

.quote-actions,
.edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

.quote-actions button,
.edit-actions button {
  min-height: 36px;
  padding: 0 14px;
  font-size: 0.85rem;
}

.quote-actions button.danger-text {
  color: var(--danger);
}

button.danger {
  background: var(--danger);
}

.confirm {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(36, 28, 22, 0.4);
}

.confirm[hidden] {
  display: none;
}

.confirm-card {
  width: min(420px, 100%);
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px 20px 16px;
  box-shadow: 0 16px 40px rgba(68, 40, 16, 0.16);
}

.confirm-card p {
  margin: 0;
}

#session-expired .confirm-card p + p {
  margin-top: 8px;
}

#session-expired .confirm-actions {
  justify-content: center;
}

#confirm-title {
  font-family: "Yu Mincho", "Hiragino Mincho ProN", "Iowan Old Style", serif;
  font-size: 1.25rem;
  letter-spacing: 0.06em;
}

.confirm-word {
  margin-top: 8px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

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

.confirm-actions button {
  min-height: 40px;
  padding: 0 16px;
}

footer {
  margin-top: 36px;
  font-size: 0.8rem;
}

footer p {
  margin: 0;
}

@media (max-width: 640px) {
  .page {
    width: min(740px, calc(100% - 24px));
    padding-top: 28px;
  }

  h1 {
    font-size: 1.7rem;
  }

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

  #form button[type="submit"] {
    width: 100%;
  }

  time {
    white-space: normal;
  }
}

@container home (max-width: 420px) {
  .masthead:has(.official-label) {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      "seal text"
      "official official"
      "note note";
    row-gap: 10px;
  }

  .masthead:has(.share) {
    grid-template-areas:
      "seal text"
      "official official"
      "note note"
      "share share";
  }

  .masthead:has(.menu:not([hidden])) {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "seal text menu"
      "official official official"
      "note note note";
  }

  .masthead:has(.menu:not([hidden])):has(.share) {
    grid-template-areas:
      "seal text menu"
      "official official official"
      "note note note"
      "share share share";
  }

  .masthead:has(.official-label) .masthead-end {
    justify-self: end;
  }

  .masthead:has(.official-label) .site-note {
    margin-top: 0;
  }
}
