.receive-center-account small {
  font-size: max(12px, .92em);
  font-weight: 400;
  color: #3f573d;
  opacity: 1;
}

.account-card-nickname {
  margin: 0 0 10px;
  color: #477250;
  font-size: 14px;
}

.account-card-nickname:empty {
  display: none;
}

/* ==========================================================================
 * Friends Tab Entrance: Unified flat paper-and-hairline style
 * Matches r29-center.css & journey bottom CTA (zero heavy shadows/gradients)
 * ========================================================================== */
#game-stage #app .receive-center .penpal-card-entrance,
.penpal-card-entrance {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: max(54px, var(--center-touch, 54px));
  margin: 0 0 10px;
  padding: 8px 12px 8px 9px;
  text-align: left;
  border: 1px solid #a8b78e;
  border-radius: 10px;
  background: #edf2dc;
  color: #294b32;
  box-shadow: none;
  touch-action: manipulation;
  transition: background-color .14s ease, border-color .14s ease;
}

#game-stage #app .receive-center .penpal-card-entrance:active,
.penpal-card-entrance:active {
  background: #e2ebd0;
}

#game-stage #app .receive-center .penpal-card-entrance:focus-visible,
.penpal-card-entrance:focus-visible {
  outline: 2px solid var(--kv-focus, #2c5135);
  outline-offset: 2px;
}

.penpal-card-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border: 1px solid #c5cfa9;
  border-radius: 8px;
  background: #fffaf0;
  overflow: hidden;
}

.penpal-card-icon img {
  display: block;
  width: 34px;
  height: 36px;
  object-fit: contain;
}

.penpal-card-entrance .penpal-card-copy {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
}

.penpal-card-entrance .penpal-card-copy b {
  color: #294b32;
  font: 600 16px/1.3 var(--kv-label, sans-serif);
}

.penpal-card-tail {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: none;
  color: #4f694e;
}

.penpal-card-tail svg {
  display: block;
  width: 18px;
  height: 18px;
}

.penpal-card-chevron {
  color: #58734c;
  font: 600 18px/1 var(--kv-label, sans-serif);
}

#game-stage #app .receive-center .penpal-card-entrance + .receive-empty {
  padding-top: 26px;
}

/* Shared icon helper */
.penpal-svg {
  display: block;
  flex: none;
  pointer-events: none;
}

/* ==========================================================================
 * Penpal Card Dialog: Original light cream paper, crisp 1px sage hairlines,
 * flat solid game buttons, clear hierarchy, compact non-jarring fallback.
 * ========================================================================== */
#app dialog.share-entry.share-invitation.penpal-share,
dialog.share-entry.share-invitation.penpal-share {
  --penpal-ink: #244830;
  --penpal-muted: #556d53;
  --penpal-paper: #fff8e9;
  --penpal-surface: #f4f1dc;
  --penpal-border: #b3c097;
  --penpal-rule: #d5dac0;
  --penpal-primary: #3d6243;
  --penpal-touch: max(44px, calc(44.25px / var(--stage-scale, 1)));
  width: 356px;
  max-width: calc((100vw - 24px) / var(--stage-scale, 1));
  max-height: calc((100dvh - 24px) / var(--stage-scale, 1));
  padding: 0;
  border: 1px solid #a9b88e;
  border-radius: 14px;
  background: var(--penpal-paper);
  color: var(--penpal-ink);
  box-shadow: 0 3px 0 #6a80574a;
  overflow: auto;
  overscroll-behavior: contain;
}

dialog.share-entry.share-invitation.penpal-share::backdrop {
  background: #19392c66;
}

#app dialog.share-invitation.penpal-share .penpal-sheet {
  display: grid;
  gap: 12px;
  padding: 13px 16px 16px;
}

#app dialog.share-invitation.penpal-share .penpal-header {
  position: static;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0;
  padding: 0 0 8px;
  border-bottom: 1px dashed var(--penpal-rule);
  background: transparent;
}

#app dialog.share-invitation.penpal-share .penpal-header h2 {
  margin: 0;
  color: #214216;
  font: 400 24px/1.2 var(--kv-writing, serif);
  letter-spacing: .02em;
}

#app dialog.share-invitation.penpal-share .penpal-close {
  display: grid;
  place-items: center;
  flex: 0 0 var(--penpal-touch);
  width: var(--penpal-touch);
  height: var(--penpal-touch);
  min-height: var(--penpal-touch);
  margin: -6px -6px -6px 0;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #4f6950;
  transition: background-color .14s ease, color .14s ease;
}

