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

:root {
  --bg-dark: #0f0f12;
  --bg-card: #18181f;
  --bg-elevated: #22222c;
  --text: #e8e8ed;
  --text-muted: #8b8b9a;
  --accent: #7c5cff;
  --accent-hover: #9378ff;
  --success: #22c55e;
  --error: #ef4444;
  --border: #2a2a35;
}

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

body {
  font-family: 'Outfit', system-ui, sans-serif;
  background: var(--bg-dark);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Subtle grid background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(124, 92, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(124, 92, 255, 0.03) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
  z-index: 0;
}

.header {
  text-align: center;
  padding: 2rem 1rem;
  position: relative;
  z-index: 1;
}

.header h1 {
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #fff 0%, #a78bfa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tagline {
  color: var(--text-muted);
  font-size: 1rem;
  margin-top: 0.5rem;
}

.stats {
  margin-top: 1rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.stats .divider {
  margin: 0 0.5rem;
  opacity: 0.5;
}

#remaining {
  color: var(--accent);
  font-weight: 600;
}

.main {
  display: flex;
  gap: 2rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem 2rem;
  position: relative;
  z-index: 1;
}

.sidebar {
  flex-shrink: 0;
  width: 220px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.color-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
}

.color-section label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.color-section input[type="color"] {
  width: 100%;
  height: 48px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background: transparent;
}

.color-section input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 4px;
}

.color-section input[type="color"]::-webkit-color-swatch {
  border: 2px solid var(--border);
  border-radius: 6px;
}

#color-hex {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
}

.visitor-log {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
}

.visitor-log label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.visitor-log-list {
  max-height: 160px;
  overflow-y: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.8;
}

.visitor-log-list::-webkit-scrollbar {
  width: 6px;
}

.visitor-log-list::-webkit-scrollbar-track {
  background: var(--bg-elevated);
  border-radius: 3px;
}

.visitor-log-list::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.visitor-log-entry {
  padding: 0.15rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.visitor-log-entry:last-child {
  border-bottom: none;
}

.visitor-time {
  color: var(--text-muted);
  opacity: 0.7;
  font-size: 0.75rem;
}

.visitor-log-empty {
  opacity: 0.6;
}

.session-log {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
}

.session-log label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.session-log-date {
  width: 100%;
  margin-bottom: 0.75rem;
  padding: 0.4rem 0.5rem;
  font-size: 0.85rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
}

.session-log-list {
  max-height: 140px;
  overflow-y: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.session-log-entry {
  padding: 0.35rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.session-log-entry:last-child {
  border-bottom: none;
}

.session-log-type {
  font-size: 0.7rem;
  opacity: 0.8;
}

/* Admin page */
.admin-page {
  max-width: 800px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.admin-back {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
}

.admin-back:hover {
  color: var(--accent);
}

.admin-login {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  max-width: 400px;
}

.admin-login label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.admin-login input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
}

.admin-login button {
  padding: 0.6rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  background: var(--accent);
  border: none;
  border-radius: 6px;
  color: white;
  cursor: pointer;
}

.admin-login button:hover {
  background: var(--accent-hover);
}

.admin-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
}

.admin-toolbar {
  margin-bottom: 1rem;
}

.admin-toolbar .session-log-date {
  margin-bottom: 0;
}

.admin-log-list {
  max-height: 60vh;
  font-size: 0.8rem;
}

.admin-empty {
  color: var(--text-muted);
  padding: 2rem;
  text-align: center;
}

.hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.lock-btn {
  margin-top: auto;
  padding: 0.75rem 1rem;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.lock-btn:hover {
  background: var(--error);
  border-color: var(--error);
  color: white;
}

.grid-container {
  flex: 1;
  min-width: 0;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 1rem;
  overflow: auto;
}

#grid {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  cursor: crosshair;
  border-radius: 4px;
}

.magnifier {
  position: fixed;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  border: 3px solid var(--accent);
  overflow: hidden;
  pointer-events: none;
  display: none;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.5),
    0 8px 32px rgba(0, 0, 0, 0.5),
    inset 0 0 0 1px rgba(255, 255, 255, 0.1);
  z-index: 100;
}

.magnifier.visible {
  display: block;
}

.magnifier canvas {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.magnifier-crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2px;
  height: 2px;
  margin: -1px 0 0 -1px;
  background: white;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.8);
  border-radius: 50%;
  pointer-events: none;
}

#cursor-preview {
  position: fixed;
  width: 12px;
  height: 12px;
  border: 2px solid white;
  border-radius: 2px;
  pointer-events: none;
  display: none;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5);
}

.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: 0.75rem 1.5rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  opacity: 0;
  transition: transform 0.3s, opacity 0.3s;
  z-index: 1000;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast.error {
  border-color: var(--error);
  color: #fca5a5;
}

.toast.success {
  border-color: var(--success);
  color: #86efac;
}
