*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  height: 100dvh;
  overflow: hidden;
}

body {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  background: #07090c;
  color: #9eb4c8;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
    env(safe-area-inset-bottom) env(safe-area-inset-left);
  -webkit-text-size-adjust: 100%;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 255, 170, 0.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 255, 170, 0.09) 1px, transparent 1px),
    linear-gradient(rgba(0, 180, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 180, 255, 0.04) 1px, transparent 1px);
  background-size: 48px 48px, 48px 48px, 16px 16px, 16px 16px;
  mask-image: radial-gradient(ellipse 85% 75% at 50% 45%, black 35%, transparent 92%);
  pointer-events: none;
}

.scanlines {
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.12) 2px,
    rgba(0, 0, 0, 0.12) 4px
  );
  pointer-events: none;
  opacity: 0.35;
}

.stage {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(1.5rem, 5vw, 2.5rem);
  padding: clamp(1rem, 4vw, 2rem);
  text-align: center;
  width: 100%;
  max-width: 100%;
}

.logo {
  font-family: "Caveat", cursive;
  font-size: clamp(3.2rem, 14vw, 6.5rem);
  font-weight: 400;
  letter-spacing: 0.02em;
  color: #e8f4ff;
  text-shadow:
    0 0 24px rgba(0, 255, 170, 0.22),
    0 0 56px rgba(0, 180, 255, 0.1);
  user-select: none;
  line-height: 1.1;
  cursor: default;
  transition:
    text-shadow 0.45s ease,
    transform 0.45s ease,
    color 0.45s ease;
}

.logo:hover {
  transform: scale(1.02);
  color: #ffffff;
  text-shadow:
    0 0 16px rgba(0, 255, 170, 0.5),
    0 0 36px rgba(0, 255, 170, 0.38),
    0 0 72px rgba(0, 255, 170, 0.22),
    0 0 100px rgba(0, 180, 255, 0.16);
}

.gate {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  width: min(320px, 88vw);
}

.gate--balanced {
  width: min(270px, 74vw);
  gap: 0.55rem;
  margin-top: 0.15rem;
  opacity: 0.88;
  transition: opacity 0.25s ease;
}

.gate--balanced:focus-within {
  opacity: 1;
}

#password,
.gate input[type="password"] {
  width: 100%;
  padding: 0.85rem 1rem;
  font-family: inherit;
  font-size: max(16px, 0.8rem);
  font-weight: 300;
  letter-spacing: 0.08em;
  color: #c5d8e8;
  background: rgba(12, 18, 24, 0.85);
  border: 1px solid rgba(0, 255, 170, 0.18);
  border-radius: 2px;
  outline: none;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
  -webkit-appearance: none;
  appearance: none;
}

#key,
.gate--balanced #password,
.gate--balanced input[type="password"] {
  padding: 0.6rem 0.85rem;
  font-size: max(16px, 0.74rem);
  font-weight: 300;
  letter-spacing: 0.07em;
  color: rgba(197, 216, 232, 0.72);
  background: rgba(12, 18, 24, 0.62);
  border: 1px solid rgba(158, 180, 200, 0.22);
  border-radius: 3px;
  text-align: center;
}

#password::placeholder,
.gate input[type="password"]::placeholder {
  color: rgba(158, 180, 200, 0.35);
  letter-spacing: 0.12em;
}

#key::placeholder,
.gate--balanced input[type="password"]::placeholder {
  color: rgba(158, 180, 200, 0.36);
  letter-spacing: 0.09em;
}

#password:focus,
.gate input[type="password"]:focus {
  border-color: rgba(0, 255, 170, 0.45);
  box-shadow:
    0 0 0 1px rgba(0, 255, 170, 0.08),
    0 0 20px rgba(0, 255, 170, 0.08);
}

#key:focus,
.gate--balanced input[type="password"]:focus {
  color: rgba(197, 216, 232, 0.88);
  border-color: rgba(0, 255, 170, 0.34);
  box-shadow: 0 0 20px rgba(0, 255, 170, 0.08);
}

.hint {
  min-height: 1.2em;
  font-size: 0.68rem;
  font-weight: 300;
  letter-spacing: 0.14em;
  color: rgba(255, 90, 90, 0.55);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.gate--balanced .hint {
  font-size: 0.62rem;
  color: rgba(255, 90, 90, 0.42);
}

.hint.visible {
  opacity: 1;
}

/* admin panel */

body.admin-body {
  display: block;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.admin-panel {
  max-width: 960px;
  margin: 0 auto;
  padding: clamp(1rem, 4vw, 2rem);
  min-height: 100dvh;
}

.admin-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.75rem 1.5rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(0, 255, 170, 0.12);
}

.admin-header h1 {
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: lowercase;
  color: #e8f4ff;
}

.admin-count {
  font-size: 0.7rem;
  color: rgba(158, 180, 200, 0.5);
  letter-spacing: 0.1em;
}

.admin-logout {
  margin-left: auto;
  font-size: 0.7rem;
  color: rgba(0, 255, 170, 0.5);
  text-decoration: none;
  letter-spacing: 0.1em;
}

.admin-logout:hover {
  color: rgba(0, 255, 170, 0.8);
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(0, 255, 170, 0.6);
  box-shadow: 0 0 8px rgba(0, 255, 170, 0.4);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
}

.admin-table tr.row-new {
  animation: row-flash 1.8s ease-out;
}

@keyframes row-flash {
  0% {
    background: rgba(0, 255, 170, 0.12);
  }
  100% {
    background: transparent;
  }
}

.admin-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: clamp(0.65rem, 2.5vw, 0.75rem);
  font-weight: 300;
}

.admin-table th {
  text-align: left;
  padding: 0.6rem 0.5rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: lowercase;
  color: rgba(0, 255, 170, 0.45);
  border-bottom: 1px solid rgba(0, 255, 170, 0.12);
  white-space: nowrap;
}

.admin-table td {
  padding: 0.55rem 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: top;
}

.admin-table .mono {
  font-family: inherit;
  word-break: break-all;
}

.admin-table .empty {
  text-align: center;
  color: rgba(158, 180, 200, 0.35);
  padding: 2rem;
}

@media (max-width: 600px) {
  .admin-table th:nth-child(1),
  .admin-table td:nth-child(1) {
    display: none;
  }
}