/* SPDX-License-Identifier: GPL-3.0-or-later */

:root {
  color-scheme: dark;
  --ink: #e8eaed;
  --dim: #9aa3ad;
  --panel: rgba(20, 24, 29, 0.92);
  --line: #2c333b;
  --accent: #e0b040;
  --bad: #ff8b7a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #14181d;
  color: var(--ink);
  font: 15px/1.45 system-ui, "Segoe UI", sans-serif;
}

#view {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  background: #8599b0;
}

#menu {
  position: relative;
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 20px 40px;
  background: var(--panel);
  min-height: 100%;
}

#menu[hidden] { display: none; }

/* AC's launcher: the theme's page fills the window but a thin bar of ours at the bottom */
#launcher {
  position: fixed;
  inset: 0 0 28px 0;
  z-index: 5;
  background: #000;
}
/* Task 42b: the loading screen over the picture */
#loading {
  position: fixed;
  left: 50%;
  bottom: 60px;
  transform: translateX(-50%);
  z-index: 7;
  width: min(640px, calc(100% - 32px));
  padding: 12px 16px;
  border-radius: 6px;
  background: rgba(13, 16, 20, 0.88);
  color: #e8edf2;
  font-size: 14px;
}
#loading[hidden], #loading-stall[hidden], #loading-progress[hidden] { display: none; }
#loading p { margin: 0 0 6px; overflow-wrap: anywhere; }
#loading-progress { height: 8px; background: #232a32; border-radius: 4px; overflow: hidden; }
#loading-bar { height: 100%; width: 0; background: var(--accent); transition: width 0.15s linear; }
#loading-stall { margin-top: 10px; }
#corner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 28px;
  z-index: 6;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  background: #0d1014;
}
#corner[hidden] { display: none; }
#corner button { font-size: 12px; padding: 2px 10px; }
/* a drive's way to the rustyAC tab (O does the same) */
#gear { position: fixed; right: 8px; bottom: 8px; z-index: 29; display: flex; align-items: center; padding: 4px 6px; opacity: 0.7; }
#gear[hidden] { display: none; }
/* Full mode asked, the debug view draws: why (see showFallback) */
#fallback { position: fixed; left: 50%; top: 8px; transform: translateX(-50%); z-index: 40; max-width: min(720px, calc(100vw - 32px)); display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px 8px 14px; background: rgba(13, 16, 20, 0.92); color: #e8edf2; border-left: 3px solid var(--accent); border-radius: 4px; font-size: 13px; line-height: 1.4; }
#fallback[hidden] { display: none; }
#fallback span { overflow-wrap: anywhere; }
#fallback button { flex: none; font-size: 14px; line-height: 1; padding: 2px 7px; }
/* the start page (no pack, no folder) and the loading of a drive: only the Content section */
body.launcher-page #menu > section.old { display: none; }
body.launcher-page.has-source #menu .folder-only { display: none; }
#launcher[hidden] { display: none; }
#launcher iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* the Controls panel: over the menu and over the picture */
#controls {
  position: fixed;
  z-index: 30;
  top: 12px;
  right: 12px;
  bottom: 12px;
  width: min(560px, calc(100vw - 24px));
  overflow-y: auto;
  padding: 14px 18px;
  background: #171c22;
  border: 1px solid var(--line);
  border-radius: 8px;
}

