:root {
  --bg: #03070d;
  --panel: #07131d;
  --panel-edge: #16334d;
  --payline: #d7e3f5;
  --payline-glow: rgba(125, 191, 255, 0.6);
  --ship-frame: #060b12;
  --text: #edf4ff;
  --button-bg: #85d5ff;
  --button-shadow: #4fb6ff;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
}

body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
}

.app-shell {
  width: min(92vw, 440px);
  background: #000;
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
}

.slot-machine {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  width: 100%;
  align-items: center;
  border: none;
  overflow: hidden;
}

.reel {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.reel-window {
  position: relative;
  width: 100%;
  height: min(58vh, 430px);
  max-height: 430px;
  background: #000;
  border: 2px solid rgba(211, 223, 255, 0.2);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.9), 0 0 12px rgba(84, 162, 255, 0.08);
}

.reel-window::before,
.reel-window::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 24%;
  z-index: 3;
  pointer-events: none;
}

.reel-window::before {
  top: 0;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0));
}

.reel-window::after {
  bottom: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0));
}

.reel-strip {
  display: flex;
  flex-direction: column;
  will-change: transform;
  transition: transform 0.05s linear, filter 0.08s ease-out;
  background: #000;
}

.reel-strip.blurred {
  filter: blur(3px);
}

.reel-window::before,
.reel-window::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: rgba(255, 255, 255, 0.12);
  z-index: 4;
  pointer-events: none;
}

.reel-window::before {
  top: 36%;
}

.reel-window::after {
  bottom: 36%;
}

.reel-window .payline {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 3px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), var(--payline), rgba(255,255,255,0));
  box-shadow: 0 0 14px var(--payline-glow);
  z-index: 5;
  pointer-events: none;
}

.reel-item {
  width: 100%;
  height: clamp(112px, 21vw, 138px);
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  border: none;
  overflow: hidden;
}

.reel-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  filter: drop-shadow(0 0 10px rgba(123, 205, 255, 0.25));
  background: #000;
  padding: 0;
}

.reel-item.matched {
  border: 4px solid #ff0000;
  box-shadow: inset 0 0 12px rgba(255, 0, 0, 0.4);
}

.spin-button {
  margin: 18px auto 0;
  display: block;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #c9f2ff 0%, #80d0ff 100%);
  color: #062033;
  font-weight: 800;
  letter-spacing: 0.12em;
  font-size: 1rem;
  padding: 0.9rem 2.5rem;
  box-shadow: 0 10px 20px rgba(79, 182, 255, 0.28), inset 0 0 12px rgba(255,255,255,0.5);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.spin-button .crystal-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
}

.spin-button .crystal-row img {
  width: 16px;
  height: 16px;
  object-fit: contain;
  display: block;
}

.spin-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 24px rgba(79, 182, 255, 0.36), inset 0 0 12px rgba(255,255,255,0.58);
}

.spin-button:active {
  transform: translateY(1px);
}

.spin-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

@media (min-width: 700px) {
  .app-shell {
    padding: 20px 18px 24px;
  }

  .reel-window {
    height: 460px;
  }

  .reel-item img {
    width: 82%;
    max-width: 120px;
  }
}

/* New styles for authentication and account system */

.app-header {
  padding: 16px 12px;
  text-align: center;
  border-bottom: 2px solid rgba(211, 223, 255, 0.2);
  margin-bottom: 12px;
}

.app-logo {
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: 0.15em;
  margin: 0 0 12px 0;
  color: var(--payline);
  text-shadow: 0 0 10px var(--payline-glow);
}

.auth-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.auth-guest, .auth-logged {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  align-items: center;
  width: 100%;
}

.auth-logged {
  font-size: 0.85rem;
}

.user-info {
  flex-basis: 100%;
  color: var(--payline);
}

.spins-info {
  flex-basis: 100%;
  color: #ffcc00;
  font-weight: bold;
}

.auth-btn {
  border: none;
  border-radius: 6px;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.auth-btn-primary {
  background: linear-gradient(180deg, #c9f2ff 0%, #80d0ff 100%);
  color: #062033;
  box-shadow: 0 4px 8px rgba(79, 182, 255, 0.3);
}

.auth-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(79, 182, 255, 0.4);
}

.auth-btn-secondary {
  background: rgba(79, 182, 255, 0.2);
  color: var(--button-bg);
  border: 1px solid var(--button-bg);
}

.auth-btn-secondary:hover {
  background: rgba(79, 182, 255, 0.35);
}

.auth-btn-tertiary {
  background: transparent;
  color: #888;
  border: 1px solid #666;
}

.auth-btn-tertiary:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

/* Modal styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal {
  background: var(--panel);
  border: 2px solid var(--panel-edge);
  border-radius: 12px;
  padding: 24px;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7);
}

.modal-large {
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
}

.modal h2 {
  margin: 0 0 16px 0;
  font-size: 1.3rem;
  text-align: center;
  color: var(--payline);
}

.modal form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal input {
  padding: 10px 12px;
  border: 1px solid var(--panel-edge);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 0.95rem;
}

.modal input:focus {
  outline: none;
  border-color: var(--button-bg);
  background: rgba(255, 255, 255, 0.1);
}

.modal input::placeholder {
  color: rgba(237, 244, 255, 0.5);
}

.error-message {
  color: #ff6666;
  font-size: 0.85rem;
  text-align: center;
  margin: 0;
}

.win-message {
  font-size: 1rem;
  line-height: 1.5;
  text-align: center;
  margin-bottom: 20px;
}

/* Control Panel styles */
.collection-stats {
  text-align: center;
  font-size: 1.1rem;
  color: var(--payline);
  margin: 0 0 16px 0;
  font-weight: bold;
}

.spaceship-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
  max-height: 60vh;
  overflow-y: auto;
}

.spaceship-item {
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid rgba(211, 223, 255, 0.2);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
}

.spaceship-item:hover {
  border-color: var(--button-bg);
}

.spaceship-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.spaceship-item.undiscovered {
  opacity: 0.4;
  filter: grayscale(100%);
}

.spaceship-item.discovered {
  border-color: var(--payline);
  box-shadow: 0 0 10px var(--payline-glow);
}

/* Responsive adjustments */
@media (max-width: 440px) {
  .auth-logged {
    flex-direction: column;
    gap: 6px;
  }
  
  .user-info, .spins-info {
    flex-basis: auto;
    display: block;
  }
  
  .auth-btn {
    flex: 1;
    min-width: 100px;
  }
  
  .spaceship-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

