@font-face {
  font-family: "OP2OpenSansBold";
  src: url("/assets/ui/OpenSans-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "OP2Roboto";
  src: url("/assets/ui/Roboto-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  color: rgb(200, 221, 180);
  font-family: "OP2Roboto", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

#op2-canvas,
#op2-fallback-canvas {
  position: fixed;
  inset: 0;
  width: 100vw !important;
  height: 100vh !important;
  display: block;
  outline: none;
  touch-action: none;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
}

#op2-vkbd-input {
  position: fixed;
  left: -9999px;
  top: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  font-size: 16px;
  border: 0;
  padding: 0;
}

#op2-fallback-canvas {
  display: none;
  pointer-events: none;
  z-index: 1;
}

#op2-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background-color: #030712;
  background-image:
    linear-gradient(rgba(3, 6, 14, 0.72), rgba(3, 6, 14, 0.84)),
    url("/assets/ui/MainMenuBackground00.png"),
    url("/assets/ui/op2shres/bitmap_220.png");
  background-size: auto, cover, auto;
  background-position: center, center, top left;
  background-repeat: no-repeat, no-repeat, repeat;
  z-index: 10;
  padding: 24px;
  box-sizing: border-box;
}

#op2-overlay.hidden {
  display: none;
}

#op2-banner {
  display: block;
  width: min(544px, 92vw);
  height: auto;
  filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.9));
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

#op2-card {
  width: min(468px, 94vw);
  background: #040812;
  border: 1px solid #101010;
  border-radius: 0;
  padding: 0;
  box-sizing: border-box;
  box-shadow:
    inset 1px 1px 0 #404044,
    inset -1px -1px 0 #2a2a2e,
    inset 2px 2px 0 #18181c,
    inset -2px -2px 0 #18181c,
    0 20px 50px rgba(0, 0, 0, 0.88);
}

#op2-titlebar {
  height: 26px;
  margin: 3px 3px 0 3px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(180deg, rgba(99, 33, 33, 0.92) 0%, rgba(31, 10, 10, 0.94) 100%),
    url("/assets/ui/op2shres/bitmap_217.png");
  background-repeat: repeat-x;
  border-bottom: 1px solid #333333;
  box-sizing: border-box;
}

#op2-title {
  margin: 0;
  font-family: "OP2OpenSansBold", system-ui, sans-serif;
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgb(240, 255, 220);
  text-shadow: 1px 1px 0 #000000;
}

#op2-body {
  margin: 0 3px 3px 3px;
  padding: 18px 22px 20px;
  background-color: #040812;
  background-image:
    linear-gradient(rgba(4, 8, 18, 0.80), rgba(4, 8, 18, 0.88)),
    url("/assets/ui/op2shres/bitmap_220.png");
  background-repeat: repeat;
}

#op2-status {
  margin: 0 0 12px 0;
  font-size: 14px;
  line-height: 1.4;
  color: rgb(200, 221, 180);
  text-shadow: 1px 1px 0 #000000;
  min-height: 20px;
}

#op2-bar-wrap {
  width: 100%;
  height: 16px;
  background: rgb(0, 0, 30);
  border: 1px solid rgb(0, 0, 120);
  box-shadow: inset 1px 1px 0 #000000;
  border-radius: 0;
  overflow: hidden;
  box-sizing: border-box;
}

#op2-bar-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #006800 0%, #00d800 72%, #ddffa0 100%);
  transition: width 80ms linear;
}

#op2-metrics {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #93aa88;
  text-shadow: 1px 1px 0 #000000;
  font-variant-numeric: tabular-nums;
}

#op2-launch-wrap {
  display: none;
  justify-content: center;
  margin-top: 18px;
}

#op2-launch-wrap.visible {
  display: flex;
}

#op2-launch-btn {
  width: 216px;
  height: 32px;
  padding: 0 16px;
  border-radius: 0;
  cursor: pointer;
  font-family: "OP2OpenSansBold", system-ui, sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgb(221, 255, 160);
  text-shadow: 1px 1px 0 #000000;
  background:
    linear-gradient(180deg, rgba(84, 90, 104, 0.24) 0%, rgba(12, 14, 20, 0.24) 100%),
    #000000;
  border: 1px solid #101010;
  box-shadow:
    inset 1px 1px 0 #2a2a2e,
    inset -1px -1px 0 #18181c,
    inset 0 0 0 2px #000000,
    inset 0 0 0 3px rgb(166, 28, 20);
  box-sizing: border-box;
  outline: none;
}

#op2-launch-btn:hover,
#op2-launch-btn:focus-visible {
  color: rgb(244, 255, 212);
  background:
    linear-gradient(180deg, rgba(110, 44, 40, 0.28) 0%, rgba(24, 8, 8, 0.92) 100%),
    rgb(24, 8, 8);
  box-shadow:
    inset 1px 1px 0 #404044,
    inset -1px -1px 0 #18181c,
    inset 0 0 0 2px #000000,
    inset 0 0 0 3px rgb(252, 44, 28);
}

#op2-launch-btn:active {
  color: rgb(244, 255, 212);
  background: rgb(40, 12, 12);
  padding: 2px 15px 0 17px;
  box-shadow:
    inset 1px 1px 0 #18181c,
    inset -1px -1px 0 #404044,
    inset 0 0 0 2px #000000,
    inset 0 0 0 3px rgb(252, 44, 28);
}

#op2-launch-btn:disabled {
  cursor: wait;
  opacity: 0.72;
}

#op2-launch-btn .op2-mnem {
  text-decoration: underline;
  text-underline-offset: 2px;
}

#op2-note {
  margin-top: 14px;
  font-size: 13px;
  line-height: 1.45;
  color: rgb(255, 192, 96);
  display: none;
  white-space: pre-wrap;
}

