/* ============================================================
   Regex Golf — Styles
   Dark purple/violet theme with neon accents
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --primary: #A855F7;
  --primary-glow: rgba(168, 85, 247, 0.15);
  --green: #22C55E;
  --red: #EF4444;
  --amber: #F59E0B;
  --bg: #0C0A14;
  --bg-surface: #13101F;
  --bg-card: rgba(19, 16, 31, 0.85);
  --text: #E8E0F0;
  --text-dim: #8A7AA0;
  --text-muted: #5A4A70;
  --border: rgba(168, 85, 247, 0.1);
  --radius: 10px;
  --font: 'Inter', -apple-system, sans-serif;
  --mono: 'JetBrains Mono', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font); background: var(--bg); color: var(--text);
  min-height: 100vh;
  background-image: radial-gradient(ellipse 60% 40% at 50% 0%, rgba(168,85,247,0.04), transparent);
}

#app { max-width: 900px; margin: 0 auto; padding: 0.75rem; }

.top-bar { display: flex; justify-content: space-between; align-items: center; padding: 0.5rem 0; }
.logo { font-size: 1.1rem; font-weight: 700; }
.header-actions { display: flex; gap: 0.5rem; align-items: center; font-family: var(--mono); font-size: 0.75rem; }
#score-display { color: var(--primary); font-weight: 600; }

.glass-card { background: var(--bg-card); backdrop-filter: blur(12px); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; }
h3 { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-dim); margin-bottom: 0.5rem; }

.btn-sm { background: rgba(255,255,255,0.05); border: 1px solid var(--border); border-radius: 6px; color: var(--text-dim); font-size: 0.7rem; padding: 0.25rem 0.5rem; cursor: pointer; font-family: var(--font); }
.btn-sm:hover { background: rgba(255,255,255,0.1); color: var(--text); }
.btn-primary { padding: 0.5rem 1.5rem; background: var(--primary); color: #fff; font-weight: 700; border: none; border-radius: 8px; cursor: pointer; font-family: var(--font); font-size: 0.8rem; }
.btn-primary:disabled { opacity: 0.3; cursor: not-allowed; }
.btn-primary:hover:not(:disabled) { transform: scale(1.02); }

/* Layout */
.game-layout { display: flex; gap: 0.75rem; margin-top: 0.75rem; }
.challenge-panel { flex: 1; }
.cheatsheet { width: 200px; flex-shrink: 0; }

.challenge-header { display: flex; justify-content: space-between; align-items: center; font-size: 0.7rem; color: var(--text-dim); margin-bottom: 0.75rem; }
.difficulty { padding: 0.1rem 0.4rem; border-radius: 4px; background: var(--primary-glow); font-size: 0.6rem; font-weight: 600; }
.timer { font-family: var(--mono); }

/* Columns */
.columns { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin-bottom: 1rem; }
.col-title { font-size: 0.65rem; margin-bottom: 0.4rem; }
.match-title { color: var(--green); }
.reject-title { color: var(--red); }
.string-list { list-style: none; font-family: var(--mono); font-size: 0.75rem; max-height: 200px; overflow-y: auto; }
.string-list li { padding: 0.2rem 0.4rem; border-radius: 4px; margin-bottom: 0.15rem; transition: background 0.2s; }
.string-list li.matched { background: rgba(34, 197, 94, 0.1); }
.string-list li.rejected { background: rgba(239, 68, 68, 0.1); }
.string-list li.fail { background: rgba(239, 68, 68, 0.2); color: var(--red); }
.string-list li.pass { background: rgba(34, 197, 94, 0.15); color: var(--green); }

/* Input */
.input-section { display: flex; flex-direction: column; gap: 0.5rem; }
.regex-input-wrap { display: flex; align-items: center; gap: 0; background: rgba(255,255,255,0.03); border: 1px solid var(--border); border-radius: 8px; padding: 0.5rem; }
.regex-delim { font-family: var(--mono); font-size: 1.1rem; color: var(--primary); font-weight: 700; padding: 0 0.3rem; }
.regex-input { flex: 1; background: transparent; border: none; outline: none; color: var(--text); font-family: var(--mono); font-size: 0.9rem; caret-color: var(--primary); }
.input-meta { display: flex; justify-content: space-between; font-size: 0.65rem; color: var(--text-muted); }
#match-status { font-weight: 600; }

/* Cheatsheet */
.cheat-grid { display: grid; grid-template-columns: auto 1fr; gap: 0.2rem 0.5rem; font-size: 0.7rem; }
.cheat-grid code { font-family: var(--mono); color: var(--primary); background: rgba(168,85,247,0.08); padding: 0.1rem 0.3rem; border-radius: 3px; }
.cheat-grid span { color: var(--text-dim); }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); }
.modal-content { max-width: 420px; width: 90%; text-align: center; padding: 1.5rem; }
.modal-content h2 { margin-bottom: 0.75rem; }
.modal-content p { font-size: 0.8rem; color: var(--text-dim); margin-bottom: 0.5rem; text-align: left; }
.modal-content code { font-family: var(--mono); color: var(--primary); background: rgba(168,85,247,0.08); padding: 0.1rem 0.3rem; border-radius: 3px; }
.explain-desc { font-size: 0.75rem; line-height: 1.5; margin-top: 0.5rem; }

.results-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.3rem 1rem; font-size: 0.8rem; text-align: left; margin-bottom: 1rem; }
.r-label { color: var(--text-muted); }
.r-value { font-weight: 700; font-family: var(--mono); }

.scores-list { font-size: 0.75rem; max-height: 250px; overflow-y: auto; }
.score-entry { display: flex; justify-content: space-between; padding: 0.25rem 0; border-bottom: 1px solid var(--border); }

@media (max-width: 640px) {
  .game-layout { flex-direction: column; }
  .cheatsheet { width: 100%; }
  .columns { grid-template-columns: 1fr; }
}
