@font-face {
  font-family: "MS Sans Serif";
  src: url("ms_sans_serif.woff2") format("woff2");
  font-weight: normal;
}
@font-face {
  font-family: "MS Sans Serif";
  src: url("ms_sans_serif_bold.woff2") format("woff2");
  font-weight: bold;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background: #008080;
  color: #000;
  font-family: "MS Sans Serif", Tahoma, sans-serif;
  position: relative;
  overflow-x: hidden;
}

.blink { animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.bg-text {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  font-size: 6rem;
  font-weight: bold;
  line-height: 1.1;
  color: rgba(0,0,0,0.4);
  pointer-events: none;
  user-select: none;
  z-index: 0;
}
@media (max-width: 640px) {
  .bg-text { font-size: clamp(1.8rem, 10vw, 3rem); }
}

.window {
  width: 100%;
  max-width: 420px;
  background: #c0c0c0;
  border-top: 2px solid #fff;
  border-left: 2px solid #fff;
  border-right: 2px solid #404040;
  border-bottom: 2px solid #404040;
  box-shadow: inset 1px 1px 0 #dfdfdf, inset -1px -1px 0 #808080, 2px 2px 8px rgba(0,0,0,0.4);
}

#mainWindow {
  position: fixed;
  top: 58%;
  left: 42%;
  transform: translate(-50%, -50%);
  width: min(420px, calc(100vw - 40px));
  z-index: 2;
}
@media (max-width: 640px) {
  #mainWindow {
    top: auto;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
  }
}

.title-bar {
  background: linear-gradient(90deg, #000080, #1084d0);
  color: #fff;
  font-weight: bold;
  font-size: 0.85rem;
  padding: 3px 4px 3px 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.title-bar-controls {
  display: flex;
  gap: 2px;
}
.title-bar-controls span {
  width: 15px;
  height: 13px;
  background: #c0c0c0;
  border-top: 1px solid #fff;
  border-left: 1px solid #fff;
  border-right: 1px solid #404040;
  border-bottom: 1px solid #404040;
  color: #000;
  font-size: 9px;
  line-height: 12px;
  text-align: center;
}

.window-body {
  padding: 18px 16px;
  text-align: center;
}

.construction-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 5;
  background: repeating-linear-gradient(45deg, #ffcc00, #ffcc00 16px, #111 16px, #111 32px);
  color: #fff;
  text-shadow: 1px 1px 2px #000, -1px -1px 2px #000;
  font-weight: bold;
  padding: 8px 0;
  border-bottom: 3px solid #000;
  font-size: 0.8rem;
  overflow: hidden;
  white-space: nowrap;
}
.construction-bar span {
  display: inline-block;
  padding-left: 100%;
  animation: marquee-scroll 9s linear infinite;
}
@keyframes marquee-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-100%); }
}

.progress-panel {
  text-align: left;
  margin: 0 0 4px;
}
.progress-label {
  font-size: 0.75rem;
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}
.progress-track {
  height: 18px;
  background: #fff;
  border-top: 2px solid #404040;
  border-left: 2px solid #404040;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  padding: 2px;
}
.progress-fill {
  height: 100%;
  width: 100%;
  background: repeating-linear-gradient(90deg, #000080 0 6px, transparent 6px 8px);
}

.win98-error {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 4px 2px;
}
.win98-error-row {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
}
.win98-error-actions {
  display: flex;
  justify-content: flex-end;
}
.win98-btn {
  background: #c0c0c0;
  border-top: 2px solid #fff;
  border-left: 2px solid #fff;
  border-right: 2px solid #404040;
  border-bottom: 2px solid #404040;
  padding: 4px 20px;
  font-family: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}
.win98-btn:active {
  border-top: 2px solid #404040;
  border-left: 2px solid #404040;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
}
.error-icon {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 32%, #ff4d4d, #b30000 75%);
  box-shadow: inset -2px -2px 3px rgba(0,0,0,0.5), inset 2px 2px 3px rgba(255,255,255,0.6);
  color: #fff;
  font-weight: bold;
  font-size: 1.1rem;
  line-height: 32px;
  text-align: center;
}
.error-text {
  font-size: 0.8rem;
  line-height: 1.4;
}

/* fixed top-right visitor counter */
#visitorFixed {
  position: fixed;
  top: 46px;
  right: clamp(6px, 2vw, 12px);
  z-index: 2;
  background: #c0c0c0;
  border-top: 2px solid #404040;
  border-left: 2px solid #404040;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  padding: clamp(4px, 1.5vw, 6px) clamp(6px, 2.5vw, 10px);
  max-width: 46vw;
}
.counter-label {
  font-size: clamp(0.55rem, 2vw, 0.65rem);
  margin-bottom: 4px;
  text-align: center;
  white-space: nowrap;
}
.counter-digits {
  background: #000;
  color: #39ff14;
  font-family: "Courier New", monospace;
  font-size: clamp(0.85rem, 3.5vw, 1.2rem);
  letter-spacing: clamp(1px, 0.6vw, 3px);
  padding: 2px 8px;
  border-top: 1px solid #404040;
  border-left: 1px solid #404040;
  border-right: 1px solid #fff;
  border-bottom: 1px solid #fff;
  display: block;
  text-align: center;
  white-space: nowrap;
}

