:root {
  --bg: #1a1a2e;
  --surface: #16213e;
  --primary: #0f3460;
  --accent: #e94560;
  --accent2: #00b4d8;
  --text: #e0e0e0;
  --text-dim: #a0a0a0;
  --shadow-light: #2a2a4a;
  --shadow-dark: #0a0a1a;
  --radius: 16px;
  --transition: 0.2s ease;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, sans-serif;
  display: flex;
  justify-content: center;
  padding: 1rem;
  min-height: 100vh;
}

.container {
  width: 100%;
  max-width: 900px;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2rem;
}

h1 {
  font-size: 2rem;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.connection {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.badge {
  background: var(--surface);
  padding: 0.5rem 1rem;
  border-radius: 30px;
  font-size: 0.9rem;
  box-shadow: inset 3px 3px 6px var(--shadow-dark), inset -3px -3px 6px var(--shadow-light);
}

.btn {
  background: var(--surface);
  color: var(--text);
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 4px 4px 8px var(--shadow-dark), -4px -4px 8px var(--shadow-light);
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn:hover {
  box-shadow: 2px 2px 4px var(--shadow-dark), -2px -2px 4px var(--shadow-light);
  transform: translateY(-1px);
}

.btn:active {
  box-shadow: inset 2px 2px 4px var(--shadow-dark), inset -2px -2px 4px var(--shadow-light);
}

.btn.connect {
  background: var(--accent);
  color: white;
  font-weight: bold;
}

/* Kortvisualisering */
.card-visual {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 2rem;
}

.card {
  width: 320px;
  height: 180px;
  background: linear-gradient(135deg, #2b2b4a, #1a1a3a);
  border-radius: 20px;
  box-shadow: 8px 8px 16px var(--shadow-dark), -8px -8px 16px var(--shadow-light);
  position: relative;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.8rem;
}

.chip {
  width: 40px;
  height: 30px;
  background: linear-gradient(145deg, #ffd700, #b8860b);
  border-radius: 6px;
  position: absolute;
  top: 1rem;
  left: 2rem;
}

.track {
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  padding: 0.3rem 0.6rem;
  font-family: 'Courier New', monospace;
  font-size: 0.8rem;
  word-break: break-all;
  min-height: 1.5em;
  color: #ccc;
}

.card-label {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* Flikar */
.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  overflow-x: auto;
}

.tab {
  background: var(--surface);
  border: none;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  color: var(--text-dim);
  cursor: pointer;
  box-shadow: 2px 2px 4px var(--shadow-dark), -2px -2px 4px var(--shadow-light);
  font-weight: 600;
  transition: all var(--transition);
}

.tab.active {
  background: var(--primary);
  color: white;
  box-shadow: inset 2px 2px 4px var(--shadow-dark), inset -2px -2px 4px var(--shadow-light);
}

.tab-content {
  display: none;
  animation: fade 0.3s;
}

.tab-content.active {
  display: block;
}

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

/* Paneler */
.card-panel {
  background: var(--surface);
  padding: 1.2rem;
  border-radius: var(--radius);
  box-shadow: 4px 4px 8px var(--shadow-dark), -4px -4px 8px var(--shadow-light);
  margin-bottom: 1rem;
}

.card-panel h3 {
  margin-bottom: 1rem;
  color: var(--accent2);
  font-size: 1rem;
}

.grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.input-group {
  margin-bottom: 0.8rem;
}

.input-group label {
  display: block;
  font-size: 0.8rem;
  margin-bottom: 0.2rem;
  color: var(--text-dim);
}

input, select {
  width: 100%;
  padding: 0.5rem;
  background: var(--bg);
  border: none;
  border-radius: 8px;
  color: var(--text);
  box-shadow: inset 2px 2px 4px var(--shadow-dark), inset -2px -2px 4px var(--shadow-light);
  margin-bottom: 0.5rem;
}

/* Lysdioder */
.led-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.led-btn {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 4px 4px 8px var(--shadow-dark), -4px -4px 8px var(--shadow-light);
  background: var(--surface);
  transition: all var(--transition);
}

.led-btn:active {
  box-shadow: inset 4px 4px 8px var(--shadow-dark), inset -4px -4px 8px var(--shadow-light);
}

.led-btn.green:active { background: #4caf50; color: white; }
.led-btn.yellow:active { background: #ffc107; color: black; }
.led-btn.red:active { background: #f44336; color: white; }
.led-btn.all:active { background: var(--primary); }

/* Logg */
footer {
  margin-top: 2rem;
}

.log {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1rem;
  height: 120px;
  overflow-y: auto;
  font-family: monospace;
  font-size: 0.8rem;
  box-shadow: inset 2px 2px 4px var(--shadow-dark), inset -2px -2px 4px var(--shadow-light);
  white-space: pre-wrap;
  color: var(--text-dim);
}
