/* color palette: #4F646F, #535674, #DEE7E7, #F4FAFF, #8EAF9D */

/* theme variables */

:root {
	--text: #1a2e36;
	--border-light: #F4FAFF;
	--border-mid: #8EAF9D;
	--border-dark: #4F646F;
	--accent: #535674;
	--accent2: #8EAF9D;
	--bg: #DEE7E7;
	--panel: #F4FAFF;
	--panel2: #DEE7E7;
	--header-bar: #4F646F;
	--titlebar-text: #F4FAFF;
	--link: #535674;
	--link-visited: #4F646F;
	--button-face: #DEE7E7;
	--button-highlight: #F4FAFF;
	--button-shadow: #4F646F;
	--scrollbar: #8EAF9D;
}

[data-theme="dark"] {
	--text: #DEE7E7;
	--border-light: #8EAF9D;
	--border-mid: #535674;
	--border-dark: #1a2e36;
	--accent: #8EAF9D;
	--accent2: #535674;
	--bg: #1a2e36;
	--panel: #253b44;
	--panel2: #1e3340;
	--header-bar: #535674;
	--titlebar-text: #F4FAFF;
	--link: #8EAF9D;
	--link-visited: #DEE7E7;
	--button-face: #2a4050;
	--button-highlight: #3a5060;
	--button-shadow: #0d1f28;
	--scrollbar: #535674;
}

/* reset */

