@font-face {
  font-family: "Modern DOS 8x16";
  src: url("/fonts/ModernDOS8x16.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: block;
}

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: #000;
  color: #e6d7b0;
  font-family: "Liberation Sans", "Segoe UI", sans-serif;
}

#name-gate,
#load-panel,
#start-panel {
  position: absolute;
  inset: 0;
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at center, #2a2114 0%, #0b0b0b 70%);
}

#name-gate {
  z-index: 40;
}

#start-panel {
  z-index: 25;
}

#load-panel {
  z-index: 30;
}

#et-icon,
.et-icon-sm {
  display: block;
  margin: 0 auto 0.85rem;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

#et-icon {
  width: 64px;
  height: 64px;
}

.hidden,
#name-gate.hidden,
#load-panel.hidden,
#start-panel.hidden,
#viewport-frame.hidden {
  display: none !important;
}

.game-kicker {
  margin: 0 0 0.15rem;
  font-size: 0.78rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: #c4a35a;
}

.music-hint {
  margin: 0.85rem 0 0;
  color: #8a7a55;
  font-size: 0.8rem;
}

.gate-card {
  width: min(28rem, 92vw);
  padding: 2rem 2.2rem 1.6rem;
  border: 1px solid #6b542c;
  background: rgba(16, 12, 8, 0.92);
  box-shadow: 0 0 0 1px #000, 0 18px 40px rgba(0, 0, 0, 0.55);
}

.gate-card h1 {
  margin: 0 0 0.35rem;
  font-size: 1.55rem;
  letter-spacing: 0.04em;
  color: #f0d48a;
}

.gate-card p {
  margin: 0 0 1.3rem;
  color: #b8a57a;
  line-height: 1.4;
}

.gate-card label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #c4b48a;
}

.gate-card input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.7rem 0.75rem;
  border: 1px solid #7a6234;
  background: #16110b;
  color: #f3e6c4;
  font-size: 1.05rem;
}

.advanced-settings {
  margin-top: 0.9rem;
  padding: 0.7rem 0.8rem 0.8rem;
  border: 1px solid #534526;
  background: rgba(6, 5, 4, 0.35);
}

.advanced-settings summary {
  color: #c4b48a;
  cursor: pointer;
  font-size: 0.86rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.advanced-settings[open] summary {
  margin-bottom: 0.8rem;
}

.advanced-settings select {
  box-sizing: border-box;
  width: 100%;
  padding: 0.55rem 0.6rem;
  border: 1px solid #7a6234;
  background: #16110b;
  color: #f3e6c4;
  font-size: 0.95rem;
}

.dynamic-settings-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.8rem;
}

.advanced-settings .toggle-setting {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.6rem;
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
}

.advanced-settings .toggle-setting input {
  width: auto;
  margin: 0;
  accent-color: #a78643;
}

.advanced-settings .fps-setting {
  min-width: 7.5rem;
}

.advanced-settings .setting-help {
  margin: 0.55rem 0 0;
  color: #897958;
  font-size: 0.76rem;
}

.gate-card button {
  margin-top: 1rem;
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #c4a35a;
  background: #3c2c12;
  color: #f4e4b2;
  font-size: 1rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}

.gate-card button:hover {
  background: #5a4218;
}

.gate-error {
  min-height: 1.2rem;
  margin: 0.6rem 0 0;
  color: #e07060;
  font-size: 0.9rem;
}

.load-bar {
  width: 100%;
  height: 0.7rem;
  margin: 0.4rem 0 0.6rem;
  border: 1px solid #7a6234;
  background: #16110b;
  overflow: hidden;
}

#load-bar-fill {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #5a4218, #c4a35a);
  transition: width 0.15s ease-out;
}

.load-detail {
  margin: 0;
  color: #8a7a55;
  font-size: 0.82rem;
}

.load-card {
  width: min(52rem, 92vw);
  padding-top: 1.35rem;
}

.load-card h1,
.load-card #load-status,
.load-card .load-detail {
  font-family: "Modern DOS 8x16", "Liberation Mono", "DejaVu Sans Mono", Consolas, monospace;
  font-synthesis: none;
}

.startup-console {
  box-sizing: border-box;
  width: 100%;
  height: min(19rem, 42vh);
  margin-top: 1rem;
  padding: 0.7rem 0.8rem;
  overflow: hidden auto;
  border: 2px solid #8c969e;
  background: #354b61;
  color: #d8dadd;
  box-shadow: inset 0 0 18px rgba(8, 17, 26, 0.24);
  font: 400 16px/16px "Modern DOS 8x16", "Liberation Mono", "DejaVu Sans Mono", Consolas, monospace;
  font-synthesis: none;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  scrollbar-color: #a8b0b6 #2b3e51;
  cursor: text;
  user-select: text;
}

.startup-console-line::before {
  content: "] ";
  color: #aeb7be;
}

.startup-console-line[data-level="warn"] {
  color: #f1d492;
}

.startup-console-line[data-level="error"] {
  color: #ffaaa0;
}

#viewport-frame {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #000;
}

#viewport-frame.hidden {
  display: none;
}

#viewport-frame:focus,
#et-canvas:focus {
  outline: none;
}

#et-canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #000;
  cursor: default;
}
