* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.55;
  word-break: keep-all;
}
[hidden] { display: none !important; }
a, button { color: inherit; }
a { text-decoration: none; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 4px; }
h1, h2, h3, p, dl, dd { margin: 0; }
section[id], main[id] { scroll-margin-top: 12px; }
.site-wrap { width: min(100%, var(--layout)); margin-inline: auto; padding-inline: var(--gutter); }
.skip-link { position: absolute; top: 10px; left: 12px; z-index: 5; padding: 10px 16px; background: white; transform: translateY(-150%); }
.skip-link:focus { transform: none; }

.site-header, .hero { --ink: #241b55; color: var(--ink); }
.site-header { background: var(--paper); }
.header-inner, .site-nav, .button, .text-link { display: flex; align-items: center; }
.header-inner { justify-content: space-between; gap: 14px; min-height: 70px; }
.brand { display: inline-flex; align-items: center; min-height: 48px; }
.brand img { display: block; width: 112px; height: auto; }
.site-nav { gap: clamp(12px, 3.3vw, 40px); }
.site-nav a { display: grid; place-items: center; min-height: 44px; min-width: 44px; font-weight: 750; font-size: .9375rem; }
.site-nav a:hover, .site-nav a:focus-visible { color: var(--blue); text-decoration: underline; text-underline-offset: 5px; }

.button {
  display: inline-flex;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 9px 17px;
  border: 2px solid transparent;
  border-radius: var(--radius);
  line-height: 1.3;
  font-size: .94rem;
  font-weight: 700;
  text-align: center;
}
.button--primary { background: var(--blue); color: var(--white); }
.button--primary:hover { background: #153eb5; }
.button--outline { background: transparent; border: 1px solid var(--input-line); }
.button--outline:hover, .button--quiet:hover { background: var(--surface); }
.button--quiet { background: none; color: var(--ink); }
.button--play { background: var(--paper); border-color: transparent; color: var(--ink); }
.button--play:hover { background: var(--white); }
.button:disabled { opacity: .55; cursor: wait; }
.text-link { display: inline-flex; min-height: 44px; width: fit-content; gap: 5px; text-decoration: underline; text-underline-offset: 4px; font-weight: 750; font-size: .92rem; }
.text-link:hover { color: var(--blue); }

.hero {
  --ticket-edge: #234cce;
  --poster-wall: #ccd7ff;
  --muted: #5d5677;
  background: var(--ticket-edge);
  padding-block: clamp(16px, 2.2vw, 34px);
}
.hero-inner {
  display: grid;
  grid-template-columns: minmax(0, .94fr) minmax(0, 1.06fr);
  --punch: 14px;
}
.poster-mount {
  display: grid;
  place-items: center;
  position: relative;
  isolation: isolate;
  background: var(--poster-wall);
  padding: clamp(24px, 2.8vw, 40px) 16px 15px;
}
.poster-mount::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: url("assets/brand/starfield.svg") center / 308px;
  opacity: .64;
}
.poster-link { display: grid; justify-items: center; gap: 12px; color: var(--ink); }
.poster-link span { background: var(--poster-wall); padding: 1px 7px; font-size: .75rem; font-weight: 750; text-decoration: underline; text-underline-offset: 3px; }
.hero-art { display: block; width: clamp(248px, 22vw, 332px); height: auto; transform: rotate(-3deg); box-shadow: 0 4px 12px rgb(25 38 97 / 21%); }
.poster-link:hover .hero-art { transform: rotate(-1deg); }
.village-intro {
  position: relative;
  display: grid;
  align-content: center;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  padding: clamp(24px, 3.8vw, 60px);
  background: var(--paper);
  border-left: 2px dashed #9eabd5;
}
.village-intro::before, .village-intro::after {
  content: "";
  position: absolute;
  left: calc(-1 * var(--punch) - 1px);
  width: calc(2 * var(--punch)); height: var(--punch);
  background: var(--ticket-edge);
}
.village-intro::before { top: 0; border-radius: 0 0 var(--punch) var(--punch); }
.village-intro::after { bottom: 0; border-radius: var(--punch) var(--punch) 0 0; }
.hero-kicker { color: var(--blue); font-size: 1rem; font-weight: 800; }
.hero-heading { position: relative; }
.hero-heading h1 {
  display: inline-block;
  color: var(--ticket-edge);
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(4.5rem, 7vw, 6.8rem);
  letter-spacing: -.065em;
  line-height: 1.04;
  margin-block: 2px 0;
}
.hero-heading h1 span { display: inline-block; transform: rotate(9deg); }
.hero-heading::after {
  content: "";
  position: absolute;
  inset: auto 0 12% auto;
  width: clamp(52px, 5vw, 80px);
  aspect-ratio: 1;
  background: url("assets/brand/planet.svg") center / contain no-repeat;
}
.hero-details {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  min-width: 0;
  align-items: center;
  justify-content: start;
  gap: 0 10px;
  margin-top: clamp(12px, 1.9vw, 26px);
}
.hero-details event-info { display: contents; }
.hero-details .event-facts, .hero-set, .hero-admission { grid-column: 1 / -1; }
.hero-details .event-facts { grid-row: 1; }
.event-facts { display: flex; flex-wrap: wrap; align-items: baseline; gap: 7px 22px; }
.event-facts dt { display: inline; color: var(--muted); font-size: .8rem; }
.event-facts dd { display: inline; margin-inline-start: 4px; font-weight: 750; }
.event-facts dd a { text-decoration: underline; text-underline-offset: 3px; }
.event-date { flex-basis: 100%; }
.event-date dt { position: absolute; clip-path: inset(50%); }
.event-date dd { display: flex; flex-wrap: wrap; gap: 0 12px; align-items: baseline; margin-inline: 0; }
.event-date dd > time { font-weight: 720; font-size: clamp(1.3rem, 2vw, 1.75rem); letter-spacing: -.045em; }
.hero .event-date dd > time { font-weight: 850; }
.event-times { color: var(--muted); font-size: .875rem; font-weight: 580; }
.event-times time { white-space: nowrap; }
.hero-set { grid-row: 2; margin-top: 6px; margin-bottom: clamp(18px, 2.3vw, 32px); color: var(--muted); font-size: .875rem; }
.hero-set strong { font-weight: 500; margin-inline-end: 4px; }
.hero-set time { font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 700; }
.hero-details .event-ticket-link { grid-row: 3; }
.hero-details .button { min-height: 48px; justify-self: start; font-weight: 800; }
.hero .event-ticket-link::before { content: ""; width: 24px; height: 24px; background: url("assets/brand/ticket.svg") center / contain; }
.hero-play { grid-row: 3; grid-column: 2; border-color: var(--ink); background: transparent; }
.hero-play:hover { background: var(--meruru); }
.hero-admission { margin-top: 9px; color: var(--muted); font-size: .78rem; }

.section-heading, .collection-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 4px 16px; flex-wrap: wrap; margin-bottom: 20px; }
.section-heading h2, .collection-heading h3 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 3.8vw, 3.4rem);
  font-weight: 400;
  letter-spacing: -.045em;
  line-height: 1.14;
}
.village-section { padding-block: clamp(32px, 5vw, 70px); }
.village-layout { max-width: 816px; margin-inline: auto; }
#play-title {
  margin-bottom: clamp(12px, 2vw, 22px);
  font: 400 clamp(1.19rem, 2.5vw, 2rem)/1.45 "Galmuri Game", var(--font-body);
  letter-spacing: -.045em;
}
#play-title span { display: inline-block; }
.village-guide { margin-top: clamp(38px, 6vw, 84px); }
.collection-heading { margin-bottom: 10px; }
.collection-heading h3 { font-size: clamp(1.75rem, 3vw, 2.65rem); }
.collection-heading p { font-size: .875rem; color: var(--muted); }
.game-area { min-width: 0; }
game-console { display: block; }
.game-shell { background: var(--console); padding: 0 6px 4px; border: 2px solid var(--console); border-radius: 5px; }
.game-top, .game-bottom { display: flex; align-items: center; justify-content: space-between; gap: 6px 12px; }
.game-top { color: var(--white); min-height: 46px; padding-inline: 8px; font-weight: 800; font-size: .89rem; }
.game-top, .game-status .button { font-family: "Galmuri Game", var(--font-body); font-weight: 400; }
.game-status { display: flex; align-items: center; gap: 8px; }
.game-status .button { min-height: 44px; padding: 4px 8px; font-size: .8rem; }
.game-status .button:focus-visible { outline-color: var(--ink); outline-offset: -4px; }
.visit-count { color: #e4e3e5; font-size: .81rem; text-align: right; }
.game-viewport { position: relative; overflow: hidden; background: var(--ink); border-radius: 3px; }
.game-viewport:focus-visible { outline-offset: 2px; outline-color: var(--meruru); }
.game-viewport canvas { display: block; width: 100%; height: auto; margin-inline: auto; image-rendering: pixelated; cursor: crosshair; }
.game-help-group { min-width: 0; }
.hint { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 750; }
.dialog {
  position: absolute;
  inset: auto 9px 9px;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  padding: 11px 13px 3px;
  max-height: 92%;
  overflow: auto;
  overscroll-behavior: contain;
}
.dialog:has(.dialog-portrait:not([hidden])) {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: clamp(9px, 1.7vw, 20px);
}
.dialog-portrait {
  --face-size: clamp(48px, 15vw, 80px);
  grid-row: 1 / span 2;
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  place-items: center;
  align-self: start;
  width: var(--face-size);
  height: max(64px, var(--face-size));
  overflow: hidden;
}
.dialog-portrait img { display: block; width: 100%; height: 100%; object-fit: contain; }
.dialog-portrait img[src$=".png"] {
  width: 64px;
  height: 64px;
  max-width: none;
  place-self: center;
  image-rendering: pixelated;
}
.dialog-copy strong { font-weight: 850; }
.dialog-copy p { margin-top: 4px; line-height: 1.5; font-size: .9375rem; overflow-wrap: anywhere; }
.dialog-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: end; gap: 0 10px; }
.dialog-actions .button { padding-inline: 10px; }
.game-bottom { min-height: 44px; color: #f3f2ed; padding-inline: 4px; }
.game-bottom p { font-size: .81rem; line-height: 1.35; }
.game-bottom kbd { font: inherit; font-weight: 800; color: #fff; }
.game-bottom .button { color: #fff; min-height: 44px; padding-inline: 6px; font-size: .81rem; white-space: nowrap; }
.game-bottom .button:hover { background: #484650; }
.game-bottom .button:focus-visible { outline-color: var(--meruru); outline-offset: -2px; }
.touch-controls, .touch-help { display: none; }
.game-note { margin-top: 11px; color: var(--muted); font-size: .875rem; }
.site-footer { border-top: 1px solid var(--line); }
.footer-inner { display: flex; justify-content: space-between; align-items: center; min-height: 80px; gap: 12px; }
.footer-inner img { display: block; }

@media (max-width: 900px), (pointer: coarse) {
  .touch-controls { display: flex; margin-top: 10px; justify-content: space-between; align-items: center; gap: 16px; }
  .touch-help { display: inline; }
  .keyboard-help { display: none; }
  .dpad { position: relative; display: grid; grid-template: repeat(3, 44px) / repeat(3, 44px); }
  .dpad::before { content: ""; position: absolute; inset: 44px; background: var(--console); pointer-events: none; }
  .dpad button, .action {
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    min-height: 44px;
    border: 0;
    font-weight: 700;
  }
  .dpad button { background: var(--console); color: var(--paper); font-size: 1rem; }
  .dpad button:focus-visible { outline: 2px solid var(--meruru); outline-offset: -4px; }
  .dpad button:active { background: var(--blue); }
  .dpad [data-dir="up"] { grid-column: 2; grid-row: 1; }
  .dpad [data-dir="left"] { grid-column: 1; grid-row: 2; }
  .dpad [data-dir="down"] { grid-column: 2; grid-row: 3; }
  .dpad [data-dir="right"] { grid-column: 3; grid-row: 2; }
  .action { width: 68px; height: 68px; border: 2px solid var(--console); border-radius: 50%; background: var(--meruru); color: var(--console); font: 400 1.4rem/1 "Galmuri Game", var(--font-body); }
  .action:active { background: var(--yon); }
  .action span { display: block; margin-top: 4px; font-size: .75rem; }
}
@media (max-width: 900px) {
  .hero-details { grid-template-columns: minmax(0, max-content) minmax(0, 1fr); }
  .hero-details .button { padding-inline: 12px; }
}
@media (max-width: 780px) {
  .header-inner { min-height: 56px; }
  .brand img { width: 95px; }
  .site-nav a { font-size: .875rem; }
}
@media (max-width: 670px) {
  .hero { padding-block: 12px; }
  .hero-inner { grid-template-columns: minmax(0, 1fr); --punch: 9px; }
  .poster-mount { padding: 16px 12px 32px; }
  .poster-link { display: block; }
  .poster-link span { position: absolute; bottom: 3px; right: 5px; font-size: .6875rem; }
  .hero-art { width: clamp(162px, 54vw, 236px); }
  .village-intro { padding: 17px clamp(16px, 4.8vw, 30px) 19px; border: 0; border-top: 2px dashed #9eabd5; }
  .village-intro::before, .village-intro::after { top: calc(-1 * var(--punch) - 1px); bottom: auto; width: var(--punch); height: calc(2 * var(--punch)); }
  .village-intro::before { left: 0; border-radius: 0 var(--punch) var(--punch) 0; }
  .village-intro::after { left: auto; right: 0; border-radius: var(--punch) 0 0 var(--punch); }
  .hero-heading h1 { font-size: clamp(3.15rem, 12vw, 4rem); }
  .hero-heading::after { width: 44px; }
  .hero-kicker { font-size: .8125rem; }
  .hero-details { margin-top: 6px; }
  .event-facts { gap: 2px 16px; }
  .event-date dd > time { font-size: 1.19rem; }
  .event-times { font-size: .8rem; }
  .hero-set { margin-block: 3px 12px; }
  .hero-admission { margin-top: 5px; }
  .hero-details .button { min-height: 44px; }
}
@media (max-width: 390px) {
  .hero-details { gap: 0 7px; }
  .hero-details .button { padding-inline: 8px; font-size: .875rem; }
  .hero .event-ticket-link::before { width: 21px; height: 21px; }
}
@media (max-width: 670px) and (max-height: 650px) {
  .hero-art { width: clamp(124px, 25svh, 158px); }
  .poster-mount { padding-block: 12px 28px; }
}
@media (orientation: landscape) and (max-height: 530px) and (min-width: 671px) and (max-width: 1000px) {
  .hero-art { width: min(200px, 48svh); }
  .hero-inner { grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); }
  .hero { padding-block: 9px; }
  .poster-mount { padding-block: 8px; }
  .village-intro { padding: 12px 25px; }
  .hero-heading h1 { font-size: 3rem; }
  .hero-heading::after { width: 45px; }
  .hero-details { margin-top: 5px; }
  .hero-set { margin-block: 3px 10px; }
}
@media (orientation: landscape) and (max-height: 530px) and (max-width: 1000px) {
  game-console { display: grid; grid-template-columns: minmax(0, 1fr) 155px; align-items: center; gap: 12px; }
  .game-shell { width: min(100%, calc((100svh - 104px) * 1.55 + 16px)); justify-self: end; }
  .touch-controls { display: grid; gap: 10px; justify-items: center; margin: 0; }
}
@media (orientation: landscape) and (max-height: 530px) and (max-width: 700px) {
  .game-shell { width: min(100%, calc((100svh - 104px) * 1.25 + 16px)); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .poster-link:hover .hero-art { transform: rotate(-3deg); }
}
