* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: #121018;
  color: #fff8f3;
  font: 16px system-ui;
}
header,
main {
  max-width: 1160px;
  margin: auto;
  padding: 20px clamp(16px, 4vw, 50px);
}
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
header b,
small {
  letter-spacing: 0.16em;
}
a {
  color: inherit;
  text-decoration: none;
}
button {
  cursor: pointer;
  font: inherit;
}
.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-radius: 26px;
  padding: clamp(24px, 5vw, 68px);
  background: linear-gradient(110deg, #34203e, #60265e 56%, #ea786d);
}
h1,
h2,
p {
  margin: 0;
}
h1 {
  font-size: clamp(58px, 9vw, 120px);
  line-height: 0.91;
  letter-spacing: -0.08em;
  margin: 22px 0 30px;
}
em {
  color: #ffcb94;
}
.sun {
  position: absolute;
  z-index: -2;
  width: 48%;
  aspect-ratio: 1;
  top: 8%;
  right: -2%;
  border-radius: 50%;
  background: repeating-linear-gradient(
    0deg,
    transparent 0 4px,
    #ffbd88 5px 16px
  );
  transform: rotate(-9deg);
}
.gridart {
  position: absolute;
  z-index: -1;
  inset: 62% -20% -45%;
  background:
    repeating-linear-gradient(90deg, transparent 0 54px, #e496d4 55px 56px),
    repeating-linear-gradient(0deg, #532b61 0 31px, #db89bc 32px 33px);
  transform: perspective(170px) rotateX(50deg);
}
.button {
  display: inline-block;
  background: #ffe6ca;
  color: #302135;
  font-weight: 750;
  border: 0;
  border-radius: 30px;
  padding: 12px 22px;
}
h2 {
  font-size: clamp(28px, 4vw, 42px);
  letter-spacing: -0.05em;
  margin: 26px 0 16px;
}
#cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(235px, 100%), 1fr));
  gap: 16px;
}
.card {
  display: flex;
  flex-direction: column;
  container-type: inline-size;
  text-align: left;
  border: 1px solid #49404c;
  background: #231e2a;
  color: inherit;
  border-radius: 18px;
  overflow: hidden;
  padding: 0;
}
.cover {
  height: 140px;
  display: grid;
  place-items: center;
  width: 100%;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  font: bold min(18cqi, 68px) / 1 monospace;
  color: #fff8d9;
  text-shadow: 5px 6px #48244e;
  background:
    repeating-linear-gradient(135deg, #ffffff15 0 2px, transparent 2px 20px),
    var(--color);
}
.caption {
  padding: 16px;
  display: grid;
  gap: 6px;
}
.caption strong {
  font-size: 24px;
}
.caption span,
p {
  color: #d3c6d7;
}
dialog {
  background: #241e30;
  color: inherit;
  border: 1px solid #65566d;
  border-radius: 20px;
  width: min(500px, 94vw);
  padding: 0;
  max-height: 94dvh;
}
dialog::backdrop {
  background: #080611db;
}
.panel {
  padding: 20px;
  position: relative;
}
#close {
  position: absolute;
  right: 14px;
  top: 9px;
  background: none;
  color: inherit;
  border: 0;
  font-size: 30px;
}
#arena {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 15px 0;
}
#arena button {
  border: 0;
  border-radius: 10px;
  min-height: 46px;
  background: #533e69;
  color: white;
  font-weight: bold;
}
#arena .signal,
canvas {
  grid-column: 1/-1;
  width: 100%;
  border-radius: 12px;
}
.signal {
  height: 140px;
}
canvas {
  touch-action: none;
  background: #171125;
  max-height: 43dvh;
  object-fit: fill;
}
button:focus-visible,
a:focus-visible {
  outline: 3px solid cyan;
}

dialog {
  position: fixed;
  inset: 0;
  margin: auto;
  height: fit-content;
  overflow-y: auto;
}
dialog.memory-game {
  width: min(570px, 94vw);
}
.memory-game #arena {
  gap: clamp(6px, 1.6vw, 12px);
}
.memory-game #arena button {
  height: clamp(60px, 11dvh, 102px);
  font-size: clamp(30px, 7vw, 48px);
  line-height: 1;
  color: #ffe8cf;
  border: 1px solid #a575a9;
  background:
    repeating-linear-gradient(135deg, transparent 0 9px, #ffffff08 9px 11px),
    linear-gradient(145deg, #784d80, #392d50);
  box-shadow: inset 0 0 0 3px #432f51;
}
.memory-game #arena button:disabled {
  opacity: 1;
  background: #fff1df;
  box-shadow: none;
}
.memory-game #arena button.matched {
  background: #c2f2df;
  border-color: #61cfa9;
}
#arena.extra-board {
  grid-template-columns: repeat(var(--columns), minmax(0, 1fr));
  gap: 8px;
}
#arena.extra-board button {
  min-height: clamp(48px, 9vh, 76px);
  font-size: clamp(16px, 4vw, 27px);
  background: linear-gradient(145deg, #724873, #473552);
  border: 1px solid #9a759f;
}
#arena.extra-board button.lit {
  background: #ffce83;
  color: #332437;
}
#arena.extra-board button:disabled {
  opacity: 0.55;
}
.extra-board input {
  color: white;
  background: #332739;
  padding: 12px;
  border: 1px solid #a47ca1;
  border-radius: 8px;
}
.orbit-track {
  margin: 22px 8px;
  height: 18px;
  position: relative;
  border-radius: 10px;
  background: linear-gradient(
    to right,
    #604768 59%,
    #84dfbd 59% 78%,
    #604768 78%
  );
}
.orbit-track i {
  position: absolute;
  top: -5px;
  height: 28px;
  width: 5px;
  background: white;
  transform: translateX(-50%);
  border-radius: 4px;
}

.sum-progress {
  display: block;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
}
.sum-equation {
  display: block;
  margin-top: 0.5rem;
  font-size: clamp(1.8rem, 6vw, 2.6rem);
  color: #ffe6ca;
  text-align: center;
}

.memory-game #arena button img {
  display: block;
  width: min(70%, 68px);
  height: 80%;
  object-fit: contain;
  margin: auto;
}
#challenge-target:not(:empty),
#share-status:not(:empty) {
  margin: 10px 0;
  color: #ffd39e;
}
#share {
  margin: 4px 0;
  background: #473453;
  color: #fff2e3;
}
#share-status input {
  width: 100%;
}