@media (hover: hover) {
  #app dialog.share-invitation.penpal-share .penpal-close:hover {
    background: #edf1da;
    color: var(--penpal-ink);
  }
}

#app dialog.share-invitation.penpal-share .penpal-close:focus-visible {
  outline: 2px solid var(--kv-focus, #2c5135);
  outline-offset: -2px;
}

#app dialog.share-invitation.penpal-share .penpal-body {
  display: grid;
  gap: 11px;
}

#app dialog.share-invitation.penpal-share .penpal-preview-pane {
  display: grid;
  place-items: center;
}

#app dialog.share-invitation.penpal-share .penpal-controls-pane {
  display: grid;
  gap: 9px;
  align-content: start;
}

/* Hero postcard preview with fixed 3:4 aspect ratio (0 CLS) */
#app dialog.share-invitation.penpal-share .penpal-card-image {
  margin: 0 auto;
  width: min(248px, 100%);
  max-width: 248px;
  text-align: center;
}

#app dialog.share-invitation.penpal-share[data-manual-open="true"] .penpal-card-image {
  width: min(204px, 100%);
  max-width: 204px;
}

#app dialog.share-invitation.penpal-share .penpal-card-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  border: 1px solid #c3cfa9;
  border-radius: 10px;
  overflow: hidden;
  background: #eff3df;
  box-shadow: none;
}

#app dialog.share-invitation.penpal-share .penpal-card-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0;
  background: transparent;
  opacity: 0;
  transition: opacity .2s ease;
}

#app dialog.share-invitation.penpal-share .penpal-card-image[data-card-state="ready"] img {
  opacity: 1;
}

#app dialog.share-invitation.penpal-share .penpal-card-image[data-card-state="error"] img {
  visibility: hidden;
}

#app dialog.share-invitation.penpal-share .penpal-card-loading,
#app dialog.share-invitation.penpal-share .penpal-card-error {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px;
  text-align: center;
}

#app dialog.share-invitation.penpal-share .penpal-card-image[data-card-state="loading"] .penpal-card-loading {
  display: flex;
  color: #4f6b4e;
  font: 500 13.5px/1.4 var(--kv-label, sans-serif);
}

#app dialog.share-invitation.penpal-share .penpal-card-image[data-card-state="error"] .penpal-card-error {
  display: flex;
  background: #f8f4e3;
  color: var(--penpal-ink);
}

#app dialog.share-invitation.penpal-share .penpal-card-error strong {
  font: 600 15px/1.35 var(--kv-label, sans-serif);
}

#app dialog.share-invitation.penpal-share .penpal-retry {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--penpal-touch);
  margin-top: 2px;
  padding: 0 16px;
  border: 1px solid #9eb186;
  border-radius: 8px;
  background: #fffaf0;
  color: var(--penpal-ink);
  font: 600 14px/1.2 var(--kv-label, sans-serif);
}

/* Loading pulse dots (pure CSS geometry, zero emoji) */
.penpal-loading-dots {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.penpal-loading-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #67875d;
  animation: penpal-dot-pulse 1.1s ease-in-out infinite;
}

.penpal-loading-dots i:nth-child(2) {
  animation-delay: .18s;
}

.penpal-loading-dots i:nth-child(3) {
  animation-delay: .36s;
}

@keyframes penpal-dot-pulse {
  0%, 80%, 100% {
    opacity: .32;
    transform: scale(.86);
  }
  40% {
    opacity: 1;
    transform: scale(1.08);
  }
}

/* Clean flat paired action bar matching r29-center.css */
#app dialog.share-invitation.penpal-share .penpal-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 8px;
  margin: 0;
}

#app dialog.share-invitation.penpal-share .penpal-download,
#app dialog.share-invitation.penpal-share .penpal-copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-width: 0;
  min-height: var(--penpal-touch);
  margin: 0;
  padding: 0 12px;
  border-radius: 8px;
  font: 600 15px/1.2 var(--kv-label, sans-serif);
  text-decoration: none;
  white-space: nowrap;
  touch-action: manipulation;
  box-shadow: none;
  transition: background-color .14s ease, border-color .14s ease, opacity .14s ease;
}

#app dialog.share-invitation.penpal-share .penpal-download {
  border: 1px solid #a7b68b;
  background: #eef2de;
  color: #294b32;
}

#app dialog.share-invitation.penpal-share .penpal-download:active:not([aria-disabled="true"]) {
  background: #e2ebd0;
}

#app dialog.share-invitation.penpal-share .penpal-download[aria-disabled="true"] {
  opacity: .46;
  pointer-events: none;
}