#op2-note.error {
  color: rgb(255, 96, 88);
}

.op2-auth-field {
  margin-bottom: 12px;
}

.op2-auth-label {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #93aa88;
  text-shadow: 1px 1px 0 #000000;
}

.op2-auth-input {
  width: 100%;
  height: 32px;
  padding: 4px 10px;
  box-sizing: border-box;
  border-radius: 0;
  border: 1px solid #3c4252;
  background: #02050d;
  color: rgb(224, 240, 208);
  font-family: "OP2Roboto", system-ui, sans-serif;
  font-size: 14px;
  outline: none;
  box-shadow: inset 1px 1px 0 #000000;
}

.op2-auth-input:focus {
  border-color: rgb(200, 56, 40);
}

.op2-auth-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 16px;
  flex-wrap: wrap;
}

.op2-btn {
  min-width: 170px;
  height: 32px;
  padding: 0 16px;
  border-radius: 0;
  cursor: pointer;
  font-family: "OP2OpenSansBold", system-ui, sans-serif;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgb(221, 255, 160);
  text-shadow: 1px 1px 0 #000000;
  background:
    linear-gradient(180deg, rgba(84, 90, 104, 0.24) 0%, rgba(12, 14, 20, 0.24) 100%),
    #000000;
  border: 1px solid #101010;
  box-shadow:
    inset 1px 1px 0 #2a2a2e,
    inset -1px -1px 0 #18181c,
    inset 0 0 0 2px #000000,
    inset 0 0 0 3px rgb(166, 28, 20);
  box-sizing: border-box;
  outline: none;
}

.op2-btn:hover,
.op2-btn:focus-visible {
  color: rgb(244, 255, 212);
  background:
    linear-gradient(180deg, rgba(110, 44, 40, 0.28) 0%, rgba(24, 8, 8, 0.92) 100%),
    rgb(24, 8, 8);
  box-shadow:
    inset 1px 1px 0 #404044,
    inset -1px -1px 0 #18181c,
    inset 0 0 0 2px #000000,
    inset 0 0 0 3px rgb(252, 44, 28);
}

.op2-btn:disabled {
  cursor: wait;
  opacity: 0.72;
}

.op2-auth-error {
  margin-top: 12px;
  font-size: 13px;
  line-height: 1.4;
  color: rgb(255, 96, 88);
  min-height: 18px;
  white-space: pre-wrap;
}

.op2-auth-hint {
  margin: 0 0 14px 0;
  font-size: 13px;
  line-height: 1.4;
  color: rgb(200, 221, 180);
  text-shadow: 1px 1px 0 #000000;
}

#op2-init-profile-row {
  margin-top: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #93aa88;
  border-top: 1px solid #1b2232;
  padding-top: 10px;
}

.op2-link-btn {
  background: transparent;
  border: 1px solid #3c4252;
  color: rgb(200, 221, 180);
  font-size: 11px;
  padding: 3px 8px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.op2-link-btn:hover {
  border-color: rgb(252, 44, 28);
  color: rgb(244, 255, 212);
}

#op2-profile-bar {
  position: fixed;
  top: 3px;
  right: 92px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 1px 6px;
  height: 18px;
  box-sizing: border-box;
  background: rgba(4, 8, 18, 0.78);
  border: 1px solid #2a2f3d;
  color: #93aa88;
  font-size: 11px;
  opacity: 0.45;
  transition: opacity 120ms ease;
}

#op2-profile-bar:hover,
#op2-profile-bar:focus-within {
  opacity: 1;
}

#op2-profile-bar[hidden] {
  display: none;
}

#op2-profile-signout-btn {
  background: transparent;
  border: 0;
  border-left: 1px solid #2a2f3d;
  padding: 0 0 0 6px;
  color: rgb(221, 255, 160);
  font-size: 10.5px;
  cursor: pointer;
  text-transform: uppercase;
}

#op2-profile-signout-btn:hover {
  color: rgb(255, 96, 88);
}

#op2-sync-banner {
  position: fixed;
  top: 28px;
  right: 12px;
  z-index: 35;
  max-width: min(440px, calc(100vw - 24px));
  padding: 10px 14px;
  background: rgba(36, 12, 12, 0.96);
  border: 1px solid rgb(252, 44, 28);
  color: rgb(255, 228, 220);
  font-size: 12.5px;
  line-height: 1.4;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.72);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#op2-sync-banner[hidden] {
  display: none;
}

#op2-sync-banner-actions {
  display: flex;
  gap: 8px;
}

#op2-save-toast {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 30;
  max-width: min(440px, calc(100vw - 24px));
  padding: 10px 14px;
  background: rgba(24, 10, 10, 0.94);
  border: 1px solid rgb(252, 44, 28);
  color: rgb(255, 224, 220);
  font-size: 13px;
  line-height: 1.4;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.65);
  white-space: pre-wrap;
  pointer-events: none;
}

#op2-fatal-banner {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  width: min(680px, calc(100vw - 24px));
  padding: 14px 16px;
  background: rgba(36, 8, 8, 0.96);
  border: 2px solid rgb(252, 44, 28);
  color: rgb(255, 232, 228);
  font-size: 13px;
  line-height: 1.45;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.85);
}

#op2-fatal-banner[hidden] {
  display: none;
}

#op2-fatal-msg {
  margin: 6px 0 10px;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  max-height: 45vh;
  overflow: auto;
}

#op2-fatal-reload {
  padding: 4px 12px;
  border: 1px solid rgb(252, 44, 28);
  background: rgb(56, 14, 14);
  color: rgb(255, 232, 228);
  cursor: pointer;
  font: inherit;
}