#controls[hidden] { display: none; }
/* Settings' rustyAC tab: over the area under the theme's tabs (top, left, width, height from theme_glue.js) */
#controls.docked { right: auto; bottom: auto; border-radius: 0; }
.controls-head { display: flex; justify-content: space-between; align-items: center; }
.control { border-top: 1px solid var(--line); padding: 8px 0 2px; }
.control-row { display: flex; gap: 10px; align-items: center; }
.control-row span:first-child { flex: 0 0 210px; color: var(--ink); }
.control-row input[type="range"] { flex: 1 1 auto; min-width: 80px; }
.control-row input[type="number"] { width: 78px; font: inherit; color: var(--ink); background: #232a32; border: 1px solid #3b4550; border-radius: 5px; padding: 3px 6px; }
.control-row .default { flex: 0 0 auto; color: var(--dim); font-size: 12px; }
.control .hint { margin: 2px 0 6px; }
.control.changed .control-row span:first-child { color: var(--accent); }
#controls-layout { margin-top: 10px; }

h1 { margin: 0 0 8px; font-size: 30px; letter-spacing: 0.02em; }
h1 small { font-size: 15px; font-weight: 400; color: var(--accent); margin-left: 8px; }
h2 { margin: 0 0 8px; font-size: 16px; color: var(--accent); }
.lead { color: var(--dim); margin: 0 0 18px; }
section { border-top: 1px solid var(--line); padding: 14px 0 6px; }
.row { display: flex; flex-wrap: wrap; gap: 14px 22px; margin: 0 0 10px; align-items: center; }
label { color: var(--dim); }

select, button {
  font: inherit;
  color: var(--ink);
  background: #232a32;
  border: 1px solid #3b4550;
  border-radius: 5px;
  padding: 6px 10px;
}

select { margin-left: 6px; max-width: 300px; }
input[type="search"] { font: inherit; color: var(--ink); background: #232a32; border: 1px solid #3b4550; border-radius: 5px; padding: 5px 8px; width: 110px; margin-left: 6px; }
input[type="search"][hidden] { display: none; }
button { cursor: pointer; }
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled, select:disabled { opacity: 0.45; cursor: default; }
#drive { font-size: 18px; padding: 9px 30px; background: #6a4d10; border-color: var(--accent); }

.hint { color: var(--dim); font-size: 13px; margin: 6px 0; }
.status { color: var(--dim); min-height: 1.4em; margin: 6px 0; }
.refusal { color: var(--bad); }
code { background: #232a32; padding: 1px 5px; border-radius: 3px; font-size: 13px; }
a { color: var(--accent); }

#progress { height: 10px; background: #232a32; border-radius: 5px; overflow: hidden; margin: 10px 0; }
#progress-bar { height: 100%; width: 0; background: var(--accent); transition: width 0.15s linear; }

#notes {
  font: 12px/1.4 Consolas, ui-monospace, monospace;
  color: var(--dim);
  white-space: pre-wrap;
  margin: 8px 0;
}

.small table { border-collapse: collapse; font-size: 13px; }
.small td { padding: 2px 16px 2px 0; color: var(--dim); }
.small td:first-child { color: var(--ink); }
details { margin: 6px 0; color: var(--dim); font-size: 13px; }
details ul { margin: 6px 0; padding-left: 18px; }
footer { border-top: 1px solid var(--line); padding-top: 10px; color: var(--dim); font-size: 12px; }

/* the display over the picture */
#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  font: 14px/1.3 Consolas, ui-monospace, monospace;
  text-shadow: 0 1px 2px #000, 0 0 6px rgba(0, 0, 0, 0.7);
}

#hud[hidden], #keys[hidden] { display: none; }

#hud-main { position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%); text-align: center; }
#hud-gear { font-size: 54px; font-weight: 700; margin-right: 14px; }
#hud-speed { font-size: 40px; font-weight: 700; }
.unit { margin-left: 5px; color: #d8dde3; }
#hud-rpm { width: 320px; height: 8px; background: rgba(0, 0, 0, 0.45); margin: 6px auto 3px; border-radius: 4px; overflow: hidden; }
#hud-rpm-bar { height: 100%; width: 0; background: var(--accent); }
#hud-lap { position: absolute; left: 18px; top: 14px; font-size: 16px; }
#hud-lap b { font-size: 22px; }
#hud-info { position: absolute; right: 18px; top: 40px; text-align: right; white-space: pre; }
#hud-aids { position: absolute; right: 18px; top: 14px; text-align: right; white-space: pre; font-size: 16px; }
#hud-aids span { margin-left: 16px; }
#hud-aids span.acting { color: var(--accent); font-weight: 700; }
#hud-note {
  position: absolute;
  left: 50%;
  top: 22%;
  transform: translateX(-50%);
  padding: 6px 16px;
  font-size: 20px;
  color: var(--accent);
  background: rgba(0, 0, 0, 0.5);
  border-radius: 4px;
}
#hud-note[hidden] { display: none; }
#hud-online { position: absolute; left: 18px; top: 92px; white-space: pre; font-size: 13px; line-height: 1.35; background: rgba(0, 0, 0, 0.35); padding: 6px 10px; border-radius: 4px; }
#hud-online[hidden], #chat[hidden] { display: none; }
#hud-referee { position: absolute; left: 50%; top: 64px; transform: translateX(-50%); white-space: pre; text-align: center; font-size: 14px; line-height: 1.35; background: rgba(0, 0, 0, 0.4); padding: 6px 12px; border-radius: 4px; }
#hud-referee-centre { position: absolute; left: 50%; top: 42%; transform: translateX(-50%); white-space: pre; text-align: center; font-size: 20px; color: #f33; background: rgba(0, 0, 0, 0.5); padding: 6px 16px; border-radius: 4px; }
#hud-referee-results { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); white-space: pre; font-size: 14px; line-height: 1.4; background: rgba(0, 0, 0, 0.85); padding: 14px 20px; border-radius: 4px; }
#hud-referee[hidden], #hud-referee-centre[hidden], #hud-referee-results[hidden] { display: none; }
#chat { position: fixed; left: 18px; bottom: 60px; width: min(480px, 60vw); font: inherit; font-size: 15px; padding: 6px 8px; border: 1px solid var(--accent); border-radius: 4px; background: rgba(0, 0, 0, 0.7); color: #fff; z-index: 5; }
#hud-perf { position: absolute; left: 18px; bottom: 14px; color: #d8dde3; white-space: pre; font-size: 12px; }

#keys {
  position: fixed;
  right: 18px;
  bottom: 14px;
  color: #d8dde3;
  font: 12px/1.35 Consolas, ui-monospace, monospace;
  text-shadow: 0 1px 2px #000;
  white-space: pre;
  pointer-events: none;
  text-align: right;
}
.refusal .detail { color: var(--dim); font-size: 12px; }