/* hatch overlay */
#hatch {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10;
  padding: 20px;
}
#hatch.show { display: flex; }
#hatch .window { max-width: 340px; }
.swan {
  width: min(200px, 55vw);
  height: auto;
  margin-top: 6px;
}
#hatch p {
  max-width: 32ch;
  line-height: 1.5;
  margin: 12px auto 0;
  font-size: 0.85rem;
}

/* "not responding" popup, shown when the main window's X is clicked */
#notResponding {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 15;
  padding: 20px;
}
#notResponding.show { display: flex; }
#notResponding .window { max-width: 320px; }

#codeInput {
  position: fixed;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: 0;
  border: none;
  outline: none;
  opacity: 0;
  font-size: 16px;
  background: transparent;
  color: transparent;
  caret-color: transparent;
  z-index: -1;
}

.clickable { cursor: pointer; }
#errorPanel { display: none; }

/* Enter gate: covers everything until the visitor clicks Enter */
#enterGate {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #008080;
  display: flex;
  align-items: center;
  justify-content: center;
}
#enterGate.hidden { display: none; }
.enter-btn {
  font-size: 1.1rem;
  padding: 8px 40px;
}
.win98-btn:focus-visible {
  outline: 1px dotted #000;
  outline-offset: -5px;
}

/* ===== Gore mode (ABACABB): Doom x Windows 98 ===== */
html.gore, html.gore body {
  background: linear-gradient(to top, #6b1405 0%, #2a0703 45%, #0d0101 100%) fixed;
}
html.gore #enterGate { background: #1a0402; }
html.gore .bg-text { color: rgba(170, 0, 0, 0.55); }

/* Window panels: Doom's brown-grey metal instead of Win98 grey */
html.gore .window,
html.gore .title-bar-controls span,
html.gore .win98-btn {
  background: #8c8279;
  border-color: #c9b8a6 #1c1510 #1c1510 #c9b8a6;
}
html.gore .window {
  box-shadow: inset 1px 1px 0 #a89a8c, inset -1px -1px 0 #4a4038, 2px 2px 12px rgba(120, 0, 0, 0.6);
}
html.gore .win98-btn:active { border-color: #1c1510 #c9b8a6 #c9b8a6 #1c1510; }
html.gore .title-bar { background: linear-gradient(90deg, #4a0000, #c21a00); }

/* Sunken bits */
html.gore #visitorFixed {
  background: #8c8279;
  border-color: #1c1510 #c9b8a6 #c9b8a6 #1c1510;
}
html.gore .progress-track {
  background: #1a0000;
  border-color: #1c1510 #c9b8a6 #c9b8a6 #1c1510;
}
html.gore .progress-fill {
  background: repeating-linear-gradient(90deg, #d10000 0 6px, transparent 6px 8px);
}
html.gore .counter-digits { color: #ff2200; background: #120000; }

html.gore .construction-bar {
  background: repeating-linear-gradient(45deg, #8b0000, #8b0000 16px, #111 16px, #111 32px);
}

/* Doom-style red "pain" flash when gore mode kicks in */
#goreFlash {
  position: fixed;
  inset: 0;
  background: #c00000;
  opacity: 0;
  pointer-events: none;
  z-index: 200;
}
#goreFlash.flash { animation: pain-flash 0.7s ease-out; }
@keyframes pain-flash {
  0% { opacity: 0.7; }
  100% { opacity: 0; }
}

/* "CODE ACCEPTED" under the Enter button; reserves its space so nothing shifts */
#enterGate { flex-direction: column; gap: 14px; }
.gate-msg {
  margin: 0;
  color: #d10000;
  font-weight: bold;
  font-size: 0.9rem;
  letter-spacing: 2px;
  visibility: hidden;
}
.gate-msg.show { visibility: visible; }