#app dialog.share-invitation.penpal-share .penpal-copy {
  border: 1px solid var(--penpal-primary);
  background: var(--penpal-primary);
  color: #fff9e9;
}

#app dialog.share-invitation.penpal-share .penpal-copy:active:not(:disabled):not([aria-disabled="true"]) {
  background: #315236;
}

#app dialog.share-invitation.penpal-share .penpal-copy[data-copied="true"] {
  border-color: #4b7950;
  background: #4b7950;
}

#app dialog.share-invitation.penpal-share :is(.penpal-download, .penpal-copy, .penpal-retry, .penpal-select-all):focus-visible {
  outline: 2px solid var(--kv-focus, #2c5135);
  outline-offset: 2px;
}

/* Quiet inline status line (zero capsule box) */
#app dialog.share-invitation.penpal-share .penpal-result {
  margin: 0;
  min-height: 0;
  color: #49664b;
  font: 500 13px/1.45 var(--kv-label, sans-serif);
  text-align: center;
}

#app dialog.share-invitation.penpal-share .penpal-result[data-tone="manual"],
#app dialog.share-invitation.penpal-share .penpal-result[data-tone="warn"] {
  color: #6b5839;
}

#app dialog.share-invitation.penpal-share .penpal-result:empty {
  display: none;
}

/* Clean flat manual-copy section: single hairline zone, zero nested double-box */
#app dialog.share-invitation.penpal-share .penpal-manual {
  margin: 0;
  padding: 9px 0 0;
  border-top: 1px dashed var(--penpal-rule);
}

#app dialog.share-invitation.penpal-share .penpal-manual[hidden] {
  display: none;
}

#app dialog.share-invitation.penpal-share .penpal-manual-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
}

#app dialog.share-invitation.penpal-share .penpal-manual .share-link-label {
  margin: 0;
  color: var(--penpal-muted);
  font: 500 12.5px/1.35 var(--kv-label, sans-serif);
}

#app dialog.share-invitation.penpal-share .penpal-select-all {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--penpal-touch);
  min-height: var(--penpal-touch);
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #294b32;
  font: 600 12.5px/1.2 var(--kv-label, sans-serif);
  touch-action: manipulation;
}

#app dialog.share-invitation.penpal-share .penpal-select-all::before {
  content: "";
  position: absolute;
  inset: 50% 0 auto;
  height: 30px;
  transform: translateY(-50%);
  z-index: -1;
  border: 1px solid #b3c097;
  border-radius: 6px;
  background: #f4f1dc;
}

#app dialog.share-invitation.penpal-share .penpal-select-all:active::before {
  background: #e6ecd2;
}

#app dialog.share-invitation.penpal-share .penpal-manual .invite-link {
  display: block;
  width: 100%;
  height: auto;
  min-height: 76px;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid #bcc7a2;
  border-radius: 8px;
  background: #f6f3e2;
  color: #244830;
  font: 400 16px/1.45 var(--kv-label, sans-serif);
  word-break: break-all;
  overflow: hidden;
  resize: none;
}

#app dialog.share-invitation.penpal-share .penpal-manual .invite-link::selection {
  background: #dce8c4;
  color: #1f402a;
}

#app dialog.share-invitation.penpal-share .penpal-manual .invite-link:focus {
  border-color: var(--kv-focus, #2c5135);
  background: #fffdf5;
}

#app dialog.share-invitation.penpal-share .penpal-manual .invite-link:focus-visible {
  outline: 2px solid var(--kv-focus, #2c5135);
  outline-offset: 2px;
}

/* Compact viewport fit (e.g. 320x660) */
@media (max-height: 690px), (max-width: 340px) {
  #app dialog.share-invitation.penpal-share .penpal-sheet {
    gap: 9px;
    padding: 11px 14px 13px;
  }

  #app dialog.share-invitation.penpal-share .penpal-body {
    gap: 9px;
  }

  #app dialog.share-invitation.penpal-share .penpal-card-image {
    width: min(230px, 100%);
    max-width: 230px;
  }

  #app dialog.share-invitation.penpal-share[data-manual-open="true"] .penpal-card-image {
    width: min(218px, 100%);
    max-width: 218px;
  }
}

