:root {
  color-scheme: dark;
  --paper: #070912;
  --paper-deep: #0d1426;
  --ink: #f2f6ff;
  --muted: #8e9bb2;
  --berry: #9c4dff;
  --berry-dark: #c38cff;
  --mint: #69f7dc;
  --yellow: #ffd36b;
  --line: rgba(166, 198, 238, 0.18);
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.55);
  font-family: "SF Pro Display", "Avenir Next", system-ui, sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  background: var(--paper);
  overscroll-behavior: none;
}

body {
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 255, 255, 0.85), transparent 28rem),
    linear-gradient(160deg, #fbf6e9 0%, var(--paper) 58%, #eee2cb 100%);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
  touch-action: manipulation;
}

button:focus-visible,
input:focus-visible,
canvas:focus-visible {
  outline: 4px solid rgba(91, 114, 232, 0.48);
  outline-offset: 3px;
}

#app {
  width: min(100%, 480px);
  min-height: 100dvh;
  margin: 0 auto;
  padding:
    max(10px, env(safe-area-inset-top))
    max(12px, env(safe-area-inset-right))
    max(10px, env(safe-area-inset-bottom))
    max(12px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.topbar {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  min-height: 44px;
  border: 0;
  padding: 3px 4px 3px 0;
  display: flex;
  align-items: center;
  gap: 9px;
  background: transparent;
  font-size: 15px;
  font-weight: 850;
  letter-spacing: -0.02em;
}

.brand-mark {
  width: 35px;
  height: 35px;
  border: 2px solid var(--ink);
  border-radius: 50% 43% 48% 43%;
  display: grid;
  place-items: center;
  transform: rotate(-7deg);
  background: var(--yellow);
  box-shadow: 2px 3px 0 var(--ink);
  font-size: 20px;
  font-weight: 950;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.icon-button {
  min-width: 56px;
  min-height: 48px;
  border: 0;
  border-radius: 14px;
  padding: 5px 8px;
  display: grid;
  justify-items: center;
  gap: 0;
  background: transparent;
  font-size: 17px;
}

.icon-button:active {
  background: rgba(45, 42, 54, 0.08);
}

.button-label {
  font-size: 11px;
  font-weight: 750;
}

.challenge-banner {
  min-height: 48px;
  border: 2px solid var(--ink);
  border-radius: 15px;
  padding: 7px 12px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #c8f3e4;
  box-shadow: 2px 3px 0 var(--ink);
  font-size: 13px;
}

.challenge-banner:not([hidden]) {
  display: flex;
  flex-wrap: wrap;
}

.challenge-banner span {
  flex: 1 1 120px;
  min-width: 0;
}

.challenge-banner strong {
  flex: 1 1 160px;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 17px;
}

.challenge-banner .text-button {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
}

.game-shell {
  min-height: 0;
  flex: 1 1 auto;
  display: grid;
  place-items: center;
}

#gameCanvas {
  width: min(100%, 390px);
  height: auto;
  max-height: calc(100dvh - 230px);
  border: 2px solid var(--ink);
  border-radius: 27px;
  display: block;
  background: #efe9d7;
  box-shadow:
    4px 6px 0 var(--ink),
    0 20px 50px rgba(67, 46, 55, 0.15);
  cursor: pointer;
}

.controls {
  flex: 0 0 auto;
  min-height: 76px;
  display: grid;
  align-items: center;
}

.action-button {
  width: 100%;
  min-height: 70px;
  border: 2px solid var(--ink);
  border-radius: 22px;
  padding: 10px 18px 11px;
  display: grid;
  place-items: center;
  background: var(--berry);
  color: #fffaf0;
  box-shadow: 3px 5px 0 var(--ink);
  text-shadow: 0 1px 0 rgba(45, 42, 54, 0.22);
  transition: transform 90ms ease, box-shadow 90ms ease, background 140ms ease;
}

.action-button:hover {
  background: #cb4d83;
}

.action-button:active,
.pill-button:active,
.wide-button:active {
  transform: translate(2px, 3px);
  box-shadow: 1px 2px 0 var(--ink);
}

.action-button span {
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  opacity: 0.85;
}

.action-button strong {
  font-size: 22px;
  letter-spacing: -0.025em;
}

.secondary-actions {
  grid-template-columns: 1.15fr 1fr;
  gap: 7px;
}

.secondary-actions:not([hidden]) {
  display: grid;
}

.pill-button {
  min-height: 52px;
  border: 2px solid var(--ink);
  border-radius: 18px;
  padding: 7px 8px;
  background: #fffaf0;
  box-shadow: 2px 3px 0 var(--ink);
  font-size: 13px;
  font-weight: 850;
}

.pill-button.primary {
  background: var(--berry);
  color: white;
}

.footer-note {
  min-height: 24px;
  padding: 1px 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.text-button {
  min-height: 44px;
  border: 0;
  padding: 8px 6px;
  background: transparent;
  color: var(--berry-dark);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  font-size: 12px;
  font-weight: 750;
}

.sheet {
  width: min(100% - 20px, 460px);
  max-height: min(88dvh, 780px);
  margin: auto auto max(8px, env(safe-area-inset-bottom));
  border: 2px solid var(--ink);
  border-radius: 28px 28px 18px 18px;
  padding: 18px;
  overflow: auto;
  background: #fffaf0;
  color: var(--ink);
  box-shadow: var(--shadow), 4px 5px 0 var(--ink);
  overscroll-behavior: contain;
  animation: sheet-in 180ms ease-out;
}

.sheet::backdrop {
  background: rgba(37, 31, 39, 0.58);
  backdrop-filter: blur(4px);
}

@keyframes sheet-in {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.98);
  }
}

