@font-face {
	font-family: "Fahkwang";
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url("./brand/fonts/fahkwang-400-latin.woff2") format("woff2");
}

@font-face {
	font-family: "Fahkwang";
	font-style: normal;
	font-weight: 600;
	font-display: swap;
	src: url("./brand/fonts/fahkwang-600-latin.woff2") format("woff2");
}

:root {
	--cream: #f5f1ea;
	--paper: rgba(255, 252, 247, 0.78);
	--text: #1c2e2b;
	--muted: #5c6b68;
	--line: rgba(28, 46, 43, 0.12);
	--accent: #d2001b;
	--accent-press: #a80016;
	--brand-red: #d2001b;
	--green-live: #31403e;
	--green-archive: #1c2e2b;
	--on-dark: #f5f1ea;
	--on-dark-muted: rgba(245, 241, 234, 0.72);
	--hero: #1c2e2b;
	--err: #b4232c;
	--ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Helvetica, Arial, sans-serif;
	--display: "Fahkwang", "Palatino Linotype", Palatino, serif;
}

* {
	box-sizing: border-box;
}

html,
body {
	margin: 0;
	height: 100%;
	height: 100svh;
	height: 100dvh;
	min-height: 100svh;
	min-height: 100dvh;
	background: var(--cream);
	color: var(--text);
	font-family: var(--ui);
	-webkit-font-smoothing: antialiased;
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
}

[hidden] {
	display: none !important;
}

.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	border: 0;
}

.page {
	height: 100%;
	height: 100svh;
	height: 100dvh;
	overflow: hidden;
}

html.is-home,
html.is-home body,
html.is-home .page {
	height: 100dvh;
	overflow: hidden;
	background: var(--green-archive);
}

html.is-home .home {
	height: 100%;
	min-height: 0;
	overflow-x: hidden;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	overscroll-behavior-y: contain;
	padding-top: 0;
	padding-bottom: max(28px, env(safe-area-inset-bottom, 0px));
}

html.is-home:has(#del-overlay:not([hidden])) .home {
	overflow: hidden;
}

.gate {
	position: relative;
	height: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: flex-start;
	overflow-x: hidden;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	padding: max(24px, env(safe-area-inset-top) + 12px) max(24px, env(safe-area-inset-right)) max(32px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
}

.gate-photo,
.gate-veil {
	position: absolute;
	inset: 0;
}

.gate-photo {
	background: var(--hero) url("./brand/hero.jpg") center / cover no-repeat;
}

.gate-veil {
	background: linear-gradient(180deg, rgba(28, 46, 43, 0.16) 0%, rgba(28, 46, 43, 0.28) 100%);
	backdrop-filter: blur(5px);
	-webkit-backdrop-filter: blur(5px);
}

.mark {
	display: block;
	height: auto;
}

.mark-card {
	width: 86px;
	margin: 0 auto 18px;
}

.mark-island {
	width: 28px;
	height: auto;
}

.card {
	position: relative;
	z-index: 1;
	width: min(420px, 100%);
	padding: 36px 28px 32px;
	text-align: center;
	background: var(--paper);
	border: 1px solid rgba(255, 255, 255, 0.55);
	border-radius: 28px;
	box-shadow: 0 24px 80px rgba(28, 46, 43, 0.28);
	backdrop-filter: blur(28px) saturate(1.4);
	-webkit-backdrop-filter: blur(28px) saturate(1.4);
}

.kicker {
	margin: 0 0 8px;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--accent);
}

h1 {
	margin: 0 0 10px;
	font-family: var(--display);
	font-size: clamp(28px, 6vw, 40px);
	font-weight: 600;
	letter-spacing: -0.02em;
	line-height: 1.1;
}

.lead {
	margin: 0 0 28px;
	color: var(--muted);
	font-size: 16px;
	line-height: 1.45;
}

.pin-wrap {
	position: relative;
	margin: 0 0 22px;
}

.pin-slots {
	display: grid;
	grid-template-columns: repeat(6, 1fr);
	gap: 8px;
}

.pin-slots span {
	height: 52px;
	border-radius: 14px;
	border: 1px solid var(--line);
	background: rgba(255, 255, 255, 0.72);
	color: var(--text);
	font-size: 22px;
	font-weight: 600;
	letter-spacing: 0;
	display: flex;
	align-items: center;
	justify-content: center;
}

.pin-slots span.filled {
	border-color: rgba(130, 34, 41, 0.35);
	background: #fff;
}

.pin-wrap input {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	opacity: 0;
	border: 0;
	font-size: 24px;
	letter-spacing: 1.6rem;
	text-align: center;
}

