@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500&display=swap");

:root {
	--bg-main: #000000;
	--bg-alt: #000000;
	--bg-hover: #1d1d1d;
	--text-main: #f9f9fa;
	--text-muted: #b1b1b3;
	--accent-main: #1a56db;
	--accent-alt: #1b1b1b;
	--border-main: #1a56db;
	--top-h: 52px;
	--tab-h: 2.5rem;
	--sb-w: 76px;
}

*,
*::before,
*::after {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
	font-family: 'Inter', sans-serif;
}

html,
body {
	height: 100%;
}

body {
	background: var(--bg-main);
	color: var(--text-main);
	overflow: hidden;
	display: flex;
	flex-direction: column;
	height: 100vh;
}

.nav-ctrl .sci {
	font-size: 1.25rem;
}

.nav-icon .sci {
	font-size: 1.75rem;
}

a {
	color: var(--text-muted);
	text-decoration: none;
	transition: color 0.2s ease;
}

a:hover {
	color: var(--text-main);
}

/* ── Tab bar ── */
#tab-bar {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	height: var(--tab-h);
	background: var(--bg-main);
	border-bottom: 1px solid var(--border-main);
	z-index: 40;
}

#tabs-wrapper {
	width: 100%;
	display: flex;
	align-items: flex-end;
	height: 2.5rem;
	overflow: hidden;
	position: relative;
}

.tabs {
	flex: 1;
	overflow-x: auto;
	white-space: nowrap;
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	align-items: flex-end;
	scrollbar-width: none;
	position: relative;
	overflow-y: hidden;
}

.tabs::-webkit-scrollbar { display: none; }

.tabs li.tab {
	display: flex;
	align-items: center;
	line-height: 1rem;
	padding: 0.5rem 0 0.5rem 0.625rem;
	border-radius: 0.375rem 0.375rem 0 0;
	margin: 0 0.125rem -0.0625rem 0;
	border: 1px solid var(--border-main);
	border-bottom: none;
	cursor: pointer;
	flex: 1 1 0;
	max-width: 14rem;
	min-width: 5rem;
	text-overflow: ellipsis;
	overflow: hidden;
	white-space: nowrap;
	transition: min-width 0.2s, background-color 0.2s ease, color 0.2s ease;
	background: var(--bg-main);
	color: var(--text-main);
	font-family: 'Inter', sans-serif;
	font-size: 0.72rem;
}

.tabs li.tab:hover { background: var(--bg-hover); color: var(--text-main); }

.tabs li.tab.active {
	background: var(--bg-main);
	border: 1px solid var(--border-main);
	border-bottom: 1px solid var(--bg-main);
	color: var(--text-main);
	box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.1);
}

.tabs li.tab .tab-close { flex-shrink: 0; flex-grow: 0; }

.tabs li.tab .tab-title {
	flex: 1;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.tab .tab-close {
	cursor: pointer;
	font-size: 1.1rem;
	padding: 0 0.3rem 0 0.4rem;
	color: var(--text-muted);
	transition: color 0.2s ease;
	display: flex;
	align-items: center;
	flex-shrink: 0;
	align-self: stretch;
}

.tab .tab-close:hover { color: var(--text-main); }

.tabs .new-tab-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	line-height: 1rem;
	padding: 0.5rem;
	background: var(--bg-main);
	border: none;
	color: var(--text-muted);
	cursor: pointer;
	flex: 0 0 auto;
	min-width: auto;
	margin: 0 0.125rem -0.0625rem 0;
	position: sticky;
	right: 0;
	z-index: 1;
	transition: color 0.2s ease;
	transform: translateY(-0.25vh);
	font-size: 1.4rem;
}

.tabs .new-tab-btn:hover { color: var(--text-main); }

/* ── Top bar (full width) ── */
.top-bar {
	position: fixed;
	top: var(--tab-h);
	left: 0;
	right: 0;
	height: var(--top-h);
	background: var(--bg-main);
	border-bottom: 1px solid var(--border-main);
	display: flex;
	align-items: center;
	padding: 0 0.5rem;
	gap: 0.25rem;
	z-index: 30;
	flex-shrink: 0;
}

/* Back / forward / refresh */
.nav-controls,
.top-right {
	display: flex;
	align-items: center;
	padding: 0.5rem;
}

