:root {
  color-scheme: dark;
  --canvas: #150e2c;
  --paper: #fffcf4;
  --ink: #232a25;
  --muted: #545d52;
  --rust: #854528;
  --rule: #cec9b8;
  --green: #2b493a;
  --serif: Georgia, 'Times New Roman', serif;
  font: 16px/1.5 system-ui, sans-serif;
  color: var(--ink);
  background: var(--canvas);
}
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  isolation: isolate;
}
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(180deg, #0d081bb3 0%, transparent 15%, transparent 74%, #0d081b62 100%),
    linear-gradient(90deg, #14082155 0%, #14082135 38%, transparent 70%),
    url('./fantasy-library.webp') center top / cover no-repeat var(--canvas);
}
h1, h2, p { margin: 0; }
a { color: inherit; }
a:focus-visible { outline: 3px solid #aa511f; outline-offset: 4px; }
.page { width: min(1120px, calc(100% - 64px)); margin: 0 auto; padding-bottom: 3rem; }
.masthead {
  min-height: 65px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid #f7e4ff52;
  color: #fff2db;
}
.signature { display: flex; align-items: center; gap: .66rem; font: bold 1.16rem var(--serif); }
.die { display: block; position: relative; }
.die {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: #25504c;
  box-shadow: 0 0 12px #61e5cb3d;
  transform: rotate(-8deg);
}
.die::after {
  content: '';
  position: absolute;
  width: 4px;
  height: 4px;
  left: 7px;
  top: 7px;
  border-radius: 50%;
  color: #f8eed5;
  background: currentColor;
  box-shadow: 10px 0, 0 10px, 10px 10px;
}
.desktop-actions { position: relative; display: flex; gap: .5rem; }
.desktop-action {
  position: relative;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid #eddbf783;
  border-radius: 8px;
  background: #201633eb;
  color: #fff2dd;
  text-decoration: none;
}
.desktop-action:hover,
.desktop-action:focus-visible { background: #3b2759; border-color: #ffe4a8; outline-color: #ffe4a8; }
.desktop-action::after,
.desktop-help {
  position: absolute;
  right: 0;
  z-index: 3;
  padding: .46rem .68rem;
  border: 1px solid #eddbf783;
  border-radius: 6px;
  background: #201633;
  box-shadow: 0 5px 16px #10062088;
  color: #fff2dd;
  font-size: .79rem;
  line-height: 1.4;
}
.desktop-action::after {
  content: attr(aria-label);
  top: calc(100% + .48rem);
  width: max-content;
  max-width: min(250px, calc(100vw - 90px));
  opacity: 0;
  pointer-events: none;
}
.desktop-action:hover::after,
.desktop-action:focus-visible::after { opacity: 1; }
.desktop-help { top: calc(100% + 3.85rem); width: min(290px, calc(100vw - 38px)); }
.desktop-help:empty { display: none; }
.intro {
  position: relative;
  min-height: 242px;
  display: flex;
  align-items: center;
  padding: 2.45rem 0 2.6rem;
}
.intro h1 { color: #fff5e3; text-shadow: 0 2px 6px #150922, 0 4px 28px #150922e8; font: normal clamp(3.35rem, 7.6vw, 6.05rem)/.98 var(--serif); letter-spacing: -.06em; text-wrap: balance; }
.intro p { margin-top: .82rem; color: #f3eaff; text-shadow: 0 1px 8px #150922, 0 2px 12px #150922; font-size: clamp(.95rem, 2vw, 1.15rem); }
.games { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); gap: 1.18rem; }
.card {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-radius: 15px;
  background: var(--paper);
  border: 1px solid var(--rule);
  box-shadow: 0 9px 28px #10062088;
}
#ash-rift { position: relative; }
#ash-rift .play::after { content: ''; position: absolute; inset: 0; z-index: 1; }
#ash-rift:focus-within { outline: 3px solid #aa511f; outline-offset: 3px; }
.art { aspect-ratio: 2.28; overflow: hidden; background: #272a26; }
.art img { width: 100%; height: 100%; display: block; object-fit: cover; object-position: center 53%; }
#black-tide .art img { object-position: center 38%; }
.details { flex: 1; display: flex; flex-direction: column; padding: 1.35rem 1.45rem 1.25rem; }
.genre { color: var(--rust); font-size: .76rem; font-weight: 760; letter-spacing: .085em; text-transform: uppercase; }
.details h2 { font: normal clamp(1.95rem, 4vw, 2.72rem)/1.1 var(--serif); letter-spacing: -.045em; margin: .32rem 0 .45rem; }
.description { color: var(--muted); font-size: .97rem; max-width: 46ch; margin-bottom: 1.1rem; text-wrap: pretty; }
.controls { display: flex; justify-content: space-between; align-items: center; gap: .7rem; border-top: 1px solid #dedacc; padding-top: .88rem; margin-top: auto; }
.players { display: inline-flex; gap: .46rem; align-items: center; font-weight: 680; color: var(--muted); white-space: nowrap; font-size: .83rem; }
.players i { width: 15px; height: 15px; position: relative; }
.players i::before, .players i::after { content: ''; position: absolute; border: 1.35px solid currentColor; }
.players i::before { width: 6px; height: 6px; left: 4.5px; top: 0; border-radius: 50%; }
.players i::after { width: 13px; height: 7px; left: 1px; bottom: 0; border-radius: 7px 7px 2px 2px; }
.play {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.15rem;
  min-width: 125px;
  background: var(--green);
  color: #fff8e9;
  text-decoration: none;
  padding: .6rem .76rem .6rem .88rem;
  border-radius: 7px;
  font-size: .89rem;
  font-weight: 720;
}
.play:hover { background: #1b3828; }
.play span { font-size: 1rem; }
.wish-jump {
  display: inline-flex;
  align-items: center;
  gap: .75rem;
  margin-top: 1.05rem;
  padding: .5rem .76rem;
  border: 1px solid #eddbf783;
  border-radius: 6px;
  background: #201633eb;
  color: #fff2dd;
  font-size: .88rem;
  font-weight: 700;
  text-decoration: none;
}
.wish-jump:hover { background: #3b2759; border-color: #ffe4a8; }
.wish-jump:focus-visible { outline-color: #ffe4a8; }
.wishes {
  margin-top: 1.45rem;
  padding: clamp(1rem, 3vw, 2rem);
  scroll-margin-top: 1rem;
  border: 1px solid var(--rule);
  border-radius: 15px;
  background: var(--paper);
  box-shadow: 0 9px 28px #10062088;
  color-scheme: light;
}
.wish-header h2 {
  margin-bottom: .28rem;
  font: normal clamp(1.95rem, 4vw, 2.72rem)/1.1 var(--serif);
  letter-spacing: -.045em;
}
.wish-header p { color: var(--muted); }
.wish-grid {
  display: grid;
  grid-template-areas: 'history form';
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  align-items: start;
  gap: clamp(1rem, 3vw, 2rem);
  margin-top: 1.2rem;
}
.wish-history {
  grid-area: history;
  min-height: 12.5rem;
  max-height: 26rem;
  overflow: auto;
  padding: .8rem 1rem;
  border: 1px solid #dedacc;
  border-radius: 9px;
  background: #f5f1e7;
  overflow-wrap: anywhere;
}
.wish-empty { padding-top: .15rem; color: var(--muted); }
.wish-list { margin: 0; padding: 0; list-style: none; }
.wish-list li { padding: .72rem 0; }
.wish-list li + li { border-top: 1px solid #dedacc; }
.wish-list strong { display: block; margin-top: .12rem; }
.wish-list p { margin-top: .23rem; color: var(--muted); white-space: pre-wrap; }
.wish-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .15rem .75rem;
  color: var(--muted);
  font-size: .82rem;
}
.wish-meta span { font-weight: 680; }
.wish-form { grid-area: form; display: grid; gap: .7rem; }
.wish-form label { display: block; font-size: .9rem; font-weight: 700; }
.wish-form label span { margin-left: .15rem; color: var(--muted); font-size: .78rem; font-weight: 500; }
.wish-form input, .wish-form textarea {
  display: block;
  width: 100%;
  margin-top: .24rem;
  padding: .5rem .59rem;
  border: 1px solid #b6b0a1;
  border-radius: 6px;
  background: #fffdf6;
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  font-weight: 400;
}
.wish-form textarea { resize: vertical; }
.wish-history:focus-visible, .wish-form :focus-visible { outline: 2px solid #854528; outline-offset: 3px; }
.wish-submit { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem .85rem; }
.wish-submit button { display: inline-block; min-height: 42px; border: 0; font-family: inherit; cursor: pointer; }
.wish-submit button:disabled { opacity: .63; cursor: wait; }
.wish-submit span, #wishes-status { color: var(--muted); font-size: .83rem; }
#wishes-status:empty { display: none; }
@media (max-width: 680px) {
  .wish-grid { grid-template-areas: 'form' 'history'; grid-template-columns: minmax(0, 1fr); }
  .wish-history { min-height: 7rem; max-height: 18rem; }
}
@media (max-width: 730px) {
  .page { width: calc(100% - 28px); padding-bottom: max(1.6rem, env(safe-area-inset-bottom)); }
  .intro { min-height: 0; padding: 1.45rem 0 1.2rem; }
  .intro h1 { font-size: clamp(2.35rem, 9.9vw, 3.65rem); }
  .intro p { margin-top: .55rem; }
  .wish-jump { margin-top: .8rem; }
  .desktop-action, .play, .wish-jump { min-height: 44px; }
  .desktop-action { min-width: 44px; }
  body::before {
    background:
      linear-gradient(180deg, #150926d6 0%, #1509265c 35%, transparent 63%, #0d081b70 100%),
      url('./fantasy-library.webp') 66% top / cover no-repeat var(--canvas);
  }
  .games { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
  .details { padding: .82rem; }
}
@media (max-width: 540px) {
  .masthead { min-height: 56px; }
  .games { grid-template-columns: minmax(0, 1fr); gap: .65rem; }
  .card { display: grid; grid-template-columns: clamp(74px, 26%, 126px) minmax(0, 1fr); border-radius: 12px; }
  .art { aspect-ratio: auto; }
  .details { min-width: 0; padding: .65rem .7rem; }
  .details h2 { font-size: clamp(1.35rem, 6vw, 1.96rem); margin: .2rem 0 .28rem; overflow-wrap: anywhere; }
  .genre { font-size: .64rem; letter-spacing: .05em; }
  .description { font-size: .86rem; line-height: 1.41; margin-bottom: .48rem; }
  .controls { gap: .3rem; padding-top: .45rem; }
  .players { gap: .25rem; font-size: .76rem; }
  .controls .play { min-width: 0; padding: .4rem .55rem; gap: .42rem; }
  .wishes { margin-top: .9rem; }
}