* {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

/* scrollbar */

::-webkit-scrollbar { width: 16px; }
::-webkit-scrollbar-track { background: var(--panel2); border-left: 1px solid var(--border-mid); }
::-webkit-scrollbar-thumb {
	background: var(--scrollbar);
	border: 1px solid var(--border-dark);
	border-top-color: var(--border-light);
	border-left-color: var(--border-light);
}
::-webkit-scrollbar-button {
	background: var(--button-face);
	border: 1px solid var(--border-dark);
	border-top-color: var(--border-light);
	border-left-color: var(--border-light);
	height: 16px;
}

/* body */

body {
	font-family: 'Times New Roman', Times, serif;
	font-size: 14px;
	color: var(--text);
	background-color: var(--bg);
	padding: 18px;
	min-height: 100vh;
	transition: background-color 0.3s, color 0.3s;
}

/* window */

.window {
	max-width: 820px;
	margin: 0 auto 20px auto;
	background: var(--panel);
	border: 2px solid var(--border-dark);
	border-top-color: var(--border-light);
	border-left-color: var(--border-light);
	box-shadow: 2px 2px 0 var(--border-dark), inset 1px 1px 0 var(--button-highlight);
}

/* titlebar */

.titlebar {
	background: linear-gradient(to right, var(--header-bar), var(--accent2), var(--header-bar));
	padding: 4px 6px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 6px;
	user-select: none;
}

.titlebar-left {
	display: flex;
	align-items: center;
	gap: 6px;
	flex: 1;
	min-width: 0;
}

.titlebar-icon {
	width: 16px;
	height: 16px;
	font-size: 14px;
	flex-shrink: 0;
	line-height: 1;
}

.titlebar h1 {
	color: var(--titlebar-text);
	font-family: 'Times New Roman', Times, serif;
	font-size: 13px;
	font-weight: bold;
	letter-spacing: 0.5px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	text-shadow: 1px 1px 1px rgba(0,0,0,0.4);
}

.titlebar-buttons {
	display: flex;
	gap: 2px;
	flex-shrink: 0;
}

.win-btn {
	width: 18px;
	height: 16px;
	font-size: 9px;
	font-family: 'Times New Roman', serif;
	font-weight: bold;
	background: var(--button-face);
	border: 1px solid var(--border-dark);
	border-top-color: var(--button-highlight);
	border-left-color: var(--button-highlight);
	color: var(--text);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	line-height: 1;
}
.win-btn:active {
	border-top-color: var(--border-dark);
	border-left-color: var(--border-dark);
	border-right-color: var(--button-highlight);
	border-bottom-color: var(--button-highlight);
}

.theme-toggle {
	background: var(--button-face);
	border: 1px solid var(--border-dark);
	border-top-color: var(--button-highlight);
	border-left-color: var(--button-highlight);
	color: var(--text);
	font-family: 'Times New Roman', serif;
	font-size: 10px;
	padding: 1px 6px;
	cursor: pointer;
	white-space: nowrap;
	display: flex;
	align-items: center;
	gap: 3px;
	transition: background 0.2s;
}
.theme-toggle:hover {
	background: var(--button-highlight);
}
.theme-toggle:active {
	border-top-color: var(--border-dark);
	border-left-color: var(--border-dark);
	border-right-color: var(--button-highlight);
	border-bottom-color: var(--button-highlight);
}
.theme-toggle .toggle-icon {
	font-size: 12px;
}

/* menubar */

.menubar {
	background: var(--panel);
	border-bottom: 1px solid var(--border-mid);
	padding: 2px 4px;
	display: flex;
	gap: 2px;
	font-size: 12px;
}
.menubar span {
	padding: 2px 6px;
	cursor: default;
	color: var(--text);
}
.menubar span:hover {
	background: var(--header-bar);
	color: var(--titlebar-text);
}

/* toolbar */

.toolbar {
	background: var(--panel2);
	border-bottom: 2px solid var(--border-dark);
	border-top: 1px solid var(--border-light);
	padding: 4px 8px;
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 11px;
}
.toolbar label {
	color: var(--text);
	font-weight: bold;
	white-space: nowrap;
}
.addressbar {
	flex: 1;
	background: var(--panel);
	border: 1px solid var(--border-dark);
	border-top-color: var(--border-mid);
	border-left-color: var(--border-mid);
	padding: 2px 5px;
	font-family: 'Times New Roman', serif;
	font-size: 12px;
	color: var(--link);
}
.go-btn {
	background: var(--button-face);
	border: 1px solid var(--border-dark);
	border-top-color: var(--button-highlight);
	border-left-color: var(--button-highlight);
	padding: 2px 8px;
	font-family: 'Times New Roman', serif;
	font-size: 11px;
	font-weight: bold;
	color: var(--text);
	cursor: pointer;
}
.go-btn:active {
	border-top-color: var(--border-dark);
	border-left-color: var(--border-dark);
}

/* content layout */

.content-area {
	display: flex;
	gap: 0;
	min-height: 420px;
}

.sidebar {
	width: 150px;
	flex-shrink: 0;
	border-right: 2px solid var(--border-dark);
	border-right-color: var(--border-mid);
	background: var(--panel2);
	padding: 8px 5px;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.sidebar-box {
	background: var(--panel);
	border: 2px solid var(--border-dark);
	border-top-color: var(--button-highlight);
	border-left-color: var(--button-highlight);
	padding: 0;
}

.sidebar-box-title {
	background: linear-gradient(to right, var(--header-bar), var(--accent2));
	color: var(--titlebar-text);
	font-size: 11px;
	font-weight: bold;
	padding: 2px 5px;
	display: flex;
	align-items: center;
	gap: 4px;
	letter-spacing: 0.3px;
}

.sidebar-box nav {
	padding: 4px 3px;
}

.sidebar-box nav a {
	display: block;
	padding: 2px 5px;
	text-decoration: none;
	color: var(--link);
	font-size: 12px;
	font-family: 'Times New Roman', serif;
	border: 1px solid transparent;
	margin-bottom: 1px;
}
.sidebar-box nav a:hover {
	background: var(--bg);
	border: 1px solid var(--border-mid);
	color: var(--text);
	font-style: italic;
}
.sidebar-box nav a:visited {
	color: var(--link-visited);
}
.sidebar-box nav a::before {
	content: '✦ ';
	font-size: 9px;
	color: var(--link);
}

/* blinking */

.sidebar-blinkies {
	text-align: center;
	padding: 4px;
	display: flex;
	flex-direction: column;
	gap: 4px;
	align-items: center;
}

.blinkie {
	display: block;
	width: 100%;
	height: 22px;
	background: linear-gradient(135deg, var(--header-bar), var(--accent));
	border: 1px solid var(--border-dark);
	color: var(--titlebar-text);
	font-size: 9px;
	font-weight: bold;
	text-align: center;
	line-height: 22px;
	letter-spacing: 0.3px;
	font-family: 'Times New Roman', serif;
	animation: blink-shimmer 3s infinite;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	padding: 0 4px;
}
.blinkie:nth-child(2) { animation-delay: 1s; background: linear-gradient(135deg, var(--accent2), var(--header-bar)); color: var(--text); }
.blinkie:nth-child(3) { animation-delay: 2s; }
.blinkie:nth-child(4) { animation-delay: 1s; background: linear-gradient(135deg, var(--accent2), var(--header-bar)); color: var(--text); }

@keyframes blink-shimmer {
	0%, 90%, 100% { opacity: 1; }
	95% { opacity: 0.5; }
}

.main-panel {
	flex: 1;
	padding: 10px;
	background: var(--panel);
	display: flex;
	flex-direction: column;
	gap: 8px;
	overflow-x: hidden;
}

/* panels */

.panel {
	background: var(--panel2);
	border: 2px solid var(--border-dark);
	border-top-color: var(--button-highlight);
	border-left-color: var(--button-highlight);
	padding: 0;
}

.panel-title {
	background: linear-gradient(to right, var(--header-bar), var(--accent2), var(--panel2));
	color: var(--titlebar-text);
	font-size: 12px;
	font-weight: bold;
	padding: 3px 8px;
	display: flex;
	align-items: center;
	gap: 5px;
	letter-spacing: 0.3px;
	text-shadow: 1px 1px 0 rgba(0,0,0,0.3);
}

.panel-body {
	padding: 8px 10px;
}

.two-col {
	display: flex;
	gap: 8px;
}
.two-col .panel {
	flex: 1;
}

.full-panel {
	width: 100%;
}

/* typography */

h1, h2, h3, h4, h5, h6 {
	font-family: 'Times New Roman', Times, serif;
	color: var(--text);
	line-height: 1.3;
}

.panel-body h2 {
	font-size: 1.15rem;
	border-bottom: 1px dashed var(--border-mid);
	padding-bottom: 3px;
	margin-bottom: 5px;
	color: var(--header-bar);
}

.panel-body h3 {
	font-size: 1rem;
	color: var(--accent);
	margin: 6px 0 3px 0;
}

.panel-body h4 {
	font-size: 0.9rem;
	color: var(--accent2);
	margin: 4px 0 2px 8px;
	font-style: italic;
}

p {
	line-height: 1.5;
	margin-bottom: 6px;
	font-family: 'Times New Roman', Times, serif;
}

ul, ol {
	padding-left: 20px;
	margin: 4px 0 6px 0;
}
li {
	margin-bottom: 2px;
	line-height: 1.4;
}
li::marker {
	color: var(--accent2);
}

a {
	color: var(--link);
	text-decoration: underline;
}
a:visited {
	color: var(--link-visited);
}
a:hover, a:focus {
	font-style: italic;
	color: var(--accent);
}

strong { color: var(--accent); }
em { font-style: italic; color: var(--header-bar); }
code {
	background: var(--bg);
	border: 1px solid var(--border-mid);
	padding: 0 3px;
	font-family: 'Courier New', monospace;
	font-size: 0.85em;
	color: var(--accent);
}
s { opacity: 0.6; }
sup, sub { font-size: 0.75em; }

img { max-width: 100%; }
pre { overflow-x: auto; background: var(--bg); border: 1px solid var(--border-mid); padding: 6px; }

/* marquee */

.welcome-banner {
  background: linear-gradient(to right, var(--panel2), var(--bg), var(--panel2));
  border-top: 1px dashed var(--accent2);
  border-bottom: 1px dashed var(--accent2);
  padding: 5px 0;
  font-size: 12px;
  color: var(--accent);
  width: 100%;
  overflow: hidden;
  white-space: nowrap;
}

.marquee-track {
  display: flex;
  width: max-content;
  animation: marquee-scroll 20s linear infinite;
}

.marquee-content {
  display: inline-block;
  padding-right: 2em;
  white-space: nowrap;
}

@keyframes marquee-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* statusbar */

.statusbar {
	background: var(--panel2);
	border-top: 2px solid var(--border-mid);
	padding: 2px 8px;
	display: flex;
	gap: 8px;
	font-size: 11px;
	color: var(--text);
	align-items: center;
}
.statusbar-item {
	border: 1px solid var(--border-mid);
	border-top-color: var(--border-dark);
	border-left-color: var(--border-dark);
	padding: 0 5px;
	font-family: 'Times New Roman', serif;
}
.statusbar-item:first-child {
	flex: 1;
}
.status-dot {
	color: var(--accent2);
	animation: pulse 2s infinite;
}
@keyframes pulse {
	0%, 100% { opacity: 1; }
	50% { opacity: 0.3; }
}

/* footer */

footer {
	text-align: center;
	font-size: 11px;
	color: var(--accent);
	margin-top: 10px;
	padding: 5px;
	font-family: 'Times New Roman', serif;
}
footer a {
	color: var(--link);
	text-decoration: none;
}
footer a:hover { font-style: italic; }

/* cjk */

.cjk {
	font-family: 'MS PGothic', 'MS Gothic', 'SimSun', serif;
	font-size: 0.95em;
	color: var(--accent);
}
.station-note {
	font-size: 0.85em;
	font-style: italic;
	color: var(--accent2);
	font-weight: normal;
}

/* dark mode overrides */

[data-theme="dark"] .panel-body h2 {
	color: var(--titlebar-text);
}

/* responsive */

@media (max-width: 560px) {
	body { padding: 4px; }
	.content-area { flex-direction: column; }
	.sidebar { width: 100%; border-right: none; border-bottom: 2px solid var(--border-mid); flex-direction: row; flex-wrap: wrap; }
	.sidebar-box { flex: 1; min-width: 130px; }
	.two-col { flex-direction: column; }
	.toolbar { flex-wrap: wrap; }
}