.header-inner {
  --rmlp-header-gap: var(--rmlp-space-2);

  flex-wrap: wrap;
  padding-block: var(--rmlp-space-3);
}

.ww-header-branding {
  min-width: 0;
}

.ww-header-actions {
  display: flex;
  gap: var(--rmlp-space-2);
  margin-left: auto;
}

.ww-publisher-lockup {
  --ww-publisher-min-height: 1.35rem;
  --ww-publisher-logo-size: var(--ww-publisher-min-height);
  --ww-publisher-margin-bottom: 0.1rem;
  --ww-publisher-gap: 0.4rem;
  --ww-publisher-font-size: 0.7rem;
  --ww-publisher-font-weight: 800;
  --ww-publisher-letter-spacing: 0.11em;

  display: flex;
  min-height: var(--ww-publisher-min-height);
  margin-bottom: var(--ww-publisher-margin-bottom);
  align-items: center;
  gap: var(--ww-publisher-gap);
  color: var(--rmlp-ink-muted);
  font-size: var(--ww-publisher-font-size);
  font-weight: var(--ww-publisher-font-weight);
  letter-spacing: var(--ww-publisher-letter-spacing);
  text-transform: uppercase;
}

.ww-logo {
  width: var(--ww-publisher-logo-size);
  height: var(--ww-publisher-logo-size);
  flex-shrink: 0;
}

.ww-wordmark {
  font-size: var(--rmlp-text-lg);
  margin: 0;
}

.ww-pill {
  --ww-pill-radius: 20px;
  --ww-pill-min-height: 46px;
  --ww-pill-padding-inline: 14px;
  --ww-pill-hover-duration: 150ms;
  --ww-pill-disabled-opacity: 0.4;

  font-family: var(--rmlp-font-ui);
  font-weight: var(--rmlp-font-weight-semibold);
  font-size: var(--rmlp-text-sm);
  color: var(--rmlp-ink-muted);
  background: var(--rmlp-paper-raised);
  border: 1px solid var(--rmlp-rule);
  border-radius: var(--ww-pill-radius);
  min-height: var(--ww-pill-min-height);
  padding: var(--rmlp-space-2) var(--ww-pill-padding-inline);
  cursor: pointer;
  transition: background-color var(--ww-pill-hover-duration) ease;
  white-space: nowrap;
}

.ww-pill:hover {
  background: var(--rmlp-paper);
}

.ww-pill:disabled {
  opacity: var(--ww-pill-disabled-opacity);
  cursor: not-allowed;
}

/* Keep both actions together beneath the branding on phones. */
@media (max-width: 480px) {
  .ww-publisher-lockup {
    --ww-publisher-logo-size: 1.2rem;
    --ww-publisher-font-size: 0.65rem;
  }

  .ww-header-actions {
    width: 100%;
    justify-content: flex-end;
    margin-left: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ww-pill {
    transition: none;
  }
}

.ww-app {
  --ww-content-width: 760px;
  --ww-control-height: 46px;
  --ww-control-padding-inline: 14px;
  --ww-transition-duration: 150ms;
  --ww-modal-layer: 50;
  --ww-modal-width: 480px;
  --ww-modal-backdrop-opacity: 45%;
  --ww-loading-duration: 2s;
  --ww-loading-stagger: 450ms;
  --ww-tutorial-dot-size: 6px;
  --ww-tutorial-active-dot-size: 8px;
}

.ww-app [hidden] {
  display: none;
}

.ww-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.ww-main {
  max-width: var(--ww-content-width);
  margin-inline: auto;
  padding: var(--rmlp-space-4) var(--rmlp-space-4) var(--rmlp-space-8);
  font-size: var(--rmlp-text-base);
}

.ww-hint,
.ww-save-status {
  font-size: var(--rmlp-text-sm);
  color: var(--rmlp-ink-muted);
  margin: 0 0 var(--rmlp-space-2);
}

.ww-session,
.ww-session-actions,
.ww-notice-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--rmlp-space-2);
}

.ww-session {
  justify-content: space-between;
  margin-bottom: var(--rmlp-space-3);
  font-size: var(--rmlp-text-sm);
}

