:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --surface2: #243044;
  --text: #e8edf4;
  --muted: #8b9cb3;
  --accent: #3d9cf5;
  --accent-hover: #5aadff;
  --success: #3dd68c;
  --warning: #f5b83d;
  --danger: #f55d5d;
  --marked: #2a6e4a;
  --free: #4a3d8f;
  --radius: 12px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(160deg, #0a0e14 0%, #121c2e 50%, #0f1419 100%);
  color: var(--text);
  line-height: 1.5;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.5rem;
}

.container.wide {
  max-width: 560px;
}

header {
  text-align: center;
  margin-bottom: 2rem;
}

header h1 {
  margin: 0 0 0.25rem;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

header p {
  margin: 0;
  color: var(--muted);
}

.card-panel {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--muted);
}

input[type='email'],
input[type='text'],
textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: var(--surface2);
  color: var(--text);
  font-size: 1rem;
  margin-bottom: 1rem;
}

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

button,
.btn {
  display: inline-block;
  padding: 0.75rem 1.25rem;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: background 0.15s;
}

button:hover,
.btn:hover {
  background: var(--accent-hover);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

button.secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

button.secondary:hover {
  background: #2d3d56;
}

.actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.error {
  background: rgba(245, 93, 93, 0.15);
  border: 1px solid var(--danger);
  color: #ffb4b4;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.success {
  background: rgba(61, 214, 140, 0.12);
  border: 1px solid var(--success);
  color: #9ef0c5;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.info-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  color: var(--muted);
}

.bingo-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin: 1rem 0;
}

.bingo-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem;
  border-radius: 8px;
  background: var(--surface2);
  border: 2px solid transparent;
  font-size: clamp(0.55rem, 2.8vw, 0.8rem);
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  user-select: none;
  transition: background 0.12s, border-color 0.12s, transform 0.1s;
  word-break: break-word;
  line-height: 1.15;
}

.bingo-cell:hover:not(.marked):not(.free) {
  border-color: var(--accent);
  transform: scale(1.02);
}

.bingo-cell.marked {
  background: var(--marked);
  border-color: var(--success);
}

.bingo-cell.free {
  background: var(--free);
  cursor: default;
  color: #d4c8ff;
}

.bingo-cell.disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}

.overlay.hidden {
  display: none;
}

.overlay-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  max-width: 400px;
  border: 2px solid var(--warning);
  animation: pop 0.35s ease;
}

.overlay-card h2 {
  margin: 0 0 0.5rem;
  font-size: 2.5rem;
  color: var(--warning);
}

@keyframes pop {
  from {
    transform: scale(0.85);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.copy-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.copy-row input {
  flex: 1;
  margin-bottom: 0;
  font-size: 0.85rem;
}

.hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.5rem;
}

.hidden {
  display: none !important;
}

@media (max-width: 400px) {
  .container {
    padding: 1rem;
  }

  .bingo-cell {
    font-size: 0.5rem;
  }
}
