:root {
	--bg-0: #061214;
	--bg-1: #0a1f24;
	--bg-2: #0e2a30;
	--bg-3: #123840;
	--border: #1d4e58;
	--teal: #14f0c8;
	--teal-dim: #0fb39a;
	--teal-glow: rgba(20, 240, 200, 0.55);
	--text: #d8f4ef;
	--text-dim: #7fb3ab;
	--text-faint: #4f7d78;
	--code-bg: #04191c;
	--accent-warn: #ffb347;
	--accent-error: #ff5c5c;
}

* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
	-webkit-tap-highlight-color: transparent;
}

html, body {
	height: 100%;
	overflow: hidden;
}

body {
	font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
	font-size: 12px;
	line-height: 1.5;
	background-color: var(--bg-0);
	color: var(--text);
	display: flex;
	flex-direction: column;
	align-items: center;
}

.app {
	width: 100%;
	max-width: 480px;
	height: 100vh;
	background-color: var(--bg-0);
	display: flex;
	flex-direction: column;
	position: relative;
	box-shadow: 0 0 40px rgba(0, 0, 0, 0.6);
	overflow: hidden;
}

.top-bar {
	flex-shrink: 0;
	padding: 4px 8px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	border-bottom: 1px solid var(--border);
	background-color: var(--bg-0);
	z-index: 10;
}

.top-bar h1 {
	font-size: 20px;
	font-weight: 700;
	letter-spacing: -0.3px;
	color: var(--teal);
	text-shadow: 0 0 12px var(--teal-glow);
	display: flex;
	align-items: center;
	gap: 6px;
}

.top-bar h1 i {
	font-size: 18px;
	color: var(--teal);
	text-shadow: 0 0 12px var(--teal-glow);
}

.icon-btn {
	background: transparent;
	border: none;
	color: var(--text-dim);
	font-size: 22px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	transition: background 0.2s;
	cursor: pointer;
}

.icon-btn:active {
	background: var(--bg-2);
}

.profile-block {
	flex-shrink: 0;
	display: flex;
	align-items: flex-start;
	gap: 14px;
	padding: 14px 16px 16px;
	background-color: var(--bg-0);
	border-bottom: 1px solid var(--border);
}

.avatar {
	flex-shrink: 0;
	width: 72px;
	height: 72px;
	border-radius: 50%;
	background: linear-gradient(145deg, var(--bg-2), var(--teal-dim));
	border: 2px solid var(--teal);
	box-shadow: 0 0 12px -2px var(--teal-glow);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 30px;
	color: var(--bg-0);
}

.profile-info {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.profile-name {
	display: flex;
	flex-direction: column;
	gap: 0;
	margin-bottom: 6px;
}

.nickname {
	font-size: 15px;
	font-weight: 700;
	color: var(--text);
	letter-spacing: 0.02em;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	line-height: 1.2;
}

.username {
	font-size: 11.5px;
	color: var(--text-dim);
	letter-spacing: 0.02em;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	line-height: 1.3;
}

.stats-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 18px;
	margin-top: 4px;
}

.stat {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 1px;
}

.stat-value {
	font-size: 11px;
	font-weight: 700;
	color: var(--text);
	font-variant-numeric: tabular-nums;
	letter-spacing: 0.01em;
	line-height: 1.2;
}

.stat-label {
	font-size: 9px;
	color: var(--text-faint);
	text-transform: uppercase;
	letter-spacing: 0.1em;
	font-weight: 700;
}

.tab-bar {
	flex-shrink: 0;
	display: flex;
	border-bottom: 1px solid var(--border);
	background-color: var(--bg-0);
	z-index: 9;
	padding: 0;
}

.tab-btn {
	flex: 1;
	background: transparent;
	border: none;
	color: var(--text-faint);
	font-family: inherit;
	font-size: 16px;
	padding: 14px 0;
	cursor: pointer;
	position: relative;
	transition: color 0.18s ease;
	display: flex;
	align-items: center;
	justify-content: center;
}

