:root {
  --ink: #22223b;
  --surface: #3e3e5b;
  --surface-raised: #4a4e69;
  --yellow: #f2a900;
  --paper: #f9f7f7;
  --orange-dark: #d2691e;
  --orange: #d67732;
  --steel: #7d7f81;
  --radius-large: 24px;
  --radius-medium: 16px;
  --shadow: 0 18px 48px rgb(0 0 0 / 24%);
  --title-size: clamp(2.7rem, 8vw, 4.5rem);
  --h1-size: clamp(2rem, 5vw, 3.2rem);
  --h2-size: clamp(1.15rem, 2.5vw, 1.45rem);
  --body-size: clamp(1rem, 1.4vw, 1.08rem);
}

/* Card outlines use one weight: yellow for required/primary content,
   orange for Credits, rewards, evaluations, and messages, steel for neutral cards. */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--ink);
  color-scheme: dark;
  font-family: "Oxanium", system-ui, sans-serif;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-size: var(--body-size);
  line-height: 1.55;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 0;
}

a {
  color: inherit;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-family: "Gugi", system-ui, sans-serif;
  font-size: var(--h1-size);
  font-weight: 400;
  letter-spacing: 0.025em;
  line-height: 1.08;
}

h2 {
  margin-bottom: 0;
  font-size: var(--h2-size);
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 10px;
  left: 10px;
  padding: 10px 14px;
  transform: translateY(-180%);
  border-radius: 8px;
  background: var(--yellow);
  color: var(--ink);
  font-weight: 700;
}

.skip-link:focus {
  transform: translateY(0);
}

.site-shell {
  min-height: 100vh;
}

.site-header {
  position: relative;
  z-index: 20;
  display: flex;
  width: min(100% - 32px, 1180px);
  min-height: 78px;
  margin: 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid rgb(125 127 129 / 46%);
}

.brand-button {
  padding: 8px 0;
  background: transparent;
  color: var(--paper);
  cursor: pointer;
  font-family: "Gugi", system-ui, sans-serif;
  font-size: clamp(1rem, 2vw, 1.25rem);
  letter-spacing: 0.035em;
}

.site-actions {
  display: flex;
  align-items: center;
  gap: 20px;
}

.site-actions[hidden],
[hidden] {
  display: none !important;
}

#app {
  outline: none;
}

.home-screen {
  display: grid;
  min-height: calc(100vh - 79px);
  padding: 40px 20px 64px;
  place-items: center;
}

.home-card {
  width: min(100%, 650px);
  padding: clamp(34px, 7vw, 70px);
  border: 2px solid var(--yellow);
  border-radius: var(--radius-large);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
}

.home-card h1 {
  margin-bottom: clamp(34px, 7vw, 56px);
  color: var(--paper);
  font-size: var(--title-size);
}

.intro-video-screen {
  display: grid;
  min-height: calc(100vh - 79px);
  padding: 28px 20px 48px;
  place-items: center;
}

.intro-video-card {
  width: min(100%, 1120px, max(320px, calc(177.78dvh - 434px)));
  padding: clamp(14px, 2.5vw, 24px);
  border: 2px solid var(--yellow);
  border-radius: var(--radius-large);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.intro-video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-medium);
  background: #000;
  object-fit: contain;
}

.intro-video-actions {
  display: flex;
  margin-top: 18px;
  justify-content: center;
}

.intro-video-actions .button {
  min-width: 180px;
}