.sheet-header {
  margin: 0 0 14px;
  padding: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.sheet-header h1 {
  margin: 2px 0 0;
  font-size: 27px;
  line-height: 1;
  letter-spacing: -0.035em;
}

.eyebrow {
  color: var(--berry-dark);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.close-button {
  width: 44px;
  height: 44px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--paper);
  font-size: 28px;
  line-height: 1;
}

.shelf-summary {
  margin: 2px 0 14px;
  color: var(--muted);
  font-size: 13px;
}

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

.specimen-card {
  min-height: 156px;
  border: 2px solid var(--ink);
  border-radius: 18px;
  padding: 8px;
  overflow: hidden;
  position: relative;
  display: grid;
  grid-template-rows: 96px minmax(52px, auto);
  background: var(--card-color, #f3ddac);
  text-align: left;
  box-shadow: 2px 3px 0 var(--ink);
}

.specimen-card[aria-pressed="true"]::after {
  content: "At home";
  position: absolute;
  top: 7px;
  right: 7px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  padding: 3px 6px;
  background: #fffaf0;
  font-size: 9px;
  font-weight: 850;
}

.specimen-card.quarantine {
  border-style: dashed;
  background-image: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 8px,
    rgba(156, 48, 66, 0.08) 8px,
    rgba(156, 48, 66, 0.08) 16px
  );
}

.specimen-card img {
  width: 100%;
  height: 96px;
  object-fit: contain;
}

.specimen-card strong {
  display: block;
  overflow: hidden;
  display: -webkit-box;
  min-height: 2.4em;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.2;
}

.specimen-card small {
  display: block;
  margin-top: 2px;
  color: rgba(45, 42, 54, 0.72);
  font-size: 10px;
}

.empty-state {
  min-height: 180px;
  margin: 0;
  border: 2px dashed rgba(45, 42, 54, 0.25);
  border-radius: 18px;
  padding: 54px 30px;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

.settings-form {
  display: grid;
  gap: 13px;
}

.settings-form > label:not(.toggle-row) {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 800;
}

.settings-form input[type="text"],
.settings-form input:not([type]) {
  width: 100%;
}

#handleInput {
  min-height: 48px;
  border: 2px solid var(--ink);
  border-radius: 14px;
  padding: 8px 12px;
  background: white;
  color: var(--ink);
  font-size: 17px;
  -webkit-user-select: text;
  user-select: text;
}

.settings-form small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.toggle-row {
  min-height: 55px;
  border-top: 1px solid var(--line);
  padding: 10px 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.toggle-row strong {
  display: block;
  font-size: 14px;
}

.toggle-row input {
  width: 48px;
  height: 28px;
  accent-color: var(--berry);
}

.wide-button {
  width: 100%;
  min-height: 53px;
  border: 2px solid var(--ink);
  border-radius: 17px;
  padding: 10px 16px;
  background: var(--berry);
  color: white;
  box-shadow: 2px 3px 0 var(--ink);
  font-weight: 850;
}

.wide-button.secondary {
  margin-top: 9px;
  background: var(--paper);
  color: var(--ink);
}

.data-actions {
  margin-top: 15px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
  display: flex;
  justify-content: space-around;
  gap: 8px;
  flex-wrap: wrap;
}

.file-label {
  min-height: 44px;
  position: relative;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
}

.file-label input {
  width: 100%;
  height: 100%;
  inset: 0;
  position: absolute;
  opacity: 0;
  cursor: pointer;
}

.file-label:focus-within {
  outline: 4px solid rgba(91, 114, 232, 0.48);
  outline-offset: 2px;
}

.text-button.danger {
  color: #9c3042;
}

.share-preview {
  width: 100%;
  max-height: 36dvh;
  border: 2px solid var(--ink);
  border-radius: 19px;
  display: block;
  object-fit: contain;
  background: #eadfca;
  box-shadow: 2px 3px 0 var(--ink);
}

.privacy-callout {
  margin: 0 0 12px;
  border: 1px solid rgba(45, 42, 54, 0.22);
  border-radius: 14px;
  padding: 10px 12px;
  background: #eef9f4;
  color: #4f4951;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

.share-copy {
  margin: 12px 4px;
  font-size: 14px;
  font-weight: 750;
  text-align: center;
}

.share-summary {
  margin: -4px 0 10px;
  border: 1px solid rgba(105, 247, 220, 0.24);
  border-radius: 3px;
  padding: 9px 10px;
  background: rgba(8, 18, 29, 0.9);
  color: #dce8f8;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.35;
}

.share-signature {
  margin: -4px 0 10px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  color: #aebdd2;
  font-size: 12px;
  font-weight: 800;
}

.share-signature input {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(105, 247, 220, 0.38);
  border-radius: 3px;
  padding: 8px 10px;
  background: #070d18;
  color: #f2f8ff;
  -webkit-user-select: text;
  user-select: text;
}

.wide-button small {
  display: block;
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
}

.share-primary {
  min-height: 62px;
}

.share-secondary-row {
  margin-top: 8px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.share-secondary-row .pill-button {
  min-height: 44px;
  padding: 7px 8px;
}

.centered {
  width: 100%;
  margin-top: 6px;
  text-align: center;
}

.fine-print {
  margin: 8px 4px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  text-align: center;
}

.data-actions .text-button,
.footer-note .text-button {
  min-height: 48px;
}

.compact-sheet {
  margin: auto;
}

.prose {
  font-size: 15px;
  line-height: 1.52;
}

.prose p:last-child {
  margin-bottom: 0;
}

.toast {
  max-width: calc(100% - 32px);
  min-height: 42px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 9px 16px;
  position: fixed;
  z-index: 50;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--ink);
  color: white;
  box-shadow: 0 8px 24px rgba(30, 26, 33, 0.28);
  font-size: 13px;
  font-weight: 750;
  text-align: center;
}

#app > .toast {
  position: fixed;
  z-index: 70;
  width: min(390px, calc(100vw - 28px));
  min-height: 40px;
  margin: 0;
  padding: 7px 12px;
  top: max(76px, calc(env(safe-area-inset-top) + 68px));
  bottom: auto;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  line-height: 1.2;
  pointer-events: none;
}

.sr-only {
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  position: absolute;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
  white-space: nowrap;
}

@media (max-height: 700px) {
  #app {
    gap: 5px;
  }

  #gameCanvas {
    max-height: calc(100dvh - 195px);
  }

  .action-button {
    min-height: 58px;
  }

  .action-button strong {
    font-size: 19px;
  }

  .controls {
    min-height: 62px;
  }

  .footer-note {
    min-height: 21px;
    font-size: 11px;
  }
}

#app:has(#resultStory:not([hidden])):has(#challengeBanner:not([hidden])) .game-shell {
  width: min(100%, 390px, max(250px, calc((100dvh - 475px) * 0.68421)));
}

#app:has(#resultStory:not([hidden])):has(#labNote:not([hidden])) .game-shell {
  width: min(100%, 390px, max(250px, calc((100dvh - 475px) * 0.68421)));
}

#app:has(#resultStory:not([hidden])) .game-shell {
  width: min(100%, 390px, max(250px, calc((100dvh - 410px) * 0.68421)));
}

/* Founder Lab v2: authored traits, finite album, and living lineage */
.draft-banner {
  width: min(100%, 390px);
  min-height: 42px;
  margin: 0 auto;
  border: 1px solid rgba(228, 181, 255, 0.5);
  border-left: 3px solid #d99bff;
  padding: 7px 10px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background:
    linear-gradient(100deg, rgba(89, 47, 133, 0.58), rgba(11, 17, 31, 0.94)),
    #080d18;
  box-shadow: 0 0 24px rgba(217, 155, 255, 0.13);
  color: #f5ebff;
}

.draft-banner:not([hidden]) {
  display: flex;
}