.ww-save-status {
  margin: 0;
}

.ww-save-status.is-error,
.ww-save-status.is-unsynced {
  color: var(--rmlp-invalid);
}

.ww-notice {
  padding: var(--rmlp-space-4);
  margin-bottom: var(--rmlp-space-4);
  border: 1px solid var(--rmlp-rule);
  border-inline-start: var(--rmlp-space-1) solid var(--rmlp-accent-teal);
  border-radius: var(--rmlp-radius-md);
  background: var(--rmlp-paper-raised);
  font-size: var(--rmlp-text-sm);
}

.ww-notice h2 {
  margin: 0 0 var(--rmlp-space-2);
  font-size: var(--rmlp-text-base);
}

.ww-notice p {
  margin: 0 0 var(--rmlp-space-3);
}

.ww-btn {
  min-height: var(--ww-control-height);
  padding: var(--rmlp-space-2) var(--ww-control-padding-inline);
  border: 1px solid var(--rmlp-rule);
  border-radius: var(--rmlp-radius-md);
  color: var(--rmlp-ink);
  background: var(--rmlp-paper-raised);
  font-family: var(--rmlp-font-ui);
  font-size: var(--rmlp-text-sm);
  font-weight: var(--rmlp-font-weight-semibold);
  cursor: pointer;
  transition: background-color var(--ww-transition-duration) ease;
}

.ww-btn:hover {
  background: var(--rmlp-paper);
}

.ww-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ww-btn-accent {
  color: var(--rmlp-paper);
  background: var(--rmlp-accent-red);
  border-color: var(--rmlp-accent-red);
}

.ww-btn-accent:hover {
  background: color-mix(in srgb, var(--rmlp-accent-red), var(--rmlp-ink) 15%);
}

.ww-board,
.ww-entry,
.ww-share-panel {
  background: var(--rmlp-paper-raised);
  border: 1px solid var(--rmlp-rule);
  border-radius: var(--rmlp-radius-lg);
}

.ww-board {
  position: relative;
  overflow: hidden;
  margin-bottom: var(--rmlp-space-3);
}

.ww-graph,
.ww-board-loading svg,
.ww-tutorial-board svg {
  width: 100%;
  height: auto;
  display: block;
}

.ww-board-viewport {
  --ww-board-viewport-height: 480px;

  overflow: auto;
  max-height: min(var(--ww-board-viewport-height), 60svh);
  overscroll-behavior: contain;
}

.ww-board-viewport:focus-visible {
  outline: 3px solid var(--rmlp-accent-gold);
  outline-offset: -3px;
}

.ww-board-viewport.is-fit {
  max-height: none;
}

.ww-board-viewport .ww-graph {
  min-width: 100%;
  max-width: none;
}

.ww-board-tools {
  display: flex;
  align-items: center;
  gap: var(--rmlp-space-2);
  padding: var(--rmlp-space-2);
  border-bottom: 1px solid var(--rmlp-rule);
  font-size: var(--rmlp-text-sm);
}

.ww-board-tools .ww-btn {
  min-width: var(--ww-control-height);
}

.ww-board-pan-hint {
  margin: 0;
  padding: var(--rmlp-space-2);
  border-top: 1px solid var(--rmlp-rule);
  color: var(--rmlp-ink-muted);
  font-size: var(--rmlp-text-sm);
}

.ww-board:has(.ww-graph[hidden]) .ww-board-viewport,
.ww-board:has(.ww-graph[hidden]) .ww-board-tools,
.ww-board:has(.ww-graph[hidden]) .ww-board-pan-hint {
  display: none;
}

.ww-node {
  cursor: grab;
  touch-action: none;
  outline: none;
}

.ww-node.is-dragging {
  cursor: grabbing;
}

.ww-node:focus-visible .ww-node-ring {
  stroke: var(--rmlp-accent-gold);
  stroke-width: var(--rmlp-space-1);
  opacity: 1;
}

.ww-board-loading {
  padding: var(--rmlp-space-3);
}

.ww-load-dot {
  fill: none;
  stroke: var(--rmlp-ink-muted);
  stroke-width: 1.5;
  stroke-dasharray: 3 5;
  animation: ww-loading-pulse var(--ww-loading-duration) ease-in-out infinite;
}

