:root {
  --primary: #00CEC9;
  --secondary: #81ECEC;
  --accent: #FD79A8;
  --bg-color: #0A1A1A;
  --panel-bg: rgba(20, 30, 30, 0.6);
  --border-color: rgba(255, 255, 255, 0.1);
  --text-main: #FFFFFF;
  --text-muted: #A0A0A0;
  
  /* Neon Turquoise Contribution Colors */
  --level-0: #132626; /* Empty/None */
  --level-1: #0a4c4a; /* Low */
  --level-2: #087d79; /* Medium-low */
  --level-3: #0db3ad; /* Medium-high */
  --level-4: #00CEC9; /* High */
  
  --border-radius: 12px;
  --font-main: 'Inter', system-ui, sans-serif;
  --transition: all 0.25s ease;
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  background-image: 
    radial-gradient(circle at 15% 50%, rgba(0, 206, 201, 0.05), transparent 25%),
    radial-gradient(circle at 85% 30%, rgba(253, 121, 168, 0.05), transparent 25%);
}

.app-container {
  width: 100%;
  max-width: 1400px;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

header {
  text-align: center;
  margin-top: 1rem;
}

header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary);
  text-shadow: 0 0 10px rgba(0, 206, 201, 0.3);
  margin-bottom: 0.5rem;
}

header p {
  color: var(--text-muted);
  font-size: 1.1rem;
}

/* Layout */
main {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.5rem;
  align-items: start;
}

/* Glassmorphism Panels */
.glass-panel {
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* Controls */
.controls-panel {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.control-group h2 {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 0.8rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.3rem;
}

.control-group label {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
  color: var(--text-main);
  font-weight: 500;
}

.color-options {
  display: flex;
  gap: 0.8rem;
  margin-top: 0.5rem;
}

.color-btn {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: var(--transition);
}

.color-btn:hover {
  transform: scale(1.1);
}

.color-btn.active {
  border-color: #fff;
  box-shadow: 0 0 8px rgba(255,255,255,0.5);
  transform: scale(1.15);
}

/* Inputs and Buttons */
.input-field {
  width: 100%;
  padding: 0.7rem;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-main);
  font-family: var(--font-main);
  margin-bottom: 0.8rem;
  outline: none;
  transition: var(--transition);
}

.input-field:focus {
  border-color: var(--primary);
  box-shadow: 0 0 5px rgba(0, 206, 201, 0.3);
}

.input-field option {
  background: var(--bg-color);
  color: var(--text-main);
}

.tool-actions {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.btn {
  padding: 0.7rem 1.2rem;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.95rem;
  font-family: var(--font-main);
  text-align: center;
  flex: 1;
}

.btn.full-width {
  width: 100%;
  margin-bottom: 0.5rem;
  flex: none;
  display: block;
}

.btn.primary {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #000;
  box-shadow: 0 4px 15px rgba(0, 206, 201, 0.2);
}

.btn.primary:hover {
  box-shadow: 0 6px 20px rgba(0, 206, 201, 0.4);
  transform: translateY(-2px);
}

.btn.secondary {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn.secondary:hover {
  background: rgba(255, 255, 255, 0.2);
}

.btn.danger {
  background: rgba(253, 121, 168, 0.1);
  color: var(--accent);
  border: 1px solid rgba(253, 121, 168, 0.3);
}

.btn.danger:hover {
  background: rgba(253, 121, 168, 0.2);
}

/* Grid Editor */
.editor-area {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

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

.graph-header h3 {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-weight: 600;
}

.badge {
  background: rgba(0, 206, 201, 0.2);
  color: var(--primary);
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.8rem;
  border: 1px solid rgba(0, 206, 201, 0.3);
}

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

.grid-scroll-container {
  overflow-x: auto;
  padding-bottom: 1rem;
  cursor: grab;
}

.grid-scroll-container:active {
  cursor: grabbing;
}

.grid-scroll-container::-webkit-scrollbar {
  height: 8px;
}
.grid-scroll-container::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}
.grid-scroll-container::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}
.grid-scroll-container::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

.graph-wrapper {
  display: flex;
  gap: 0.5rem;
  min-width: max-content;
  padding: 1.5rem;
  background: rgba(0,0,0,0.3);
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
}

.days-axis {
  display: flex;
  flex-direction: column;
  font-size: 0.75rem;
  color: var(--text-muted);
  gap: 0;
}

.days-axis span {
  height: 15px; /* Must roughly match cell height + gap */
  line-height: 15px;
  margin-bottom: 4px;
  display: block;
}

.grid-container {
  display: grid;
  grid-template-columns: repeat(52, 1fr);
  grid-template-rows: repeat(7, 1fr);
  gap: 4px;
  width: fit-content;
  user-select: none;
}

.grid-cell {
  width: 15px;
  height: 15px;
  border-radius: 3px;
  background-color: var(--level-0);
  cursor: crosshair;
  transition: transform 0.1s, background-color 0.1s;
  outline: 1px solid rgba(255,255,255,0.03);
}

.grid-cell:hover, .grid-cell.preview {
  box-shadow: 0 0 0 2px rgba(255,255,255,0.8);
  z-index: 10;
}

/* Output Panel */
.output-panel {
  margin-top: 1.5rem;
  background: rgba(0, 0, 0, 0.5);
  padding: 1.5rem;
  border-radius: var(--border-radius);
  border: 1px solid var(--primary);
  box-shadow: 0 0 20px rgba(0, 206, 201, 0.1);
  animation: slideIn 0.3s ease;
}

.output-panel.hidden {
  display: none;
}

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

.output-header h2 {
  font-size: 1.2rem;
  color: var(--primary);
}

.btn-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
  transition: var(--transition);
}

.btn-close:hover {
  color: var(--accent);
  transform: scale(1.1);
}

.code-output {
  width: 100%;
  height: 250px;
  background: #000;
  color: #39d353;
  padding: 1rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
  font-size: 0.9rem;
  resize: vertical;
  margin-bottom: 1rem;
  white-space: pre-wrap;
  word-wrap: break-word;
}

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

/* Responsive */
@media (max-width: 1024px) {
  main {
    grid-template-columns: 1fr;
  }
}