button {
	appearance: none;
	width: 100%;
	min-height: 44px;
	padding: 15px 22px;
	border: 0;
	border-radius: 980px;
	background: var(--accent);
	color: #fff;
	font-family: inherit;
	font-size: 17px;
	font-weight: 600;
	letter-spacing: -0.01em;
	cursor: pointer;
	touch-action: manipulation;
	-webkit-tap-highlight-color: rgba(130, 34, 41, 0.18);
}

button:active {
	background: var(--accent-press);
}

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

.error {
	color: var(--err);
	margin: 14px 0 0;
	font-size: 14px;
}

.stage {
	position: relative;
	height: 100%;
	min-height: 100svh;
	min-height: 100dvh;
	overflow: hidden;
	background: #000;
}

.stage:fullscreen,
.stage:-webkit-full-screen {
	width: 100%;
	height: 100%;
	background: #000;
}

html.is-fs,
html.is-fs body,
html.is-fs .page {
	height: 100%;
	height: 100svh;
	height: 100dvh;
	overflow: hidden;
}

.stage.is-fs {
	position: fixed;
	inset: 0;
	z-index: 2147483646;
	width: 100vw;
	height: 100dvh;
	background: #000;
}

.stage.is-idle .island,
.stage.is-idle .dock {
	opacity: 0;
	pointer-events: none;
}

.stage.is-idle .back-corner,
.stage.is-idle .fs-corner {
	opacity: 1;
	pointer-events: auto;
}

.stage.is-idle {
	cursor: none;
}

.island,
.dock {
	transition: opacity 0.25s ease;
}

video {
	position: relative;
	z-index: 0;
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
	background: #000;
}

.island {
	position: absolute;
	z-index: 2;
	top: calc(max(16px, env(safe-area-inset-top)) + 56px);
	left: 12px;
	right: 12px;
	transform: none;
	display: flex;
	align-items: center;
	gap: 10px;
	max-width: none;
	width: auto;
	padding: 8px 16px 8px 10px;
	border-radius: 22px;
	background: rgba(28, 46, 43, 0.72);
	color: #f5f1ea;
	border: 1px solid rgba(255, 255, 255, 0.14);
	font-size: 14px;
	font-weight: 500;
}

.back-corner,
.fs-corner {
	position: absolute;
	z-index: 6;
	top: max(16px, env(safe-area-inset-top));
	right: 12px;
	width: auto;
	min-width: 96px;
	min-height: 44px;
	padding: 10px 16px;
	border-radius: 980px;
	background: rgba(255, 252, 247, 0.94);
	color: var(--accent);
	font-size: 15px;
	font-weight: 600;
	touch-action: manipulation;
	-webkit-tap-highlight-color: rgba(130, 34, 41, 0.25);
}

.back-corner {
	left: 12px;
	right: auto;
}

.island-text {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 1px;
	min-width: 0;
}

.stats {
	font-size: 12px;
	font-weight: 500;
	font-variant-numeric: tabular-nums;
	letter-spacing: 0.01em;
	color: rgba(245, 241, 234, 0.78);
	white-space: nowrap;
}

.dock {
	position: absolute;
	z-index: 2;
	left: 0;
	right: 0;
	bottom: 0;
	display: flex;
	justify-content: center;
	flex-wrap: wrap;
	gap: 10px;
	padding: 0 20px calc(max(22px, env(safe-area-inset-bottom)) + 72px);
	background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.45));
}

.dock button {
	width: auto;
	min-width: 110px;
	min-height: 44px;
	background: rgba(255, 252, 247, 0.92);
	color: var(--accent);
	touch-action: manipulation;
	-webkit-tap-highlight-color: rgba(130, 34, 41, 0.25);
}

.dock button:active {
	background: #fff;
}

.home {
	min-height: 100svh;
	min-height: 100dvh;
	padding: 0;
	overflow-x: hidden;
	background: var(--green-archive);
}

.home-bar {
	position: -webkit-sticky;
	position: sticky;
	top: 0;
	z-index: 10;
	display: grid;
	grid-template-columns: minmax(max-content, 1fr) auto minmax(max-content, 1fr);
	align-items: center;
	column-gap: 10px;
	margin: 0;
	padding: calc(env(safe-area-inset-top, 0px) + 8px) max(16px, env(safe-area-inset-right, 0px)) 12px max(16px, env(safe-area-inset-left, 0px));
	background: var(--brand-red);
	box-shadow: 0 1px 0 rgba(0, 0, 0, 0.18), 0 -100px 0 0 var(--brand-red);
}