.nav-ctrl {
	background: none;
	border: none;
	color: var(--text-muted);
	cursor: pointer;
	padding: 0.5rem;
	border-radius: 0.375rem;
	transition: color 0.2s ease, background 0.2s ease;
	line-height: 1;
}

.nav-ctrl:hover {
	color: var(--text-main);
	background: var(--bg-hover);
}

/* Gradient URL bar */
.url-form {
	flex: 1;
	min-width: 0;
	margin: 0 0.25rem;
}

.url-wrap {
	display: flex;
	align-items: center;
	background: #0d0d0d;
	border: 1px solid var(--border-main);
	border-radius: 0.5rem;
	padding: 0.5rem;
	height: 36px;
	transition: box-shadow 0.2s ease;
}

.url-wrap:focus-within {
	box-shadow: 0 0 0 2px rgba(26, 86, 219, 0.35);
}

#url-bar {
	flex: 1;
	background: none;
	border: none;
	outline: none;
	color: var(--text-muted);
	font-family: 'Inter', sans-serif;
	font-size: 0.875rem;
	font-weight: 400;
	transition: color 0.2s ease;
}

#url-bar:focus {
	color: var(--text-main);
}

#url-bar::placeholder {
	color: var(--text-muted);
}

/* ── Sidebar (below top bar) ── */
main {
	display: flex;
	flex: 1;
	overflow: hidden;
	margin-top: calc(var(--top-h) + var(--tab-h));
}

.sidebar {
	width: var(--sb-w);
	height: 100%;
	background: var(--bg-alt);
	border-right: 1px solid var(--border-main);
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: 0.5rem 0;
	gap: 0.125rem;
	overflow-y: auto;
	overflow-x: hidden;
	scrollbar-width: thin;
	flex-shrink: 0;
	z-index: 20;
}

.nav-icon {
	width: 52px;
	height: 52px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 0.5rem;
	color: var(--text-muted);
	text-decoration: none;
	background: none;
	border: none;
	cursor: pointer;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.nav-icon:hover {
	color: var(--text-main);
	background: var(--bg-hover);
}

.nav-icon.active {
	color: var(--text-main);
	background: var(--bg-hover);
}

.nav-gap {
	flex: 1;
}

.nav-sep {
	width: 60%;
	height: 1px;
	background: var(--border-main);
	margin: 0.5rem 0;
	flex-shrink: 0;
	opacity: 0.6;
}

/* ── Content area ── */
.content-area {
	flex: 1;
	position: relative;
	overflow: hidden;
}

#content-frame,
#sj-frame {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: none;
	background: var(--bg-main);
}

/* ── Credits page (iframe content) ── */
.credits-page {
	background: var(--bg-main);
	color: var(--text-main);
	font-family: 'Inter', sans-serif;
	padding: 3rem 2.5rem;
	min-height: 100vh;
}

.credits-page h1 {
	font-size: 2.5rem;
	font-weight: 300;
	color: var(--accent-main);
	margin-bottom: 1.75rem;
	letter-spacing: 0.04em;
	text-transform: lowercase;
}

.credit {
	border-radius: 0.5rem;
	padding: 0.875rem 1rem;
	border: 1px solid rgba(255, 0, 84, 0.2);
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem;
	margin-bottom: 0.5rem;
	background: rgba(255, 0, 84, 0.04);
	transition: background 0.2s ease;
}

.credit:hover {
	background: rgba(255, 0, 84, 0.07);
}

.credit span {
	flex: 1;
	font-size: 0.9rem;
}

.credit label {
	cursor: pointer;
	color: var(--text-muted);
	font-size: 0.8rem;
	text-decoration: underline;
}

.credit a {
	color: var(--accent-main);
	font-size: 0.8rem;
}

.credit a:hover {
	text-decoration: underline;
}

.credit label::after {
	content: 'show license';
}

.credit input:checked + label::after {
	content: 'hide license';
}

.credit pre {
	display: none;
	width: 100%;
	font-size: 0.7rem;
	color: var(--text-muted);
	margin-top: 0.75rem;
	white-space: pre-wrap;
}

.credit input:checked ~ pre {
	display: block;
}

.credit input[type='checkbox'] {
	display: none;
}

hr {
	display: block;
	height: 1px;
	border: 0;
	border-top: 1px solid var(--border-main);
	margin: 1rem 0;
	padding: 0;
}
