:root {
	--ink: #e8edf8;
	--muted: #8f9cba;
	--gold: #f4d494;
	--blue: #80c8ff;
	--purple: #bc91ff;
}
* {
	box-sizing: border-box;
}
body {
	margin: 0;
	background: #080d1b;
	color: var(--ink);
	font-family: "Yu Gothic", "Meiryo", sans-serif;
	min-height: 100vh;
}
body:before {
	content: "";
	position: fixed;
	inset: 0;
	pointer-events: none;
	background:
		radial-gradient(ellipse at 60% 25%, #28315166, transparent 55%),
		radial-gradient(ellipse at 0% 100%, #31224c55, transparent 55%);
}
button,
input {
	font: inherit;
}
button {
	cursor: pointer;
}
button:disabled {
	cursor: wait;
	opacity: 0.5;
}
button:focus-visible,
input:focus-visible {
	outline: 2px solid var(--gold);
	outline-offset: 5px;
}
canvas#sky {
	position: fixed;
	inset: 0;
	pointer-events: none;
}
main {
	position: relative;
	max-width: 1320px;
	margin: auto;
	padding: 30px 44px;
}
header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	border-bottom: 1px solid #ffffff18;
	padding-bottom: 22px;
}
.brand {
	font-size: 21px;
	letter-spacing: 6px;
}
.brand small {
	display: block;
	font-size: 9px;
	letter-spacing: 3px;
	color: var(--muted);
	margin-top: 6px;
}
.tools {
	display: flex;
	gap: 12px;
}
.ghost {
	color: var(--muted);
	border: 1px solid #ffffff20;
	background: #ffffff04;
	border-radius: 6px;
	padding: 9px 13px;
}
.hero {
	display: grid;
	grid-template-columns: 1fr 1fr;
	align-items: center;
	min-height: 470px;
	gap: 30px;
}
.eyebrow {
	font-size: 11px;
	letter-spacing: 4px;
	color: var(--gold);
}
h1 {
	font-size: clamp(40px, 5vw, 67px);
	font-weight: 500;
	letter-spacing: 6px;
	line-height: 1.2;
	margin: 24px 0;
}
h1 span {
	color: var(--gold);
}
.subtitle {
	color: var(--muted);
	line-height: 2;
	font-size: 13px;
}
.tag {
	display: inline-block;
	font-size: 11px;
	color: var(--gold);
	padding: 7px 12px;
	border: 1px solid #f4d49440;
	margin-top: 20px;
}
.gate {
	height: 390px;
	display: grid;
	place-items: center;
	position: relative;
}
.orbit {
	position: absolute;
	width: 310px;
	height: 310px;
	border: 1px solid #d8c3ff55;
	border-radius: 50%;
	box-shadow:
		0 0 65px #9c8aff15,
		inset 0 0 40px #9c8aff10;
	animation: rotate 50s linear infinite;
}
.orbit:before,
.orbit:after {
	content: "";
	position: absolute;
	inset: 18px;
	border: 1px dashed #d8c3ff33;
	border-radius: 50%;
}
.orbit:after {
	inset: 43px;
	border-style: solid;
}
.axis {
	position: absolute;
	width: 355px;
	height: 355px;
	border: 1px solid #f4d49426;
	transform: rotate(45deg);
	border-radius: 28%;
}
.diamond {
	height: 112px;
	width: 112px;
	transform: rotate(45deg);
	background: linear-gradient(135deg, #e9e7ff, #a0aaff 40%, #6c579e);
	box-shadow:
		0 0 40px #adb1ff88,
		0 0 120px #b7acff44;
	animation: breathe 4s ease-in-out infinite;
	border: 1px solid #fff;
}
.diamond:after {
	content: "";
	position: absolute;
	inset: 20px;
	border: 1px solid #ffffff99;
	background: linear-gradient(135deg, #fff7, transparent);
}
.gate-label {
	position: absolute;
	bottom: 4px;
	font-size: 10px;
	letter-spacing: 5px;
	color: var(--muted);
}
.console {
	background: #11192bd9;
	border: 1px solid #ffffff18;
	border-radius: 12px;
	padding: 25px;
	backdrop-filter: blur(20px);
}
.meters {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 30px;
}
.meter-head {
	display: flex;
	justify-content: space-between;
	font-size: 12px;
	color: var(--muted);
}
.meter-head b {
	color: var(--gold);
	font-size: 18px;
}
.bar {
	height: 3px;
	background: #ffffff13;
	margin: 13px 0;
}
.bar i {
	display: block;
	height: 100%;
	background: var(--gold);
	transition: width 0.5s;
}
.fine {
	font-size: 11px;
	color: var(--muted);
}
.actions {
	display: flex;
	gap: 14px;
	margin-top: 25px;
}
.pull {
	border: 1px solid #f4d49477;
	border-radius: 6px;
	padding: 16px 30px;
	background: #f4d4940a;
	color: var(--gold);
	flex: 1;
	transition: 0.2s;
}
.pull.primary {
	background: linear-gradient(110deg, #f5dfb0, #c9a56c);
	color: #292235;
	box-shadow: 0 5px 28px #d9b77718;
	font-weight: bold;
}
.pull:hover {
	transform: translateY(-2px);
	box-shadow: 0 0 24px #f4d49425;
}
.pull small {
	display: block;
	font-size: 10px;
	letter-spacing: 2px;
	opacity: 0.6;
	margin-top: 5px;
}
.bulk {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-top: 18px;
	font-size: 11px;
	color: var(--muted);
}
input {
	width: 90px;
	background: #080d1b;
	border: 1px solid #ffffff24;
	border-radius: 5px;
	padding: 8px;
	color: var(--ink);
}
.stats {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 12px;
	margin: 22px 0;
}
.stat {
	border: 1px solid #ffffff14;
	padding: 18px;
	border-radius: 8px;
	background: #ffffff02;
}
.stat small {
	color: var(--muted);
	font-size: 11px;
}
.stat strong {
	display: block;
	font-size: 27px;
	font-weight: 400;
	margin-top: 8px;
}
.section-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin: 30px 0 15px;
	font-size: 13px;
	letter-spacing: 2px;
}
.results {
	display: grid;
	grid-template-columns: repeat(10, 1fr);
	gap: 10px;
}
.card {
	--rarity: var(--blue);
	position: relative;
	overflow: hidden;
	border: 1px solid color-mix(in srgb, var(--rarity) 45%, transparent);
	border-radius: 6px;
	background: linear-gradient(160deg, color-mix(in srgb, var(--rarity) 14%, #0c1425), #0c1425);
	padding: 23px 4px 13px;
	text-align: center;
	animation: reveal 0.65s both;
	animation-delay: calc(var(--i) * 60ms);
}
.card.r4 {
	--rarity: var(--purple);
}
.card.r5 {
	--rarity: var(--gold);
}
.card .symbol {
	display: block;
	font-size: 34px;
	color: var(--rarity);
	text-shadow: 0 0 18px var(--rarity);
	margin-bottom: 20px;
}
.card .stars {
	font-size: 9px;
	color: var(--rarity);
	letter-spacing: 1px;
}
.card .name {
	font-size: 10px;
	margin-top: 8px;
}
.card .pickup {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	background: #f4d494;
	color: #272134;
	font-size: 8px;
	padding: 3px;
	letter-spacing: 1px;
}
.empty {
	grid-column: 1/-1;
	text-align: center;
	color: var(--muted);
	padding: 40px;
	border: 1px dashed #ffffff20;
	border-radius: 8px;
	font-size: 12px;
}
.history {
	display: flex;
	flex-wrap: wrap;
	gap: 7px;
	max-height: 110px;
	overflow: auto;
}
.chip {
	font-size: 10px;
	border: 1px solid #ffffff18;
	padding: 5px 8px;
	color: var(--blue);
}
.chip.r4 {
	color: var(--purple);
}
.chip.r5 {
	color: var(--gold);
}
footer {
	margin: 35px 0 10px;
	font-size: 10px;
	color: #64718d;
	line-height: 1.9;
}
dialog {
	background: #10182b;
	color: var(--ink);
	border: 1px solid #ffffff25;
	border-radius: 12px;
	max-width: 520px;
	padding: 30px;
}
dialog::backdrop {
	background: #000b;
	backdrop-filter: blur(6px);
}
dialog p {
	font-size: 13px;
	line-height: 2;
	color: var(--muted);
}
#cinema {
	position: fixed;
	inset: 0;
	background: #03050d;
	z-index: 10;
	display: none;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	--flash: var(--blue);
}
#cinema.active {
	display: flex;
	animation: fade 0.3s;
}
.beam {
	position: absolute;
	width: 5px;
	height: 70vh;
	background: #fff;
	box-shadow:
		0 0 25px 8px var(--flash),
		0 0 90px 25px var(--flash);
	transform: rotate(35deg) translateY(-130vh);
	animation: shoot 1.4s ease-in forwards;
}
.portal {
	position: absolute;
	width: 50px;
	height: 50px;
	border: 1px solid var(--flash);
	border-radius: 50%;
	box-shadow:
		0 0 70px var(--flash),
		inset 0 0 45px var(--flash);
	opacity: 0;
	animation: burst 1.3s 0.9s ease-out forwards;
}
.cinema-text {
	position: absolute;
	bottom: 16%;
	text-align: center;
	letter-spacing: 6px;
	font-size: 12px;
	color: var(--flash);
	animation: fade 1s;
}
.skip {
	position: absolute;
	top: 30px;
	right: 30px;
	z-index: 2;
}
.cinema-text b {
	display: block;
	font-size: 28px;
	margin: 14px;
	letter-spacing: 3px;
}
@keyframes rotate {
	to {
		transform: rotate(360deg);
	}
}
@keyframes breathe {
	50% {
		transform: rotate(45deg) translate(-6px, -6px);
		box-shadow:
			0 0 60px #adb1ffbb,
			0 0 160px #b7acff55;
	}
}
@keyframes reveal {
	from {
		opacity: 0;
		transform: translateY(20px) scale(0.94);
	}
	to {
		opacity: 1;
		transform: none;
	}
}
@keyframes fade {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}
@keyframes shoot {
	70% {
		transform: rotate(35deg) translateY(0);
	}
	100% {
		transform: rotate(35deg) translateY(130vh);
	}
}
@keyframes burst {
	10% {
		opacity: 1;
	}
	100% {
		width: 180vmax;
		height: 180vmax;
		opacity: 0;
		background: var(--flash);
	}
}
@media (max-width: 800px) {
	main {
		padding: 22px 20px;
	}
	.hero {
		grid-template-columns: 1fr;
		min-height: auto;
		gap: 0;
	}
	.hero > div:first-child {
		padding-top: 32px;
	}
	.gate {
		height: 280px;
	}
	.orbit {
		width: 220px;
		height: 220px;
	}
	.axis {
		width: 250px;
		height: 250px;
	}
	.diamond {
		width: 80px;
		height: 80px;
	}
	h1 {
		font-size: 43px;
	}
	.results {
		grid-template-columns: repeat(5, 1fr);
	}
	.console {
		padding: 18px;
	}
	.stats {
		grid-template-columns: repeat(2, 1fr);
	}
	.tools {
		gap: 5px;
	}
	.ghost {
		font-size: 11px;
	}
	.meters {
		gap: 15px;
	}
	.bulk {
		flex-wrap: wrap;
	}
	.pull {
		padding: 15px 10px;
	}
}
@media (prefers-reduced-motion: reduce) {
	*,
	*:before,
	*:after {
		animation: none !important;
		transition: none !important;
	}
}

.card.r5 {
	cursor: pointer;
	padding-top: 0;
	min-height: 170px;
	box-shadow: 0 0 24px #f4d49418;
}
.card.r5 .pickup {
	z-index: 2;
}
.card-portrait {
	display: block;
	width: 100%;
	height: 125px;
	object-fit: cover;
	object-position: 50% 22%;
	background: radial-gradient(ellipse, #85714888, transparent 75%);
	filter: drop-shadow(0 0 7px #f4d49455);
}
.card.r5:hover {
	border-color: #ffe5ac;
	transform: translateY(-3px);
}
.card.r5 .name {
	margin-bottom: 6px;
}
.card.r5:focus-visible {
	outline: 2px solid var(--gold);
	outline-offset: 4px;
}
#characterScene {
	position: absolute;
	inset: 0;
	display: none;
	background:
		radial-gradient(ellipse at 63% 45%, #5e473166, transparent 55%),
		linear-gradient(120deg, #070b17, #161627);
	isolation: isolate;
}
#cinema.character-mode #characterScene {
	display: block;
}
#cinema.character-mode > .beam,
#cinema.character-mode > .portal,
#cinema.character-mode > .cinema-text {
	display: none;
}
.summon-ring {
	position: absolute;
	left: 61%;
	top: 49%;
	width: 65vh;
	height: 65vh;
	transform: translate(-50%, -50%);
	border: 1px solid #eac47788;
	border-radius: 50%;
	box-shadow:
		0 0 100px #d4aa4b24,
		inset 0 0 80px #eac47712;
}
.summon-ring:before {
	content: "";
	position: absolute;
	inset: 25px;
	border: 1px dashed #f4d49455;
	border-radius: 50%;
	animation: rotate 40s linear infinite;
}
.summon-ring:after {
	content: "✧";
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	font-size: 48vh;
	color: #eac4770c;
}
.character-art {
	position: absolute;
	right: 2%;
	bottom: -3%;
	height: 105%;
	width: 65%;
	object-fit: contain;
	filter: brightness(0) drop-shadow(0 0 28px #ffd68b);
	animation: characterEntrance 1.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.character-copy {
	position: absolute;
	left: 9%;
	top: 35%;
	z-index: 2;
	max-width: 42%;
	text-shadow: 0 2px 30px #000;
}
.character-kicker {
	font-size: 11px;
	letter-spacing: 5px;
	color: #e6c88d;
}
.character-copy h2 {
	font-weight: 400;
	font-size: clamp(40px, 6vw, 82px);
	letter-spacing: 10px;
	margin: 18px 0 4px;
}
.character-en {
	color: #bfa97b;
	letter-spacing: 7px;
	font-size: 12px;
}
.character-stars {
	color: #ffe09b;
	font-size: 23px;
	letter-spacing: 9px;
	margin: 25px 0;
	text-shadow: 0 0 25px #f4d49488;
}
.character-line {
	font-size: 13px;
	line-height: 2;
	color: #c5c9d7;
}
.character-type {
	display: inline-block;
	border: 1px solid #f4d49460;
	padding: 7px 12px;
	color: var(--gold);
	font-size: 11px;
}
.character-copy > * {
	animation: copyEntrance 0.8s 1s both;
}
.character-footer {
	position: absolute;
	bottom: 6%;
	left: 9%;
	right: 9%;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 15px;
	z-index: 3;
}
.character-footer .pull {
	flex: 0 0 auto;
	padding: 13px 30px;
}
.character-footer small {
	color: #b6a888;
	letter-spacing: 2px;
	font-size: 10px;
}
.gold-mote {
	position: absolute;
	left: var(--x);
	top: var(--y);
	width: 3px;
	height: 3px;
	background: #ffe5aa;
	box-shadow: 0 0 12px #ffc85a;
	animation: moteDrift var(--d) ease-in-out infinite alternate;
	opacity: 0.7;
}
.reveal-flare {
	position: absolute;
	inset: 0;
	pointer-events: none;
	background: radial-gradient(ellipse at 60% 45%, #fff4d6, transparent 70%);
	animation: revealFlare 1.6s both;
	z-index: 4;
}
.preview-action {
	margin-top: 12px;
	border-color: #f4d49455;
	color: var(--gold);
}
#cinema .skip {
	z-index: 8;
}
@keyframes characterEntrance {
	0% {
		opacity: 0;
		transform: translateX(7%) scale(1.08);
		filter: brightness(0) drop-shadow(0 0 40px #ffda8e);
	}
	35% {
		opacity: 1;
		filter: brightness(0) drop-shadow(0 0 40px #ffda8e);
	}
	60%,
	100% {
		opacity: 1;
		transform: none;
		filter: brightness(1) drop-shadow(0 0 20px #e6bd6655);
	}
}
@keyframes copyEntrance {
	from {
		opacity: 0;
		transform: translateY(16px);
	}
	to {
		opacity: 1;
		transform: none;
	}
}
@keyframes revealFlare {
	0%,
	25% {
		opacity: 0;
	}
	40% {
		opacity: 0.85;
	}
	100% {
		opacity: 0;
	}
}
@keyframes moteDrift {
	to {
		transform: translate(15px, -65px);
		opacity: 0.15;
	}
}
@media (max-width: 700px) {
	.character-art {
		right: -20%;
		width: 110%;
		height: 85%;
		bottom: 10%;
	}
	.summon-ring {
		left: 60%;
		top: 42%;
		width: 48vh;
		height: 48vh;
	}
	.character-copy {
		top: auto;
		bottom: 18%;
		left: 7%;
		max-width: 90%;
		padding: 15px 20px 10px 0;
		background: linear-gradient(90deg, #070b17e8, #070b1700);
	}
	.character-copy h2 {
		font-size: 42px;
		margin: 10px 0;
		letter-spacing: 6px;
	}
	.character-kicker {
		font-size: 9px;
	}
	.character-stars {
		margin: 12px 0;
		font-size: 17px;
	}
	.character-line {
		display: none;
	}
	.character-footer {
		left: 7%;
		right: 7%;
		bottom: 5%;
	}
	.character-footer small {
		max-width: 45%;
		line-height: 1.7;
	}
	.card-portrait {
		height: 110px;
	}
}
@media (prefers-reduced-motion: reduce) {
	.character-art {
		filter: brightness(1) drop-shadow(0 0 20px #e6bd6655);
	}
	.reveal-flare {
		display: none;
	}
}

@keyframes characterFloat {
	0%,
	100% {
		transform: translateY(0) rotate(-0.25deg) scale(1);
	}
	50% {
		transform: translateY(-9px) rotate(0.25deg) scale(1.008);
	}
}
.character-art {
	animation:
		characterEntrance 1.7s cubic-bezier(0.16, 1, 0.3, 1) both,
		characterFloat 5s 1.7s ease-in-out infinite;
	translate: var(--px, 0px) var(--py, 0px);
	transition: translate 0.25s ease-out;
}
#riftCanvas,
#riftParticles {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	z-index: 6;
	pointer-events: none;
	display: none;
}
#riftParticles {
	z-index: 7;
}
#cinema .skip {
	z-index: 12;
	background: #080b19a8;
	backdrop-filter: blur(10px);
}
.rift-mode #characterScene {
	background:
		radial-gradient(ellipse at 62% 46%, #2a1b4266, transparent 62%),
		linear-gradient(120deg, #060813, #111329);
}
.rift-mode .summon-ring,
.rift-mode #motes,
.rift-mode .reveal-flare {
	display: none;
}
.rift-mode .character-art {
	animation: none;
	opacity: 0;
	filter: brightness(1) drop-shadow(0 0 22px #a893ff25);
	translate: none;
}
.rift-mode .character-copy,
.rift-mode .character-footer {
	opacity: 0;
	pointer-events: none;
}
.rift-mode .character-copy > * {
	animation: none;
}
.rift-mode.rift-landed .character-art {
	opacity: 1;
	animation: characterFloat 6s 0.6s ease-in-out infinite;
}
.rift-mode.rift-landed .character-copy {
	opacity: 1;
	pointer-events: auto;
	animation: copyEntrance 1.2s both;
}
.rift-mode.rift-landed .character-footer {
	opacity: 1;
	pointer-events: auto;
	animation: copyEntrance 1s 0.2s both;
}
.rift-mode .character-kicker,
.rift-mode .character-en {
	color: #c4b0ff;
}
.rift-mode .character-type {
	border-color: #b69aff88;
	color: #dacdff;
}
.rift-mode .character-stars {
	text-shadow: 0 0 14px #bc9fff44;
}
.rift-mode .character-copy h2 {
	letter-spacing: 8px;
}
@media (prefers-reduced-motion: reduce) {
	.character-art,
	.rift-mode.rift-landed .character-art {
		animation: none;
		translate: none;
	}
	.rift-mode.rift-landed .character-copy,
	.rift-mode.rift-landed .character-footer {
		animation: none;
	}
	#riftCanvas,
	#riftParticles {
		display: none !important;
	}
}

/* 公開版：立ち絵の代わりに光の演出を表示する。 */
.character-art {
	object-fit: contain;
}
