@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Fraunces:opsz,wght@9..144,500;9..144,600;9..144,700&display=swap");
:root {
  --paper: #f4efdf;
  --ink: #283d2b;
  --muted: #63715a;
  --clay: #a54d2f;
  --line: #c9cdb4;
  --grass: #647749;
  font-family: "DM Sans", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
  min-width: 320px;
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 5px,
      #283d2b03 6px
    ),
    var(--paper);
}
button,
input,
select {
  font: inherit;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: default;
}
a {
  color: inherit;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
canvas:focus-visible {
  outline: 3px solid var(--clay);
  outline-offset: 4px;
}
button {
  color: inherit;
}
h1,
h2,
p,
figure {
  margin: 0;
}
h1,
h2 {
  font-family: Fraunces, Georgia, serif;
  font-weight: 600;
}
button {
  border: 0;
}
.fieldbook {
  max-width: 1280px;
  margin: auto;
  padding: 0 40px;
}
.masthead {
  height: 78px;
  border-bottom: 1px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.wordmark {
  text-decoration: none;
  font:
    600 32px Fraunces,
    Georgia,
    serif;
}
.wordmark span {
  margin-left: 7px;
  font-size: 25px;
  color: var(--clay);
}
.masthead-note,
.edition,
.eyebrow {
  font-size: 11px;
  letter-spacing: 0.16em;
  font-weight: 700;
}
.edition {
  font-family: Georgia, serif;
  font-style: italic;
  letter-spacing: 0.05em;
}
.intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 30px 0 34px;
  gap: 24px;
}
.eyebrow {
  color: var(--clay);
  margin-bottom: 10px;
}
h1 {
  font-size: clamp(38px, 5.4vw, 70px);
  letter-spacing: -0.045em;
  line-height: 1.08;
}
h1 em {
  font-weight: 500;
  color: var(--clay);
}
.intro-description {
  font-size: 15px;
  line-height: 1.6;
  margin-top: 14px;
  color: var(--muted);
}
.portrait {
  width: 135px;
  flex-shrink: 0;
  transform: rotate(5deg);
  padding: 7px 7px 0;
  background: #fffaf0;
  box-shadow: 3px 4px 0 #bec3a9;
}
.portrait img {
  width: 121px;
  height: 108px;
  object-fit: cover;
  object-position: 0 0;
}
.portrait figcaption {
  font-family: Georgia, serif;
  font-style: italic;
  text-align: center;
  font-size: 12px;
  padding: 7px 0;
}
.game-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--ink);
  padding: 10px 0;
  gap: 12px;
}
.mode-picker {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}
.mode-picker button,
.text-button {
  min-height: 44px;
  padding: 8px 13px;
  background: transparent;
  font-size: 13px;
}
.mode-picker button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
}
.text-button {
  border-bottom: 1px solid var(--ink);
}
.game-frame {
  position: relative;
  aspect-ratio: 16/9;
  background: #bec9ae;
  overflow: hidden;
  border: 2px solid var(--ink);
  box-shadow: 6px 6px 0 #bec3a9;
}
canvas {
  width: 100%;
  height: 100%;
  display: block;
}
.hud {
  position: absolute;
  inset: 16px 16px auto;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.hud > * {
  pointer-events: auto;
}
.level-sign {
  background: var(--ink);
  color: #fff6dc;
  padding: 9px 13px;
  font-size: 12px;
  letter-spacing: 0.03em;
}
.butterfly-counter {
  background: #f7efd8;
  color: var(--ink);
  padding: 9px 12px;
  display: flex;
  gap: 5px;
  align-items: center;
  font-size: 13px;
}
.butterfly-counter > span:first-child {
  font-size: 20px;
  color: var(--clay);
}
#butterfly-total {
  color: var(--muted);
  font-size: 12px;
}
#timer {
  margin-left: auto;
  background: #f7efd8;
  padding: 10px;
  font-variant-numeric: tabular-nums;
}
.hud-button {
  background: #f7efd8;
  border: 1px solid var(--ink);
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  font-size: 27px;
}
#reset-button {
  margin-left: auto;
}
#timer:not([hidden]) + #reset-button {
  margin-left: 0;
}
.hud-button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}
.game-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: #283d2b20;
}
.game-overlay.hidden {
  display: none;
}
.start-sign {
  background: #f8f0d9;
  border: 2px solid #66563c;
  box-shadow: 5px 6px 0 #283d2b44;
  padding: 28px 30px;
  text-align: center;
  width: min(410px, calc(100% - 32px));
  transform: rotate(-1deg);
  background-image: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 35px,
    #9c81530b 36px
  );
}
.overlay-kicker {
  font-size: 10px;
  letter-spacing: 0.15em;
  color: var(--clay);
  font-weight: 700;
}
.start-sign h2 {
  font-size: 40px;
  letter-spacing: -0.045em;
  margin: 8px 0;
}
.start-sign > p {
  font-size: 14px;
  line-height: 1.5;
  color: #56614b;
}
.primary-button,
.small-button {
  background: var(--clay);
  color: #fff9ec;
  border: 1px solid #743824;
  box-shadow: 0 3px 0 #743824;
  min-height: 54px;
  padding: 12px 22px;
  font-weight: 700;
}
.primary-button {
  margin-top: 20px;
  display: block;
  width: 100%;
}
.primary-button span {
  padding-left: 6px;
}
.primary-button:hover,
.small-button:hover {
  background: #8e4027;
}
.primary-button:active,
.small-button:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #743824;
}
.inline-button {
  display: block;
  margin: 12px auto 0;
  background: none;
  text-decoration: underline;
  text-underline-offset: 4px;
  min-height: 44px;
}
.start-sign .overlay-tip {
  font-size: 11px;
  margin-top: 8px;
}
.game-toast {
  position: absolute;
  top: 78px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--paper);
  padding: 9px 16px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  max-width: 80%;
  text-align: center;
}
.game-toast.show {
  opacity: 1;
}
.touch-controls {
  display: none;
  position: absolute;
  inset: auto max(16px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}
.direction-buttons {
  display: flex;
  gap: 12px;
}
.touch-button {
  width: 76px;
  height: 76px;
  font-size: 30px;
  background: #f8f0d9ed;
  color: var(--ink);
  border: 2px solid var(--ink);
  box-shadow: 0 4px 0 #283d2b70;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  pointer-events: auto;
}
.jump-button {
  width: 126px;
  font-size: 16px;
  font-weight: 700;
}
.jump-button span {
  font-size: 23px;
  margin-left: 5px;
}
.touch-button.pressed {
  background: var(--ink);
  color: var(--paper);
  transform: translateY(3px);
  box-shadow: none;
}
.has-touch .touch-controls {
  display: flex;
}
.game-frame:has(.game-overlay:not(.hidden)) .touch-controls {
  display: none;
}
.under-game {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-top: 18px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}
.under-game > p:first-child {
  max-width: 60%;
}
kbd {
  font: 11px inherit;
  border: 1px solid var(--line);
  padding: 2px 4px;
  background: #fffbef;
}
.journey {
  margin: 44px 0 32px;
}
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  margin-bottom: 22px;
}
.section-heading h2 {
  font-size: 30px;
}
.section-heading > span {
  font:
    italic 22px Georgia,
    serif;
  color: var(--muted);
}
.level-trail {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}
.level-stop {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 84px;
  text-align: left;
  background: transparent;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 15px;
}
.level-stop:hover:enabled {
  background: #e3e8d2;
}
.level-stop[aria-current="true"] {
  background: var(--ink);
  color: var(--paper);
}
.level-stop:disabled {
  opacity: 0.55;
}
.level-stop .number {
  font:
    italic 30px Fraunces,
    Georgia,
    serif;
  min-width: 24px;
}
.level-stop .level-label {
  font-size: 12px;
  font-weight: 700;
}
.level-stop small {
  display: block;
  font-size: 10px;
  margin-top: 4px;
  font-weight: 400;
}
.records-section {
  border-top: 1px solid var(--line);
  padding: 24px 0;
}
.records-section h2 {
  font-size: 28px;
}
.records-section p {
  margin: 12px 0;
  font-size: 13px;
  color: var(--muted);
}
.records-section li {
  padding: 5px;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
footer {
  border-top: 1px solid var(--ink);
  display: flex;
  justify-content: space-between;
  padding: 20px 0 30px;
  font-size: 10px;
  letter-spacing: 0.09em;
  color: var(--muted);
}
footer > span:nth-child(2) {
  font-size: 22px;
  color: var(--clay);
}
.family-panel {
  padding: 22px;
  background: #e1e7d4;
  border: 1px solid var(--line);
  margin-bottom: 15px;
}
.family-panel h2 {
  font-size: 26px;
}
.family-panel p {
  font-size: 13px;
  margin: 8px 0 0;
  line-height: 1.5;
}
.room-actions {
  display: flex;
  align-items: end;
  gap: 24px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.small-button {
  min-height: 44px;
  font-size: 13px;
  padding: 10px 14px;
}
.join-fields {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}
.join-fields input {
  width: 112px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.join-fields input,
.join-fields select {
  min-height: 44px;
  padding: 8px;
  border: 1px solid var(--ink);
  background: var(--paper);
}
label {
  font-size: 12px;
  font-weight: 700;
}
.room-bar {
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: #dce4cb;
  font-size: 13px;
  margin-bottom: 12px;
}
.room-bar button {
  background: transparent;
  text-decoration: underline;
  min-height: 44px;
  font-size: 12px;
}
.helper-page {
  max-width: 560px;
  margin: auto;
  padding: 30px 20px;
}
.helper-page h1 {
  font-size: 40px;
}
.helper-page p {
  line-height: 1.6;
  margin: 16px 0;
}
.helper-actions {
  display: grid;
  gap: 16px;
  margin: 24px 0;
}
.helper-action {
  min-height: 90px;
  font-size: 19px;
}
.helper-action.pressed {
  background: var(--ink);
}
html.game-fullscreen,
html.game-fullscreen body {
  overflow: hidden;
}
.game-frame.fullscreen-active {
  width: 100vw;
  height: 100dvh;
  aspect-ratio: auto;
  border: 0;
  box-shadow: none;
}
.game-frame.immersive-fallback {
  position: fixed;
  inset: 0;
  z-index: 1000;
}
.fullscreen-active .hud {
  inset: max(14px, env(safe-area-inset-top))
    max(14px, env(safe-area-inset-right)) auto
    max(14px, env(safe-area-inset-left));
}
.has-touch .fullscreen-active .touch-controls {
  display: flex;
}
.has-touch .keyboard-hint {
  display: none;
}
@media (max-width: 800px) {
  .fieldbook {
    padding: 0 20px;
  }
  .masthead {
    height: 62px;
  }
  .masthead-note {
    display: none;
  }
  .intro {
    padding: 24px 0;
  }
  .portrait {
    width: 108px;
  }
  .portrait img {
    width: 94px;
    height: 88px;
  }
  .game-toolbar {
    align-items: start;
  }
  .mode-picker {
    gap: 2px;
  }
  .mode-picker button {
    padding: 8px;
    font-size: 11px;
  }
  .text-button {
    font-size: 12px;
    white-space: nowrap;
  }
  .game-frame {
    height: 440px;
    aspect-ratio: auto;
  }
  .level-trail {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .under-game > p:first-child {
    max-width: 100%;
  }
  .keyboard-hint {
    display: none;
  }
  .hud {
    inset: 10px 10px auto;
    gap: 5px;
  }
  .level-sign {
    font-size: 10px;
    padding: 9px;
  }
  .butterfly-counter {
    padding: 7px;
  }
  .hud-button {
    width: 44px;
    height: 44px;
  }
  .start-sign {
    padding: 22px;
  }
  .start-sign h2 {
    font-size: 34px;
  }
  .level-stop {
    min-height: 72px;
  }
  .game-frame.fullscreen-active {
    height: 100dvh;
  }
}
@media (max-width: 500px) {
  .fieldbook {
    padding: 0 14px;
  }
  .intro {
    padding: 20px 0;
  }
  .portrait {
    display: none;
  }
  .intro-description {
    font-size: 13px;
  }
  .eyebrow {
    font-size: 9px;
  }
  h1 {
    font-size: 42px;
  }
  .game-toolbar {
    flex-wrap: wrap;
    gap: 0;
  }
  .text-button {
    margin-left: auto;
  }
  .game-frame {
    height: 430px;
  }
  .start-sign {
    padding: 22px 18px;
  }
  .hud {
    flex-wrap: wrap;
  }
  .level-sign {
    max-width: 42%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .touch-controls {
    left: 10px;
    right: 10px;
    bottom: 14px;
  }
  .direction-buttons {
    gap: 8px;
  }
  .jump-button {
    width: 116px;
  }
  .journey {
    margin-top: 30px;
  }
  .section-heading .eyebrow {
    font-size: 8px;
  }
  .section-heading h2 {
    font-size: 26px;
  }
  .join-fields {
    flex-wrap: wrap;
  }
  .join-fields select {
    max-width: 105px;
  }
  footer {
    font-size: 8px;
    gap: 10px;
  }
  .desktop-break {
    display: none;
  }
  #timer {
    font-size: 11px;
    padding: 6px;
  }
  .hud-button {
    font-size: 23px;
  }
  .butterfly-counter {
    font-size: 12px;
  }
  #butterfly-total {
    font-size: 10px;
  }
}
@media (max-height: 500px) and (orientation: landscape) {
  .masthead,
  .intro,
  .under-game,
  .journey,
  .records-section,
  footer {
    display: none;
  }
  .fieldbook {
    padding: 0 10px;
  }
  .game-toolbar {
    padding: 3px 0;
  }
  .game-frame {
    height: calc(100dvh - 65px);
  }
  .touch-button {
    width: 70px;
    height: 64px;
  }
  .jump-button {
    width: 116px;
  }
  .start-sign {
    padding: 12px 20px;
    max-width: 390px;
  }
  .start-sign h2 {
    font-size: 28px;
  }
  .primary-button {
    margin-top: 12px;
    min-height: 44px;
  }
  .start-sign .overlay-tip {
    display: none;
  }
  .inline-button {
    margin-top: 5px;
  }
  .game-frame.fullscreen-active {
    height: 100dvh;
  }
  .game-overlay {
    background: #283d2b25;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
@media (max-height: 500px) and (orientation: landscape) {
  .game-frame {
    width: 100%;
    aspect-ratio: auto;
  }
}
.portrait-photo {
  width: 100%;
  height: 108px;
  overflow: hidden;
}
.portrait-photo img {
  width: 316%;
  height: 316%;
  max-width: none;
  object-fit: cover;
  object-position: 0 0;
}
.helper-action {
  touch-action: none;
}
@media (max-width: 800px) {
  .portrait-photo {
    height: 88px;
  }
}
.helper-mode .touch-controls {
  display: none !important;
}
.room-bar .helper-actions {
  width: 100%;
  margin: 8px 0;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.room-bar .helper-action {
  background: var(--clay);
  color: var(--paper);
  text-decoration: none;
  min-height: 76px;
  touch-action: none;
}
