/* Realm Hand provides Latin lettering. These faces supply Japanese and Simplified Chinese glyphs. */
@font-face {
  font-family: 'Spellmeat Japanese';
  src: url('assets/noto-jp.otf') format('opentype');
  font-display: swap;
}
@font-face {
  font-family: 'Spellmeat Simplified Chinese';
  src: url('assets/noto-sc.otf') format('opentype');
  font-display: swap;
}

@font-face {
  font-family: 'Realm Hand';
  src: url('assets/realm-hand.woff2') format('woff2');
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #14141e;
  --panel: #201e2a;
  --ink: #fff3df;
  --muted: #d6c9c9;
  --gold: #f5d6a1;
  --line: #50434d;
  font-family: 'Realm Hand', 'Spellmeat Japanese', 'Spellmeat Simplified Chinese', sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html[lang="zh-CN"] {
  font-family: 'Realm Hand', 'Spellmeat Simplified Chinese', 'Spellmeat Japanese', sans-serif;
}
html:lang(ja) h1,
html:lang(zh) h1 { letter-spacing: -.025em; }

body {
  margin: 0;
  background:
    radial-gradient(ellipse at 15% 24%, #252333 0%, transparent 45%),
    radial-gradient(ellipse at 89% 18%, #302136 0%, transparent 47%),
    var(--bg);
  color: var(--ink);
  font-size: 17px;
  line-height: 1.6;
}
h1, h2, p { margin: 0; }
h1, h2 { font-weight: normal; line-height: 1.12; }
h2 { font-size: 1.8rem; }
button, a, select { font: inherit; }
a { color: inherit; text-decoration: none; }
button { color: inherit; cursor: pointer; }
button:disabled { opacity: .45; cursor: default; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }
.skip {
  position: absolute;
  z-index: 1;
  left: 12px;
  top: 12px;
  transform: translateY(-150%);
  background: var(--bg);
  padding: 8px 12px;
}
.skip:focus { transform: none; }
.wrap { width: min(90%, 1260px); margin-inline: auto; }
.site-header {
  color: #392323;
  background: #f4e7d0;
  border-bottom: 1px solid #e4b98170;
}
.header-row { min-height: 87px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: grid; place-items: center; }
.brand img { display: block; width: 77px; height: 74px; object-fit: contain; }
nav { display: flex; gap: clamp(12px, 3vw, 39px); align-items: center; }
.locale-picker {
  appearance: none;
  min-height: 40px;
  padding: 5px 31px 5px 12px;
  border: 1px solid #ac8670;
  border-radius: 5px;
  color-scheme: light;
  color: inherit;
  background:
    linear-gradient(45deg, transparent 50%, #553539 50%) right 14px center / 5px 5px no-repeat,
    linear-gradient(135deg, #553539 50%, transparent 50%) right 9px center / 5px 5px no-repeat,
    #fbefd9;
  cursor: pointer;
}
.locale-picker:hover { background-color: #fff6e4; }
.locale-picker:focus-visible { outline-color: #81372e; }
nav a:hover { text-decoration: underline; text-underline-offset: 5px; }
.site-header a:focus-visible { outline-color: #81372e; }

.games { padding: 46px 0 64px; }
.section-title { display: flex; align-items: center; gap: 24px; margin-bottom: 26px; }
.section-title::after { content: ''; flex: auto; height: 1px; background: linear-gradient(90deg, #8b6f61, #443743); }
h1 { font-size: clamp(2.6rem, 5vw, 4.3rem); letter-spacing: -.065em; }
.game-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: clamp(16px, 2vw, 28px); }
.game {
  --accent: #edcf97;
  --action-ink: #342315;
  display: flex;
  min-width: 0;
  flex-direction: column;
  overflow: hidden;
  background: linear-gradient(145deg, #2b2733, #1d1b27 72%);
  border: 1px solid #8a7864;
  border-radius: 9px;
  box-shadow: 0 18px 36px #09071355;
}
.game-die {
  --accent: #edb99c;
  background: linear-gradient(145deg, #302433, #241c2a 72%);
  border-color: #916057;
}
.screenshot {
  display: block;
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 16/9;
  padding: 0;
  border: 0;
  border-bottom: 1px solid #e4ba8b30;
  background: #2a1d2a;
}
.screenshot img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .25s ease;
}
.screenshot:hover img { transform: scale(1.025); }
.screenshot:focus-visible { outline-offset: -5px; }
.screenshot-action {
  position: absolute;
  bottom: 13px;
  right: 13px;
  padding: 3px 12px;
  color: white;
  background: #15111de8;
  border: 1px solid #fff4;
  border-radius: 4px;
  font-size: .9rem;
  opacity: 0;
}
.screenshot:hover .screenshot-action, .screenshot:focus-visible .screenshot-action { opacity: 1; }
.game-info { display: flex; flex: 1; flex-direction: column; align-items: flex-start; padding: 18px clamp(19px, 2vw, 32px) 25px; }
.game-info h2 { display: flex; align-items: center; width: 100%; min-height: 90px; }
.game-logo { display: block; width: min(100%, 278px); height: 90px; object-fit: contain; object-position: left center; }
.game-realm .game-logo { width: min(100%, 166px); }
.genre { margin: 9px 0 3px; color: var(--accent); }
.description { flex: 1; color: var(--muted); }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.game .actions { margin-top: 19px; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 43px;
  gap: 9px;
  padding: 7px 14px;
  border: 1px solid #8a7580;
  border-radius: 5px;
  background: #17152065;
  font-size: .97rem;
  line-height: 1.35;
  text-align: center;
}
.button:hover:not(:disabled) { background: #534151; }
.button.primary { color: var(--action-ink); background: var(--accent); border-color: var(--accent); }
.button.primary:hover { background: #ffecd0; }
.steam-icon {
  width: 1.15em;
  height: 1.15em;
  background: currentColor;
  mask: url('steam.svg') center / contain no-repeat;
  flex: none;
}
.studio { border-block: 1px solid #51404b; background: #25212c; }
.studio-row { display: flex; align-items: center; gap: clamp(18px, 3vw, 36px); min-height: 162px; padding-block: 22px; }
.studio-row p { color: var(--muted); margin-top: 5px; }
.studio-mark { width: 104px; height: 104px; object-fit: contain; padding: 10px; border-radius: 50%; background: #f2dfbf; flex: none; }
.studio-row button { margin-left: auto; }
.community { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding-block: 32px; }
footer { border-top: 1px solid var(--line); color: var(--muted); padding-block: 19px 28px; font-size: .95rem; }

.gallery {
  max-height: 95dvh;
  width: min(900px, 96vw);
  max-width: none;
  padding: 0;
  color: var(--ink);
  border: 1px solid #826e79;
  border-radius: 9px;
  background: var(--panel);
  box-shadow: 0 16px 80px #020105b0;
}
.gallery::backdrop { background: #100c18df; }
body:has(dialog[open]) { overflow: hidden; }
.gallery-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}
.gallery-header h2 { font-size: clamp(1.2rem, 3vw, 1.65rem); }
.gallery-content { padding: 12px 16px 16px; }
.stage {
  display: grid;
  place-items: center;
  width: 100%;
  background: #0d0c13;
}
.stage { aspect-ratio: 16/9; max-height: 56dvh; border-radius: 4px; overflow: hidden; }
.stage img, .stage video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  min-height: 0;
}
.stage > button {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  padding: 0;
  background: none;
  cursor: zoom-in;
}
.stage > button:focus-visible { outline-offset: -4px; }
.media-tools { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 7px 0; }
.media-tools p { min-width: 0; color: var(--muted); }
.filmstrip { display: flex; gap: 7px; align-items: stretch; }
.rail {
  display: flex;
  flex: 1;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 3px 7px;
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
  scrollbar-color: #9b7f78 #15121d;
}
.thumb {
  flex: 0 0 clamp(94px, 16vw, 144px);
  position: relative;
  padding: 2px;
  border-radius: 4px;
  border: 2px solid transparent;
  background: transparent;
}
.thumb:hover { border-color: #a88f7e; }
.thumb[aria-pressed="true"] { border-color: var(--gold); }
.thumb:focus-visible { outline-offset: 0; }
.thumb img { display: block; width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 2px; }
.thumb span {
  position: absolute;
  left: 6px;
  bottom: 6px;
  padding: 1px 5px;
  background: #14131aec;
  color: #fff3df;
  border-radius: 3px;
  font-size: .75rem;
}
.rail-control { width: 35px; padding-inline: 0; margin-block: 4px 10px; }
.rail-control::before { content: ''; border: solid currentColor; border-width: 0 0 2px 2px; width: 8px; height: 8px; transform: rotate(45deg); }
.rail-control.next::before { transform: rotate(-135deg); }
.gallery.expanded { width: min(1520px, 98vw); }
#collapse-gallery,
.gallery.expanded #close-gallery,
.gallery.expanded .media-tools,
.gallery.expanded .filmstrip { display: none; }
.gallery.expanded #collapse-gallery { display: inline-flex; }
.gallery.expanded .gallery-content { padding: 0; }
.gallery.expanded .stage { max-height: calc(95dvh - 67px); border-radius: 0; }
.gallery.expanded .stage > button { cursor: default; }

@media (max-width: 700px) {
  .header-row {
    display: grid;
    grid-template-columns: auto auto;
    align-items: center;
    gap: 4px 12px;
    padding-block: 5px 10px;
  }
  .header-row nav {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: center;
    flex-wrap: wrap;
  }
  .locale-picker { grid-column: 2; grid-row: 1; justify-self: end; }
  .brand img { width: 62px; height: 61px; }
  .games { padding: 32px 0 42px; }
  .game-grid { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .game-info h2 { min-height: 77px; }
  .game-logo { height: 77px; }
  .studio-row, .community { flex-wrap: wrap; justify-content: flex-start; }
  .studio-row button { margin-left: 0; }
  .studio-mark { width: 76px; height: 76px; padding: 7px; }
  .gallery-header { padding-inline: 9px; }
  .gallery-content { padding-inline: 8px; }
  .rail-control { width: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .screenshot img { transition: none; }
}
