/* The Crucible (/tournament): a fight-night poster over the portal's tokens (landing.css). Dark stone and lava with
   the site's purple and gold, Alagard for headings, see-through glass panels. Motion moves only transform and
   opacity; every animation stops under prefers-reduced-motion. Phone first. */

:root {
	--lava: #ff6a1f;
	--lava-hi: #ffb347;
	--stone: #14101a;
}

body.crucible { background: var(--void); color: var(--text); font-family: var(--body); margin: 0; overflow-x: hidden; }

.skip-link {
	position: fixed; top: 10px; left: 10px; z-index: 100; transform: translateY(-160%);
	border: 1px solid var(--line-strong); border-radius: 7px; background: var(--void-2); color: var(--text); padding: 9px 13px;
}
.skip-link:focus-visible { transform: translateY(0); }

.cr-glass {
	border: 1px solid var(--line); border-radius: 12px; background: var(--panel);
	box-shadow: inset 0 1px 0 rgba(178, 140, 242, .14); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}

/* ---- 1. Hero ------------------------------------------------------------------------------------------------- */
.cr-hero { position: relative; min-height: 100svh; display: grid; place-items: center; overflow: hidden; isolation: isolate; }
.cr-film { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -3; }
.cr-vignette {
	position: absolute; inset: 0; z-index: -2;
	background:
		radial-gradient(ellipse 70% 55% at 50% 100%, rgba(255, 106, 31, .28), transparent 70%),
		radial-gradient(ellipse at center, rgba(11, 8, 18, .25) 0%, rgba(11, 8, 18, .7) 62%, rgba(11, 8, 18, .96) 100%),
		linear-gradient(to bottom, rgba(11, 8, 18, .55), transparent 30%, transparent 60%, var(--void));
}
.cr-embers { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.cr-ember {
	position: absolute; bottom: -12px; width: 4px; height: 4px; border-radius: 50%;
	background: var(--lava-hi); box-shadow: 0 0 8px 2px rgba(255, 106, 31, .8); opacity: 0;
	animation: cr-rise var(--dur, 7s) linear var(--delay, 0s) infinite;
}
@keyframes cr-rise {
	0% { transform: translate3d(0, 0, 0) scale(1); opacity: 0; }
	10% { opacity: .9; }
	100% { transform: translate3d(var(--drift, 20px), -100svh, 0) scale(.3); opacity: 0; }
}

.cr-hero-inner { position: relative; text-align: center; padding: 96px 18px 56px; max-width: 980px; }
.cr-eyebrow { margin: 0 0 10px; color: var(--gold-hi); letter-spacing: .14em; text-transform: uppercase; font-size: 13px; font-weight: 600; }
.cr-sub { margin: 14px 0 0; }
.cr-title {
	position: relative; margin: 0; font-family: var(--display); font-weight: 400; line-height: .95;
	font-size: clamp(42px, 10vw, 112px); letter-spacing: .02em; color: #fff3dc;
	text-shadow: 0 2px 0 #3b1306, 0 0 22px rgba(255, 106, 31, .55), 0 0 60px rgba(255, 106, 31, .35);
}
/* The flame: a hotter copy of the title over it, flickering by opacity alone. */
.cr-title::after {
	content: attr(data-text); position: absolute; inset: 0; color: transparent; pointer-events: none;
	text-shadow: 0 -4px 18px rgba(255, 179, 71, .95), 0 0 42px rgba(255, 106, 31, .9), 0 -12px 60px rgba(255, 60, 0, .6);
	animation: cr-flicker 2.4s steps(1, end) infinite;
}
@keyframes cr-flicker {
	0%, 100% { opacity: .55; } 12% { opacity: .9; } 20% { opacity: .45; } 34% { opacity: 1; } 47% { opacity: .6; }
	58% { opacity: .95; } 71% { opacity: .5; } 84% { opacity: .85; }
}
.cr-pool {
	margin: 18px 0 0; display: inline-flex; align-items: center; gap: 10px; font-family: var(--display);
	color: var(--gold-hi); font-size: clamp(22px, 5vw, 34px);
}
.cr-pool span { font-size: clamp(40px, 10vw, 68px); color: #ffd98a; text-shadow: 0 0 24px rgba(226, 192, 130, .55); }
.cr-pool img, .cr-step img, .cr-steps img, .cr-note img { image-rendering: pixelated; width: 48px; height: 32px; }

.cr-clock { margin: 22px auto 0; }
.cr-clock-label { margin: 0 0 8px; color: var(--muted); letter-spacing: .12em; text-transform: uppercase; font-size: 12px; }
.cr-digits { display: inline-flex; gap: clamp(8px, 2.6vw, 18px); }
.cr-unit { display: grid; justify-items: center; min-width: 64px; }
.cr-unit b {
	display: block; min-width: 2ch; font-family: var(--display); font-weight: 400; font-variant-numeric: tabular-nums;
	font-size: clamp(38px, 10vw, 72px); line-height: 1; color: #fff3dc; text-shadow: 0 0 18px rgba(143, 85, 223, .7);
}
.cr-unit b.is-tick { animation: cr-tick .35s ease-out; }
@keyframes cr-tick { from { transform: translateY(-14%); opacity: .2; } to { transform: none; opacity: 1; } }
.cr-unit i { font-style: normal; color: var(--muted); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; margin-top: 4px; }

.cr-cta, .cr-btn {
	display: inline-flex; align-items: center; justify-content: center; min-height: 54px; padding: 0 38px; margin-top: 26px;
	border: 0; border-radius: 10px; cursor: pointer; text-decoration: none; font-family: var(--display); font-size: 24px;
	letter-spacing: .08em; text-transform: uppercase; color: #2a1206;
	background: linear-gradient(180deg, #ffd27a, #ff8f2e 55%, #e0561a);
	box-shadow: 0 0 0 1px rgba(255, 210, 122, .6), 0 10px 34px rgba(255, 106, 31, .45);
	transition: transform .15s ease;
}
.cr-cta:hover, .cr-btn:hover:not(:disabled) { transform: translateY(-2px) scale(1.02); }
.cr-cta:focus-visible, .cr-btn:focus-visible, .cr-card:focus-visible { outline: 3px solid var(--gold-hi); outline-offset: 3px; }
.cr-cta.is-shut { pointer-events: none; color: var(--gold-hi); background: rgba(21, 16, 34, .72); box-shadow: 0 0 0 1px var(--line-strong); font-size: 18px; }
.cr-status { margin: 14px 0 0; color: var(--muted); font-size: 14px; min-height: 1.4em; }

/* ---- Sections ------------------------------------------------------------------------------------------------ */
.cr-section { max-width: 1120px; margin: 0 auto; padding: 56px 18px 0; }
.cr-h2 {
	margin: 0 0 22px; text-align: center; font-family: var(--display); font-weight: 400; color: #fff3dc;
	font-size: clamp(30px, 6vw, 46px); text-shadow: 0 0 18px rgba(255, 106, 31, .35);
}
.cr-note { margin: 16px auto 0; text-align: center; color: var(--muted); font-size: 14px; display: flex; gap: 8px; justify-content: center; align-items: center; }
.cr-note[hidden] { display: none; }
.cr-line { text-align: center; color: var(--text); font-size: 17px; margin: 0 auto 16px; max-width: 640px; }

/* ---- 2. Bracket cards ---------------------------------------------------------------------------------------- */
.cr-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.cr-card {
	position: relative; display: grid; grid-template-rows: auto auto auto 1fr auto; justify-items: center; gap: 10px;
	padding: 22px 16px 18px; min-height: 380px; text-align: center; cursor: pointer; color: var(--text); font: inherit;
	border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
	background: linear-gradient(180deg, rgba(255, 106, 31, .07), rgba(21, 16, 34, .78) 45%), var(--panel);
	backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
	transition: transform .18s ease, border-color .18s ease;
}
.cr-card:hover { transform: translateY(-4px); border-color: var(--line-strong); }
.cr-card[aria-checked="true"] { border-color: var(--gold-hi); box-shadow: 0 0 0 1px var(--gold-hi), 0 16px 40px rgba(255, 106, 31, .25); }
.cr-card-title { font-family: var(--display); font-size: 28px; color: #fff3dc; }
/* A fighter from the game's own avatar frames: the sheet slides one frame at a time (transform only). */
.cr-sprite { position: relative; display: block; overflow: hidden; height: var(--sh, 202px); width: calc(var(--sh, 202px) * var(--w) / var(--h)); }
.cr-sprite img {
	position: absolute; left: 0; top: 0; height: 100%; width: auto; max-width: none; image-rendering: pixelated;
	animation: cr-frames var(--speed, 1.2s) steps(var(--frames), end) infinite;
}
@keyframes cr-frames { to { transform: translateX(-100%); } }
.cr-chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.cr-chip {
	display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px 3px 4px; border-radius: 999px;
	background: rgba(11, 8, 18, .55); border: 1px solid var(--line); font-size: 13px; font-weight: 600; color: var(--gold-hi);
}
.cr-chip img { width: 18px; height: 18px; image-rendering: pixelated; }
.cr-places, .cr-places-text { display: block; width: 100%; }
.cr-places-bar { display: block; height: 8px; border-radius: 999px; background: rgba(11, 8, 18, .6); overflow: hidden; border: 1px solid var(--line); }
.cr-places-bar span {
	display: block; height: 100%; width: 100%; transform-origin: left; transform: scaleX(var(--fill, 0));
	background: linear-gradient(90deg, var(--purple), var(--lava)); transition: transform .6s ease;
}
.cr-places-text { margin-top: 6px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---- 3. Form and code ---------------------------------------------------------------------------------------- */
.cr-form-wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-top: 18px; }
.cr-form-wrap[hidden] { display: none; }
.cr-form, .cr-result { padding: 20px; }
.cr-form-for { margin: 0 0 12px; font-family: var(--display); font-size: 24px; color: var(--gold-hi); }
.cr-field { display: grid; gap: 6px; margin: 0 0 12px; font-size: 14px; color: var(--text); }
.cr-field input {
	min-height: 46px; border: 1px solid var(--line-strong); border-radius: 9px; background: rgba(11, 8, 18, .6);
	color: var(--text); font: inherit; font-size: 16px; padding: 8px 12px;
}
.cr-field input:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 2px; }
.cr-hint { color: var(--muted); font-size: 12px; }
.cr-check { display: flex; gap: 8px; align-items: center; margin: 0 0 12px; font-size: 14px; }
.cr-check input { accent-color: var(--gold-hi); }
.cr-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
#ts-team[hidden], #ts-team-fields[hidden] { display: none; }
.cr-btn { width: 100%; margin-top: 4px; }
.cr-btn:disabled { opacity: .6; cursor: progress; }
.cr-error { margin: 12px 0 0; color: #ffb4a8; font-size: 14px; }
.cr-error[hidden], .cr-result[hidden] { display: none; }
.cr-result { text-align: center; }
.cr-result:focus { outline: none; }
.cr-code-label { margin: 0; color: var(--muted); letter-spacing: .14em; text-transform: uppercase; font-size: 12px; }
.cr-code {
	margin: 6px 0 10px; font-family: var(--display); font-size: clamp(46px, 12vw, 64px); letter-spacing: .16em; color: #ffd98a;
	text-shadow: 0 0 26px rgba(255, 106, 31, .6); animation: cr-land .55s cubic-bezier(.2, 1.4, .4, 1) both;
}
@keyframes cr-land { from { transform: scale(2.2); opacity: 0; } to { transform: none; opacity: 1; } }
.cr-copy {
	min-height: 38px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--line-strong); background: rgba(11, 8, 18, .6);
	color: var(--text); font: inherit; cursor: pointer;
}
.cr-type { margin: 12px 0 0; font-size: 15px; }
.cr-type code { color: var(--gold-hi); font-size: 15px; }

/* ---- 4. How it works ----------------------------------------------------------------------------------------- */
.cr-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; counter-reset: cr; }
.cr-steps li {
	display: grid; justify-items: center; gap: 8px; text-align: center; padding: 16px 8px; border-radius: 12px;
	border: 1px solid var(--line); background: var(--panel); counter-increment: cr;
}
.cr-steps li::before { content: counter(cr); font-family: var(--display); font-size: 26px; color: var(--lava-hi); }
.cr-steps b { font-size: 15px; }

/* ---- 5. Who's in --------------------------------------------------------------------------------------------- */
.cr-walls { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.cr-wall { padding: 18px; }
.cr-wall-title { margin: 0 0 8px; font-family: var(--display); font-size: 24px; color: #fff3dc; }
.cr-roster { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; max-height: 360px; overflow-y: auto; }
.cr-entrant {
	display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 3px; border-radius: 999px;
	border: 1px solid var(--line-strong); background: rgba(143, 85, 223, .18); font-size: 13px; font-weight: 600;
}
.cr-entrant.is-pending { opacity: .5; border-style: dashed; background: rgba(11, 8, 18, .5); }
.cr-entrant.is-waiting { border-color: var(--gold); }
.cr-entrant.is-new { animation: cr-join .5s ease-out both; }
@keyframes cr-join { from { transform: scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }
.cr-entrant.is-new.is-pending { animation-name: cr-join-dim; }
@keyframes cr-join-dim { from { transform: scale(.4); opacity: 0; } to { transform: none; opacity: .5; } }
.cr-face { width: 22px; height: 22px; border-radius: 50%; overflow: hidden; background: rgba(11, 8, 18, .7); position: relative; }
.cr-face img { position: absolute; max-width: none; height: 72px; left: var(--face-x, -6px); top: -2px; image-rendering: pixelated; }
.cr-empty { color: var(--muted); font-size: 14px; margin: 10px 0 0; }

/* ---- 6. Prizes ----------------------------------------------------------------------------------------------- */
.cr-podium { display: grid; grid-template-columns: 1fr 1.15fr 1fr; align-items: end; gap: 10px; max-width: 760px; margin: 0 auto; }
.cr-step {
	display: grid; justify-items: center; align-content: start; gap: 6px; padding: 18px 10px; text-align: center;
	border: 1px solid var(--line); border-radius: 12px 12px 4px 4px; background: var(--panel);
}
.cr-step b { font-family: var(--display); font-size: 30px; font-weight: 400; color: #fff3dc; }
.cr-step span { color: var(--gold-hi); font-weight: 600; }
.cr-first { min-height: 230px; border-color: var(--gold-hi); background: linear-gradient(180deg, rgba(226, 192, 130, .18), var(--panel)); }
.cr-first img { width: 72px; height: 48px; }
.cr-second { min-height: 180px; }
.cr-third { min-height: 150px; }

/* ---- 7. The day ---------------------------------------------------------------------------------------------- */
.cr-times { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.cr-time { padding: 16px; text-align: center; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.cr-time b { display: block; font-family: var(--display); font-weight: 400; font-size: 22px; color: #fff3dc; }
.cr-time strong { display: block; margin-top: 6px; font-size: 26px; color: var(--gold-hi); font-variant-numeric: tabular-nums; }
.cr-time span { color: var(--muted); font-size: 13px; }

/* ---- 8. Rules ------------------------------------------------------------------------------------------------ */
.cr-rules { padding-bottom: 64px; }
.cr-fold { max-width: 760px; margin: 0 auto; padding: 0 18px; }
.cr-fold summary { cursor: pointer; padding: 14px 0; font-weight: 600; color: var(--gold-hi); }
.cr-fold ul { margin: 0 0 16px; padding-left: 18px; line-height: 1.6; color: var(--text); }
.cr-fold code, .cr-rules code { color: var(--gold-hi); }

/* ---- Phone --------------------------------------------------------------------------------------------------- */
@media (max-width: 860px) {
	.cr-cards, .cr-walls, .cr-form-wrap { grid-template-columns: 1fr; }
	.cr-card { min-height: 0; padding: 18px 14px 16px; }
	.cr-card .cr-sprite { --sh: 160px; }
}
@media (max-width: 480px) {
	.cr-unit { min-width: 52px; }
	.cr-cta.is-shut { font-size: 15px; padding: 0 18px; }
	.cr-steps, .cr-times { grid-template-columns: 1fr; }
	.cr-steps li { grid-auto-flow: column; justify-content: start; }
	.cr-pair { grid-template-columns: 1fr; }
}

/* ---- Reduced motion: still frames, no embers, the poster instead of the film -------------------------------- */
@media (prefers-reduced-motion: reduce) {
	.cr-ember, .cr-embers { display: none; }
	.cr-title::after, .cr-sprite img, .cr-unit b.is-tick, .cr-code, .cr-entrant.is-new { animation: none; }
	.cr-entrant.is-new.is-pending { opacity: .5; }
	.cr-card, .cr-cta, .cr-btn, .cr-places-bar span { transition: none; }
}

/* ---- The explainer video (owner 11-19) ---------------------------------------------------------------------- */
.cr-explainer { max-width: 960px; margin: 0 auto; padding: 8px; }
.cr-explainer video { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; border-radius: 8px; background: #000; }
