:root {
  color-scheme: dark;
  --bg: #171329;
  --panel: #241b3b;
  --text: #fff8fd;
  --muted: #dacbe8;
  --line: #483561;
  --violet: #d5b5ff;
  --lime: #ddfc9b;
  font-family: "Malgun Gothic","Apple SD Gothic Neo",system-ui,sans-serif;
  background: var(--bg);
  color: var(--text);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(ellipse at 90% 0,#362050 0%,transparent 52%),var(--bg);
}

button,input {
  font: inherit;
}

h1,h2,p {
  margin: 0;
}

.shell {
  width: min(1050px,100% - 54px);
  margin: auto;
  padding: 50px 0;
}

.hero {
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  isolation: isolate;
  min-height: 143px;
  padding: 0 16px 23px;
  margin-bottom: 22px;
  overflow: hidden;
}

.hero>div:first-child {
  z-index: 1;
}

.hero h1 {
  font-size: clamp(3.15rem,8vw,6.3rem);
  font-weight: 920;
  line-height: 1.04;
  letter-spacing: -.105em;
}

.hero p {
  color: var(--muted);
  margin-top: 13px;
  font-size: 1.03rem;
  line-height: 1.45;
}

.dice {
  position: absolute;
  right: 51px;
  top: 38px;
  width: 101px;
  height: 101px;
  background: linear-gradient(145deg,#e7cbff,#a478d8);
  border-radius: 26px;
  box-shadow: 7px 8px 0 #8157b3,0 0 60px #b27fec55;
  transform: rotate(24deg);
  display: grid;
  place-items: center;
}

.dice::before,.dice::after {
  content: "";
  position: absolute;
  display: block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #43285f;
}

.dice::before {
  left: 22px;
  top: 22px;
}

.dice::after {
  right: 21px;
  bottom: 22px;
}

.dice span {
  width: 16px;
  height: 16px;
  background: #43285f;
  border-radius: 50%;
}

.dice i,.dice b {
  position: absolute;
  background: #dfffa0;
  clip-path: polygon(50% 0,61% 38%,100% 50%,62% 62%,50% 100%,39% 63%,0 50%,39% 38%);
  width: 36px;
  height: 36px;
  right: -49px;
  top: 16px;
}

.dice b {
  right: 105px;
  top: -12px;
  width: 24px;
  height: 24px;
  background: #fbc6de;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0,.88fr) minmax(0,1.12fr);
  gap: 20px;
  align-items: stretch;
}

form,.game-card {
  border-radius: 22px;
  min-width: 0;
}

form {
  display: grid;
  gap: 18px;
  align-content: center;
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
}

fieldset {
  border: 0;
  padding: 0;
  margin: 0;
  min-width: 0;
}

legend {
  font-size: .94rem;
  margin-bottom: 8px;
  padding: 0;
  font-weight: 770;
}

.player-field label {
  display: block;
  margin-bottom: 8px;
  font-size: .94rem;
  font-weight: 770;
}

.player-input {
  position: relative;
  width: 100px;
}

.player-input input {
  width: 100%;
  min-height: 44px;
  padding: 6px 33px 6px 12px;
  border: 1px solid #8e70ae;
  border-radius: 11px;
  background: #2d2147;
  color: var(--text);
  font-weight: 750;
}

.player-input span {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.player-input input:focus-visible,.game-sources :is(summary,a):focus-visible {
  outline: 3px solid #cfa8ff;
  outline-offset: 3px;
}

.game-sources {
  margin-top: 18px;
  color: var(--muted);
  font-size: .88rem;
  line-height: 1.6;
}

.game-sources summary {
  width: fit-content;
  padding: 8px 0;
  cursor: pointer;
}

.game-sources a {
  color: var(--violet);
}

.game-sources ul {
  margin: 6px 0 0;
  padding-left: 1.35rem;
}

.choices {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.choices label {
  position: relative;
  cursor: pointer;
  flex: 1;
  min-width: max-content;
}

.choices input {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.choices span {
  display: grid;
  place-items: center;
  white-space: nowrap;
  background: #2d2147;
  color: #e8d9f6;
  font-size: .86rem;
  font-weight: 700;
  min-height: 44px;
  border: 1px solid #56416e;
  border-radius: 11px;
  padding: 6px 11px;
}

.choices input:checked+span {
  background: #4c336c;
  color: #f6e6ff;
  border-color: #cbacf4;
  font-weight: 820;
}

.choices input:focus-visible+span,:is(button,h2):focus-visible {
  outline: 3px solid #cfa8ff;
  outline-offset: 4px;
}

button {
  border: 0;
  background: var(--lime);
  color: #25331a;
  min-height: 51px;
  border-radius: 11px;
  font-weight: 900;
  cursor: pointer;
}

button:hover {
  background: #ecffc7;
}

button:active {
  transform: translateY(1px);
}

button:disabled {
  opacity: .58;
  cursor: default;
  transform: none;
}

.game-card {
  isolation: isolate;
  position: relative;
  overflow: hidden;
  border: 1px solid #a98ad6;
  background: radial-gradient(ellipse at 100% 2%,#7853a2,transparent 60%),#523477;
  min-height: 356px;
  display: flex;
  align-items: center;
}

.card-edge {
  position: absolute;
  border: 1px solid #dbc4fc70;
  inset: 10px;
  border-radius: 15px;
  pointer-events: none;
}

.card-edge::after {
  content: "";
  position: absolute;
  top: 13px;
  right: 13px;
  width: 29px;
  height: 29px;
  background: #dcfaa5;
  clip-path: polygon(50% 0,61% 38%,100% 50%,62% 62%,50% 100%,39% 63%,0 50%,39% 38%);
}

.card-content {
  position: relative;
  padding: 41px 36px 33px;
  width: 100%;
}

.card-content h2 {
  font-size: clamp(2.15rem,5.25vw,3.68rem);
  line-height: 1.14;
  letter-spacing: -.087em;
  font-weight: 910;
  overflow-wrap: break-word;
  word-break: keep-all;
  max-width: 95%;
}

.game-meta {
  color: #e9d3ff;
  font-size: .9rem;
  font-weight: 780;
  margin-top: 11px;
  line-height: 1.4;
}

.game-rules {
  color: #fff6ff;
  font-size: clamp(1.05rem,2.1vw,1.25rem);
  line-height: 1.62;
  margin-top: 14px;
  overflow-wrap: break-word;
  word-break: keep-all;
}

.game-rules ol {
  margin: 0;
  padding-inline-start: 1.35em;
}

.game-rules li + li { margin-top: 9px; }
.game-rules li::marker { color: var(--lime); font-weight: 850; }

.game-count {
  margin-top: -7px;
  color: var(--muted);
  text-align: center;
  font-size: .88rem;
  line-height: 1.4;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.card-content button {
  margin-top: 20px;
  min-height: 46px;
  padding: 0 20px;
  background: #f1e4ff;
  color: #442862;
}

.card-content button:hover {
  background: #fff;
}

.card-content button[hidden] {
  display: none;
}

@media(max-width:760px) {
  .shell {
    width: min(535px,100% - 28px);
    padding: 16px 0 28px;
  }
  .hero {
    padding: 0 4px 14px;
    margin-bottom: 13px;
    min-height: 104px;
  }
  .hero h1 {
    font-size: clamp(2.85rem,11vw,4.7rem);
  }
  .hero p {
    margin-top: 6px;
    font-size: .94rem;
    max-width: 215px;
    word-break: keep-all;
  }
  .dice {
    right: 12px;
    top: 5px;
    transform: rotate(24deg) scale(.61);
  }
  .layout {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  form {
    gap: 13px;
    padding: 15px;
    border-radius: 17px;
  }
  .choices span {
    padding-inline: 7px;
  }
  .game-card {
    min-height: 185px;
    border-radius: 18px;
  }
  .card-edge {
    inset: 7px;
    border-radius: 13px;
  }
  .card-edge::after {
    width: 23px;
    height: 23px;
    right: 8px;
    top: 8px;
  }
  .card-content {
    padding: 26px 21px;
  }
  .card-content h2 {
    font-size: clamp(1.96rem,8.25vw,3rem);
    max-width: 94%;
  }
  .game-rules {
    margin-top: 11px;
    font-size: 1.1rem;
    line-height: 1.51;
  }
  .game-meta {
    margin-top: 7px;
  }
  .card-content button {
    width: 100%;
    margin-top: 17px;
  }
}

@media(max-width:352px) {
  .shell {
    width: calc(100% - 20px);
  }
  .dice {
    right: -6px;
    transform: rotate(24deg) scale(.53);
  }
  .choices {
    gap: 4px;
  }
}
