.gacha-page {
  --gacha-night: #191333;
  --gacha-violet: #4925ad;
  --gacha-lime: #ddfb79;
}

.gacha-page .shell { width: min(100% - 40px, 1120px); }
.gacha-crumb { padding: 20px 0 16px; font-size: 12px; color: var(--muted); }
.gacha-crumb ol { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0; }
.gacha-crumb li + li::before { content: '/'; margin-inline-end: 8px; color: #83798e; }
.gacha-crumb a { text-underline-offset: 3px; }
.gacha-intro {
  color: white;
  background: var(--gacha-night);
  border-radius: 16px;
  padding: clamp(16px, 3vw, 32px);
}
.gacha-intro h1 { margin: 0; font-size: clamp(23px, 5.6vw, 44px); letter-spacing: -.035em; line-height: 1.25; font-weight: 950; }
.gacha-intro h1 span { display: inline-block; color: var(--gacha-lime); }
.gacha-lead { margin-top: 6px; color: #eee8fa; font-size: clamp(13px, 2vw, 16px); line-height: 1.55; }

.gacha-workspace { display: grid; grid-template-columns: minmax(0, .86fr) minmax(0, 1.14fr); align-items: start; gap: 20px; margin-block: 22px 30px; }
.gacha-control, .gacha-preview { min-width: 0; border: 1px solid var(--line); border-radius: 20px; background: white; padding: clamp(14px, 2vw, 24px); box-shadow: 0 6px 24px #28154e09; }
.gacha-control h2, .gacha-preview h2 { font-size: 18px; font-weight: 900; letter-spacing: -.035em; }
#gacha-mode { width: 100%; min-height: 49px; margin-top: 12px; padding: 8px 12px; color: var(--ink); background: var(--soft); border: 1px solid var(--line); border-radius: 10px; font: inherit; font-weight: 800; font-size: 16px; }
.gacha-mode-hint { margin-top: 7px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.gacha-formats button, .gacha-actions button, .gacha-retry {
  color: var(--ink);
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  min-height: 44px;
  padding: 7px 6px;
  font-size: 12px;
  font-weight: 800;
}
.gacha-formats button[aria-pressed="true"] { color: var(--gacha-violet); border-color: #9374dd; background: #efe8ff; }
.gacha-formats button:hover, .gacha-actions button:not(:disabled):hover, .gacha-retry:not(:disabled):hover { border-color: #9374dd; }
.gacha-faq summary, .gacha-discover summary { cursor: pointer; padding-block: 8px; font-size: 13px; font-weight: 800; }
.gacha-draw { margin-top: 15px; display: flex; width: 100%; gap: 9px; align-items: center; justify-content: center; min-height: 58px; padding: 10px; border: 2px solid var(--gacha-night); border-radius: 11px; background: var(--gacha-lime); color: var(--gacha-night); font-size: 16px; font-weight: 950; box-shadow: 0 3px var(--gacha-night); }
.gacha-draw:not(:disabled):hover { background: #ebffa5; }
.gacha-draw span:last-child { margin-inline-start: auto; }
.gacha-draw span:first-child { margin-inline-end: auto; }
.gacha-message { margin-top: 10px; color: #a12242; font-size: 13px; font-weight: 700; line-height: 1.6; }

.gacha-preview { scroll-margin-top: 12px; }
.gacha-preview-head { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.gacha-preview-head > span { color: var(--gacha-violet); font-size: 11px; font-weight: 850; background: #efe8ff; padding: 5px 8px; border-radius: 6px; }
.gacha-stage { display: grid; place-items: center; overflow: hidden; background: var(--gacha-night); border-radius: 13px; }
.gacha-placeholder, .gacha-reveal { position: relative; isolation: isolate; overflow: hidden; width: 100%; min-height: clamp(290px, 36vw, 450px); display: grid; place-items: center; text-align: center; color: white; background: radial-gradient(ellipse at 50% 55%, #5534a5, transparent 72%), repeating-linear-gradient(96deg, #fff1 0 1px, transparent 1px 26px), var(--gacha-night); }
.gacha-placeholder::before, .gacha-placeholder::after { position: absolute; content: ''; z-index: -1; inset: 16px; border: 1px dashed #c7aaff8c; border-radius: 11px; }
.gacha-placeholder::after { inset: 24px; border-style: solid; opacity: .3; }
.gacha-orbit { position: absolute; z-index: -1; inset: 25% 10%; border: 2px solid #d9c7ff82; border-radius: 50%; transform: rotate(-32deg); }
.gacha-orbit-second { transform: rotate(28deg); border-color: #e2ff89a3; }
.gacha-placeholder-copy { display: grid; justify-items: center; padding: 24px; }
.gacha-placeholder-mark { color: var(--gacha-lime); font-size: 39px; line-height: 1; margin-bottom: 7px; }
.gacha-placeholder strong { font: 700 clamp(31px, 5.8vw, 76px)/.95 Impact, "Arial Black", system-ui, sans-serif; letter-spacing: -.015em; color: #fff; text-shadow: 0 4px 16px #1b0c46; }
.gacha-placeholder em { font-style: normal; color: var(--gacha-lime); }
.gacha-placeholder p { margin-top: 13px; color: #eee5ff; font-size: 12px; font-weight: 800; }
.gacha-reveal { gap: 10px; align-content: center; padding: 12px; }
.gacha-reveal > p { color: var(--gacha-lime); font-size: 13px; font-weight: 850; }
.gacha-reveal ol { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(3, minmax(31px, 1fr)) minmax(48px, auto); gap: 5px; width: 100%; max-width: 460px; margin: 0; padding: 0; list-style: none; }
.gacha-reveal li { display: grid; place-content: center; padding: 4px; color: #fff; background: #352369; border: 1px solid #b89aff57; border-radius: 6px; font-size: 11px; line-height: 1.2; font-weight: 800; overflow-wrap: anywhere; animation: gacha-appear .26s ease-out both; }
.gacha-reveal li[data-headliner] { grid-column: 1 / -1; color: var(--gacha-lime); background: #261848; border-color: #ddfb7977; font-size: 16px; }
.gacha-reveal li small { font-size: 9px; letter-spacing: .15em; }
.gacha-skip { color: white; background: #33215f; border: 1px solid #b499fa; border-radius: 7px; min-height: 42px; padding: 6px 12px; font-size: 12px; font-weight: 800; }
@keyframes gacha-appear { from { opacity: 0; transform: scale(.86); box-shadow: 0 0 24px #b887ff; } to { opacity: 1; transform: scale(1); box-shadow: none; } }
#gacha-poster { display: block; width: min(100%, var(--gacha-poster-max, 530px)); height: auto; }
#gacha-poster[data-format="story"] { --gacha-poster-max: 340px; }

.gacha-name-row { margin-top: 15px; }
.gacha-name-row label { display: block; font-size: 13px; font-weight: 800; }
.gacha-name-row small { color: var(--muted); font-size: 11px; font-weight: 600; }
.gacha-name-row input { display: block; width: 100%; margin-top: 5px; font-size: 16px; }
.gacha-formats, .gacha-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 8px; }
.gacha-formats small { display: block; font-size: 10px; font-weight: 600; }
.gacha-actions .primary-button { color: white; background: var(--accent); border-color: var(--accent); }
.gacha-actions .primary-button:not(:disabled):hover { background: var(--accent-hover); }
#gacha-share-image, .gacha-share-hint { grid-column: 1 / -1; }
.gacha-share-hint { color: var(--muted); font-size: 12px; line-height: 1.5; }
.gacha-action-status { color: var(--muted); font-size: 12px; line-height: 1.5; }
.gacha-action-status:not(:empty) { margin-top: 6px; }
.gacha-retry { display: block; width: 100%; margin-top: 10px; color: var(--gacha-violet); }
.gacha-discover { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 5px; }
.gacha-discover ul { margin: 0; padding: 0; list-style: none; }
.gacha-discover li { font-size: 13px; padding: 8px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.gacha-discover li div { display: flex; flex-wrap: wrap; gap: 2px 13px; }
.gacha-discover li a { display: inline-grid; place-items: center; min-height: 40px; color: var(--gacha-violet); font-size: 12px; text-underline-offset: 3px; }

.gacha-info { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.gacha-info section, .gacha-related { background: white; border: 1px solid var(--line); border-radius: 16px; padding: 18px; }
.gacha-info h2, .gacha-related h2 { font-size: 18px; margin-bottom: 7px; }
.gacha-info ol { margin: 9px 0; padding-left: 1.3em; }
.gacha-info p, .gacha-info li { color: var(--muted); font-size: 13px; line-height: 1.75; }
.gacha-faq details + details { border-top: 1px solid var(--line); }
.gacha-faq details p { margin-bottom: 7px; }
.gacha-related { margin-top: 20px; }
.gacha-related > div { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.gacha-related a { display: grid; font-size: 13px; gap: 4px; padding: 10px; background: var(--soft); border: 1px solid var(--line); border-radius: 8px; text-decoration: none; }
.gacha-related a:hover { border-color: var(--accent); }
.gacha-related a strong { color: var(--gacha-violet); letter-spacing: .045em; font-size: 12px; }
.gacha-telemetry { margin-block: 14px 26px; color: var(--muted); font-size: 12px; }
.gacha-telemetry label { display: inline-flex; align-items: center; gap: 7px; min-height: 44px; }
.gacha-telemetry input { min-height: 0; width: 16px; height: 16px; flex: none; accent-color: var(--gacha-violet); }
.gacha-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

@media (max-width: 730px) {
  .gacha-page .shell { width: calc(100% - 28px); }
  .gacha-crumb { padding-top: 13px; }
  .gacha-workspace, .gacha-info { grid-template-columns: 1fr; gap: 12px; }
  .gacha-workspace { margin-block: 13px 20px; }
}
@media (max-width: 375px) {
  .gacha-related > div { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  html:has(.gacha-page) { scroll-behavior: auto; }
  .gacha-reveal li { animation: none; }
}