.tab-btn:hover {
	color: var(--text-dim);
}

.tab-btn.active {
	color: var(--teal);
	text-shadow: 0 0 10px var(--teal-glow);
}

.tab-btn.active::after {
	content: "";
	position: absolute;
	left: 20%;
	right: 20%;
	bottom: 0;
	height: 2px;
	background: var(--teal);
	box-shadow: 0 0 8px var(--teal-glow);
	border-radius: 1px;
}

.tab-panels {
	flex: 1;
	min-height: 0;
	position: relative;
}

.tab-panel {
	position: absolute;
	inset: 0;
	display: none;
	flex-direction: column;
	overflow-y: auto;
	overflow-x: hidden;
	scrollbar-width: thin;
	scrollbar-color: var(--teal-dim) transparent;
}

.tab-panel.active {
	display: flex;
}

.tab-panel::-webkit-scrollbar {
	width: 4px;
}

.tab-panel::-webkit-scrollbar-thumb {
	background: var(--teal-dim);
	border-radius: 2px;
}

.grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 2px;
	background-color: var(--bg-0);
	flex: 1;
	padding: 0;
	width: 100%;
	position: relative;
}

.grid-item {
	position: relative;
	aspect-ratio: 9 / 16;
	background-color: var(--bg-3);
	overflow: hidden;
	cursor: pointer;
	border-radius: 0;
	transition: opacity 0.15s;
	content-visibility: auto;
	contain-intrinsic-size: 160px 284px;
}

.grid-item:active {
	opacity: 0.75;
}

.thumb {
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 32px;
	font-weight: 600;
	color: var(--text);
	background-size: cover;
	background-position: center;
	position: relative;
	text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}

.thumb::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(to bottom, transparent 60%, rgba(0, 0, 0, 0.5));
	pointer-events: none;
}

.view-count {
	position: absolute;
	bottom: 6px;
	left: 6px;
	display: flex;
	align-items: center;
	gap: 4px;
	background: rgba(4, 25, 28, 0.72);
	backdrop-filter: blur(4px);
	padding: 3px 6px 3px 4px;
	border-radius: 12px;
	font-size: 11px;
	font-weight: 500;
	color: var(--text);
	letter-spacing: 0.2px;
	z-index: 2;
	line-height: 1.2;
}

.view-count i {
	font-size: 9px;
	color: var(--teal);
	text-shadow: 0 0 6px var(--teal-glow);
}

.bottom-nav {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: space-around;
	padding: 4px 8px;
	background-color: var(--bg-0);
	border-top: 1px solid var(--border);
	z-index: 10;
}

.nav-item {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 3px;
	color: var(--text-faint);
	font-size: 11px;
	font-weight: 500;
	transition: color 0.2s;
	background: none;
	border: none;
	padding: 4px 8px;
	border-radius: 30px;
	font-family: inherit;
	cursor: pointer;
	text-decoration: none;
}

.nav-item.active {
	color: var(--text);
}

.nav-item.active .nav-icon {
	color: var(--teal);
	text-shadow: 0 0 10px var(--teal-glow);
}

.nav-icon {
	font-size: 20px;
	line-height: 1;
}

.create-btn {
	background-color: var(--teal);
	color: var(--bg-0);
	width: 48px;
	height: 32px;
	border-radius: 12px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 16px;
	box-shadow: 0 0 14px var(--teal-glow);
	border: 1px solid var(--teal);
	cursor: pointer;
	transition: transform 0.15s;
}

.create-btn:active {
	transform: scale(0.92);
}