.home-title {
	display: none;
}

.home-bar-balance,
.home-bar button {
	width: auto;
	min-width: 44px;
	min-height: 44px;
	padding: 10px 14px;
	border: 1px solid rgba(255, 255, 255, 0.38);
	flex-shrink: 0;
	white-space: nowrap;
	font: inherit;
	line-height: 1;
}

.home-bar-balance {
	grid-column: 1;
	justify-self: start;
	visibility: hidden;
	pointer-events: none;
	user-select: none;
	color: transparent;
	background: transparent;
}

.home-bar button {
	grid-column: 3;
	justify-self: end;
	background: transparent;
	color: #fff;
	touch-action: manipulation;
}

.mark-home {
	display: block;
	grid-column: 1;
	justify-self: start;
	width: auto;
	height: 40px;
	max-height: 44px;
}

.mark-home-center {
	display: block;
	grid-column: 2;
	justify-self: center;
	width: auto;
	height: 42px;
	max-height: 48px;
	max-width: min(168px, 38vw);
	object-fit: contain;
}

.home-hero,
.home-split,
.library {
	width: 100%;
	max-width: none;
	margin-left: 0;
	margin-right: 0;
	padding-left: max(20px, env(safe-area-inset-left, 0px));
	padding-right: max(20px, env(safe-area-inset-right, 0px));
}

.home-hero {
	padding-top: 20px;
	padding-bottom: 28px;
	text-align: center;
	background: var(--green-live);
	color: var(--on-dark);
}

.home-hero > *,
.library > * {
	max-width: 1080px;
	margin-left: auto;
	margin-right: auto;
}

.live-heading {
	margin: 0 0 12px;
	font-family: var(--display);
	font-size: clamp(20px, 4.2vw, 28px);
	font-weight: 600;
	letter-spacing: -0.02em;
	line-height: 1.15;
	color: var(--on-dark);
}

.live-wrap {
	position: relative;
	width: 100%;
	aspect-ratio: 16 / 9;
	max-height: min(62vh, 720px);
	margin: 0 auto;
	overflow: hidden;
	border-radius: 18px;
	background: #111;
}

.live-wrap video {
	width: 100%;
	height: 100%;
	object-fit: contain;
	background: #111;
}

.live-status {
	position: absolute;
	left: 12px;
	bottom: 48px;
	z-index: 2;
	margin: 0;
	padding: 6px 10px;
	border-radius: 8px;
	background: rgba(0, 0, 0, 0.45);
	color: #fff;
	font-size: 13px;
	line-height: 1.2;
	pointer-events: none;
}

.live-status[hidden] {
	display: none;
}

.live-wrap .offline-board {
	padding: 24px 20px;
	border-radius: 18px;
}

.live-wrap .offline-board img {
	width: min(140px, 36vw);
	margin-bottom: 16px;
}

.live-wrap .offline-board p {
	font-size: clamp(20px, 4.6vw, 32px);
}

.live-wrap.is-offline {
	background: var(--cream);
}

.live-wrap.is-offline video,
.live-wrap.is-offline .live-status {
	opacity: 0;
	pointer-events: none;
}

.home-split {
	display: none;
}

.home-hint {
	margin: 0 0 16px;
	color: var(--on-dark-muted);
	font-size: 14px;
	line-height: 1.45;
	text-align: center;
}

.rec-switch {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 10px;
	min-height: 44px;
	padding: 6px 4px 6px 0;
	cursor: pointer;
	user-select: none;
	-webkit-user-select: none;
	touch-action: manipulation;
	-webkit-tap-highlight-color: transparent;
}

.rec-switch input {
	position: absolute;
	inset: 0;
	z-index: 1;
	width: 100%;
	height: 100%;
	margin: 0;
	opacity: 0.01;
	cursor: pointer;
}

.rec-switch-ui {
	position: relative;
	flex-shrink: 0;
	width: 52px;
	height: 32px;
	border-radius: 980px;
	background: rgba(255, 255, 255, 0.22);
	transition: background 0.2s ease;
}

.rec-switch-ui::after {
	content: "";
	position: absolute;
	top: 3px;
	left: 3px;
	width: 26px;
	height: 26px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 4px rgba(28, 46, 43, 0.25);
	transition: transform 0.2s ease;
}

.rec-switch input:checked + .rec-switch-ui {
	background: var(--accent);
}

.rec-switch input:checked + .rec-switch-ui::after {
	transform: translateX(20px);
}

