/* === RETRO PIXEL STYLE === */

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

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

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

/* Pixel starfield */
.stars {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 0;
  pointer-events: none;
}

/* Ground line like Chrome Dino */
.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 */
.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); }
}

/* Dino runner game during generation */
#dinoGame {
  position: fixed;
  height: 280px;
  background: var(--bg);
  border: 3px solid var(--accent);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
}

#dinoGame canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

/* Blur overlay behind game */
#dinoGameBlur {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 15, 15, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 49;
  pointer-events: none;
}

/* Keep dino above blur */
.dino {
  z-index: 101;
}

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

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

.row > .box {
  flex: 1;
  align-self: stretch;
  display: flex;
  flex-direction: column;
}

.price-single {
  text-align: center;
  padding: 30px 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.features {
  list-style: none;
  font-size: 8px;
  margin-top: auto;
}

.features li {
  padding: 6px 0;
  border-bottom: 1px dashed var(--border-color);
}

.features li::before {
  content: '> ';
  color: var(--accent);
}

/* Header */
header {
  text-align: center;
  margin-bottom: 10px;
  padding: 16px 0;
}

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

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

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

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

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

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

.auth-logout {
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  padding: 4px 8px;
  border: 1px solid var(--border-color);
  background: none;
  color: var(--dim);
  cursor: pointer;
}

.auth-logout:hover {
  color: var(--accent);
  border-color: var(--accent);
}

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

.btn-logout:hover {
  opacity: 0.6;
}

.btn-logout svg {
  image-rendering: pixelated;
}

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

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

.sub {
  font-size: 8px;
  color: var(--dim);
  letter-spacing: 3px;
}

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

/* Pixel corner decoration */
.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);
}

/* Form fields */
.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="file"] {
  width: 100%;
  font-family: 'Press Start 2P', 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: 80px;
}

textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 4px 4px 0 rgba(0, 255, 65, 0.1);
}

select {
  appearance: none;
  cursor: pointer;
  padding-right: 30px;
}

/* Custom pixel select */
.custom-select {
  position: relative;
  cursor: pointer;
}

.custom-select-value {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  line-height: 2;
  padding: 10px;
  border: 2px solid var(--border-color);
  background: var(--bg);
  color: var(--text);
}

.custom-select-value::after {
  content: '';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid var(--accent);
}

.custom-select.open .custom-select-value {
  border-color: var(--accent);
}

.custom-select.open .custom-select-value::after {
  border-top: none;
  border-bottom: 5px solid var(--accent);
}

.custom-select-list {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  border: 2px solid var(--accent);
  background: var(--bg);
  z-index: 50;
  max-height: 200px;
  overflow-y: auto;
}

.custom-select.open .custom-select-list {
  display: block;
}

.custom-select-list div {
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  padding: 8px 10px;
  color: var(--text);
  cursor: pointer;
  border-bottom: 1px solid var(--border-color);
}

.custom-select-list div:last-child {
  border-bottom: none;
}

.custom-select-list div:hover {
  background: var(--accent);
  color: var(--bg);
}

.custom-select-list div.selected {
  color: var(--accent);
}

/* Scrollbar for list */
.custom-select-list::-webkit-scrollbar {
  width: 6px;
}

.custom-select-list::-webkit-scrollbar-track {
  background: var(--bg);
}

.custom-select-list::-webkit-scrollbar-thumb {
  background: var(--border-color);
}

input[type="file"] {
  cursor: pointer;
  padding: 8px;
  font-size: 8px;
}

input[type="file"]::file-selector-button {
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  padding: 6px 12px;
  border: 2px solid var(--border-color);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  margin-right: 10px;
}