.bg-1 {
	background: linear-gradient(145deg, #0a1f24, #0fb39a, #14f0c8);
}

.bg-2 {
	background: linear-gradient(145deg, #061214, #123840, #0fb39a);
}

.bg-3 {
	background: linear-gradient(145deg, #0e2a30, #14f0c8, #0a1f24);
}

.bg-4 {
	background: linear-gradient(145deg, #04191c, #1d4e58, #0fb39a);
}

.bg-5 {
	background: linear-gradient(145deg, #0a1f24, #0fb39a, #123840);
}

.bg-6 {
	background: linear-gradient(145deg, #123840, #14f0c8, #061214);
}

.bg-7 {
	background: linear-gradient(145deg, #0e2a30, #0fb39a, #04191c);
}

.bg-8 {
	background: linear-gradient(145deg, #061214, #14f0c8, #1d4e58);
}

.bg-9 {
	background: linear-gradient(145deg, #0a1f24, #0fb39a, #0e2a30);
}

.bg-10 {
	background: linear-gradient(145deg, #04191c, #14f0c8, #123840);
}

.bg-11 {
	background: linear-gradient(145deg, #123840, #0fb39a, #061214);
}

.bg-12 {
	background: linear-gradient(145deg, #0e2a30, #14f0c8, #0a1f24);
}

.thumb i {
	display: none;
}

.thumb img {
	width: 100%;
	height: 100%;
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
}

.thumb::after {
	content: "";
	position: absolute;
	inset: 0;
	pointer-events: none;
	z-index: 2;
}

.thumb.tiktok-fade::after {
	background: linear-gradient(to bottom, transparent 55%, rgba(6, 18, 20, 0.55) 85%, rgba(6, 18, 20, 0.85) 100%);
}

.posted-date {
	position: absolute;
	top: 6px;
	right: 6px;
	font-size: 10px;
	font-weight: 600;
	color: var(--text-dim);
	background: rgba(4, 25, 28, 0.72);
	backdrop-filter: blur(4px);
	padding: 2px 6px;
	border-radius: 8px;
	z-index: 2;
	letter-spacing: 0.02em;
	line-height: 1.2;
	text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

.avatar img {
	width: 68px;
	height: 68px;
	object-fit: contain;
	border-radius: 50%;
}

#panel-private {
	overflow: hidden;
	position: relative!important;
	height: 100%!important;
}

/* ── Loading indicators ──────────────────────────────── */
.grid-loading {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 12px;
	color: var(--teal);
	font-size: 10px;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	font-weight: 700;
	pointer-events: none;
	background: var(--bg-0);
	z-index: 2;
}

.grid-loading i {
	font-size: 32px;
	color: var(--teal);
	text-shadow: 0 0 20px var(--teal-glow);
	animation: player-spin 0.9s linear infinite;
}

.grid-load-more {
	grid-column: 1 / -1;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 16px 0;
	color: var(--teal);
	font-size: 10px;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	font-weight: 700;
}

.grid-load-more i {
	font-size: 16px;
	animation: player-spin 0.9s linear infinite;
}

.grid-load-more.is-error {
	color: var(--accent-error);
}

.grid-load-more.is-error i {
	animation: none;
}

.player-overlay {
	position: absolute;
	inset: 0;
	z-index: 9999;
	background: #000;
	display: none;
	flex-direction: column;
	overflow: hidden;
	padding-top: env(safe-area-inset-top);
	padding-bottom: env(safe-area-inset-bottom);
}

.player-overlay.active {
	display: flex;
}

.player-stage {
	flex: 1;
	min-height: 0;
	position: relative;
	background: #000;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
}

.player-stage video {
	width: 100%;
	height: 100%;
	object-fit: contain;
	background: #000;
	outline: none;
}

.player-stage::after {
	content: "";
	position: absolute;
	inset: 0;
	pointer-events: none;
	box-shadow: inset 0 0 120px rgba(20, 240, 200, 0.06);
}

.player-top {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	padding: calc(env(safe-area-inset-top) + 10px) 12px 28px;
	display: flex;
	align-items: center;
	gap: 10px;
	background: linear-gradient(to bottom, rgba(0,0,0,0.72), transparent);
	z-index: 4;
	pointer-events: none;
}

.player-top > * {
	pointer-events: auto;
}

.player-close {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	border: 1px solid var(--border);
	background: rgba(6, 18, 20, 0.6);
	backdrop-filter: blur(6px);
	color: var(--teal);
	font-size: 20px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	text-shadow: 0 0 10px var(--teal-glow);
}

.player-close:active {
	transform: scale(0.94);
}

.player-title {
	flex: 1;
	min-width: 0;
	color: var(--text);
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.02em;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	text-shadow: 0 1px 6px rgba(0,0,0,0.8);
}

.player-size {
	flex-shrink: 0;
	font-size: 11px;
	font-weight: 600;
	color: var(--text-dim);
	letter-spacing: 0.02em;
	padding: 4px 8px;
	border: 1px solid var(--border);
	border-radius: 10px;
	background: rgba(6, 18, 20, 0.55);
	backdrop-filter: blur(6px);
	text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8);
	white-space: nowrap;
}

.player-rail {
	position: absolute;
	right: 10px;
	bottom: 100px;
	display: flex;
	flex-direction: column;
	gap: 18px;
	z-index: 4;
}

.rail-btn {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 3px;
	background: none;
	border: none;
	color: var(--text);
	font-family: inherit;
	font-size: 10px;
	cursor: pointer;
	text-shadow: 0 1px 6px rgba(0,0,0,0.8);
}

.rail-btn i {
	font-size: 26px;
	color: var(--text);
	transition: color 0.15s, transform 0.15s;
}

.rail-btn:active i {
	transform: scale(0.9);
}

.rail-btn.is-active i {
	color: var(--teal);
	text-shadow: 0 0 12px var(--teal-glow);
}

.rail-count {
	font-variant-numeric: tabular-nums;
	font-weight: 600;
	color: var(--text);
}

.player-meta {
	position: absolute;
	left: 12px;
	right: 80px;
	bottom: 28px;
	z-index: 4;
	color: var(--text);
	text-shadow: 0 1px 6px rgba(0,0,0,0.8);
	pointer-events: none;
}

.player-author {
	font-size: 14px;
	font-weight: 700;
	color: var(--teal);
	letter-spacing: 0.02em;
	text-shadow: 0 0 12px var(--teal-glow);
	margin-bottom: 4px;
}

.player-caption {
	font-size: 12px;
	line-height: 1.4;
	color: var(--text-dim);
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.player-pause-ind {
	position: absolute;
	inset: 0;
	display: none;
	align-items: center;
	justify-content: center;
	background: rgba(0,0,0,0.25);
	z-index: 3;
	pointer-events: none;
}

.player-pause-ind.show {
	display: flex;
}

.player-pause-ind i {
	font-size: 64px;
	color: var(--teal);
	opacity: 0.9;
	text-shadow: 0 0 30px var(--teal-glow);
}

.player-loading {
	position: absolute;
	inset: 0;
	display: none;
	align-items: center;
	justify-content: center;
	z-index: 2;
}

.player-loading.show {
	display: flex;
}

.player-loading i {
	font-size: 36px;
	color: var(--teal);
	text-shadow: 0 0 20px var(--teal-glow);
	animation: player-spin 0.9s linear infinite;
}

@keyframes player-spin {
	to {
		transform: rotate(360deg);
	}
}

.grid-item {
	cursor: pointer;
}

.grid-item::before {
	content: "\f04b";
	font-family: "Font Awesome 6 Free";
	font-weight: 900;
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 20px;
	color: rgba(20, 240, 200, 0.35);
	transition: color 0.18s;
	z-index: 1;
	pointer-events: none;
}

.grid-item:hover::before {
	color: rgba(20, 240, 200, 0.85);
	font-size: 26px;
}

body.player-open {
	overflow: hidden;
}

[hidden] {
	display: none!important;
}

.grid {
	gap: 8px;
}

.grid-item {
	border-radius: 8px;
}

.view-count {
	display: none!important;
}

.posted-date {
	top: auto;
	bottom: 6px;
}

.stat {
	align-items: center;
}

body.player .profile-block, body.player .bottom-nav {
	display: none;
}