.eyebrow {
  margin-bottom: 7px;
  color: var(--yellow);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.home-actions {
  display: grid;
  gap: 12px;
}

.button,
.level-picker-button,
.document-link {
  min-height: 50px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
  text-decoration: none;
  transition: transform 140ms ease, background-color 140ms ease, border-color 140ms ease;
}

.button {
  display: inline-flex;
  padding: 12px 22px;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.button:hover,
.level-picker-button:hover,
.document-link:hover {
  transform: translateY(-2px);
}

.button-primary {
  background: var(--yellow);
  color: var(--ink);
}

.button-primary:hover {
  background: var(--paper);
}

.button-secondary {
  border: 2px solid var(--orange);
  background: var(--orange-dark);
  color: var(--paper);
}

.button-quiet {
  border: 1px solid rgb(249 247 247 / 34%);
  background: var(--surface-raised);
  color: var(--paper);
}

.button-quiet:hover {
  border-color: var(--paper);
  background: var(--surface);
}

.button:disabled,
.button:disabled:hover {
  border: 1px solid rgb(125 127 129 / 55%);
  background: var(--surface-raised);
  color: rgb(249 247 247 / 48%);
  cursor: not-allowed;
  transform: none;
}

.button small {
  color: inherit;
  font-size: 0.7rem;
  font-weight: 500;
  opacity: 0.78;
}

.home-actions .button:first-child {
  flex-wrap: wrap;
}

.document-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 26px;
  padding-top: 13px;
  border-top: 1px solid rgb(125 127 129 / 55%);
}

.document-link {
  display: inline-flex;
  padding: 10px 5px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--paper);
  text-align: center;
}

.text-button {
  padding: 6px 0;
  border-bottom: 1px solid transparent;
  background: transparent;
  color: var(--paper);
  cursor: pointer;
  font-weight: 600;
}

.text-button:hover {
  border-bottom-color: currentColor;
}