.draft-banner span {
  flex: 0 0 auto;
  color: #e4b5ff;
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.draft-banner strong {
  font-size: 11px;
  line-height: 1.25;
  text-align: right;
}

.result-primary {
  min-height: 56px;
  border-color: rgba(228, 181, 255, 0.72);
  background:
    linear-gradient(110deg, rgba(116, 59, 187, 0.98), rgba(29, 143, 137, 0.95));
  box-shadow: 0 0 22px rgba(157, 95, 240, 0.2);
  color: #fff;
  font-size: 15px;
}

.trait-trace {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}

.trait-trace > div {
  min-width: 0;
  border: 1px solid rgba(142, 187, 232, 0.18);
  padding: 6px 5px;
  background: rgba(14, 23, 41, 0.78);
}

.trait-trace span,
.trait-trace strong,
.trait-trace small {
  display: block;
  margin: 0;
}

.trait-trace span {
  color: #8393aa;
  font-size: 7px;
  font-weight: 850;
  letter-spacing: 0.05em;
}

.trait-trace strong {
  min-height: 2.2em;
  margin-top: 3px;
  color: #edf6ff;
  font-size: 9px;
  line-height: 1.1;
}

.trait-trace small {
  margin-top: 3px;
  color: #8affea;
  font-size: 7px;
}

.album-advance {
  margin-top: 7px;
  border-top: 1px solid rgba(142, 187, 232, 0.14);
  padding-top: 6px;
  color: #cbb5df;
  font-size: 0.7rem;
  font-weight: 750;
  line-height: 1.35;
}

.section-heading {
  margin: 22px 0 9px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.section-heading h2 {
  margin: 2px 0 0;
  color: #edf4ff;
  font-size: 17px;
  line-height: 1.1;
}

.section-heading > strong {
  color: #8affea;
  font-size: 14px;
}

.founder-panel {
  min-height: 116px;
  border: 1px solid rgba(228, 181, 255, 0.48);
  padding: 9px;
  display: grid;
  grid-template-columns: 112px 1fr;
  align-items: center;
  gap: 12px;
  background:
    radial-gradient(circle at 15% 45%, rgba(217, 155, 255, 0.18), transparent 45%),
    rgba(10, 16, 29, 0.92);
  box-shadow: 0 0 28px rgba(217, 155, 255, 0.09);
}

.founder-panel img {
  width: 112px;
  height: 96px;
  object-fit: contain;
  background: #070912;
}

.founder-panel strong {
  display: block;
  margin-top: 3px;
  color: #fff;
  font-size: 17px;
  overflow-wrap: anywhere;
}

.founder-panel p {
  margin: 6px 0 0;
  color: #aebbd0;
  font-size: 11px;
  line-height: 1.35;
}

.founder-panel:has(.room-resident) {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
}

.founder-panel[data-count="1"] {
  grid-template-columns: 1fr;
}

.founder-panel[data-count="1"] .room-resident {
  grid-template-columns: 112px minmax(0, 1fr);
  align-items: center;
}

.founder-panel[data-count="1"] .room-resident img {
  height: 96px;
}

.founder-panel[data-count="2"] {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.room-resident-heading {
  grid-column: 1 / -1;
}

.room-resident-heading > strong {
  margin-top: 2px;
}

.room-resident {
  min-width: 0;
  border: 1px solid rgba(138, 255, 234, 0.14);
  padding: 7px;
  display: grid;
  align-content: start;
  gap: 5px;
  background: rgba(4, 9, 18, 0.52);
}

.room-resident img {
  width: 100%;
  height: 76px;
  object-fit: contain;
  background: #070912;
}

.room-resident strong,
.room-resident p,
.room-resident small {
  display: block;
  overflow-wrap: break-word;
  word-break: normal;
}

.room-resident strong {
  font-size: 14px;
}

.room-resident p {
  margin: 3px 0;
  font-size: 11px;
  line-height: 1.35;
}

.room-resident small {
  color: #ffe7a4;
  font-size: 10px;
  line-height: 1.3;
}

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

.album-slot {
  min-height: 128px;
  border: 1px dashed rgba(139, 178, 221, 0.3);
  padding: 8px;
  display: grid;
  grid-template-rows: 69px auto auto;
  align-content: start;
  background:
    linear-gradient(145deg, rgba(17, 27, 47, 0.88), rgba(7, 11, 21, 0.96));
  color: #99a8bd;
  text-align: left;
}

button.album-slot {
  border-style: solid;
  border-color: rgba(105, 247, 220, 0.42);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  color: #eaf8f5;
}

.album-slot img {
  width: 100%;
  height: 69px;
  object-fit: contain;
  background: #070912;
}

.album-silhouette {
  display: grid;
  place-items: center;
  color: rgba(170, 198, 231, 0.22);
  font-size: 50px;
  line-height: 1;
  filter: blur(0.2px);
}

.album-slot strong {
  margin-top: 5px;
  color: inherit;
  font-size: 11px;
}

.album-slot small {
  margin-top: 3px;
  color: #75859c;
  font-size: 11px;
  line-height: 1.3;
}

.journal-panel {
  margin-top: 3px;
}

.journal-list {
  display: grid;
  gap: 6px;
}

.journal-list article {
  border-left: 2px solid #d99bff;
  padding: 9px 10px;
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 7px;
  background: rgba(16, 22, 39, 0.78);
}

.journal-list article > span {
  color: #e4b5ff;
  font-size: 16px;
}

.journal-list p {
  margin: 0;
  color: #bac6d8;
  font-size: 11px;
  line-height: 1.4;
}

.journal-list .empty-state {
  min-height: 72px;
  padding: 16px 20px;
  font-size: 11px;
}

.specimen-heading {
  border-top: 1px solid rgba(142, 187, 232, 0.13);
  padding-top: 18px;
}

.founder-intro {
  margin: 0 0 13px;
  color: #9cabc0;
  font-size: 12px;
  line-height: 1.45;
}

.founder-grid {
  display: grid;
  gap: 9px;
}

.founder-choice {
  min-height: 142px;
  border: 1px solid rgba(228, 181, 255, 0.36);
  padding: 8px;
  display: grid;
  grid-template-columns: 122px 1fr;
  grid-template-rows: auto auto 1fr;
  column-gap: 11px;
  background:
    linear-gradient(135deg, rgba(43, 30, 70, 0.92), rgba(9, 15, 27, 0.98));
  color: #eef4ff;
  text-align: left;
}

.founder-choice img {
  width: 122px;
  height: 122px;
  grid-row: 1 / 4;
  object-fit: contain;
  background: #070912;
}

.founder-choice strong {
  align-self: end;
  font-size: 16px;
  overflow-wrap: anywhere;
}

.founder-choice span {
  margin-top: 4px;
  color: #8affea;
  font-size: 0.7rem;
  font-weight: 800;
}

.founder-choice small {
  margin-top: 7px;
  color: #a6b4c8;
  font-size: 0.7rem;
  line-height: 1.3;
}

@media (max-width: 355px) {
  .founder-panel:has(.room-resident) {
    grid-template-columns: 1fr;
  }

  .room-resident {
    grid-template-columns: 82px minmax(0, 1fr);
    align-items: center;
  }

  .room-resident img {
    width: 82px;
    height: 76px;
  }

  .trait-trace {
    grid-template-columns: 1fr;
  }

  .trait-trace strong {
    min-height: 0;
  }

  .founder-choice {
    grid-template-columns: 100px 1fr;
  }

  .founder-choice img {
    width: 100px;
    height: 112px;
  }
}

@media (max-width: 355px) {
  .brand > span:last-child {
    display: none;
  }

  .secondary-actions {
    grid-template-columns: 1fr 1fr;
  }

  .pill-button {
    font-size: 11px;
  }
}

@media (min-width: 700px) and (min-height: 800px) {
  #app {
    padding-top: 18px;
    padding-bottom: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* Living Line: choices, commitments, and visible utility */
.ritual-sheet,
.ownership-sheet,
.activity-sheet {
  background:
    radial-gradient(circle at 85% 0%, rgba(105, 247, 220, 0.11), transparent 18rem),
    linear-gradient(150deg, #11192b, #080c16);
}

.choice-grid {
  display: grid;
  gap: 9px;
}

.choice-card {
  width: 100%;
  min-height: 82px;
  border: 1px solid rgba(138, 255, 234, 0.3);
  border-radius: 3px;
  padding: 12px;
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 10px;
  background:
    linear-gradient(120deg, rgba(47, 63, 104, 0.68), rgba(12, 18, 33, 0.92));
  color: #eef8ff;
  text-align: left;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.choice-card::before {
  content: attr(data-sigil);
  width: 42px;
  height: 42px;
  border: 1px solid rgba(228, 181, 255, 0.45);
  display: grid;
  place-items: center;
  background: rgba(217, 155, 255, 0.1);
  color: #8affea;
  font-size: 22px;
}

.choice-card strong,
.choice-card small {
  display: block;
}

.choice-card strong {
  font-size: 15px;
}

.choice-card small {
  margin-top: 4px;
  color: #a9b8cb;
  font-size: 11px;
  line-height: 1.35;
}

.choice-card > em {
  color: #d8b6ff;
  font-size: 10px;
  font-style: normal;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.choice-card:active {
  background: linear-gradient(120deg, rgba(68, 88, 139, 0.78), rgba(16, 25, 44, 0.96));
}

.ownership-creature {
  min-height: 132px;
  margin-bottom: 12px;
  border: 1px solid rgba(228, 181, 255, 0.3);
  padding: 10px;
  display: grid;
  grid-template-columns: 132px 1fr;
  align-items: center;
  gap: 12px;
  background: rgba(10, 16, 29, 0.78);
  box-shadow: 0 0 26px rgba(228, 181, 255, 0.14);
  animation: ownership-reveal 320ms ease-out;
}

.ownership-creature img {
  width: 132px;
  height: 114px;
  object-fit: contain;
  border-radius: 3px;
  box-shadow: 0 0 16px rgba(138, 255, 234, 0.22);
}

@keyframes ownership-reveal {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
}

.ownership-creature strong {
  display: block;
  color: #fff;
  font-size: 18px;
  overflow-wrap: anywhere;
}

.ownership-creature span,
.ownership-creature small {
  display: block;
  margin-top: 5px;
  color: #9eb0c8;
  font-size: 11px;
  line-height: 1.35;
}

#creatureNameInput {
  width: 100%;
  min-height: 50px;
  border: 1px solid rgba(138, 255, 234, 0.5);
  border-radius: 3px;
  padding: 9px 12px;
  background: #080d18;
  color: #f5fbff;
  font-size: 18px;
  user-select: text;
  -webkit-user-select: text;
}

.activity-confirmation {
  border: 1px solid rgba(105, 247, 220, 0.28);
  padding: 14px;
  background: rgba(13, 28, 43, 0.9);
  text-align: center;
}

.activity-confirmation strong {
  display: block;
  color: #8affea;
  font-size: 17px;
}

.activity-confirmation p {
  margin: 7px 0 12px;
  color: #aab9cc;
  font-size: 12px;
  line-height: 1.4;
}

.activity-panel,
.social-panel,
.weekly-panel,
.inventory-panel {
  margin-top: 4px;
}

.social-panel {
  border: 1px solid rgba(145, 186, 231, 0.2);
  border-radius: 18px;
  padding: 10px;
  background: rgba(8, 14, 26, 0.62);
}

.social-panel .section-heading {
  margin-bottom: 4px;
}

.social-inbox {
  display: grid;
  gap: 8px;
}

.social-row {
  border: 1px solid rgba(238, 245, 255, 0.16);
  border-radius: 14px;
  padding: 9px;
  display: grid;
  gap: 7px;
  background: rgba(255, 255, 255, 0.04);
}

.social-row.has-answer {
  border-color: rgba(105, 247, 220, 0.38);
  background: linear-gradient(135deg, rgba(18, 71, 75, 0.62), rgba(22, 20, 49, 0.72));
}

.social-row strong,
.social-row small {
  display: block;
}

.social-row small,
.social-state {
  color: #a9b8cb;
  font-size: 11px;
  line-height: 1.35;
}

.social-row .pill-button {
  min-height: 44px;
}

.activity-list,
.inventory-list {
  display: grid;
  gap: 7px;
}

.activity-row,
.inventory-row {
  border: 1px solid rgba(105, 247, 220, 0.2);
  padding: 10px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  background: rgba(13, 22, 38, 0.84);
}

.activity-row strong,
.activity-row small,
.inventory-row strong,
.inventory-row small {
  display: block;
}

.activity-row strong,
.inventory-row strong {
  color: #eef8ff;
  font-size: 12px;
}

.activity-row small,
.inventory-row small {
  margin-top: 3px;
  color: #8d9db3;
  font-size: 10px;
}

.timer-chip {
  border: 1px solid rgba(217, 155, 255, 0.34);
  border-radius: 20px;
  padding: 5px 9px;
  color: #e4b5ff;
  font-size: 0.7rem;
  font-weight: 850;
  white-space: nowrap;
}

.panel-hint {
  margin: -3px 0 9px;
  color: #91a2b8;
  font-size: 11px;
  line-height: 1.35;
}

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

.weekly-slot {
  min-height: 76px;
  border: 1px dashed rgba(139, 178, 221, 0.27);
  padding: 6px 4px;
  display: grid;
  align-content: center;
  gap: 5px;
  background: rgba(7, 12, 23, 0.82);
  color: #74859d;
  text-align: center;
}

.weekly-slot.is-filled {
  border-style: solid;
  border-color: rgba(105, 247, 220, 0.42);
  background:
    radial-gradient(circle at 50% 30%, rgba(105, 247, 220, 0.12), transparent 60%),
    rgba(9, 24, 34, 0.9);
  color: #9dffed;
}

.weekly-slot b {
  font-size: 17px;
}

.weekly-slot span {
  font-size: 8px;
  font-weight: 800;
  line-height: 1.2;
}

.specimen-card {
  grid-template-rows: 96px auto auto;
}

.specimen-card.is-archived {
  filter: saturate(0.4);
  opacity: 0.78;
}

.specimen-actions {
  margin-top: 7px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}

.specimen-actions button {
  min-height: 36px;
  border: 1px solid rgba(238, 245, 255, 0.24);
  border-radius: 2px;
  padding: 4px;
  background: rgba(7, 12, 23, 0.72);
  color: #eaf4ff;
  font-size: 9px;
  font-weight: 800;
}

.specimen-actions button:disabled {
  opacity: 0.38;
}

.specimen-state {
  display: inline-block;
  margin-top: 4px;
  color: #6a3fa4;
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

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

  .choice-card {
    grid-template-columns: 38px 1fr;
  }

  .choice-card > em {
    grid-column: 2;
  }
}

/* Cinematic containment-lab skin */
html,
body {
  background: #05060b;
}

body {
  background:
    radial-gradient(circle at 50% -15%, rgba(82, 65, 164, 0.28), transparent 38rem),
    radial-gradient(circle at 50% 115%, rgba(45, 204, 172, 0.12), transparent 30rem),
    #05060b;
  color: var(--ink);
}

#app {
  width: min(100%, 500px);
  gap: 6px;
  padding:
    max(8px, env(safe-area-inset-top))
    max(10px, env(safe-area-inset-right))
    max(8px, env(safe-area-inset-bottom))
    max(10px, env(safe-area-inset-left));
  background:
    linear-gradient(90deg, transparent, rgba(101, 134, 182, 0.05) 50%, transparent),
    transparent;
}

.topbar {
  width: min(100%, 390px);
  min-height: 48px;
  margin: 0 auto;
}

.brand {
  color: #eef5ff;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(116, 255, 225, 0.72);
  border-radius: 0;
  clip-path: polygon(22% 0, 78% 0, 100% 22%, 100% 78%, 78% 100%, 22% 100%, 0 78%, 0 22%);
  transform: none;
  background:
    radial-gradient(circle at 50% 40%, rgba(138, 255, 234, 0.9), rgba(86, 88, 201, 0.42) 48%, #12182b 72%);
  box-shadow: 0 0 20px rgba(105, 247, 220, 0.25), inset 0 0 12px rgba(255, 255, 255, 0.2);
  color: #f8ffff;
  font-size: 18px;
  text-shadow: 0 0 12px #69f7dc;
}

.icon-button {
  min-width: 58px;
  min-height: 44px;
  border: 1px solid rgba(151, 186, 232, 0.16);
  border-radius: 4px;
  padding: 4px 8px;
  background: linear-gradient(180deg, rgba(28, 39, 66, 0.72), rgba(10, 15, 28, 0.8));
  color: #b9c8df;
  font-size: 15px;
}

.icon-button:hover,
.icon-button:active {
  background: linear-gradient(180deg, rgba(45, 59, 94, 0.8), rgba(14, 21, 39, 0.9));
  color: #8affea;
}

.sound-button[aria-pressed="true"] {
  border-color: rgba(255, 211, 107, 0.52);
  background: linear-gradient(180deg, rgba(89, 70, 34, 0.76), rgba(29, 26, 25, 0.9));
  color: #ffe7a4;
  box-shadow: 0 0 18px rgba(255, 211, 107, 0.12);
}

.button-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.challenge-banner {
  width: min(100%, 390px);
  min-height: 48px;
  margin: 0 auto;
  border: 1px solid rgba(216, 167, 255, 0.58);
  border-radius: 3px;
  background: linear-gradient(90deg, rgba(111, 55, 171, 0.4), rgba(18, 25, 46, 0.9));
  box-shadow: 0 0 22px rgba(179, 103, 255, 0.15);
  color: #f5eaff;
  font-size: 11px;
}

.lab-note {
  width: min(100%, 390px);
  min-height: 44px;
  margin: 0 auto;
  border: 1px solid rgba(105, 247, 220, 0.36);
  border-radius: 3px;
  padding: 8px 12px;
  background: linear-gradient(90deg, rgba(20, 83, 79, 0.42), rgba(16, 23, 41, 0.92));
  color: #cffff6;
  font-size: 11px;
  font-weight: 750;
  line-height: 1.35;
  text-align: left;
}

.game-shell {
  width: min(100%, 390px, calc((100dvh - 214px) * 0.68421));
  min-height: 0;
  aspect-ratio: 390 / 570;
  margin: auto;
  position: relative;
  flex: 0 1 auto;
  place-items: stretch;
  isolation: isolate;
}

:root[data-mode="home"] #app:has(#labNote:not([hidden])) .game-shell {
  width: min(100%, 390px, max(250px, calc((100dvh - 312px) * 0.68421)));
}

:root[data-mode="result"] .game-shell {
  width: min(100%, 250px);
}

:root[data-mode="result"] #app:has(#challengeBanner:not([hidden])) .game-shell {
  width: min(100%, 205px);
}

#gameCanvas,
#hudCanvas,
.scene-vignette {
  width: 100%;
  height: 100%;
  max-height: none;
  inset: 0;
  position: absolute;
  display: block;
}

#gameCanvas {
  z-index: 1;
  border: 1px solid rgba(143, 190, 236, 0.3);
  border-radius: 7px;
  background: #070912;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.85),
    0 0 36px rgba(99, 82, 208, 0.18),
    0 28px 65px rgba(0, 0, 0, 0.6);
}

#hudCanvas {
  z-index: 3;
  border-radius: 7px;
  pointer-events: none;
}

.scene-vignette {
  z-index: 2;
  border-radius: 7px;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(3, 5, 12, 0.36), transparent 22%, transparent 72%, rgba(3, 5, 12, 0.5)),
    radial-gradient(ellipse at center, transparent 52%, rgba(0, 0, 0, 0.42) 100%);
  box-shadow:
    inset 0 0 0 1px rgba(153, 207, 255, 0.16),
    inset 0 0 55px rgba(0, 0, 0, 0.35);
}

.controls {
  width: min(100%, 390px);
  min-height: 68px;
  margin: 0 auto;
  gap: 6px;
}

.incident-panel {
  border: 1px solid rgba(255, 211, 107, 0.54);
  padding: 15px;
  display: grid;
  gap: 9px;
  background:
    radial-gradient(circle at 90% 0%, rgba(255, 211, 107, 0.13), transparent 42%),
    linear-gradient(145deg, rgba(24, 30, 46, 0.98), rgba(9, 14, 25, 0.99));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.035),
    0 16px 34px rgba(0, 0, 0, 0.38);
}