.rec-switch input:focus-visible + .rec-switch-ui {
	outline: 2px solid var(--accent);
	outline-offset: 3px;
}

.rec-switch-label {
	font-size: 16px;
	font-weight: 600;
	color: var(--on-dark);
}

.library {
	padding-top: 24px;
	padding-bottom: max(32px, env(safe-area-inset-bottom, 0px));
	background: var(--green-archive);
	color: var(--on-dark);
}

.library-head {
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 0 0 16px;
	text-align: center;
}

.library-title {
	min-width: 0;
	text-align: center;
}

.library h2 {
	margin: 0;
	font-family: var(--display);
	font-size: 26px;
	font-weight: 400;
}

#rec-usage {
	margin: 4px 0 0;
	color: var(--on-dark-muted);
	font-size: 13px;
	font-variant-numeric: tabular-nums;
	letter-spacing: 0.01em;
}

.library-head .rec-switch {
	flex-shrink: 0;
	margin: 0;
	padding: 6px 0;
}

.rec-grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 16px;
}

.rec-grid > * {
	min-width: 0;
}

.rec-card {
	position: relative;
	display: block;
	width: 100%;
	min-height: 44px;
	padding: 0;
	border: 1px solid var(--line);
	border-radius: 22px;
	background: #fff;
	color: var(--text);
	text-align: left;
	min-width: 0;
	overflow: hidden;
	box-shadow: 0 10px 30px rgba(28, 46, 43, 0.06);
	transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.rec-open {
	display: block;
	width: 100%;
	min-height: 44px;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: transparent;
	color: inherit;
	text-align: left;
	touch-action: manipulation;
	-webkit-tap-highlight-color: rgba(130, 34, 41, 0.12);
}

.rec-open:active {
	background: transparent;
}

.rec-del {
	position: absolute;
	top: 10px;
	right: 10px;
	z-index: 2;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	min-width: 44px;
	height: 44px;
	min-height: 44px;
	padding: 0;
	border-radius: 50%;
	background: rgba(255, 252, 247, 0.94);
	color: var(--accent);
	box-shadow: 0 4px 14px rgba(28, 46, 43, 0.16);
	touch-action: manipulation;
	-webkit-tap-highlight-color: rgba(130, 34, 41, 0.25);
}

.rec-del:focus-visible {
	outline: none;
	box-shadow: 0 0 0 2px var(--cream), 0 0 0 4px var(--accent);
}

.rec-del:active {
	background: #fff;
}

.rec-del svg {
	display: block;
	width: 18px;
	height: 18px;
	margin: 0 auto;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.rec-card.is-live {
	border-color: rgba(130, 34, 41, 0.28);
}

.rec-card.is-live .rec-meta span {
	color: var(--accent);
	font-weight: 600;
}

.rec-thumb:not([src]),
.rec-thumb[src=""] {
	background: var(--hero);
}

.rec-card:active {
	background: #fff;
}

.rec-thumb {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
	object-fit: cover;
	background: var(--hero);
	pointer-events: none;
	-webkit-user-drag: none;
	user-select: none;
}

.rec-meta {
	padding: 14px 16px 16px;
	pointer-events: none;
}

.rec-meta strong {
	display: block;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-size: 16px;
	font-weight: 600;
	letter-spacing: -0.01em;
}

.rec-meta span {
	display: block;
	margin-top: 4px;
	color: var(--muted);
	font-size: 13px;
}

.vod video {
	cursor: default;
}

.offline-board {
	position: absolute;
	inset: 0;
	z-index: 3;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: max(88px, env(safe-area-inset-top, 0px)) 28px max(40px, env(safe-area-inset-bottom, 0px));
	background: var(--cream);
	color: var(--text);
	text-align: center;
}

.offline-board[hidden] {
	display: none;
}

.offline-board img {
	width: min(200px, 52vw);
	height: auto;
	margin: 0 0 28px;
}

.offline-board p {
	margin: 0;
	max-width: 11em;
	font-family: var(--display);
	font-size: clamp(26px, 6.4vw, 42px);
	font-weight: 400;
	letter-spacing: -0.02em;
	line-height: 1.2;
}

.stage.is-offline {
	background: var(--cream);
}

.stage.is-offline video,
.stage.is-offline .island,
.stage.is-offline .dock {
	opacity: 0;
	pointer-events: none;
}

.stage.is-offline .back-corner,
.stage.is-offline .fs-corner {
	opacity: 1;
	pointer-events: auto;
}

.vod .island {
	left: max(12px, env(safe-area-inset-left));
	right: max(12px, env(safe-area-inset-right));
	pointer-events: none;
}

.vod .island-text,
#vod-status {
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.vod .dock {
	bottom: calc(48px + env(safe-area-inset-bottom));
	padding: 0 max(20px, env(safe-area-inset-right)) 8px max(20px, env(safe-area-inset-left));
	background: none;
	pointer-events: none;
}

.vod .dock button {
	pointer-events: auto;
}

@media (hover: hover) and (pointer: fine) {
	.home-bar button:hover {
		background: rgba(255, 255, 255, 0.12);
	}

	.rec-card:hover {
		transform: translateY(-2px);
		box-shadow: 0 16px 40px rgba(28, 46, 43, 0.1);
		border-color: rgba(130, 34, 41, 0.22);
		background: #fff;
	}

	.rec-del:hover {
		background: #fff;
	}
}

@media (min-width: 768px) {
	.rec-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.gate {
		justify-content: center;
	}

	.home-bar,
	.home-hero,
	.home-split,
	.library {
		padding-left: max(32px, env(safe-area-inset-left, 0px));
		padding-right: max(32px, env(safe-area-inset-right, 0px));
	}
}

@media (min-width: 1024px) {
	.rec-grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (max-width: 640px) {
	.home-bar {
		column-gap: 8px;
	}

	.mark-home {
		height: 32px;
	}

	.mark-home-center {
		height: 34px;
		max-width: min(132px, 36vw);
	}

	.home-bar-balance,
	.home-bar button {
		padding: 8px 10px;
		font-size: 14px;
	}
}

@media (max-width: 420px) {
	.card {
		padding: 28px 18px 24px;
		border-radius: 24px;
	}

	.pin-slots {
		gap: 6px;
	}

	.pin-slots span {
		height: 46px;
		border-radius: 12px;
		font-size: 20px;
	}

	.library-head {
		flex-wrap: nowrap;
		gap: 10px;
	}

	.library h2 {
		font-size: 20px;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}

	.library-head .rec-switch {
		gap: 8px;
	}

	.rec-switch-label {
		font-size: 15px;
	}

	.mark-home {
		width: auto;
		height: 32px;
	}

	.mark-home-center {
		height: 32px;
		max-width: min(120px, 34vw);
	}

	.home-bar {
		padding-left: max(12px, env(safe-area-inset-left, 0px));
		padding-right: max(12px, env(safe-area-inset-right, 0px));
	}

	.home-bar-balance,
	.home-bar button {
		padding: 8px 10px;
		font-size: 14px;
	}

	.home-split {
		height: 20px;
		margin-top: 4px;
		margin-bottom: 12px;
	}
}

@media (max-height: 560px) {
	.gate {
		padding-top: max(12px, env(safe-area-inset-top));
		justify-content: flex-start;
	}
}

.del-overlay {
	position: fixed;
	top: var(--vv-top, 0px);
	left: 0;
	right: 0;
	bottom: auto;
	height: var(--vv-height, 100dvh);
	z-index: 40;
	display: flex;
	align-items: flex-start;
	justify-content: center;
	overflow-x: hidden;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	overscroll-behavior: contain;
	padding: max(12px, env(safe-area-inset-top, 0px)) max(20px, env(safe-area-inset-right, 0px)) max(12px, env(safe-area-inset-bottom, 0px)) max(20px, env(safe-area-inset-left, 0px));
	background: rgba(28, 46, 43, 0.42);
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
}

.del-card {
	width: min(400px, 100%);
	margin-top: max(12px, 6vh);
	margin-bottom: 24px;
	flex-shrink: 0;
	padding: 28px 24px 24px;
	text-align: center;
	background: var(--paper);
	border: 1px solid rgba(255, 255, 255, 0.55);
	border-radius: 28px;
	box-shadow: 0 24px 80px rgba(28, 46, 43, 0.28);
	backdrop-filter: blur(28px) saturate(1.4);
	-webkit-backdrop-filter: blur(28px) saturate(1.4);
}

.del-card h2 {
	margin: 0 0 8px;
	font-family: var(--display);
	font-size: 26px;
	font-weight: 400;
}

.del-card .lead {
	margin-bottom: 20px;
	font-size: 15px;
}

.del-actions {
	display: flex;
	gap: 10px;
}

.del-actions button {
	flex: 1;
	min-width: 0;
	white-space: nowrap;
}

#del-cancel {
	background: transparent;
	color: var(--accent);
	border: 1px solid var(--line);
}

#del-cancel:active {
	background: rgba(130, 34, 41, 0.06);
}