/* Desktop two-column calm paper layout */
@media (min-width: 760px) and (min-height: 620px) {
  #app dialog.share-entry.share-invitation.penpal-share,
  dialog.share-entry.share-invitation.penpal-share {
    width: 584px;
  }

  #app dialog.share-invitation.penpal-share .penpal-sheet {
    gap: 12px;
    padding: 14px 18px 18px;
  }

  #app dialog.share-invitation.penpal-share .penpal-body {
    grid-template-columns: 244px minmax(0, 1fr);
    gap: 18px;
    align-items: center;
  }

  #app dialog.share-invitation.penpal-share .penpal-preview-pane {
    padding-right: 18px;
    border-right: 1px dashed var(--penpal-rule);
  }

  #app dialog.share-invitation.penpal-share .penpal-card-image,
  #app dialog.share-invitation.penpal-share[data-manual-open="true"] .penpal-card-image {
    width: 226px;
    max-width: 226px;
  }

  #app dialog.share-invitation.penpal-share .penpal-controls-pane {
    gap: 11px;
  }

  #app dialog.share-invitation.penpal-share .penpal-result {
    text-align: left;
  }
}

/* ==========================================================================
 * Received Penpal Link Page (.penpal-welcome)
 * Quiet cream paper card with thin sage hairline matching the game's tone
 * ========================================================================== */
#game-stage #app .invitation-welcome.penpal-welcome,
#app .invitation-welcome.penpal-welcome {
  --penpal-touch: max(46px, calc(44.25px / var(--stage-scale, 1)));
  position: relative;
  height: 844px;
  overflow: hidden;
  background: linear-gradient(180deg, #dde9d4 0%, #ebf0d7 48%, #c9d7aa 100%);
  color: #244830;
}

#game-stage #app .penpal-welcome > .r9-station-backdrop {
  background: linear-gradient(180deg, #e3eddd59 0%, #f1efd5a8 52%, #c1ce9b52 100%);
}

#game-stage #app .penpal-welcome :is(.r9-station-window, .r9-station-beam, .r9-station-floor, .r9-station-pot) {
  display: none;
}

#game-stage #app .penpal-welcome > header {
  position: relative;
  z-index: 4;
}

#game-stage #app .penpal-welcome .penpal-back {
  position: absolute;
  z-index: 5;
  top: 82px;
  left: 18px;
  display: grid;
  place-items: center;
  width: var(--penpal-touch);
  height: var(--penpal-touch);
  min-width: var(--penpal-touch);
  min-height: var(--penpal-touch);
  padding: 0;
  border: 1px solid #a2ad84;
  border-radius: 50%;
  background: #faf4df;
  color: #244830;
  box-shadow: none;
}

#game-stage #app .penpal-welcome .penpal-back:focus-visible {
  outline: 2px solid var(--kv-focus, #2c5135);
  outline-offset: 2px;
}

#game-stage #app .penpal-welcome .penpal-welcome-stage {
  position: absolute;
  z-index: 2;
  inset: 124px 20px 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 0 32px;
  overflow: auto;
  overscroll-behavior: contain;
  text-align: center;
}

#game-stage #app .penpal-welcome .penpal-letter-card {
  position: relative;
  width: 100%;
  margin: auto 0;
  padding: 18px 20px 22px;
  border: 1px solid #aebc93;
  border-radius: 16px;
  background: #fff9ea;
  box-shadow: 0 3px 0 #77915e28;
}

#game-stage #app .penpal-welcome .penpal-letter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 6px;
}

#game-stage #app .penpal-welcome .invitation-kicker {
  margin: 0;
  padding: 0;
  color: #5d7456;
  font: 500 12.5px/1.3 var(--kv-label, sans-serif);
  letter-spacing: .05em;
}

#game-stage #app .penpal-welcome .penpal-postmark {
  display: grid;
  place-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid #a7b892;
  border-radius: 50%;
  color: #6b845e;
  transform: rotate(8deg);
  flex: none;
}

#game-stage #app .penpal-welcome .penpal-postmark span {
  font: 700 10.5px/1 system-ui, sans-serif;
}

#game-stage #app .penpal-welcome .penpal-postmark i {
  font: 600 7px/1.2 system-ui, sans-serif;
  letter-spacing: .06em;
}

#game-stage #app .penpal-welcome .penpal-letter-card > h1 {
  margin: 0 0 8px;
  padding: 0;
  color: #214216;
  font: 400 28px/1.25 var(--kv-writing, serif);
  letter-spacing: .03em;
}

#game-stage #app .penpal-welcome .penpal-welcome-hero {
  position: relative;
  height: 200px;
  margin: 4px auto 12px;
}

#game-stage #app .penpal-welcome .penpal-welcome-hero::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 10px;
  width: 214px;
  height: 180px;
  transform: translateX(-50%);
  border: 1px solid #cfd9b8;
  border-radius: 16px;
  background: #e8efda;
}

#game-stage #app .penpal-welcome .penpal-welcome-hero::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 16px;
  width: 106px;
  height: 10px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: #8aa27338;
  pointer-events: none;
}