.incident-panel h2,
.incident-panel p {
  margin: 0;
}

.incident-panel h2 {
  color: #fff8df;
  font-size: clamp(22px, 6vw, 28px);
  line-height: 1.04;
  letter-spacing: -0.03em;
}

.incident-panel > p {
  color: #c9d3e4;
  font-size: 15px;
  line-height: 1.45;
}

.incident-panel > strong {
  color: #fff;
  font-size: 15px;
  line-height: 1.3;
}

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

.incident-choices button {
  min-height: 52px;
  border: 1px solid rgba(138, 255, 234, 0.34);
  padding: 9px 10px;
  background: rgba(17, 42, 52, 0.84);
  color: #eafffb;
  font-weight: 850;
  line-height: 1.2;
}

.incident-choices button:last-child {
  border-color: rgba(228, 181, 255, 0.34);
  background: rgba(47, 30, 67, 0.78);
}

.incident-consequence {
  border-left: 3px solid #ffd36b;
  padding: 9px 11px;
  background: rgba(255, 211, 107, 0.08);
  color: #fff4cc !important;
  font-weight: 760;
}

#app:has(.incident-panel:not([hidden])) .game-shell {
  width: min(100%, 390px, max(220px, calc((100dvh - 345px) * 0.68421)));
}

.action-button {
  min-height: 66px;
  border: 1px solid rgba(146, 255, 231, 0.74);
  border-radius: 0;
  clip-path: polygon(12px 0, calc(100% - 12px) 0, 100% 12px, 100% calc(100% - 12px), calc(100% - 12px) 100%, 12px 100%, 0 calc(100% - 12px), 0 12px);
  background:
    linear-gradient(110deg, rgba(34, 132, 126, 0.92), rgba(74, 55, 159, 0.96)),
    #192d4a;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    inset 0 -18px 35px rgba(0, 0, 0, 0.18),
    0 0 28px rgba(105, 247, 220, 0.2);
  color: #f6ffff;
  text-shadow: 0 0 14px rgba(105, 247, 220, 0.55);
}