.ww-load-dot:nth-child(2) {
  animation-delay: var(--ww-loading-stagger);
}

.ww-load-dot:nth-child(3) {
  animation-delay: calc(var(--ww-loading-stagger) * 2);
}

@keyframes ww-loading-pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.8; }
}

.ww-entry,
.ww-share-panel {
  padding: var(--rmlp-space-4);
}

.ww-entry-form {
  display: flex;
  gap: var(--rmlp-space-2);
}

.ww-word-input {
  flex: 1;
  min-width: 0;
  padding: var(--rmlp-space-3) var(--ww-control-padding-inline);
  border: 1px solid var(--rmlp-rule);
  border-radius: var(--rmlp-radius-sm);
  color: var(--rmlp-ink);
  background: var(--rmlp-paper);
  font-family: var(--rmlp-font-mono);
  font-size: var(--rmlp-text-lg);
  font-weight: var(--rmlp-font-weight-bold);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.ww-word-input::placeholder {
  color: var(--rmlp-ink-muted);
  font-family: var(--rmlp-font-ui);
  font-size: var(--rmlp-text-base);
  font-weight: var(--rmlp-font-weight-regular);
  letter-spacing: normal;
  text-transform: none;
}

.ww-word-input:focus-visible,
.ww-share-manual-text:focus-visible {
  outline: var(--rmlp-focus-outline-width) solid var(--rmlp-accent-teal);
  outline-offset: var(--rmlp-focus-outline-offset);
}

.ww-word-input:disabled {
  opacity: 0.6;
}

.ww-entry-feedback {
  min-height: 1.3em;
  margin: var(--rmlp-space-2) 0 0;
  color: var(--rmlp-ink-muted);
  font-size: var(--rmlp-text-sm);
}

.ww-entry-feedback.is-error {
  color: var(--rmlp-invalid);
}

.ww-entry-feedback.is-success {
  color: var(--rmlp-accent-teal);
}

.ww-stats-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: var(--rmlp-space-6);
  margin: var(--rmlp-space-3) 0 var(--rmlp-space-4);
  color: var(--rmlp-ink-muted);
  font-family: var(--rmlp-font-mono);
  font-size: var(--rmlp-text-sm);
}

.ww-stat b {
  margin-left: var(--rmlp-space-1);
  color: var(--rmlp-ink);
  font-size: var(--rmlp-text-lg);
  font-weight: var(--rmlp-font-weight-bold);
}

.ww-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--ww-modal-layer);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--rmlp-space-4);
  background: rgb(from var(--rmlp-ink) r g b / var(--ww-modal-backdrop-opacity));
}

.ww-modal {
  position: relative;
  width: 100%;
  max-width: var(--ww-modal-width);
  max-height: calc(100dvh - 2 * var(--rmlp-space-4));
  overflow-y: auto;
  padding: var(--rmlp-space-6);
  border: 1px solid var(--rmlp-rule);
  border-radius: var(--rmlp-radius-lg);
  background: var(--rmlp-paper);
}

.ww-modal-close {
  position: absolute;
  top: var(--rmlp-space-2);
  right: var(--rmlp-space-2);
  min-width: var(--ww-control-height);
  min-height: var(--ww-control-height);
  padding: var(--rmlp-space-1);
  border: none;
  color: var(--rmlp-ink-muted);
  background: transparent;
  font-size: var(--rmlp-text-lg);
  line-height: 1;
  cursor: pointer;
}

.ww-modal-title {
  margin: 0 var(--ww-control-height) var(--rmlp-space-3) 0;
  font-family: var(--rmlp-font-display);
  font-size: var(--rmlp-text-xl);
  line-height: 1.2;
}

.ww-modal-actions,
.ww-share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--rmlp-space-2);
  margin-top: var(--rmlp-space-4);
  justify-content: flex-end;
}

.ww-completion-modal {
  --ww-modal-width: 420px;
  text-align: center;
}

.ww-completion-stat {
  margin: 0 0 var(--rmlp-space-4);
  color: var(--rmlp-ink-muted);
  font-family: var(--rmlp-font-mono);
  font-size: var(--rmlp-text-sm);
}