#game-stage #app .penpal-welcome .penpal-welcome-hero > .turtle {
  position: relative;
  z-index: 1;
  display: block;
  width: 220px;
  height: 192px;
  margin: 0 auto;
  transform: none;
}

#game-stage #app .penpal-welcome .penpal-letter-divider {
  height: 1px;
  margin: 2px 0 16px;
  border-top: 1px dashed #cfd5b8;
}

#game-stage #app .penpal-welcome #penpal-info {
  min-height: 130px;
}

#game-stage #app .penpal-welcome .penpal-loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 116px;
  color: #5a7457;
}

#game-stage #app .penpal-welcome .penpal-loading-state p {
  margin: 0;
  font: 500 14px/1.4 var(--kv-label, sans-serif);
}

#game-stage #app .penpal-welcome #penpal-info h2 {
  margin: 0 0 8px;
  color: #244830;
  font: 600 20px/1.4 var(--kv-label, sans-serif);
  overflow-wrap: anywhere;
  text-wrap: balance;
}

#game-stage #app .penpal-welcome #penpal-info > p,
#game-stage #app .penpal-welcome .invitation-account {
  margin: 0 0 18px;
  color: #526a50;
  font: 400 14px/1.6 var(--kv-label, sans-serif);
  overflow-wrap: anywhere;
}

/* Pending request: the line under the ID reads with the heading, not the hint. */
#game-stage #app .penpal-welcome #penpal-info > p.penpal-request {
  margin: -6px 0 12px;
  color: #244830;
  font: 600 20px/1.4 var(--kv-label, sans-serif);
}

#game-stage #app .penpal-welcome #penpal-info > p.penpal-request-note {
  margin: 14px 0 0;
  text-align: center;
}

#game-stage #app .penpal-welcome #penpal-info .actions {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
}

#game-stage #app .penpal-welcome #penpal-info :is(.primary, .secondary) {
  width: 100%;
  min-height: var(--penpal-touch);
  margin: 0;
  padding: 10px 16px;
  border-radius: 10px;
  font: 600 16px/1.25 var(--kv-label, sans-serif);
  box-shadow: none;
  transition: background-color .14s ease;
}

#game-stage #app .penpal-welcome #penpal-info .primary {
  border: 1px solid #3d6243;
  background: #3d6243;
  color: #fff9e9;
}

#game-stage #app .penpal-welcome #penpal-info .primary:active {
  background: #315236;
}

#game-stage #app .penpal-welcome #penpal-info .secondary {
  border: 1px solid #a7b68b;
  background: #eef2de;
  color: #294b32;
}

#game-stage #app .penpal-welcome #penpal-info .secondary:active {
  background: #e2ebd0;
}

#game-stage #app .penpal-welcome #penpal-info :is(.primary, .secondary):focus-visible {
  outline: 2px solid var(--kv-focus, #2c5135);
  outline-offset: 2px;
}

/* Self penpal card: suppress exact verbatim duplicate paragraph from app.js */
#game-stage #app .penpal-welcome #penpal-info:has([data-go="center"]) .invitation-account {
  display: none;
}

#game-stage #app .penpal-welcome #penpal-info:has([data-go="center"]) h2 {
  margin-bottom: 18px;
}

/* Error state: soften card tone and hide cheerful invite headline */
#game-stage #app .penpal-welcome .penpal-letter-card:has(#penpal-info [data-go="home"]) {
  border-color: #c7b698;
}

#game-stage #app .penpal-welcome .penpal-letter-card:has(#penpal-info [data-go="home"]) > h1 {
  display: none;
}

#game-stage #app .penpal-welcome .penpal-letter-card:has(#penpal-info [data-go="home"]) .penpal-welcome-hero {
  height: 174px;
  opacity: .88;
}

#game-stage #app .penpal-welcome .penpal-letter-card:has(#penpal-info [data-go="home"]) .penpal-welcome-hero::before {
  width: 184px;
  height: 158px;
  background: #f4eedd;
  border-color: #dcd2b7;
}

#game-stage #app .penpal-welcome .penpal-letter-card:has(#penpal-info [data-go="home"]) .penpal-welcome-hero > .turtle {
  width: 194px;
  height: 168px;
}

@media (prefers-reduced-motion: reduce) {
  .penpal-loading-dots i {
    animation: none;
    opacity: .7;
  }

  #app dialog.share-invitation.penpal-share .penpal-card-image,
  #app dialog.share-invitation.penpal-share .penpal-card-image img {
    transition: none;
  }
}
