html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #000;
  color: #fff;
  font-family: "Trebuchet MS", Verdana, sans-serif;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
}

#world {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

#loading {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: #000;
  z-index: 10;
}
#loading[hidden] { display: none; }

.loading-box {
  width: min(360px, 80vw);
  text-align: center;
}
.loading-title {
  font-size: 34px;
  font-weight: bold;
  letter-spacing: 2px;
  color: #ffe600;
  text-shadow: 0 3px 0 #000, 0 0 12px rgba(255, 186, 0, 0.5);
  margin-bottom: 18px;
}
.loading-track {
  height: 12px;
  border: 2px solid #000;
  outline: 2px solid #6b5a44;
  background: #2a2420;
}
#loading-bar {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  appearance: none;
  -webkit-appearance: none;
  background: #2a2420;
}
#loading-bar::-webkit-progress-bar {
  background: #2a2420;
}
#loading-bar::-webkit-progress-value {
  background: #d83030;
  transition: width 0.2s;
}
#loading-bar::-moz-progress-bar {
  background: #d83030;
}
#loading-text {
  margin-top: 10px;
  font-size: 14px;
  color: #ccc;
}

.overlay-box {
  position: fixed;
  left: 50%;
  top: 38%;
  transform: translate(-50%, -50%);
  z-index: 5;
  background: rgba(20, 18, 16, 0.95);
  border: 3px solid #000;
  outline: 2px solid #6b5a44;
  padding: 16px 18px;
  min-width: min(320px, 86vw);
}
.overlay-box[hidden] { display: none; }
.overlay-box.chat { top: auto; bottom: 12px; transform: translateX(-50%); }
.overlay-box form { display: flex; flex-direction: column; gap: 10px; }
.overlay-box.chat form { flex-direction: row; }
.overlay-box label { color: #ffe600; font-weight: bold; font-size: 16px; text-shadow: 0 2px 0 #000; }
.overlay-box input {
  font: inherit;
  font-size: 16px;
  padding: 8px 10px;
  background: #0d0c0b;
  color: #fff;
  border: 2px solid #6b5a44;
  outline: none;
  flex: 1;
}
.overlay-box button {
  font: inherit;
  font-weight: bold;
  font-size: 15px;
  padding: 8px 14px;
  color: #fff;
  background: #3f8f2f;
  border: 2px solid #000;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.35);
  cursor: pointer;
}


.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
  box-sizing: border-box;
  background:
    radial-gradient(circle at 50% 35%, rgba(112, 71, 32, 0.22), transparent 36%),
    rgba(0, 0, 0, 0.94);
  touch-action: auto;
}
.auth-gate[hidden] { display: none; }
.auth-card {
  width: min(420px, 92vw);
  box-sizing: border-box;
  padding: 28px;
  border: 2px solid #6b5a44;
  outline: 3px solid #000;
  background: linear-gradient(180deg, rgba(35, 29, 23, 0.98), rgba(12, 11, 10, 0.98));
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.65), inset 0 0 0 1px rgba(255, 230, 0, 0.08);
}
.auth-kicker {
  color: #ffe600;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-align: center;
}
.auth-card h1 {
  margin: 8px 0 8px;
  text-align: center;
  font-size: 32px;
  line-height: 1;
  color: #fff1b8;
  text-shadow: 0 3px 0 #000;
}
.auth-card > p {
  margin: 0 0 20px;
  color: #bdb7ae;
  text-align: center;
  font-size: 14px;
  line-height: 1.45;
}
.auth-choice,
.auth-form {
  display: grid;
  gap: 10px;
}
.auth-form[hidden],
.auth-choice[hidden] { display: none; }
.auth-form label {
  display: grid;
  gap: 6px;
  color: #d7d0c6;
  font-size: 12px;
  font-weight: 700;
}
.auth-form input {
  min-width: 0;
  box-sizing: border-box;
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #665744;
  outline: none;
  background: #090807;
  color: #fff;
  font: inherit;
  font-size: 15px;
  user-select: text;
  -webkit-user-select: text;
}
.auth-form input:focus {
  border-color: #d6b04d;
  box-shadow: 0 0 0 2px rgba(214, 176, 77, 0.14);
}
.auth-card button {
  min-height: 44px;
  border: 1px solid #5c5041;
  background: #201c18;
  color: #eee9df;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}
.auth-card button:hover:not(:disabled) { filter: brightness(1.15); }
.auth-card button:disabled { opacity: 0.55; cursor: progress; }
.auth-card .auth-primary {
  border-color: #214f1d;
  background: linear-gradient(#4b9f39, #2d6f25);
  color: white;
  text-shadow: 0 2px 0 rgba(0,0,0,.55);
}
.auth-secondary-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.auth-secondary-actions button { flex: 1; }
.auth-error {
  margin-top: 12px;
  padding: 9px 10px;
  border: 1px solid #773737;
  background: rgba(120, 35, 35, 0.2);
  color: #ffaaa2;
  font-size: 12px;
  line-height: 1.4;
}
.auth-card small {
  display: block;
  margin-top: 16px;
  color: #77716a;
  text-align: center;
  font-size: 10px;
  line-height: 1.4;
}


/* Professional authentication gateway */
.auth-brand { margin-bottom: 18px; }
.auth-current {
  display: grid;
  gap: 6px;
  margin: 0 0 14px;
  padding: 13px;
  border: 1px solid #4d6b42;
  background: rgba(36, 70, 31, 0.22);
  text-align: center;
}
.auth-current[hidden] { display: none; }
.auth-current > span {
  color: #78cf68;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.auth-current > strong { color: #fff; font-size: 17px; }
.auth-current > small { color: #aaa39a; font-size: 11px; overflow-wrap: anywhere; }
.auth-card .auth-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-color: #6f6f6f;
  background: #f7f7f7;
  color: #171717;
  text-shadow: none;
}
.auth-card .auth-google > span {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  color: #4285f4;
  font-weight: 1000;
  box-shadow: 0 0 0 1px #d8d8d8;
}
.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #817a70;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}
.auth-divider::before,
.auth-divider::after { content: ""; height: 1px; flex: 1; background: #39332c; }
.auth-footnote {
  display: block;
  margin-top: 14px;
  color: #8e887f;
  font-size: 10px;
  line-height: 1.45;
  text-align: center;
}
@media (max-width: 520px) {
  .auth-gate { padding: 10px; }
  .auth-card { width: min(440px, 96vw); padding: 20px 18px; max-height: 96vh; overflow: auto; }
  .auth-card h1 { font-size: 27px; }
}