.action-button:hover {
  background: linear-gradient(110deg, rgba(41, 154, 145, 0.96), rgba(91, 67, 188, 0.98));
}

.action-button:active,
.pill-button:active,
.wide-button:active {
  transform: translateY(1px);
  box-shadow: inset 0 2px 12px rgba(0, 0, 0, 0.35);
}

.action-button span {
  font-size: 11px;
  letter-spacing: 0.13em;
}

.action-button strong {
  font-size: 19px;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.weekly-strip {
  width: 100%;
  min-height: 58px;
  border: 1px solid rgba(145, 186, 231, 0.28);
  border-radius: 3px;
  padding: 9px 11px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  background: linear-gradient(120deg, rgba(12, 22, 39, 0.94), rgba(19, 37, 56, 0.9));
  color: #dce8f8;
  text-align: left;
}

.weekly-strip-copy strong,
.weekly-strip-copy small {
  display: block;
}

.weekly-strip-copy strong {
  color: #8affea;
  font-size: 12px;
  line-height: 1.2;
}

.weekly-strip-copy small {
  margin-top: 3px;
  color: #aebbd0;
  font-size: 11px;
  line-height: 1.25;
}

.weekly-strip-progress {
  min-width: 58px;
  display: grid;
  justify-items: end;
  gap: 4px;
  color: #f4f8ff;
  font-size: 12px;
  font-weight: 900;
}

.weekly-strip progress {
  width: 56px;
  height: 8px;
  accent-color: #69f7dc;
}

.secondary-actions {
  grid-template-columns: 1fr;
  gap: 6px;
}

.result-story {
  border: 1px solid rgba(142, 187, 232, 0.2);
  border-left: 2px solid #69f7dc;
  padding: 9px 11px;
  background: rgba(8, 13, 25, 0.88);
  color: #dce7f7;
  line-height: 1.3;
}

.result-story strong {
  display: block;
  color: #8affea;
  font-size: 11px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.result-story p {
  margin: 4px 0 0;
  font-size: 12px;
  font-weight: 750;
}

.result-story small {
  display: block;
  margin-top: 4px;
  color: #8e9bb2;
  font-size: 11px;
}

.result-tools {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.more-actions > :only-child {
  grid-column: 1 / -1;
}

.more-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.pill-button {
  min-height: 48px;
  border: 1px solid rgba(150, 190, 235, 0.28);
  border-radius: 3px;
  background: linear-gradient(180deg, rgba(28, 40, 68, 0.92), rgba(10, 15, 28, 0.96));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
  color: #dce7f7;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.pill-button.primary {
  border-color: rgba(105, 247, 220, 0.55);
  background: linear-gradient(120deg, rgba(30, 120, 117, 0.88), rgba(62, 47, 133, 0.94));
  color: #f3ffff;
}

.footer-note {
  width: min(100%, 390px);
  min-height: 20px;
  margin: 0 auto;
  color: #66758e;
  font-size: 9px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.text-button {
  min-height: 44px;
  color: #a98cff;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-decoration: none;
  text-transform: uppercase;
}

.sheet {
  border: 1px solid rgba(146, 188, 235, 0.3);
  border-radius: 6px;
  background:
    linear-gradient(160deg, rgba(22, 32, 55, 0.98), rgba(7, 10, 20, 0.99)),
    #0a0e18;
  color: #edf4ff;
  box-shadow: var(--shadow), 0 0 45px rgba(104, 80, 209, 0.2);
}

.sheet::backdrop {
  background: rgba(2, 3, 8, 0.93);
  backdrop-filter: blur(11px) saturate(0.7);
}

.sheet-header h1 {
  font-size: 26px;
  letter-spacing: -0.02em;
}

.eyebrow {
  color: #8affea;
}

.close-button {
  border: 1px solid rgba(152, 190, 232, 0.34);
  border-radius: 3px;
  background: rgba(12, 18, 32, 0.9);
  color: #dce7f8;
}

.shelf-summary,
.settings-form small,
.share-copy,
.fine-print {
  color: #8e9bb2;
}

.shelf-grid {
  gap: 8px;
}

.specimen-card {
  min-height: 170px;
  border: 1px solid rgba(142, 187, 232, 0.26);
  border-radius: 3px;
  background: linear-gradient(150deg, rgba(29, 41, 68, 0.94), rgba(9, 13, 24, 0.98));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  color: #edf4ff;
}

.specimen-card[aria-pressed="true"] {
  border-color: rgba(105, 247, 220, 0.7);
  box-shadow: 0 0 22px rgba(105, 247, 220, 0.16);
}

.specimen-card[aria-pressed="true"]::after {
  border: 1px solid #69f7dc;
  border-radius: 2px;
  background: #0d2828;
  color: #a6fff0;
}

.specimen-card small {
  color: #92a2bb;
}

.specimen-card.quarantine {
  background:
    repeating-linear-gradient(-45deg, transparent, transparent 8px, rgba(255, 86, 112, 0.06) 8px, rgba(255, 86, 112, 0.06) 16px),
    #120d17;
}

.empty-state,
.privacy-callout {
  border: 1px solid rgba(145, 186, 231, 0.22);
  border-radius: 3px;
  background: rgba(11, 18, 31, 0.8);
  color: #9aa9c0;
}

#handleInput {
  border: 1px solid rgba(150, 188, 232, 0.32);
  border-radius: 3px;
  background: #080d18;
  color: #eff6ff;
}

.toggle-row {
  border-color: rgba(148, 187, 231, 0.15);
}

.toggle-row input {
  accent-color: #69f7dc;
}

.wide-button {
  border: 1px solid rgba(105, 247, 220, 0.58);
  border-radius: 3px;
  background: linear-gradient(110deg, rgba(31, 124, 120, 0.92), rgba(73, 54, 154, 0.96));
  box-shadow: 0 0 20px rgba(105, 247, 220, 0.12);
  color: #f2ffff;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.wide-button.secondary {
  background: rgba(13, 20, 36, 0.92);
  color: #cbd8ea;
}

.share-preview {
  border: 1px solid rgba(140, 186, 233, 0.34);
  border-radius: 3px;
  background: #070912;
  box-shadow: 0 0 30px rgba(99, 80, 204, 0.15);
}

.privacy-callout {
  font-size: 11px;
}

.toast {
  border: 1px solid rgba(105, 247, 220, 0.55);
  border-radius: 3px;
  background: rgba(6, 11, 20, 0.96);
  color: #eafffb;
  box-shadow: 0 0 30px rgba(105, 247, 220, 0.18);
}

button:focus-visible,
input:focus-visible,
canvas:focus-visible,
.file-label:focus-within {
  outline: 2px solid #8affea;
  outline-offset: 3px;
}

@media (max-height: 700px) {
  .game-shell {
    width: min(100%, 390px, calc((100dvh - 184px) * 0.68421));
  }

  .action-button {
    min-height: 54px;
  }

  .controls {
    min-height: 56px;
  }
}

.pill-button.result-primary {
  min-height: 56px;
  border-color: rgba(228, 181, 255, 0.72);
  background: linear-gradient(110deg, rgba(116, 59, 187, 0.98), rgba(29, 143, 137, 0.95));
  box-shadow: 0 0 22px rgba(157, 95, 240, 0.2);
  color: #fff;
  font-size: 15px;
}

.result-story .trait-trace strong {
  min-height: 2.2em;
  margin-top: 3px;
  color: #edf6ff;
  font-size: 9px;
  line-height: 1.1;
  letter-spacing: 0;
  text-transform: none;
}

.result-story .trait-trace small {
  margin-top: 3px;
  color: #8affea;
  font-size: 7px;
}

.specimen-card[data-keeper="true"] {
  border-color: rgba(105, 247, 220, 0.7);
  box-shadow: 0 0 22px rgba(105, 247, 220, 0.16);
}

.specimen-card[data-keeper="true"]::after {
  content: "At home";
  position: absolute;
  top: 7px;
  right: 7px;
  border: 1px solid #69f7dc;
  padding: 3px 6px;
  background: #0d2828;
  color: #a6fff0;
  font-size: 0.7rem;
  font-weight: 850;
}

/* Living Line readability and state clarity */
#creatureNameInput::placeholder {
  color: #718198;
  font-weight: 400;
  opacity: 1;
}

.founder-intro.is-error {
  border-left: 2px solid #ff8c9c;
  padding-left: 10px;
  color: #ffdce2;
}

.result-story .trait-trace span {
  color: #afbed1;
  font-size: 0.7rem;
  line-height: 1.3;
}

.result-story .trait-trace strong {
  min-height: 0;
  font-size: 12px;
  line-height: 1.25;
}

.result-story .trait-trace small {
  color: #9dffed;
  font-size: 0.7rem;
  line-height: 1.3;
}

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

.weekly-slot {
  min-height: 86px;
  padding: 9px;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  align-content: stretch;
  text-align: left;
}

.weekly-slot > span,
.weekly-slot > span strong,
.weekly-slot > span small {
  display: block;
}

.weekly-slot > span strong {
  color: #dce8f7;
  font-size: 12px;
  line-height: 1.2;
}

.weekly-slot > span small {
  margin-top: 4px;
  color: #98aac1;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
}

.weekly-state {
  border: 1px solid rgba(145, 186, 231, 0.26);
  padding: 4px 6px;
  color: #dce8f7;
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.weekly-slot.is-locked {
  border-style: dashed;
  color: #7f8fa8;
  background: rgba(7, 12, 23, 0.58);
}

.weekly-slot.is-locked .weekly-state {
  color: #9ba8ba;
}

.weekly-slot.is-bonus {
  grid-column: 1 / -1;
}

.weekly-slot.is-filled > span strong,
.weekly-slot.is-filled > span small {
  color: #b7fff1;
}

.weekly-panel.has-pigment {
  border: 1px solid rgba(138, 255, 234, 0.42);
  padding: 10px;
  background:
    radial-gradient(circle at 92% 10%, var(--pigment-color, rgba(138, 255, 234, 0.24)), transparent 52%),
    rgba(9, 17, 31, 0.84);
  box-shadow: 0 0 24px var(--pigment-shadow, rgba(138, 255, 234, 0.12));
}

.weekly-panel[data-pigment="0"] {
  --pigment-color: rgba(255, 151, 104, 0.25);
  --pigment-shadow: rgba(255, 151, 104, 0.16);
}

.weekly-panel[data-pigment="1"] {
  --pigment-color: rgba(116, 245, 255, 0.24);
  --pigment-shadow: rgba(116, 245, 255, 0.15);
}

.weekly-panel[data-pigment="2"] {
  --pigment-color: rgba(215, 156, 255, 0.24);
  --pigment-shadow: rgba(215, 156, 255, 0.15);
}

.activity-row > div,
.inventory-row > div,
.specimen-card > span {
  min-width: 0;
}

.activity-row strong,
.activity-row small,
.inventory-row strong,
.inventory-row small,
.specimen-card strong,
.specimen-card small,
.specimen-state {
  overflow-wrap: anywhere;
}

.specimen-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.specimen-actions button {
  min-height: 44px;
  padding: 7px 4px;
  font-size: 11px;
}

.specimen-actions button:disabled {
  color: #8c9ab0;
  opacity: 0.58;
}

.specimen-actions button[aria-disabled="true"],
.album-slot[aria-disabled="true"],
.weekly-slot[aria-disabled="true"],
.inventory-row button[aria-disabled="true"],
.pill-button[aria-disabled="true"] {
  border-color: rgba(145, 166, 197, 0.18);
  background: rgba(6, 10, 18, 0.46);
  color: #9ba8ba;
  opacity: 1;
  filter: saturate(0.65);
}

.specimen-actions button {
  white-space: normal;
  overflow-wrap: anywhere;
}

.specimen-actions .is-primary {
  border-color: rgba(105, 247, 220, 0.5);
  background: linear-gradient(135deg, rgba(23, 86, 87, 0.92), rgba(40, 35, 91, 0.94));
}

.specimen-actions .is-quiet {
  border-color: rgba(145, 166, 197, 0.16);
  background: rgba(6, 10, 18, 0.5);
  color: #aebbd0;
}

.specimen-actions > :last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.specimen-action-hint {
  grid-column: 1 / -1;
  margin-top: 5px;
  color: #a5b4c9 !important;
  font-size: 10px;
  line-height: 1.35;
}

.toast {
  z-index: 2147483647;
  width: max-content;
  max-width: min(390px, calc(100vw - 28px));
  min-height: 48px;
  padding: 12px 16px;
  font-size: 13px;
  line-height: 1.3;
  pointer-events: none;
}

.sheet-header > .toast {
  grid-column: 1 / -1;
  width: 100%;
  max-width: none;
  margin: 0;
  position: static;
  top: auto;
  bottom: auto;
  left: auto;
  transform: none;
}

.weekly-slot.is-actionable {
  width: 100%;
  cursor: pointer;
  font: inherit;
}

.weekly-slot.is-actionable::after {
  content: "";
  grid-column: 2;
  color: #8affea;
  font-size: 9px;
  font-weight: 850;
  text-transform: uppercase;
}

.weekly-panel {
  position: relative;
}

.weekly-panel::after {
  width: 26px;
  height: 26px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  position: absolute;
  top: 24px;
  right: 54px;
  content: "";
  background: var(--pigment-color, rgba(138, 255, 234, 0.24));
  box-shadow: 0 0 18px var(--pigment-shadow, rgba(138, 255, 234, 0.14));
  clip-path: polygon(50% 0, 100% 35%, 82% 100%, 18% 100%, 0 35%);
}

.share-sheet .share-preview {
  max-height: 42dvh;
  object-fit: contain;
}

.confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.wide-button.danger {
  border-color: rgba(255, 123, 143, 0.68);
  background: linear-gradient(120deg, rgba(135, 35, 61, 0.96), rgba(77, 28, 67, 0.96));
}

.sheet {
  width: min(calc(100vw - 20px), 460px);
  max-height: calc(100dvh - max(8px, env(safe-area-inset-top)) - max(8px, env(safe-area-inset-bottom)));
  margin: 0 auto;
  position: fixed;
  inset-block-start: max(8px, env(safe-area-inset-top));
  inset-block-end: auto;
  inset-inline: 10px;
  overflow: auto;
  overscroll-behavior: contain;
}

.sheet > .sheet-header {
  margin-top: -18px;
  padding: 18px 0 4px;
  position: sticky;
  z-index: 8;
  top: -18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  align-items: start;
  background: linear-gradient(180deg, #141e34 0%, #0e1628 100%);
  box-shadow: 0 10px 14px rgba(5, 9, 18, 0.5);
}

body:has(dialog[open]) {
  overflow: hidden;
}

.compact-sheet {
  margin: 0 auto;
}

@media (min-width: 700px) {
  .sheet {
    inset-block-start: 0;
    inset-block-end: 0;
    margin-block: auto;
    max-height: min(88dvh, 780px);
  }
}

.reduce-motion *,
.reduce-motion *::before,
.reduce-motion *::after {
  scroll-behavior: auto !important;
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

@media (max-width: 355px) {
  .trait-trace {
    grid-template-columns: 1fr;
  }

  .weekly-grid {
    grid-template-columns: 1fr;
  }

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

  .activity-row .timer-chip {
    justify-self: start;
  }
}

@media (max-width: 480px) {
  #ownershipDialog[data-mode="first"] .ownership-creature {
    grid-template-columns: 1fr;
  }

  #ownershipDialog[data-mode="first"] .ownership-creature img {
    width: 100%;
    height: 168px;
    object-fit: contain;
    object-position: center;
    background: #050912;
  }

  .share-sheet .share-preview {
    max-height: 23dvh;
  }

  .share-sheet .share-copy {
    display: none;
  }

  .share-sheet .privacy-callout,
  .share-sheet .share-summary {
    margin-block: 5px;
  }

  :root[data-mode="result"] #app {
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }

  :root[data-mode="result"] .secondary-actions:not([hidden]) {
    width: 100%;
    position: static;
    transform: none;
  }

  .weekly-grid {
    grid-template-columns: 1fr;
  }

  .weekly-slot {
    min-height: 72px;
  }

  .weekly-slot.is-bonus {
    grid-column: auto;
  }

  #serumDialog,
  #ownershipDialog,
  #activityDialog,
  #distillDialog,
  #confirmDialog,
  #aboutDialog {
    width: min(calc(100vw - 16px), 460px);
    max-height: calc(92dvh - max(8px, env(safe-area-inset-bottom)));
    inset-block-start: max(8px, env(safe-area-inset-top));
    inset-block-end: auto;
    inset-inline: 8px;
  }

  #shelfDialog,
  #settingsDialog,
  #founderDialog,
  #shareDialog {
    width: min(calc(100vw - 16px), 460px);
    height: calc(100dvh - max(8px, env(safe-area-inset-top)) - max(8px, env(safe-area-inset-bottom)));
    max-height: calc(100dvh - max(8px, env(safe-area-inset-top)) - max(8px, env(safe-area-inset-bottom)));
    inset-block-start: max(8px, env(safe-area-inset-top));
    inset-block-end: auto;
    inset-inline: 8px;
  }

  .choice-card {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .choice-card > em {
    grid-column: 2;
    text-align: left;
  }
}

/* Creature-first readability: important help text must not look like fine print. */
.eyebrow {
  font-size: 12px;
  letter-spacing: 0.08em;
}

.shelf-summary,
.founder-intro,
.panel-hint {
  color: #c1cee0;
  font-size: 15px;
  line-height: 1.5;
}

.choice-card {
  min-height: 96px;
}

.choice-card strong {
  font-size: 17px;
}

.choice-card small {
  color: #c6d2e2;
  font-size: 14px;
  line-height: 1.45;
}

.choice-card > em {
  font-size: 12px;
  line-height: 1.3;
}

.activity-row strong,
.inventory-row strong,
.specimen-card strong {
  font-size: 14px;
}

.activity-row small,
.inventory-row small,
.specimen-card small,
.journal-list p,
.album-slot small {
  color: #b7c4d7;
  font-size: 13px;
  line-height: 1.4;
}

.specimen-actions button {
  font-size: 12px;
}

.trait-trace span,
.trait-trace small {
  font-size: 9px;
}

.trait-trace strong {
  font-size: 11px;
}

.play-steps {
  display: grid;
  gap: 10px;
}

.play-steps p {
  margin: 0;
  border-left: 3px solid rgba(105, 247, 220, 0.55);
  padding: 10px 12px;
  background: rgba(11, 20, 35, 0.72);
}

.play-steps .advanced-help {
  border-left-color: rgba(217, 155, 255, 0.55);
}

.shelf-grid:has(> .specimen-card:only-child) {
  grid-template-columns: 1fr;
}

.shelf-grid > .specimen-card:only-child {
  grid-template-rows: 160px auto auto;
}

.shelf-grid > .specimen-card:only-child img {
  height: 160px;
}

.privacy-link {
  display: grid;
  place-items: center;
  text-decoration: none;
}

.reset-data-action {
  margin-top: 12px;
  border-top: 1px solid rgba(255, 140, 156, 0.28);
  padding-top: 14px;
}

.share-safety {
  display: block;
  margin: -3px 0 10px;
  color: #c6d2e2;
  font-size: 13px;
  line-height: 1.4;
}

.privacy-page {
  width: min(100% - 32px, 760px);
  margin: 0 auto;
  padding: 32px 0 64px;
  color: #dce8f8;
  font-size: 17px;
  line-height: 1.65;
}

.privacy-page h1,
.privacy-page h2 {
  color: #fff;
  line-height: 1.15;
}

.privacy-page h1 {
  margin: 8px 0 10px;
  font-size: clamp(34px, 8vw, 54px);
}

.privacy-page h2 {
  margin-top: 30px;
  font-size: 23px;
}

.privacy-page a {
  color: #8affea;
}

.privacy-page .privacy-lede {
  color: #bfcde0;
  font-size: 19px;
}

.privacy-page .privacy-note {
  border: 1px solid rgba(105, 247, 220, 0.35);
  padding: 14px 16px;
  background: rgba(12, 25, 39, 0.78);
}
