:root {
  --black: #09090b;
  --paper: rgba(25, 25, 27, 0.94);
  --paper-light: rgba(51, 51, 55, 0.36);
  --white: #f3f3ef;
  --muted: #b5b5ad;
  --purple: #5b29ba;
  --purple-light: #8a5be5;
  --lime: #d8ff17;
  --lime-dark: #9fc000;
  --danger: #ff7777;
  --outline: rgba(255, 255, 255, 0.16);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

html {
  overflow-x: hidden;
}

body {
  overflow-x: hidden;
  color: var(--white);
  background: #171717 url("/assets/camo-black-2x.png") center / cover fixed no-repeat;
  font-family: "Trebuchet MS", "Arial Rounded MT Bold", system-ui, sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

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

.app-shell {
  position: relative;
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 36px 18px 74px;
}

.game-card {
  position: relative;
  width: min(100%, 790px);
  min-height: 500px;
  isolation: isolate;
  overflow: hidden;
  background: transparent url("/assets/Cmn_SystemWindow.webp") center / 100% 100% no-repeat;
}

.card-content {
  display: flex;
  min-height: 500px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 82px clamp(32px, 8vw, 84px) 82px;
  text-align: center;
}

.card-content.card-enter {
  animation: card-enter 360ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.card-content.card-exit {
  animation: card-exit 220ms ease both;
}

@keyframes card-enter {
  from { opacity: 0; transform: scale(0.96) translateY(13px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes card-exit {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0; transform: scale(1.03) translateY(-10px); }
}

.eyebrow {
  margin: 0 0 18px;
  color: var(--lime);
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  color: var(--white);
  font-weight: 900;
  line-height: 1.15;
  text-shadow: 3px 4px 0 rgba(0, 0, 0, 0.5);
}

h1 {
  max-width: 620px;
  font-size: clamp(2rem, 6vw, 3.8rem);
}

h2 {
  max-width: 620px;
  font-size: clamp(1.7rem, 4.6vw, 2.8rem);
}

.lead {
  max-width: 580px;
  margin: 26px 0 0;
  color: var(--white);
  font-size: clamp(1rem, 2.5vw, 1.26rem);
  line-height: 1.8;
}

.subtle {
  max-width: 580px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.65;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 18px;
  width: 100%;
  margin-top: 42px;
}

.ink-button {
  min-width: 180px;
  padding: 15px 30px;
  color: #111;
  border-radius: 53% 47% 46% 54% / 53% 43% 57% 47%;
  background: var(--lime);
  box-shadow: inset 0 -7px 0 rgba(95, 122, 0, 0.28), 0 8px 0 rgba(0, 0, 0, 0.28);
  font-weight: 900;
  transition: transform 160ms ease, filter 160ms ease, box-shadow 160ms ease;
}

.ink-button:hover:not(:disabled) {
  filter: brightness(1.11);
  transform: translateY(-3px) rotate(-1deg);
  box-shadow: inset 0 -7px 0 rgba(95, 122, 0, 0.28), 0 11px 0 rgba(0, 0, 0, 0.28);
}

.ink-button:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: inset 0 -3px 0 rgba(95, 122, 0, 0.28), 0 4px 0 rgba(0, 0, 0, 0.28);
}

.ink-button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.ink-button.secondary {
  color: var(--white);
  background: var(--purple);
  box-shadow: inset 0 -7px 0 rgba(28, 9, 77, 0.46), 0 8px 0 rgba(0, 0, 0, 0.3);
}

.ink-button.secondary:hover:not(:disabled) {
  background: var(--purple-light);
  box-shadow: inset 0 -7px 0 rgba(28, 9, 77, 0.46), 0 11px 0 rgba(0, 0, 0, 0.3);
}

.text-button {
  margin-top: 18px;
  padding: 8px 12px;
  color: var(--muted);
  background: transparent;
  font-size: 0.88rem;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.text-button:hover {
  color: var(--white);
}

.instructions {
  display: grid;
  gap: 12px;
  width: min(100%, 540px);
  margin-top: 30px;
  text-align: left;
}

.instruction {
  display: grid;
  grid-template-columns: 32px 1fr;
  align-items: start;
  gap: 12px;
  color: #e1e1dc;
  line-height: 1.55;
}

.instruction-number {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  color: #111;
  border-radius: 50%;
  background: var(--lime);
  font-size: 0.85rem;
  font-weight: 900;
}

.login-link {
  display: flex;
  align-items: center;
  width: min(100%, 570px);
  margin-top: 28px;
  padding: 16px 18px;
  overflow: hidden;
  color: var(--muted);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.35);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.77rem;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.field-label {
  align-self: flex-start;
  width: min(100%, 570px);
  margin: 28px 0 8px;
  color: var(--white);
  font-size: 0.92rem;
  font-weight: 900;
  text-align: left;
}

.link-input {
  width: min(100%, 570px);
  min-height: 116px;
  resize: vertical;
  padding: 15px 17px;
  color: var(--white);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 13px;
  outline: none;
  background: rgba(0, 0, 0, 0.42);
  font-size: 0.95rem;
  line-height: 1.55;
}

.link-input::placeholder {
  color: #85857f;
}

.link-input:focus {
  border-color: var(--lime);
  box-shadow: 0 0 0 3px rgba(216, 255, 23, 0.13);
}

.progress-list {
  display: grid;
  gap: 13px;
  width: min(100%, 470px);
  margin-top: 32px;
  text-align: left;
}

.progress-item {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 0.95rem;
}

.progress-item.active {
  color: var(--white);
}

.progress-item.done {
  color: var(--lime);
}

.progress-dot {
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.progress-item.active .progress-dot {
  background: var(--lime);
  box-shadow: 0 0 12px var(--lime);
  animation: pulse 900ms ease-in-out infinite alternate;
}

.progress-item.done .progress-dot {
  background: currentColor;
}

@keyframes pulse {
  from { opacity: 0.45; transform: scale(0.82); }
  to { opacity: 1; transform: scale(1.1); }
}

.error-box {
  width: min(100%, 570px);
  margin-top: 24px;
  padding: 14px 18px;
  color: #ffd1d1;
  border: 1px solid rgba(255, 119, 119, 0.4);
  border-radius: 12px;
  background: rgba(120, 20, 20, 0.25);
  line-height: 1.55;
}

.file-name {
  margin-top: 24px;
  padding: 10px 16px;
  color: var(--lime);
  border: 1px solid rgba(216, 255, 23, 0.3);
  border-radius: 999px;
  background: rgba(216, 255, 23, 0.08);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.86rem;
}

.footer-note {
  position: absolute;
  right: 18px;
  bottom: 22px;
  left: 18px;
  margin: 0;
  color: rgba(255, 255, 255, 0.42);
  font-size: 0.76rem;
  letter-spacing: 0.06em;
  text-align: center;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 22px;
  z-index: 10;
  max-width: min(360px, calc(100vw - 36px));
  padding: 12px 16px;
  color: var(--white);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 10px;
  background: rgba(15, 15, 17, 0.94);
  box-shadow: 0 9px 26px rgba(0, 0, 0, 0.4);
  font-size: 0.88rem;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 620px) {
  .app-shell {
    padding: 16px 8px 62px;
  }

  .game-card,
  .card-content {
    min-height: 650px;
  }

  .card-content {
    padding: 74px 28px 70px;
  }

  .actions {
    gap: 13px;
    margin-top: 32px;
  }

  .ink-button {
    width: min(100%, 280px);
  }

  .footer-note {
    bottom: 14px;
  }
}

/* English headings are wider than the Chinese copy. Give them enough room
   for a natural two-line wrap instead of clipping the second line. */
html[lang="en"] .screen-layout {
  grid-template-rows: 122px minmax(0, 1fr) 166px;
}

html[lang="en"] .screen-header {
  overflow: visible;
}

html[lang="en"] .screen-header h1,
html[lang="en"] .screen-header h2 {
  display: block;
  overflow: visible;
  font-size: clamp(1.7rem, 3.8vw, 2.5rem);
  line-height: 1.08;
  -webkit-line-clamp: unset;
}

html[lang="en"] .screen-body {
  padding-top: 10px;
}

html[lang="en"] .paste-body .field-label {
  margin-top: 12px;
}

html[lang="en"] .paste-body .link-input {
  height: 90px;
  min-height: 90px;
}

html[lang="en"] .game-card[data-screen="paste"] .screen-header h2 {
  white-space: nowrap;
  font-size: clamp(1.2rem, 2.4vw, 1.9rem);
  letter-spacing: -0.035em;
}

@media (max-width: 620px) {
  html[lang="en"] .screen-layout {
    grid-template-rows: 116px minmax(0, 1fr) 244px;
  }

  html[lang="en"] .screen-header h1,
  html[lang="en"] .screen-header h2 {
    font-size: clamp(1.5rem, 7.5vw, 2.2rem);
  }

  html[lang="en"] .game-card[data-screen="paste"] .screen-header h2 {
    max-width: none;
    font-size: clamp(0.85rem, 3.7vw, 1.2rem);
    transform: scaleX(0.92);
  }
}

/* The original secondary rule has higher specificity; keep the extracted
   mask as the only button surface. */
.ink-button.secondary {
  background: transparent;
  box-shadow: none;
}

.ink-button.secondary:hover:not(:disabled),
.ink-button.secondary:focus-visible:not(:disabled) {
  background: transparent;
  box-shadow: none;
}

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

/* Splatoon-inspired skin. The original game assets remain optional placeholders. */
@font-face {
  font-family: "DFPZongYiW7-GB";
  src: url("/assets/fonts/DFP_GBZY7.ttf?v=4") format("truetype");
  font-style: normal;
  font-weight: 100 900;
  font-display: block;
}

:root {
  --paper: #19191b;
  --white: #f7f7f2;
  --muted: #bbbcb3;
  --purple: #5123bd;
  --purple-light: #7d4be0;
  --lime: #d9ff19;
  --orange: #ff7900;
}

body {
  color: var(--white);
  background: #171717 url("/assets/camo-black-2x.png") center / cover fixed no-repeat;
  font-family: "DFPZongYiW7-GB", "Trebuchet MS", "Arial Rounded MT Bold", system-ui, sans-serif;
}

.app-shell {
  padding: 48px 18px 76px;
  overflow: hidden;
}

.game-card {
  width: min(100%, 940px);
  min-height: 620px;
  background: transparent url("/assets/Cmn_SystemWindow.webp") center / 100% 100% no-repeat;
}

.card-content {
  min-height: 620px;
  height: 620px;
  padding: 100px clamp(34px, 9vw, 104px) 94px;
}

.eyebrow {
  margin-bottom: 20px;
  color: var(--orange);
  font-size: 0.95rem;
  letter-spacing: 0.16em;
  text-shadow: 2px 2px 0 #161616;
}

h1 { max-width: 780px; font-size: clamp(2.15rem, 6vw, 4.5rem); }
h2 { max-width: 780px; font-size: clamp(1.9rem, 4.8vw, 3.25rem); }

.lead {
  max-width: 700px;
  margin-top: 28px;
  font-size: clamp(1.05rem, 2.5vw, 1.4rem);
  line-height: 1.7;
}

.subtle {
  max-width: 700px;
  font-size: 1rem;
}

.actions {
  gap: 28px;
  margin-top: 46px;
}

.ink-button {
  min-width: 208px;
  padding: 17px 32px 18px;
  border-radius: 54% 46% 48% 52% / 48% 52% 44% 56%;
  box-shadow: inset 0 -8px 0 rgba(95, 122, 0, 0.3), 0 9px 0 rgba(0, 0, 0, 0.38);
  font-size: 1.12rem;
}

.ink-button:hover:not(:disabled) {
  box-shadow: inset 0 -8px 0 rgba(95, 122, 0, 0.3), 0 12px 0 rgba(0, 0, 0, 0.38);
}

.ink-button:active:not(:disabled) {
  box-shadow: inset 0 -4px 0 rgba(95, 122, 0, 0.3), 0 4px 0 rgba(0, 0, 0, 0.38);
}

/* Use the extracted game ink masks. The source PNGs are white alpha masks, so
   CSS masking keeps their original silhouettes while allowing web colors. */
.ink-button {
  position: relative;
  display: inline-grid;
  width: 250px;
  min-width: 250px;
  height: 132px;
  min-height: 132px;
  place-items: center;
  padding: 34px 42px;
  isolation: isolate;
  overflow: visible;
  color: var(--white);
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  transform: translateY(0);
}

.ink-button::before,
.ink-button::after {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background: linear-gradient(180deg, #7440df 0%, #4b1db6 64%, #35118b 100%);
  -webkit-mask: url("/assets/buttons/InkBtnM_00_s.png") center 38% / 140% 210% no-repeat;
  mask: url("/assets/buttons/InkBtnM_00_s.png") center 38% / 140% 210% no-repeat;
  -webkit-mask-mode: luminance;
  mask-mode: luminance;
  filter: drop-shadow(0 10px 0 rgba(12, 4, 35, 0.62));
  transition: transform 160ms ease, filter 160ms ease, opacity 160ms ease;
}

.ink-button::after {
  inset: 7px 4px 0;
  z-index: 0;
  opacity: 0.92;
  background:
    radial-gradient(ellipse 86% 38% at 50% 94%, rgba(255, 255, 255, 0.95) 0 19%, rgba(150, 232, 255, 0.78) 39%, transparent 72%),
    linear-gradient(180deg, transparent 0 64%, rgba(255, 255, 255, 0.12) 76%, transparent 100%);
  -webkit-mask: url("/assets/buttons/InkBtnM_00_s.png") center 38% / 140% 210% no-repeat;
  mask: url("/assets/buttons/InkBtnM_00_s.png") center 38% / 140% 210% no-repeat;
  -webkit-mask-mode: luminance;
  mask-mode: luminance;
  filter: blur(0.5px);
}

.ink-button:not(.secondary)::before,
.ink-button:hover::before,
.ink-button:focus-visible::before {
  background: linear-gradient(180deg, #f4ff3e 0%, #c7f000 60%, #8fc400 100%);
  -webkit-mask: url("/assets/buttons/InkBtnM_13_s.png") center 0% / 110% 130% no-repeat;
  mask: url("/assets/buttons/InkBtnM_13_s.png") center 0% / 110% 130% no-repeat;
  -webkit-mask-mode: luminance;
  mask-mode: luminance;
  filter: drop-shadow(0 10px 0 rgba(48, 62, 0, 0.58));
}

.ink-button:not(.secondary)::after,
.ink-button:hover::after,
.ink-button:focus-visible::after {
  inset: 0;
  opacity: 0.95;
  background:
    radial-gradient(ellipse 35% 22% at 65% 13%, rgba(255, 255, 255, 0.98) 0 12%, rgba(255, 255, 255, 0.46) 28%, transparent 70%),
    linear-gradient(150deg, rgba(255, 255, 255, 0.55), transparent 24% 100%);
  -webkit-mask: url("/assets/buttons/InkBtnM_13_s.png") center 0% / 110% 130% no-repeat;
  mask: url("/assets/buttons/InkBtnM_13_s.png") center 0% / 110% 130% no-repeat;
  -webkit-mask-mode: luminance;
  mask-mode: luminance;
}

.button-label {
  position: relative;
  z-index: 1;
  display: block;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: inherit;
  white-space: nowrap;
  text-shadow: 2px 3px 0 rgba(22, 16, 63, 0.55);
}

.ink-button:hover .button-label,
.ink-button:focus-visible .button-label {
  color: #20200d;
  text-shadow: 1px 2px 0 rgba(255, 255, 255, 0.35);
}

/* Selecting the left action temporarily moves focus away from the default
   right action, matching the one-selection behavior of the game UI. */
.actions:has(.ink-button.secondary:hover) .ink-button:not(.secondary)::before,
.actions:has(.ink-button.secondary:focus-visible) .ink-button:not(.secondary)::before {
  background: linear-gradient(180deg, #7440df 0%, #4b1db6 64%, #35118b 100%);
  -webkit-mask: url("/assets/buttons/InkBtnM_00_s.png") center 38% / 140% 210% no-repeat;
  mask: url("/assets/buttons/InkBtnM_00_s.png") center 38% / 140% 210% no-repeat;
  -webkit-mask-mode: luminance;
  mask-mode: luminance;
  filter: drop-shadow(0 10px 0 rgba(12, 4, 35, 0.62));
}

.actions:has(.ink-button.secondary:hover) .ink-button:not(.secondary)::after,
.actions:has(.ink-button.secondary:focus-visible) .ink-button:not(.secondary)::after {
  inset: 7px 4px 0;
  opacity: 0.92;
  background:
    radial-gradient(ellipse 86% 38% at 50% 94%, rgba(255, 255, 255, 0.95) 0 19%, rgba(150, 232, 255, 0.78) 39%, transparent 72%),
    linear-gradient(180deg, transparent 0 64%, rgba(255, 255, 255, 0.12) 76%, transparent 100%);
  -webkit-mask: url("/assets/buttons/InkBtnM_00_s.png") center 38% / 140% 210% no-repeat;
  mask: url("/assets/buttons/InkBtnM_00_s.png") center 38% / 140% 210% no-repeat;
  -webkit-mask-mode: luminance;
  mask-mode: luminance;
}

.actions:has(.ink-button.secondary:hover) .ink-button:not(.secondary) .button-label,
.actions:has(.ink-button.secondary:focus-visible) .ink-button:not(.secondary) .button-label {
  color: var(--white);
  text-shadow: 2px 3px 0 rgba(22, 16, 63, 0.55);
}

.ink-button:hover:not(:disabled),
.ink-button:focus-visible:not(:disabled) {
  transform: translateY(-3px) rotate(-1deg);
  box-shadow: none;
  filter: none;
}

.ink-button:active:not(:disabled) {
  transform: translateY(3px) rotate(0deg);
}

.ink-button:disabled {
  filter: grayscale(0.35);
}

.ink-button.secondary {
  border-radius: 49% 51% 56% 44% / 48% 56% 44% 52%;
}

/* Step 1 has the extra instruction list and login link. Keep the game panel
   at its normal height by tightening only this screen's vertical rhythm. */
.game-card[data-screen="login"] .card-content {
  padding-top: 66px;
  padding-bottom: 54px;
}

.game-card[data-screen="login"] .eyebrow {
  margin-bottom: 10px;
}

.game-card[data-screen="login"] h2 {
  font-size: clamp(1.7rem, 4.2vw, 2.65rem);
}

.game-card[data-screen="login"] .instructions {
  gap: 8px;
  margin-top: 16px;
  padding-top: 10px;
}

.game-card[data-screen="login"] .instruction {
  gap: 10px;
  font-size: 0.92rem;
  line-height: 1.3;
}

.game-card[data-screen="login"] .instruction-number {
  width: 26px;
  height: 26px;
  font-size: 1rem;
}

.game-card[data-screen="login"] .login-link {
  margin-top: 12px;
  padding: 10px 14px;
  font-size: 0.7rem;
}

.game-card[data-screen="login"] .subtle {
  margin-top: 8px;
  font-size: 0.86rem;
}

.game-card[data-screen="login"] .actions {
  gap: 22px;
  margin-top: 18px;
}

.game-card[data-screen="login"] .ink-button {
  width: 220px;
  min-width: 220px;
  height: 108px;
  min-height: 108px;
  padding: 25px 34px;
}

.game-card[data-screen="login"] .text-button {
  margin-top: 6px;
  padding: 4px 8px;
  position: relative;
  top: 12px;
}

/* Keep welcome and step titles visually consistent without allowing long
   step titles to exceed the fixed game panel. */
.game-card h1,
.game-card h2 {
  font-size: clamp(1.85rem, 5vw, 3.25rem);
}

.instructions {
  gap: 15px;
  margin-top: 34px;
  padding-top: 17px;
  border-top: 2px dashed rgba(255, 255, 255, 0.38);
}

.instruction {
  color: #e8e8e2;
  font-size: 1.06rem;
}

.instruction-number {
  display: block;
  width: 32px;
  height: 32px;
  color: var(--orange);
  background: transparent;
  font-size: 1.24rem;
  line-height: 1.1;
}

.login-link,
.link-input,
.error-box,
.file-name {
  border-radius: 3px;
}

.login-link,
.link-input {
  border-width: 2px;
}

h1,
h2,
.lead,
.subtle,
.ink-button,
.instruction,
.field-label,
.link-input,
.error-box,
.footer-note {
  font-family: "DFPZongYiW7-GB", "Trebuchet MS", "Arial Rounded MT Bold", system-ui, sans-serif;
}

.preview-switcher[hidden] {
  display: none;
}

.preview-switcher {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 8px 14px;
  color: var(--white);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 4px;
  background: rgba(10, 10, 12, 0.78);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.32);
  font-size: 0.78rem;
}

.preview-switcher button {
  padding: 8px 12px;
  color: #20200d;
  border-radius: 3px;
  background: var(--lime);
  font: inherit;
  font-weight: 900;
}

.preview-switcher button:first-of-type {
  color: var(--white);
  background: rgba(255, 255, 255, 0.14);
}

.preview-switcher button:first-of-type:hover,
.preview-switcher button:first-of-type:focus-visible {
  background: rgba(255, 255, 255, 0.24);
}

.preview-switcher button:hover,
.preview-switcher button:focus-visible {
  background: #f0ff5b;
  transform: translateY(-1px);
}

@media (max-width: 620px) {
  .preview-switcher {
    top: 10px;
    right: 10px;
    left: 10px;
    gap: 6px;
    justify-content: flex-start;
  }

  .preview-switcher .preview-label {
    margin-right: auto;
  }
}

@media (max-width: 620px) {
  .game-card,
  .card-content {
    min-height: 680px;
  }

  .card-content {
    height: 680px;
  }

  .card-content {
    padding: 82px 28px 74px;
  }

  .instructions,
  .login-link,
  .link-input,
  .error-box {
    width: 100%;
  }

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

  .actions .ink-button:not(.secondary) {
    order: -1;
  }
}

/* Keep every screen on the same vertical grid: header, content, actions. */
.card-content {
  display: block;
  height: 620px;
  min-height: 620px;
  padding: 0;
}

.screen-layout {
  display: grid;
  width: 100%;
  height: 100%;
  grid-template-rows: 96px minmax(0, 1fr) 166px;
  padding: 84px clamp(34px, 9vw, 104px) 60px;
  text-align: center;
}

.screen-header {
  min-width: 0;
  overflow: hidden;
}

.screen-header .eyebrow {
  margin: 0 0 12px;
  line-height: 1.1;
}

.screen-header h1,
.screen-header h2 {
  display: -webkit-box;
  max-width: 100%;
  overflow: hidden;
  font-size: clamp(1.85rem, 5vw, 3.25rem);
  line-height: 1.1;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.screen-body {
  display: flex;
  min-height: 0;
  flex-direction: column;
  align-items: center;
  overflow-y: auto;
  padding-top: 18px;
  scrollbar-width: thin;
  text-align: center;
}

.screen-body > .lead,
.screen-body > .subtle {
  margin-top: 0;
}

.welcome-body {
  overflow: visible;
}

.risk-notice {
  width: min(100%, 700px);
  margin-top: 20px;
  padding: 12px 16px 10px;
  color: var(--white);
  border: 1px solid rgba(255, 121, 0, 0.58);
  border-radius: 13px 8px 12px 7px;
  background:
    linear-gradient(108deg, rgba(255, 121, 0, 0.12), transparent 46%),
    rgba(0, 0, 0, 0.2);
  box-shadow: inset 4px 0 0 rgba(255, 121, 0, 0.72), 0 8px 24px rgba(0, 0, 0, 0.18);
  text-align: left;
}

.risk-notice-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #ffb15c;
  font-size: 0.98rem;
  line-height: 1.3;
}

.risk-privacy {
  margin: 7px 0 0;
  color: #f1eee2;
  font-size: 0.8rem;
  line-height: 1.35;
}

.risk-notice-icon {
  display: inline-grid;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  place-items: center;
  color: #1a1107;
  border-radius: 50%;
  background: var(--orange);
  font-size: 0.88rem;
  font-weight: 900;
}

.risk-notice-list {
  margin: 8px 0 0;
  padding-left: 19px;
}

.risk-notice-list li {
  margin-top: 3px;
  color: #d5d5cd;
  font-size: 0.78rem;
  line-height: 1.4;
}

.risk-notice-list li::marker {
  color: var(--orange);
}

.footer-note {
  display: flex;
  flex-direction: column;
  gap: 5px;
  line-height: 1.3;
}

.footer-meta a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 160ms ease;
}

.footer-meta a.author-name {
  color: var(--lime);
}

.language-toggle {
  padding: 0;
  color: var(--lime);
  background: transparent;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.language-toggle:hover,
.language-toggle:focus-visible {
  color: var(--white);
}

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

.footer-thanks {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

.game-card[data-screen="welcome"] .screen-layout {
  grid-template-rows: 96px minmax(0, 1fr) 148px;
}

.thanks-label {
  color: var(--orange);
  font-weight: 900;
  white-space: nowrap;
}

.project-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 14px;
}

.project-links a {
  color: var(--white);
  text-decoration: underline;
  text-decoration-color: rgba(216, 255, 23, 0.75);
  text-underline-offset: 4px;
  transition: color 160ms ease, text-decoration-color 160ms ease;
}

.project-links a:hover,
.project-links a:focus-visible {
  color: var(--lime);
  text-decoration-color: var(--lime);
}

.login-body .instructions {
  gap: 10px;
  width: min(100%, 570px);
  margin: 0;
  padding-top: 14px;
}

.login-body .instruction {
  font-size: 0.98rem;
  line-height: 1.35;
}

.login-body .login-link {
  width: min(100%, 570px);
  margin-top: 14px;
  padding: 11px 14px;
}

.login-body .subtle {
  margin-top: 8px;
  font-size: 0.86rem;
}

.paste-body .subtle {
  max-width: 600px;
}

.paste-body .field-label {
  width: min(100%, 570px);
  margin: 18px 0 8px;
  align-self: center;
}

.paste-body .link-input {
  width: min(100%, 570px);
  height: 104px;
  min-height: 104px;
  resize: none;
}

.paste-body .link-input:focus {
  outline: none;
  border-color: var(--lime);
  box-shadow: none;
}

.generating-stack {
  width: fit-content;
  max-width: 100%;
  text-align: left;
}

.generating-stack > .subtle {
  max-width: none;
  text-align: center;
}

.generating-stack .progress-list {
  width: fit-content;
  max-width: 100%;
  margin-right: auto;
  margin-left: auto;
  margin-top: 18px;
}

.success-body .file-name {
  margin-top: 18px;
}

.error-body .error-box {
  margin-top: 8px;
}

.screen-footer {
  display: grid;
  min-height: 0;
  grid-template-rows: 120px 28px;
  align-content: end;
  justify-items: center;
}

.screen-footer .actions {
  grid-row: 1;
  width: 100%;
  height: 120px;
  min-height: 120px;
  gap: 24px;
  margin: 0;
}

.game-card .screen-footer .ink-button {
  width: 230px;
  min-width: 230px;
  height: 120px;
  min-height: 120px;
}

.game-card .screen-footer .actions {
  margin-top: 0;
}

.screen-footer .text-button {
  grid-row: 2;
  align-self: end;
  margin: 0;
  padding: 2px 8px;
  line-height: 1.2;
  position: static;
  top: auto;
}

.screen-footer .footer-hint {
  grid-row: 2;
  align-self: end;
  margin: 4px 0 0;
  font-size: 0.82rem;
  line-height: 1.3;
}

.game-card[data-screen="login"] .card-content {
  height: 620px;
  min-height: 620px;
  padding: 0;
}

@media (max-width: 620px) {
  .app-shell {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    align-items: center;
    justify-items: center;
    padding: 20px 18px 12px;
  }

  .game-card {
    grid-row: 1;
    align-self: center;
    height: 580px;
    min-height: 580px;
  }

  .card-content {
    height: 580px;
    min-height: 580px;
  }

  .screen-layout {
    grid-template-rows: 92px minmax(0, 1fr) 244px;
    padding: 66px 24px 40px;
  }

  .screen-body {
    min-width: 0;
    padding-top: 16px;
    overflow: visible;
  }

  .risk-notice {
    padding: 12px 14px 10px;
  }

  .risk-notice-list li {
    font-size: 0.76rem;
  }

  .risk-privacy {
    font-size: 0.75rem;
  }

  .screen-body > .subtle {
    font-size: 1.05rem;
    line-height: 1.5;
  }

  .game-card[data-screen="login"] .instruction {
    font-size: 0.98rem;
    line-height: 1.32;
  }

  .game-card[data-screen="login"] .subtle {
    font-size: 0.9rem;
    line-height: 1.4;
  }

  .game-card[data-screen="welcome"] .card-content {
    height: 580px;
    min-height: 580px;
  }

  .game-card[data-screen="welcome"] .screen-layout {
    grid-template-rows: 92px minmax(0, 1fr) 244px;
  }

  .game-card[data-screen="login"] .card-content {
    height: 580px;
    min-height: 580px;
  }

  .game-card .screen-footer .ink-button {
    width: calc((100% - clamp(2px, 1vw, 5px)) / 2);
    min-width: 0;
    height: clamp(88px, 24vw, 106px);
    min-height: clamp(88px, 24vw, 106px);
    padding: 16px 6px;
  }

  .screen-footer .actions {
    height: clamp(88px, 24vw, 106px);
    min-height: clamp(88px, 24vw, 106px);
    flex: 0 0 clamp(88px, 24vw, 106px);
    flex-direction: row;
    flex-wrap: nowrap;
    gap: clamp(2px, 1vw, 5px);
  }

  .game-card .screen-footer .actions {
    gap: clamp(2px, 1vw, 5px);
  }

  .screen-footer .actions .ink-button:not(.secondary) {
    order: 0;
  }

  .screen-footer {
    grid-template-rows: clamp(88px, 24vw, 106px) 28px;
  }

  .footer-note {
    grid-row: 2;
    align-self: end;
    position: static;
    width: 100%;
    margin: 8px 0 0;
  }

  .paste-body .link-input {
    height: 90px;
    min-height: 90px;
  }

  html[lang="en"] .game-card[data-screen="login"] .instructions {
    gap: 6px;
    margin-top: 12px;
    padding-top: 8px;
  }

  html[lang="en"] .game-card[data-screen="login"] .instruction {
    gap: 8px;
    font-size: 0.84rem;
    line-height: 1.2;
  }

  html[lang="en"] .game-card[data-screen="login"] .instruction-number {
    width: 24px;
    height: 24px;
    font-size: 0.78rem;
  }

  html[lang="en"] .game-card[data-screen="login"] .login-link {
    margin-top: 8px;
    padding: 8px 10px;
    font-size: 0.65rem;
  }
}

@media (max-width: 360px) {
  .app-shell {
    padding: 16px 10px 12px;
  }

  .game-card {
    min-height: 580px;
  }

  .card-content,
  .game-card[data-screen="welcome"] .card-content,
  .game-card[data-screen="login"] .card-content {
    height: 580px;
    min-height: 580px;
  }

  .screen-layout {
    grid-template-rows: 80px minmax(0, 1fr) 244px;
    padding: 40px 18px 40px;
  }

  .game-card[data-screen="welcome"] .screen-layout {
    grid-template-rows: 80px minmax(0, 1fr) 244px;
  }

  .screen-header h1,
  .screen-header h2 {
    font-size: 1.35rem;
    line-height: 1.05;
  }

  .game-card[data-screen="login"] .screen-header h2 {
    font-size: 1.35rem;
  }

  html[lang="en"] .screen-header h1,
  html[lang="en"] .screen-header h2 {
    font-size: 1.5rem;
  }

  html[lang="en"] .risk-notice {
    padding: 10px 12px 8px;
  }

  html[lang="en"] .risk-notice-heading {
    gap: 8px;
    font-size: 0.85rem;
    line-height: 1.15;
  }

  html[lang="en"] .risk-privacy {
    margin-top: 5px;
    font-size: 0.68rem;
    line-height: 1.2;
  }

  html[lang="en"] .risk-notice-list {
    margin-top: 5px;
    padding-left: 16px;
  }

  html[lang="en"] .risk-notice-list li {
    margin-top: 2px;
    font-size: 0.68rem;
    line-height: 1.2;
  }

  html[lang="en"] .generating-stack .progress-list {
    gap: 8px;
    margin-top: 20px;
  }

  html[lang="en"] .generating-stack .progress-item {
    gap: 8px;
    font-size: 0.78rem;
    line-height: 1.2;
  }
}
