body:has(.csr) {
  background: radial-gradient(120% 70% at 50% 0%, #1a1030 0%, #0a0c17 55%, #06070d 100%) fixed;
  color: #ece9f6;
}

body:has(.csr) > header {
  max-width: 600px;
  padding-bottom: 12px;
}

body:has(.csr) > header a {
  color: #a7a1bd;
  font-size: 13px;
}

main:has(.csr) {
  max-width: 600px;
  background: transparent;
  padding-top: 12px;
}

.csr {
  --accent: #e879f9;
  --accent-ink: #2a0b30;
  --muted: #a7a1bd;
  --panel: #161427;
  --line: #2e2a48;
  width: 100%;
}

.csr-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.csr-eyebrow {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .18em;
  color: var(--muted);
}

.csr-head h1 {
  margin: 0;
  font-size: 38px;
  line-height: 1.1;
  letter-spacing: .06em;
}

.csr-head h1 span {
  margin-left: 14px;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: .12em;
  color: var(--muted);
}

.csr-tag {
  margin: 0;
  font-size: 13px;
  color: var(--accent);
  text-align: right;
}

.csr-bar {
  display: grid;
  grid-template-columns: 1.5fr 1.2fr .8fr .8fr;
  gap: 8px;
  margin-bottom: 12px;
}

.csr-stat {
  padding: 8px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  min-width: 0;
}

.csr-stat span {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .14em;
  color: var(--muted);
}

.csr-stat strong {
  display: block;
  font-size: 22px;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
}

.csr-stat-score strong {
  color: var(--accent);
}

/* ---- 画面 ---- */
.csr-stage {
  position: relative;
  width: min(100%, max(260px, calc((100svh - 250px) * .75)));
  margin: 0 auto;
}

.csr-screen {
  position: relative;
  aspect-ratio: 3 / 4;
  width: 100%;
  background: #05060c;
  border: 1px solid #3a3358;
  border-radius: 14px;
  box-shadow: 0 0 0 4px rgba(232, 121, 249, .06), 0 18px 50px rgba(0, 0, 0, .45);
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  cursor: crosshair;
}

.csr-screen:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.csr-screen canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

.csr-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 24px;
  text-align: center;
  background: rgba(6, 6, 14, .74);
  border-radius: 14px;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.csr-overlay[hidden] {
  display: none;
}

.csr-overlay-kicker {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .24em;
  color: var(--muted);
}

.csr-overlay-title {
  margin: 0;
  font-size: clamp(24px, 7vw, 34px);
  font-weight: 800;
  letter-spacing: .06em;
  color: #fff;
  text-shadow: 0 0 18px rgba(232, 121, 249, .55);
}

.csr-overlay-desc {
  max-width: 300px;
  margin: 2px 0 12px;
  font-size: 13px;
  line-height: 1.7;
  color: #d4cfe6;
  white-space: pre-line;
}

.csr-overlay-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

/* ---- ボタン ---- */
.csr button {
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  color: #ece9f6;
  background: #231f3a;
  border: 1px solid #3f3863;
  border-radius: 8px;
  padding: 10px 16px;
  cursor: pointer;
  touch-action: manipulation;
  transition: background .15s, transform .08s;
}

.csr button:hover:not(:disabled) {
  background: #302a50;
}

.csr button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.csr button:disabled {
  opacity: .4;
  cursor: default;
}

.csr .csr-primary {
  min-width: 140px;
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
}

.csr .csr-primary:hover:not(:disabled) {
  background: #f0a6fb;
}

.csr-actions {
  display: flex;
  gap: 8px;
  width: min(100%, 420px);
  margin: 12px auto 0;
}

.csr-actions button {
  flex: 1;
}

/* ---- スマホの操作ボタン ---- */
.csr-pad {
  display: grid;
  grid-template-columns: 1fr 1.3fr 1fr;
  gap: 8px;
  width: min(100%, 420px);
  margin: 10px auto 0;
}

.csr .csr-pad button {
  min-height: 60px;
  font-size: 20px;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
}

.csr .csr-pad .csr-fire {
  font-size: 15px;
  letter-spacing: .14em;
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
}

.csr .csr-pad button.is-held {
  transform: scale(.96);
  background: #3b3363;
}

.csr .csr-pad .csr-fire.is-held {
  background: #f5c2fc;
}

@media (hover: hover) and (pointer: fine) {
  .csr-pad {
    display: none;
  }
}

.csr-status {
  min-height: 1.7em;
  margin: 10px 0 0;
  font-size: 13px;
  text-align: center;
  color: var(--muted);
}

.csr-note {
  margin: 0;
  font-size: 12px;
  text-align: center;
  color: #f5b16b;
}

/* ---- 遊び方 ---- */
.csr-how {
  margin-top: 18px;
  padding: 16px 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 13px;
}

.csr-how h2 {
  margin: 0 0 10px;
  font-size: 14px;
  letter-spacing: .08em;
}

.csr-how dl {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 6px 18px;
  margin: 0;
}

.csr-how dl div {
  display: flex;
  gap: 10px;
}

.csr-how dt {
  flex: none;
  min-width: 96px;
  font-weight: 700;
  color: var(--accent);
}

.csr-how dd {
  margin: 0;
  color: #d4cfe6;
}

.csr-points {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 14px 0 0;
  padding: 10px 0 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.csr-points li {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #d4cfe6;
}

.csr-points b {
  font-variant-numeric: tabular-nums;
  color: #fff;
}

.csr-points i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.csr-pt-a { background: #f472b6; }
.csr-pt-b { background: #c084fc; }
.csr-pt-c { background: #60a5fa; }
.csr-pt-u { background: #fb7185; border-radius: 50% 50% 2px 2px !important; }

.csr-how p {
  margin: 12px 0 0;
  line-height: 1.8;
  color: var(--muted);
}

@media (max-width: 600px) {
  .csr-head h1 {
    font-size: 30px;
  }

  .csr-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    margin-bottom: 12px;
  }

  .csr-tag {
    font-size: 12px;
    text-align: left;
  }

  .csr-bar {
    gap: 6px;
  }

  .csr-stat {
    padding: 6px 9px;
  }

  .csr-stat strong {
    font-size: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .csr button {
    transition: none;
  }

  .csr .csr-pad button.is-held {
    transform: none;
  }
}
