/* ===== MINICRIMS - Shared Styles ===== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@500;700&display=swap');

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

:root {
  --bg-primary: #0f0f13;
  --bg-secondary: #1a1a24;
  --bg-card: #22222e;
  --bg-input: #2a2a38;
  --border: #3a3a4a;
  --text-primary: #e8e8ef;
  --text-secondary: #9999aa;
  --text-muted: #666677;
  --accent: #7c6ff7;
  --accent-hover: #9488ff;
  --accent-dim: rgba(124, 111, 247, 0.15);
  --danger: #e55b5b;
  --success: #4ecb71;
  --warning: #f0b040;
  --radius: 12px;
  --radius-sm: 8px;
  --transition: 0.2s ease;
}

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
}

/* ===== Layout ===== */

.container {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 20px;
}

.screen {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
  max-width: 480px;
  animation: fadeIn 0.3s ease;
}

.screen.active {
  display: flex;
}

/* ===== Typography ===== */

h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-align: center;
}

h2 {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-align: center;
}

h3 {
  font-size: 1.1rem;
  font-weight: 600;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  text-align: center;
}

/* ===== Logo ===== */

.logo {
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #7c6ff7, #b06ff7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.logo-small {
  font-size: 1.2rem;
  font-weight: 700;
  background: linear-gradient(135deg, #7c6ff7, #b06ff7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  cursor: pointer;
  text-decoration: none;
}

/* ===== Buttons ===== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  width: 100%;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 20px rgba(124, 111, 247, 0.3);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

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

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: #ff6b6b;
}

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

.btn-small {
  padding: 10px 20px;
  font-size: 0.9rem;
}

/* ===== Inputs ===== */

.input-group {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.input-group label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

input[type="text"] {
  width: 100%;
  padding: 14px 16px;
  font-size: 1rem;
  font-family: inherit;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition);
}

input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

input[type="text"]::placeholder {
  color: var(--text-muted);
}

.code-input {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.8rem;
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  padding: 16px;
}

/* ===== Cards ===== */

.card {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

/* ===== Lobby Code Display ===== */

.lobby-code-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
}

.lobby-code-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.lobby-code-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: 0.25em;
  color: var(--accent);
}

/* ===== Player List ===== */

.player-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.player-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.player-count {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.player-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}

.player-item .player-name {
  font-weight: 500;
}

.player-item .player-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-host {
  background: var(--accent-dim);
  color: var(--accent);
}

/* ===== Checkbox ===== */

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  width: 100%;
  user-select: none;
}

.checkbox-group:hover {
  border-color: var(--accent);
}

.checkbox-group input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.checkbox-group label {
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
}

/* ===== Status / Messages ===== */

.status-message {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  text-align: center;
}

.status-error {
  background: rgba(229, 91, 91, 0.12);
  color: var(--danger);
  border: 1px solid rgba(229, 91, 91, 0.25);
}

.status-success {
  background: rgba(78, 203, 113, 0.12);
  color: var(--success);
  border: 1px solid rgba(78, 203, 113, 0.25);
}

.status-info {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(124, 111, 247, 0.25);
}

.status-warning {
  background: rgba(240, 176, 64, 0.12);
  color: var(--warning);
  border: 1px solid rgba(240, 176, 64, 0.25);
}

/* ===== Loading Spinner ===== */

.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 40px 20px;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-text {
  font-size: 1rem;
  color: var(--text-secondary);
  text-align: center;
}

.loading-dots::after {
  content: '';
  animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
  0%   { content: ''; }
  25%  { content: '.'; }
  50%  { content: '..'; }
  75%  { content: '...'; }
  100% { content: ''; }
}

/* ===== Timer ===== */

.timer-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 24px;
  width: 100%;
}

.timer-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 3.5rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-primary);
}

.timer-value.timer-warning {
  color: var(--warning);
}

.timer-value.timer-danger {
  color: var(--danger);
  animation: pulse 1s ease infinite;
}

.timer-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.times-up {
  font-size: 2rem;
  font-weight: 800;
  color: var(--danger);
  text-align: center;
  animation: pulse 1s ease infinite;
}

/* ===== Game Role Display ===== */

.role-display {
  width: 100%;
  text-align: center;
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.role-title {
  font-size: 1.6rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.role-subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.story-card {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.story-card h3 {
  margin-bottom: 12px;
  color: var(--accent);
}

.story-text {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text-secondary);
  white-space: pre-wrap;
}

.character-name {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
  margin-top: 4px;
}

/* ===== Divider ===== */

.divider {
  width: 100%;
  height: 1px;
  background: var(--border);
  margin: 8px 0;
}

/* ===== Modal Overlay ===== */

.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 100;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: slideUp 0.3s ease;
}

.modal h2 {
  font-size: 1.3rem;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.modal-actions .btn {
  flex: 1;
}

/* ===== Animations ===== */

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

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

/* ===== Responsive ===== */

@media (max-width: 520px) {
  body {
    padding: 12px;
  }

  .logo {
    font-size: 2rem;
  }

  .lobby-code-value {
    font-size: 2rem;
  }

  .timer-value {
    font-size: 2.8rem;
  }

  h1 {
    font-size: 1.6rem;
  }
}

/* ===== Kick Button ===== */

.btn-kick {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: rgba(229, 91, 91, 0.12);
  color: var(--danger);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}

.btn-kick:hover {
  background: rgba(229, 91, 91, 0.25);
  color: #ff6b6b;
}

.btn-kick:active {
  transform: scale(0.9);
}

.player-item-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ===== Hidden helper ===== */

.hidden {
  display: none !important;
}

/* ===== Spacer ===== */

.spacer {
  flex: 1;
}

.gap-sm { gap: 8px; }
.gap-md { gap: 16px; }
.gap-lg { gap: 24px; }

.w-full { width: 100%; }
.text-center { text-align: center; }
.mt-auto { margin-top: auto; }