.page-card,
.level-page {
  width: min(100% - 32px, 1100px);
  margin: 44px auto 70px;
  border: 2px solid var(--steel);
  border-radius: var(--radius-large);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.page-card {
  padding: clamp(28px, 6vw, 58px);
}

.page-heading {
  max-width: 760px;
  margin-bottom: 32px;
}

.page-heading h1 {
  margin-bottom: 14px;
}

.page-heading p:last-child {
  margin-bottom: 0;
  color: rgb(249 247 247 / 80%);
}

.centered-heading {
  margin-right: auto;
  margin-left: auto;
  text-align: center;
}

.playtest-card {
  max-width: 760px;
}

.level-picker {
  display: grid;
  max-width: 560px;
  margin: 0 auto;
  gap: 12px;
}

.level-picker-button {
  display: flex;
  width: 100%;
  padding: 15px 20px;
  align-items: center;
  justify-content: space-between;
  border: 2px solid var(--yellow);
  background: var(--surface-raised);
  color: var(--paper);
  font-family: "Gugi", system-ui, sans-serif;
  text-align: left;
}

.level-picker-button span:last-child {
  color: var(--yellow);
  font-family: "Oxanium", system-ui, sans-serif;
  font-size: 1.8rem;
  line-height: 0;
}

.level-page {
  overflow: hidden;
}

.level-heading {
  display: flex;
  padding: clamp(26px, 4vw, 42px);
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid rgb(125 127 129 / 38%);
}

.objective-panel {
  display: grid;
  margin: clamp(22px, 4vw, 38px) clamp(22px, 4vw, 38px) 0;
  padding: clamp(24px, 4vw, 38px);
  grid-template-columns: minmax(180px, 0.7fr) minmax(0, 1.5fr);
  align-items: center;
  gap: 32px;
  border: 2px solid var(--yellow);
  border-radius: var(--radius-medium);
  background: var(--surface-raised);
  color: var(--paper);
}

.objective-panel .eyebrow {
  color: var(--yellow);
}

.section-heading h2 {
  font-family: "Gugi", system-ui, sans-serif;
  font-weight: 400;
}

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

.objective-list {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.resource-item {
  display: flex;
  min-width: 0;
  padding: 10px 12px;
  align-items: center;
  gap: 11px;
  border: 1px solid rgb(249 247 247 / 18%);
  border-radius: 14px;
  background: rgb(34 34 59 / 42%);
}

.objective-resource {
  border: 2px solid var(--yellow);
  background: var(--ink);
  color: var(--paper);
}

.recipe-output-notice {
  display: grid;
  margin: 18px clamp(22px, 4vw, 38px) 0;
  padding: 18px clamp(20px, 3vw, 28px);
  border: 2px solid var(--orange);
  border-radius: 14px;
  align-items: center;
  background: var(--ink);
  grid-template-columns: minmax(190px, 0.65fr) minmax(0, 1.35fr);
  gap: 22px;
}

.recipe-output-notice h2,
.recipe-output-notice p {
  margin: 0;
}

.recipe-output-notice .eyebrow {
  margin-bottom: 5px;
}

.recipe-output-notice > p {
  color: rgb(249 247 247 / 82%);
}

.recipe-output-notice strong {
  color: var(--yellow);
}

.resource-icon {
  width: 60px;
  height: 60px;
  flex: 0 0 60px;
  object-fit: contain;
}

.resource-value {
  display: flex;
  min-width: 0;
  flex-direction: column;
  line-height: 1.15;
}

.resource-value strong {
  color: var(--yellow);
  font-size: 1.45rem;
}

.resource-value span {
  overflow-wrap: anywhere;
}

.level-grid {
  display: grid;
  padding: clamp(22px, 4vw, 38px);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.setup-panel,
.credit-panel {
  min-width: 0;
  padding: clamp(20px, 3vw, 28px);
  border: 2px solid var(--steel);
  border-radius: var(--radius-medium);
  background: var(--surface-raised);
}

.setup-panel .section-heading {
  margin-bottom: 19px;
}

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

.optional-output-list {
  grid-template-columns: 1fr;
}

.optional-output-item {
  flex-wrap: wrap;
  border: 2px solid var(--orange);
}

.optional-panel {
  border-color: var(--orange);
}

.optional-panel .eyebrow {
  color: var(--orange);
}

.reward-value {
  margin-left: auto;
  color: var(--yellow);
  font-weight: 700;
  white-space: nowrap;
}

.section-note {
  margin: 15px 0 0;
  color: rgb(249 247 247 / 74%);
  font-size: 0.88rem;
}

.empty-state {
  margin: 0;
  padding: 20px;
  border: 1px dashed var(--steel);
  border-radius: 12px;
  color: rgb(249 247 247 / 72%);
  text-align: center;
}

.credit-panel {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  justify-content: center;
  gap: 20px;
  border-color: var(--orange-dark);
  background: var(--ink);
  text-align: center;
}

.credit-panel > img {
  width: 84px;
  height: 84px;
  object-fit: contain;
}

.credit-panel strong {
  display: block;
  margin-top: 4px;
  color: var(--yellow);
  font-family: "Gugi", system-ui, sans-serif;
  font-size: clamp(2.1rem, 5vw, 3rem);
  font-weight: 400;
  line-height: 1;
}

.level-footer-actions {
  display: flex;
  padding: clamp(24px, 4vw, 36px) clamp(24px, 4vw, 38px) clamp(28px, 4vw, 40px);
  align-items: center;
  justify-content: center;
  gap: 24px;
  border-top: 1px solid rgb(125 127 129 / 34%);
}

.complete-button {
  min-width: 220px;
}

.mobile-action-dock {
  display: none;
}

.evs-card,
.result-card {
  max-width: 700px;
  text-align: center;
}

.evs-form {
  display: grid;
  max-width: 430px;
  margin: 0 auto;
  gap: 12px;
}

.evs-form > label {
  font-weight: 700;
}

.credit-input-wrap {
  display: grid;
  padding: 10px 14px;
  align-items: center;
  grid-template-columns: 56px minmax(0, 1fr) 56px;
  gap: 12px;
  border: 2px solid var(--orange);
  border-radius: 14px;
  background: var(--ink);
}

.credit-input-wrap::after {
  width: 56px;
  height: 1px;
  content: "";
}

.credit-input-wrap:focus-within {
  border-color: var(--yellow);
}

.credit-input-wrap img {
  width: 56px;
  height: 56px;
  object-fit: contain;
}

.credit-input-wrap input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--paper);
  font-family: "Gugi", system-ui, sans-serif;
  font-size: 2rem;
  text-align: center;
  appearance: textfield;
  -moz-appearance: textfield;
}

.credit-input-wrap input::-webkit-inner-spin-button,
.credit-input-wrap input::-webkit-outer-spin-button {
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
}

.form-error {
  margin: 0;
  color: var(--orange);
  font-weight: 600;
}

.form-actions,
.result-actions {
  display: flex;
  margin-top: 20px;
  justify-content: center;
  gap: 12px;
}

.evs-score {
  display: grid;
  width: min(100%, 340px);
  min-height: 132px;
  margin: 8px auto 30px;
  padding: 20px 28px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: center;
  column-gap: 0;
  border: 2px solid var(--orange);
  border-radius: var(--radius-medium);
  background: var(--surface-raised);
  text-align: center;
}

.evs-score img {
  width: 82px;
  height: 82px;
  margin: 0;
  justify-self: center;
  object-fit: contain;
}

.evs-score-value {
  display: flex;
  min-height: 82px;
  padding-left: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-left: 1px solid var(--steel);
}

.evs-score strong {
  color: var(--yellow);
  font-family: "Gugi", system-ui, sans-serif;
  font-size: 3.4rem;
  font-weight: 400;
  line-height: 0.85;
}

.evs-score span {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.result-card h1 {
  max-width: 560px;
  margin-right: auto;
  margin-bottom: 0;
  margin-left: auto;
}

.narrative-card {
  max-width: 780px;
}

.final-choice-card {
  max-width: 700px;
  text-align: center;
}

.dialogue-panel {
  min-height: 250px;
  padding: clamp(24px, 5vw, 38px);
  border: 2px solid var(--orange);
  border-radius: var(--radius-medium);
  background: var(--ink);
  text-align: left;
}

.dialogue-speaker {
  margin-bottom: 6px;
  color: var(--yellow);
  font-family: "Gugi", system-ui, sans-serif;
  font-size: 0.88rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.dialogue-text {
  min-height: 8.5em;
  margin: 0;
  color: var(--paper);
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  line-height: 1.7;
  white-space: pre-line;
}

.dialogue-text [data-dialogue-text]:not([data-complete="true"])::after {
  display: inline-block;
  width: 0.55em;
  height: 1em;
  margin-left: 4px;
  background: var(--yellow);
  content: "";
  vertical-align: -0.1em;
  animation: dialogue-cursor 700ms steps(1) infinite;
}

.narrative-actions {
  display: flex;
  margin-top: 22px;
  justify-content: center;
  gap: 12px;
}

.narrative-actions .button {
  min-width: 170px;
}

.narrative-actions .button:disabled {
  cursor: wait;
  opacity: 0.45;
  transform: none;
}

.final-choice-actions {
  display: grid;
  max-width: 480px;
  margin: 0 auto;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.choice-button {
  min-height: 64px;
  font-family: "Gugi", system-ui, sans-serif;
  font-size: 1.2rem;
}

.ending-card {
  max-width: 900px;
}

.ending-text {
  max-width: 720px;
  margin: 0 auto;
  font-size: clamp(1.05rem, 2vw, 1.2rem);
  line-height: 1.75;
  text-align: left;
}

.campaign-score-summary {
  max-width: 760px;
  margin: 30px auto 0;
  padding: 24px;
  border: 2px solid var(--orange);
  border-radius: 14px;
  background: var(--ink);
}

.campaign-score-summary .section-heading {
  margin-bottom: 18px;
  text-align: center;
}

.campaign-score-summary h2 {
  margin: 0;
  font-size: clamp(1.35rem, 3vw, 1.8rem);
}

.level-score-list {
  display: grid;
  margin: 0;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.level-score-item {
  display: flex;
  min-width: 0;
  padding: 12px 8px;
  border: 1px solid rgb(143 144 147 / 55%);
  border-radius: 10px;
  flex-direction: column;
  align-items: center;
  background: var(--surface);
  text-align: center;
}

.level-score-item dt {
  color: rgb(249 247 247 / 72%);
  font-size: 0.78rem;
  font-weight: 700;
}

.level-score-item dd {
  margin: 4px 0 0;
  color: var(--yellow);
  font-family: "Gugi", system-ui, sans-serif;
  font-size: 1.65rem;
}

.unrecorded-score dd {
  color: var(--steel);
}

.total-score-item {
  border-color: var(--yellow);
}

.credits-screen {
  display: flex;
  min-height: calc(100dvh - 79px);
  padding: 24px 16px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.credits-window {
  position: relative;
  width: min(100%, 820px);
  height: min(76dvh, 760px);
  min-height: 520px;
  overflow: hidden;
  border: 2px solid var(--yellow);
  border-radius: var(--radius-large);
  background: var(--ink);
  box-shadow: var(--shadow);
}

.credits-track {
  position: absolute;
  top: 100%;
  left: 50%;
  width: min(100% - 36px, 680px);
  text-align: center;
  animation: credits-scroll 26s linear forwards;
}

.credits-heading {
  margin-bottom: 34px;
  font-family: "Gugi", system-ui, sans-serif;
  font-size: clamp(2.4rem, 7vw, 4.4rem);
}

.game-by {
  margin-bottom: 38px;
  font-size: clamp(1rem, 2vw, 1.2rem);
  line-height: 1.7;
}

.game-by strong {
  color: var(--yellow);
}

.credits-list {
  display: grid;
  max-width: 500px;
  margin: 0 auto;
  gap: 10px;
}

.credits-list div {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.credits-list dt {
  color: var(--yellow);
  font-weight: 700;
  text-align: right;
}

.credits-list dd {
  margin: 0;
  text-align: left;
}

.course-credit,
.thanks-message {
  margin-top: 30px;
}

.thanks-message {
  color: var(--yellow);
  font-family: "Gugi", system-ui, sans-serif;
  font-size: 1.2rem;
}

.ending-quote {
  margin: 34px 0 0;
  padding: 24px;
  border: 2px solid var(--orange);
  border-radius: var(--radius-medium);
  background: var(--ink);
  text-align: left;
}

.ending-quote p {
  margin-bottom: 12px;
}

.ending-quote cite {
  color: rgb(249 247 247 / 72%);
}

.credits-final-title {
  position: absolute;
  inset: 0;
  display: grid;
  padding: 24px;
  align-content: center;
  color: var(--paper);
  font-family: "Gugi", system-ui, sans-serif;
  font-size: clamp(3rem, 11vw, 6.8rem);
  letter-spacing: 0.025em;
  line-height: 1.05;
  opacity: 0;
  text-align: center;
  animation: credits-title-fade 1s ease 27s forwards;
}

.credits-skip {
  margin-top: 8px;
}

.credits-finished .credits-track {
  display: none;
  animation: none;
}

.credits-finished .credits-final-title {
  opacity: 1;
  animation: none;
}

@keyframes credits-scroll {
  0% {
    top: 100%;
    transform: translate(-50%, 0);
  }

  100% {
    top: 0;
    transform: translate(-50%, -100%);
  }
}

@keyframes credits-title-fade {
  0% {
    opacity: 0;
    transform: scale(0.97);
  }

  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes dialogue-cursor {
  50% {
    opacity: 0;
  }
}

.rules-dialog {
  width: min(920px, calc(100% - 28px));
  max-height: calc(100dvh - 28px);
  padding: 0;
  overflow: hidden;
  border: 2px solid var(--surface-raised);
  border-radius: var(--radius-large);
  background: var(--surface);
  color: var(--paper);
  box-shadow: 0 28px 80px rgb(0 0 0 / 50%);
}

.rules-dialog::backdrop {
  background: rgb(15 15 27 / 78%);
}

.dialog-surface {
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
}

.dialog-header {
  position: sticky;
  z-index: 2;
  top: 0;
  display: flex;
  padding: 24px clamp(22px, 5vw, 42px);
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid rgb(249 247 247 / 16%);
  background: var(--surface);
}

.dialog-header h1 {
  font-size: clamp(1.8rem, 5vw, 2.6rem);
}

.icon-button {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border-radius: 50%;
  background: var(--surface-raised);
  color: var(--paper);
  cursor: pointer;
  font-size: 1.8rem;
  line-height: 1;
}

.dialog-intro {
  margin: 22px clamp(22px, 5vw, 42px) 0;
  padding: 18px 22px;
  border: 2px solid var(--yellow);
  border-radius: var(--radius-medium);
  background: var(--surface-raised);
  color: var(--paper);
  font-weight: 600;
  text-align: center;
}

.action-reference {
  display: grid;
  padding: clamp(22px, 5vw, 42px);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.action-section {
  padding: 22px;
  border: 1px solid rgb(249 247 247 / 18%);
  border-radius: var(--radius-medium);
  background: var(--surface-raised);
}

.action-section h2 {
  margin-bottom: 16px;
  color: var(--yellow);
  font-family: "Gugi", system-ui, sans-serif;
  font-weight: 400;
}

.action-section ul {
  margin: 16px 0 0;
  padding-left: 20px;
}

.action-section li + li {
  margin-top: 8px;
}

.cost-list {
  display: grid;
  margin: 0;
  gap: 8px;
}

.cost-list div {
  display: grid;
  padding-bottom: 8px;
  grid-template-columns: 1fr auto;
  gap: 15px;
  border-bottom: 1px solid rgb(249 247 247 / 13%);
}

.cost-list dt,
.cost-list dd {
  margin: 0;
}

.cost-list dd {
  color: var(--yellow);
  font-weight: 700;
  text-align: right;
}

.switch-on-section {
  grid-column: 1 / -1;
  border: 2px solid var(--orange);
}

.dialog-footer {
  display: flex;
  padding: 0 clamp(22px, 5vw, 42px) clamp(26px, 5vw, 42px);
  justify-content: center;
}

.dialog-footer .button {
  min-width: 220px;
}

.noscript-message {
  margin: 20px;
  padding: 16px;
  border: 2px solid var(--orange);
  background: var(--surface);
  text-align: center;
}

:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 4px;
}

@media (max-width: 760px) {
  .site-header {
    width: min(100% - 24px, 1180px);
    min-height: 68px;
  }

  .site-actions {
    gap: 14px;
  }

  .site-actions [data-action="quick-rules"] {
    display: none;
  }

  .home-screen {
    min-height: calc(100vh - 69px);
    padding: 24px 12px 40px;
  }

  .intro-video-screen {
    min-height: calc(100dvh - 69px);
    padding: 18px 12px 32px;
  }

  .intro-video-card {
    padding: 10px;
    border-radius: 18px;
  }

  .intro-video {
    border-radius: 12px;
  }

  .intro-video-actions {
    margin-top: 12px;
  }

  .credits-screen {
    min-height: calc(100dvh - 69px);
    padding: 12px 10px;
  }

  .credits-window {
    height: calc(100dvh - 130px);
    min-height: 440px;
    border-radius: 18px;
  }

  .home-card {
    padding: 34px 22px;
  }

  .page-card,
  .level-page {
    width: min(100% - 20px, 1100px);
    margin-top: 18px;
    margin-bottom: 96px;
    border-radius: 18px;
  }

  .level-heading {
    padding: 24px 20px;
  }

  .objective-panel {
    margin: 18px 18px 0;
    padding: 24px 18px;
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .objective-panel .section-heading {
    text-align: center;
  }

  .recipe-output-notice {
    margin: 16px 18px 0;
    grid-template-columns: 1fr;
    gap: 10px;
    text-align: center;
  }

  .level-grid {
    padding: 18px;
    grid-template-columns: 1fr;
  }

  .credit-panel {
    grid-column: auto;
  }

  .level-footer-actions {
    display: none;
  }

  .mobile-action-dock {
    position: fixed;
    z-index: 30;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    padding: 10px max(12px, env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    grid-template-columns: 0.9fr 1.2fr;
    gap: 10px;
    border-top: 1px solid rgb(249 247 247 / 18%);
    background: var(--ink);
    box-shadow: 0 -8px 25px rgb(0 0 0 / 28%);
  }

  .mobile-action-dock .button {
    min-height: 48px;
    padding-right: 12px;
    padding-left: 12px;
  }

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

  .resource-item {
    padding: 8px;
  }

  .resource-icon {
    width: 52px;
    height: 52px;
    flex-basis: 52px;
  }

  .form-actions,
  .result-actions,
  .narrative-actions {
    flex-direction: column;
  }

  .dialogue-panel {
    min-height: 280px;
  }

  .action-reference {
    grid-template-columns: 1fr;
  }

  .switch-on-section {
    grid-column: auto;
  }
}

@media (max-width: 430px) {
  .brand-button {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .site-actions .text-button {
    font-size: 0.9rem;
  }

  .home-card h1 {
    font-size: clamp(2.35rem, 13vw, 3.1rem);
  }

  .page-card {
    padding: 26px 18px;
  }

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

  .credits-list div {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .credits-list dt,
  .credits-list dd {
    text-align: center;
  }

  .ending-quote {
    padding: 18px;
  }

  .campaign-score-summary {
    padding: 20px 16px;
  }

  .level-score-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .objective-list,
  .input-list {
    grid-template-columns: 1fr;
  }

  .resource-icon {
    width: 58px;
    height: 58px;
    flex-basis: 58px;
  }

  .credit-panel {
    align-items: center;
    text-align: center;
  }

  .credit-panel > img {
    width: 68px;
    height: 68px;
  }

  .reward-value {
    width: 100%;
    margin-left: 69px;
  }

  .evs-score {
    padding: 18px 20px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 0;
  }

  .evs-score img {
    width: 66px;
    height: 66px;
  }

  .evs-score-value {
    min-height: 70px;
    padding-left: 0;
  }

  .evs-score strong {
    font-size: 3rem;
  }

  .dialog-header {
    padding: 20px 18px;
  }

  .dialog-intro,
  .action-reference {
    padding-right: 18px;
    padding-left: 18px;
  }

  .action-section {
    padding: 18px;
  }

  .cost-list div {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .cost-list dd {
    text-align: left;
  }
}

@media (max-height: 560px) and (orientation: landscape) {
  .site-header {
    min-height: 58px;
  }

  .home-screen {
    min-height: calc(100vh - 59px);
    padding-top: 16px;
    padding-bottom: 24px;
  }

  .intro-video-screen {
    min-height: calc(100dvh - 59px);
    padding: 10px 14px 14px;
  }

  .intro-video-card {
    display: grid;
    padding: 8px;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
  }

  .intro-video {
    height: auto;
  }

  .intro-video-actions {
    margin-top: 0;
  }

  .intro-video-actions .button {
    min-width: 100px;
  }

  .home-card {
    padding-top: 24px;
    padding-bottom: 24px;
  }

  .home-card h1 {
    margin-bottom: 22px;
    font-size: 2.5rem;
  }

  .home-actions {
    grid-template-columns: repeat(3, 1fr);
  }

  .document-links {
    margin-top: 16px;
  }

  .site-actions [data-action="quick-rules"] {
    display: none;
  }

  .level-page {
    margin-bottom: 84px;
  }

  .level-footer-actions {
    display: none;
  }

  .mobile-action-dock {
    position: fixed;
    z-index: 30;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    padding: 8px max(12px, env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    grid-template-columns: 0.9fr 1.2fr;
    gap: 10px;
    border-top: 1px solid rgb(249 247 247 / 18%);
    background: var(--ink);
    box-shadow: 0 -8px 25px rgb(0 0 0 / 28%);
  }

  .mobile-action-dock .button {
    min-height: 44px;
    padding: 8px 12px;
  }
}

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