@font-face {
  font-family: "Press Start 2P Local";
  src: url("./fonts/PressStart2P.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Press Start 2P Local";
  src: url("./fonts/PressStart2P-cyrillic.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

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

:root {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --border-color: #3a3a3a;
  --text: #e0e0e0;
  --dim: #666666;
  --accent: #00ff41;
  --accent-soft: #0ddf48;
  --danger: #ff5252;
  --success: #00d26a;
  --border: 3px solid var(--border-color);
}

[hidden] {
  display: none !important;
}

body {
  font-family: "Press Start 2P Local", monospace;
  background: var(--bg);
  color: var(--text);
  font-size: 10px;
  line-height: 2;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

body[data-auth-state="booting"] #authScreen,
body[data-auth-state="booting"] #appShell,
body[data-auth-state="guest"] #appShell,
body[data-auth-state="user"] #authScreen {
  display: none !important;
}

.stars {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.ground {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--border-color);
  z-index: 100;
}

.ground::before {
  content: "";
  position: absolute;
  bottom: 2px;
  left: 0;
  right: 0;
  height: 1px;
  background: repeating-linear-gradient(
    90deg,
    var(--border-color) 0px, var(--border-color) 4px,
    transparent 4px, transparent 12px
  );
}

.dino {
  position: fixed;
  bottom: 6px;
  left: 30px;
  z-index: 101;
  animation: walk 0.4s steps(2) infinite;
  image-rendering: pixelated;
}

@keyframes walk {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

main {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 20px 80px;
}

.auth-screen {
  min-height: calc(100vh - 100px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-card {
  width: min(100%, 560px);
  text-align: center;
}

.auth-card h1 {
  margin-bottom: 20px;
}

.auth-card .tagline {
  margin-bottom: 28px;
}

.auth-start {
  min-width: 260px;
  justify-content: center;
}

.app-shell {
  display: block;
}

header {
  text-align: center;
  margin-bottom: 18px;
  padding: 16px 0;
}

h1 {
  font-size: 18px;
  letter-spacing: 2px;
  margin-bottom: 16px;
}

.tagline {
  font-size: 11px;
  color: var(--accent);
  margin-bottom: 12px;
}

.auth-bar {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 10;
}

#authUser {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 8px;
}

#authName {
  color: var(--accent);
}

.auth-usage {
  color: var(--dim);
}

.btn-login {
  font-family: "Press Start 2P Local", monospace;
  font-size: 8px;
  padding: 6px 14px;
  border: 2px solid var(--accent);
  background: none;
  color: var(--accent);
  cursor: pointer;
}

.btn-login:hover,
.btn-login:focus-visible {
  background: var(--accent);
  color: var(--bg);
}

.btn-logout {
  background: transparent;
  border: none;
  color: var(--dim);
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
}

.btn-logout:hover,
.btn-logout:focus-visible {
  opacity: 0.65;
}

.auth-message {
  margin: 0 auto 18px;
  max-width: 640px;
  border: 2px solid var(--accent);
  background: rgba(0, 255, 65, 0.08);
  color: var(--accent);
  padding: 10px 14px;
  text-align: center;
}

.auth-card .auth-message {
  margin-top: 18px;
  margin-bottom: 0;
}

.row {
  display: flex;
  gap: 30px;
  align-items: flex-start;
}

.row > .box {
  flex: 1;
}

.box {
  border: var(--border);
  padding: 30px;
  margin-bottom: 30px;
  position: relative;
  background: var(--surface);
}

.box::before {
  content: "";
  position: absolute;
  top: -3px;
  right: -3px;
  width: 8px;
  height: 8px;
  background: var(--accent);
}

h2 {
  font-size: 12px;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 2px dashed var(--border-color);
}

.field {
  margin-bottom: 18px;
}

label {
  display: block;
  font-size: 8px;
  color: var(--accent);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

textarea,
select,
input[type="text"],
input[type="file"] {
  width: 100%;
  font-family: "Press Start 2P Local", monospace;
  font-size: 9px;
  line-height: 2;
  padding: 10px;
  border: 2px solid var(--border-color);
  background: var(--bg);
  color: var(--text);
  outline: none;
  image-rendering: pixelated;
}

textarea {
  resize: vertical;
  min-height: 180px;
}

textarea:focus,
select:focus,
input[type="text"]:focus,
input[type="file"]:focus,
.btn:focus-visible {
  border-color: var(--accent);
}

input::file-selector-button {
  font-family: "Press Start 2P Local", monospace;
  font-size: 8px;
  margin-right: 10px;
  padding: 8px 10px;
  border: 2px solid var(--accent);
  background: transparent;
  color: var(--accent);
  cursor: pointer;
}

.counter,
.hint {
  display: block;
  margin-top: 8px;
  font-size: 8px;
  color: var(--dim);
}

.turnstile-slot {
  min-height: 1px;
  margin: 8px 0 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: "Press Start 2P Local", monospace;
  font-size: 9px;
  text-transform: lowercase;
  padding: 12px 16px;
  border: 2px solid var(--accent);
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
}

.btn:hover,
.btn:focus-visible {
  background: var(--accent);
  color: var(--bg);
}

.btn-full {
  width: 100%;
}

.btn-secondary {
  margin-top: 14px;
}

.error,
.success {
  margin-top: 14px;
  border: 2px solid;
  padding: 10px 12px;
  font-size: 8px;
}

.error {
  color: var(--danger);
  border-color: var(--danger);
  background: rgba(255, 82, 82, 0.08);
}

.success {
  color: var(--success);
  border-color: var(--success);
  background: rgba(0, 210, 106, 0.08);
}

.result-wrap {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 2px dashed var(--border-color);
}

.result-wrap audio,
.result-wrap img {
  width: 100%;
  display: block;
  border: 2px solid var(--border-color);
  background: var(--bg);
}

footer {
  text-align: center;
  color: var(--dim);
  font-size: 8px;
  margin-top: 20px;
}

@media (max-width: 960px) {
  .row {
    flex-direction: column;
  }

  .auth-bar {
    position: static;
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 9px;
  }

  main {
    padding: 14px 14px 80px;
  }

  .box {
    padding: 18px;
  }

  h1 {
    font-size: 14px;
  }

  .tagline {
    font-size: 9px;
  }

  textarea {
    min-height: 140px;
  }
}