input[type="file"]::file-selector-button:hover {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

.counter {
  display: block;
  text-align: right;
  font-size: 7px;
  color: var(--dim);
  margin-top: 4px;
}

.hint {
  display: block;
  font-size: 7px;
  color: var(--dim);
  margin-top: 4px;
}

/* Buttons */
.btn {
  display: inline-block;
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  padding: 14px 28px;
  border: 3px solid var(--accent);
  background: var(--bg);
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: all 0.1s;
  position: relative;
}

.btn::after {
  content: '';
  position: absolute;
  bottom: -5px;
  right: -5px;
  width: 100%;
  height: 100%;
  border: 2px solid var(--border-color);
  z-index: -1;
}

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

.btn:active {
  transform: translate(2px, 2px);
}

.btn:active::after {
  transform: translate(-2px, -2px);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn:disabled:hover {
  background: var(--bg);
  color: var(--accent);
}

.btn-full {
  display: block;
  width: 100%;
  margin-top: 20px;
  padding: 14px 28px;
  font-size: 10px;
  line-height: 1.6;
  box-sizing: border-box;
}

.btn-small {
  font-size: 8px;
  padding: 8px 16px;
  margin-top: 12px;
}

/* Result */
#result {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 2px dashed var(--border-color);
}

audio {
  display: none;
}

/* Comic speech bubble above dino */
.dino-bubble {
  position: fixed;
  bottom: 120px;
  left: 16px;
  z-index: 102;
  background: var(--surface);
  border: 3px solid var(--accent);
  padding: 8px 10px;
  display: flex;
  gap: 8px;
  align-items: center;
  image-rendering: pixelated;
}

/* Pixel tail pointing down to dino */
.bubble-tail {
  position: absolute;
  bottom: -18px;
  left: 20px;
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 18px solid var(--accent);
}

.bubble-tail::after {
  content: '';
  position: absolute;
  top: -20px;
  left: -7px;
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 15px solid var(--surface);
}

.bubble-btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  padding: 6px 10px;
  border: 2px solid var(--accent);
  background: none;
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.bubble-btn:hover {
  background: var(--accent);
  color: var(--bg);
}

/* Error */
.error {
  margin-top: 14px;
  padding: 10px;
  border: 2px solid #ff4444;
  font-size: 8px;
  color: #ff4444;
  background: rgba(255, 68, 68, 0.1);
}

/* API section */
pre {
  background: var(--bg);
  border: 2px solid var(--border-color);
  padding: 16px;
  overflow-x: auto;
  margin-bottom: 20px;
}

code {
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  line-height: 2.2;
  color: var(--accent);
}

.code-wrap {
  position: relative;
}

.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  font-family: 'Press Start 2P', monospace;
  font-size: 6px;
  padding: 4px 8px;
  border: 1px solid var(--border-color);
  background: var(--surface);
  color: var(--dim);
  cursor: pointer;
}

.copy-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.api-params {
  font-size: 8px;
}

.param {
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  gap: 16px;
}

.param-name {
  min-width: 120px;
  color: var(--accent);
}

.param-desc {
  color: var(--dim);
}

/* Pricing */
.price-grid,
.price-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.price-card {
  border: 2px solid var(--border-color);
  padding: 20px;
  text-align: center;
  background: var(--bg);
}

.price-card h3 {
  font-size: 9px;
  margin-bottom: 12px;
}

.price {
  font-size: 20px;
  margin-bottom: 4px;
}

.price-single .price {
  font-size: 32px;
  color: var(--accent);
  margin-bottom: 8px;
}

.price-unit {
  font-size: 8px;
  color: var(--dim);
  margin-bottom: 16px;
}

.price-card ul {
  list-style: none;
  font-size: 7px;
  text-align: left;
}

.price-card li {
  padding: 4px 0;
  border-bottom: 1px dashed var(--border-color);
}

.price-card li::before {
  content: '> ';
  color: var(--accent);
}

/* Contact */
#contact {
  text-align: center;
}

#contact p {
  font-size: 8px;
  color: var(--dim);
  margin-bottom: 16px;
}

/* Footer */
footer {
  position: relative;
  margin-top: 60px;
  padding-bottom: 10px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 7px;
  color: var(--dim);
  z-index: 101;
}

/* Scanline overlay */
body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.03) 0px,
    rgba(0, 0, 0, 0.03) 1px,
    transparent 1px,
    transparent 3px
  );
  z-index: 9999;
}

/* Responsive */
@media (max-width: 768px) {
  .row { flex-direction: column; }
  h1 { font-size: 14px; }
  header { padding-top: 40px; }
  .box { padding: 20px; }
  .param { flex-direction: column; gap: 4px; }
  .param-name { min-width: auto; }
}

/* Loading animation */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.btn-loading {
  animation: blink 0.8s steps(1) infinite;
}
