/* Xash3D FWGS web launcher - Classic 2000s Win32/Half-Life Grey Aesthetic */
:root {
	--bg: #3a3a3a;
	--bg-2: #2e2e2e;
	--surface: #d4d4d4;
	--surface-2: #e0e0e0;
	--border: #808080;
	--border-light: #ffffff;
	--border-dark: #404040;
	--border-strong: #ff8c00;
	--text: #1a1a1a;
	--text-dim: #555555;
	--accent: #ff8c00;
	--accent-2: #d97700;
	--accent-ink: #ffffff;
	--ok: #006600;
	--warn: #806600;
	--err: #cc0000;
	--radius: 0px;
	--radius-sm: 0px;
	--shadow: none;
	--font: Tahoma, Arial, Helvetica, sans-serif;
	--mono: "Courier New", Courier, monospace;
	--gutter: 16px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
	margin: 0;
	min-height: 100vh;
	min-height: 100dvh;
	background: var(--bg);
	color: var(--text);
	font: 12px/1.4 var(--font);
}
body.playing { overflow: hidden; background: #000; }
body.playing .landing { display: none; }

a { color: #0044cc; text-decoration: underline; }
a:hover { color: #002266; }
code, kbd { font-family: var(--mono); font-size: .9em; background: #ffffff; border: 1px solid var(--border); color: #000000; padding: 0 3px; }
h1, h2 { margin: 0; line-height: 1.2; text-transform: uppercase; letter-spacing: .05em; font-family: Tahoma, Arial, sans-serif; }
h2 { font-size: 1rem; color: #000000; border-bottom: 1px solid var(--border); padding-bottom: 4px; margin-bottom: 10px; font-weight: bold; }
.muted { color: var(--text-dim); }
.small { font-size: .8rem; }
.grow { flex: 1 1 auto; min-width: 0; }
:focus-visible { outline: 1px dotted #000; outline-offset: 1px; }

/* ---------------------------------------------------------------- landing */
.landing {
	max-width: 960px;
	margin: 0 auto;
	padding: 20px;
}
.hero { display: flex; align-items: center; gap: 14px; margin: 10px 0 20px; border-bottom: 2px solid var(--accent); padding-bottom: 12px; }
.hero-mark { width: 48px; height: 48px; flex: none; fill: none; stroke: var(--accent); stroke-width: 2.5; }
.hero h1 { font-size: 1.5rem; font-weight: bold; color: #ffffff; text-shadow: 1px 1px #000; }
.hero-tag { color: var(--accent); }
.hero-sub { margin: 4px 0 0; color: #cccccc; font-size: .9rem; }

.layout { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
.layout > .games, .layout > .advanced { grid-column: 1 / -1; }
@media (max-width: 768px) { .layout { grid-template-columns: 1fr; } }

.card {
	background: var(--surface);
	border: 2px solid;
	border-color: var(--border-light) var(--border-dark) var(--border-dark) var(--border-light);
	border-radius: var(--radius);
	padding: 14px;
	color: #000000;
}
.intro p { margin: 0 0 8px; }
.steps { margin: 0 0 10px; padding-left: 1.2em; }
.steps li { margin: 3px 0; }
.steps li::marker { color: var(--accent); font-weight: bold; }

.notice { border-radius: var(--radius-sm); padding: 8px 10px; font-size: .85rem; margin-top: 8px; }
.notice.warn { background: #ffffe0; border: 1px solid #cc9900; color: #664400; }

.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row.center { justify-content: center; }
.row.end { justify-content: flex-end; }

/* buttons */
.btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 6px;
	min-height: 26px; padding: 3px 12px;
	border-radius: var(--radius);
	border: 2px solid;
	border-color: var(--border-light) var(--border-dark) var(--border-dark) var(--border-light);
	background: #c0c0c0; color: #000000;
	font: inherit; font-size: .85rem; font-weight: bold;
	cursor: pointer; user-select: none; text-decoration: none;
}
.btn:hover { background: #d0d0d0; }
.btn:active { border-color: var(--border-dark) var(--border-light) var(--border-light) var(--border-dark); padding: 4px 11px 2px 13px; }
.btn:disabled { opacity: .5; color: #808080; cursor: not-allowed; }
.btn.primary { background: #e07000; color: #ffffff; border-color: #ffaa33 #804000 #804000 #ffaa33; }
.btn.primary:hover:not(:disabled) { background: #f08000; }
.btn.ghost { background: #c0c0c0; }
.btn.danger { color: #cc0000; }
.btn.tiny { min-height: 20px; padding: 1px 6px; font-size: .75rem; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }

/* source */
.saved { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding: 8px 10px; margin-bottom: 10px; border: 1px solid #006600; background: #e6f2e6; color: #003300; }
.saved-info { display: flex; gap: 8px; align-items: center; }
.saved-title { font-weight: bold; color: #006600; }
.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; color: #006600; }
.saved .icon { color: #006600; }

.dropzone {
	display: grid; justify-items: center; gap: 4px; text-align: center;
	padding: 16px; border-radius: var(--radius);
	border: 2px groove var(--border);
	background: #ffffff;
	cursor: pointer;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: #fffaf0; }
.drop-icon { width: 32px; height: 32px; fill: none; stroke: var(--accent); stroke-width: 2; }
.drop-title { font-size: .95rem; font-weight: bold; }

.check { display: flex; gap: 8px; align-items: center; margin-top: 10px; cursor: pointer; font-size: .85rem; color: #000; }
.check input { width: 14px; height: 14px; accent-color: var(--accent); flex: none; margin: 0; }

.source-info { display: flex; gap: 8px; align-items: center; margin-top: 10px; padding: 8px; background: #ffffff; border: 1px solid var(--border); }
.source-name { font-weight: bold; color: #000; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 6px; border-radius: 0; font-size: .75rem; font-weight: bold; background: #e0e0e0; border: 1px solid var(--border); color: #333; }
.chip.ok { color: #006600; border-color: #006600; background: #e6f2e6; }
.chip.warn { color: #806600; border-color: #806600; background: #ffffe0; }
.chip.err { color: #cc0000; border-color: #cc0000; background: #ffe6e6; }

/* games */
.game-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.game {
	position: relative; display: grid; gap: 6px; align-content: space-between;
	padding: 10px; background: #eaeaea;
	border: 2px solid;
	border-color: var(--border-light) var(--border-dark) var(--border-dark) var(--border-light);
}
.game::after { display: none; }
.game.ready { border-color: var(--border-light) var(--border-dark) var(--border-dark) var(--border-light); }
.game.unavailable { opacity: .5; }
.game.selected { outline: 1px dotted #000; }
.game-title { font-size: 1rem; font-weight: bold; color: #000; }
.game-sub { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.game-note { font-size: .8rem; color: #444; }
.game .btn { justify-self: start; margin-top: 4px; }
.play-icon { width: 12px; height: 12px; fill: currentColor; }

/* advanced */
.advanced summary { list-style: none; cursor: pointer; font-weight: bold; color: #ffffff; text-shadow: 1px 1px #000; }
.advanced summary::-webkit-details-marker { display: none; }
.advanced[open] summary { margin-bottom: 10px; border-bottom: 1px solid #808080; padding-bottom: 4px; }
.form { display: grid; gap: 10px; color: #000; }
.field { display: grid; gap: 4px; font-size: .85rem; }
input[type=text], select {
	width: 100%; min-height: 24px; padding: 2px 6px;
	background: #ffffff; color: #000000;
	border: 2px solid;
	border-color: var(--border-dark) var(--border-light) var(--border-light) var(--border-dark);
	border-radius: 0;
	font: inherit; font-family: var(--mono); font-size: .85rem;
}
select { font-family: var(--font); }
input[type=text]:focus, select:focus { outline: 1px dotted #000; }

.footer { margin: 20px 0 10px; text-align: center; font-size: .75rem; color: #cccccc; }

/* ---------------------------------------------------------------- game stage */
.stage { position: fixed; inset: 0; background: #000; z-index: 10; }
.stage canvas { display: block; width: 100%; height: 100%; outline: none; }
.hud {
	position: absolute; top: 8px; right: 8px;
	display: flex; gap: 4px; align-items: center;
}
.hud.idle { opacity: 0; pointer-events: none; }
.hud-btn {
	width: 28px; height: 28px; display: grid; place-items: center;
	background: #c0c0c0; border: 2px solid;
	border-color: var(--border-light) var(--border-dark) var(--border-dark) var(--border-light);
	border-radius: 0; color: #000; cursor: pointer;
}
.hud-btn:hover { background: #d0d0d0; }
.hud-btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }
.save-dot { width: 6px; height: 6px; background: var(--accent); }
.toast {
	position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%);
	padding: 4px 10px; border: 2px solid;
	border-color: var(--border-light) var(--border-dark) var(--border-dark) var(--border-light);
	background: #c0c0c0; color: #000;
	font-size: .85rem; font-family: var(--mono);
}

/* ---------------------------------------------------------------- overlays */
.overlay {
	position: fixed; inset: 0; z-index: 30;
	display: grid; place-items: center; padding: 10px;
	background: rgba(0, 0, 0, 0.6);
}
.panel {
	width: min(480px, 100%);
	background: var(--surface);
	border: 2px solid;
	border-color: var(--border-light) var(--border-dark) var(--border-dark) var(--border-light);
	border-radius: 0;
	padding: 16px;
	color: #000;
}
.panel h2 { margin-bottom: 10px; font-size: 1rem; color: #000; }
.stages { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; font-size: .85rem; }
.stages li { display: flex; align-items: center; gap: 8px; color: #333; }
.stages li::before { content: "[ ]"; font-family: var(--mono); color: #555; }
.stages li.active { color: #000; font-weight: bold; }
.stages li.active::before { content: "[>]"; color: var(--accent); }
.stages li.done { color: #006600; }
.stages li.done::before { content: "[X]"; color: #006600; }
.stages li .stage-extra { margin-left: auto; font-family: var(--mono); font-size: .75rem; color: #333; }
.bar { height: 6px; border-radius: 0; background: #ffffff; border: 2px solid; border-color: var(--border-dark) var(--border-light) var(--border-light) var(--border-dark); overflow: hidden; }
.bar-fill { height: 100%; width: 0; background: #000084; }
.bar.indeterminate .bar-fill { width: 30%; animation: slide 1s linear infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(350%); } }
.progress-detail { margin-top: 6px; font-family: var(--mono); font-size: .75rem; color: #333; }

.error-panel { border-color: var(--border-light) var(--border-dark) var(--border-dark) var(--border-light); }
.error-panel h2 { color: #cc0000; }
.error-panel pre { background: #ffffff; border: 2px solid; border-color: var(--border-dark) var(--border-light) var(--border-light) var(--border-dark); padding: 8px; font-family: var(--mono); font-size: .75rem; color: #cc0000; }

/* ---------------------------------------------------------------- log drawer */
.log {
	position: fixed; z-index: 40; right: 8px; bottom: 8px;
	width: min(640px, calc(100vw - 16px)); height: 35vh;
	display: flex; flex-direction: column;
	background: var(--surface);
	border: 2px solid;
	border-color: var(--border-light) var(--border-dark) var(--border-dark) var(--border-light);
}
.log-head { display: flex; align-items: center; gap: 6px; padding: 4px 8px; background: #c0c0c0; border-bottom: 1px solid var(--border); font-size: .8rem; color: #000; }
.log-body { flex: 1; margin: 0; padding: 6px 8px; overflow: auto; font: .75rem/1.4 var(--mono); background: #ffffff; color: #000000; }
.log-body .e { color: #cc0000; }
.log-body .w { color: #996600; }
.log-body .i { color: #0000cc; }
.log-toggle {
	position: fixed; z-index: 35; right: 8px; bottom: 8px;
	padding: 4px 8px; border-radius: 0;
	background: #c0c0c0; color: #000;
	border: 2px solid;
	border-color: var(--border-light) var(--border-dark) var(--border-dark) var(--border-light);
	font: bold .75rem var(--font); cursor: pointer;
}
body.playing .log-toggle { display: none; }
.badge { min-width: 6px; height: 6px; background: #cc0000; display: inline-block; }

.dropveil { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(58, 58, 58, 0.85); border: 2px solid var(--accent); font-family: var(--mono); font-size: 1.2rem; color: #fff; }