.ww-tutorial-caption {
  min-height: var(--ww-control-height);
  margin: 0 var(--ww-control-height) var(--rmlp-space-3) 0;
  color: var(--rmlp-ink);
  font-size: var(--rmlp-text-base);
  line-height: 1.5;
}

.ww-tutorial-board {
  padding: var(--rmlp-space-3);
  margin-bottom: var(--rmlp-space-2);
  border: 1px solid var(--rmlp-rule);
  border-radius: var(--rmlp-radius-md);
  background: var(--rmlp-paper-raised);
}

.ww-tutorial-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--rmlp-space-2);
  margin-top: var(--rmlp-space-4);
}

.ww-tutorial-controls .is-unavailable {
  visibility: hidden;
}

.ww-tutorial-dots {
  display: flex;
  align-items: center;
  gap: var(--ww-tutorial-dot-size);
}

.ww-tutorial-dot {
  width: var(--ww-tutorial-dot-size);
  height: var(--ww-tutorial-dot-size);
  border-radius: 50%;
  background: color-mix(in srgb, var(--rmlp-rule), var(--rmlp-paper) 55%);
}

.ww-tutorial-dot.is-past {
  background: var(--rmlp-rule);
}

.ww-tutorial-dot.is-current {
  width: var(--ww-tutorial-active-dot-size);
  height: var(--ww-tutorial-active-dot-size);
  background: var(--rmlp-accent-red);
}

.ww-footer {
  max-width: var(--ww-content-width);
  margin: 0 auto;
  padding: var(--rmlp-space-3) var(--rmlp-space-4) var(--rmlp-space-6);
  border-top: 1px solid var(--rmlp-rule);
  color: var(--rmlp-ink-muted);
  font-size: var(--rmlp-text-sm);
}

.ww-footer-links {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--rmlp-space-2) var(--rmlp-space-4);
}

.ww-footer-links a {
  display: inline-flex;
  align-items: center;
  min-height: var(--ww-control-height);
  text-align: center;
}

.ww-listdle-link {
  padding-block: var(--rmlp-space-1);
}

.ww-listdle-badge {
  display: block;
  width: auto;
  height: 50px;
}

.ww-share-panel {
  margin-top: var(--rmlp-space-3);
  text-align: center;
}

.ww-share-panel canvas {
  max-width: 100%;
  height: auto;
  border-radius: var(--rmlp-radius-md);
}

.ww-share-actions {
  justify-content: center;
  margin-top: var(--rmlp-space-3);
}

.ww-share-status {
  min-height: 1.2em;
  margin: var(--rmlp-space-2) 0 0;
  color: var(--rmlp-ink-muted);
  font-size: var(--rmlp-text-xs);
}

.ww-share-manual {
  margin-top: var(--rmlp-space-3);
  text-align: left;
}

.ww-share-manual label {
  display: block;
  margin-bottom: var(--rmlp-space-2);
  font-size: var(--rmlp-text-sm);
  font-weight: var(--rmlp-font-weight-semibold);
}

.ww-share-manual-text {
  width: 100%;
  resize: vertical;
  padding: var(--rmlp-space-3);
  border: 1px solid var(--rmlp-rule);
  border-radius: var(--rmlp-radius-sm);
  color: var(--rmlp-ink);
  background: var(--rmlp-paper);
  font-family: var(--rmlp-font-mono);
  font-size: var(--rmlp-text-sm);
  line-height: 1.4;
}

@media (max-width: 480px) {
  .ww-stats-row {
    gap: var(--rmlp-space-4);
  }

  .ww-modal {
    padding: var(--rmlp-space-4);
  }

  .ww-tutorial-controls {
    flex-wrap: wrap;
  }

  .ww-tutorial-dots {
    order: 1;
    flex-basis: 100%;
    justify-content: center;
    margin-top: var(--rmlp-space-2);
  }
}

@media (max-width: 340px) {
  .ww-entry-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .ww-entry-form .ww-btn {
    justify-self: end;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ww-load-dot {
    animation: none;
  }

  .ww-btn {
    transition: none;
  }
}
