:root {
  --bg: #09090b;
  --surface: #18181b;
  --border: #27272a;
  --accent: #22d3ee;
  --accent-hover: #06b6d4;
  --text: #fafafa;
  --text-muted: #a1a1aa;
  --success: #4ade80;
  --danger: #f87171;
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
}

h1 {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.5px;
}

.subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 2px;
}

.icon-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.icon-btn:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

/* Settings Panel */
.settings-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 24px;
  overflow: hidden;
  transition: all 0.2s;
}

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

.settings-content {
  padding: 20px;
}

.settings-content label {
  font-size: 14px;
  font-weight: 500;
  display: block;
  margin-bottom: 8px;
}

.optional {
  color: var(--text-muted);
  font-weight: 400;
}

.settings-content input {
  width: 100%;
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  margin-bottom: 8px;
}

.settings-content input:focus {
  outline: none;
  border-color: var(--accent);
}

.hint {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.settings-actions {
  display: flex;
  gap: 8px;
}

/* Main Layout */
.main {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 32px;
  align-items: start;
}

/* Board Section */
.board-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.board-container {
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.3s;
}

.board-container.hidden {
  opacity: 0.05;
  filter: blur(20px);
}

#board {
  width: 400px;
}

.board-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.shortcut {
  font-size: 13px;
  color: var(--text-muted);
}

/* Play Section */
.play-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.game-controls {
  display: flex;
  gap: 12px;
}

/* Buttons */
.btn {
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
}

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

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

.btn.ghost {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn.ghost:hover {
  border-color: var(--text-muted);
}

.btn-sm {
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
}

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

.btn-sm.ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-sm.ghost:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

.btn-xs {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  background: transparent;
  color: var(--text-muted);
  margin-left: 8px;
}

.btn-xs:hover {
  color: var(--text);
}

/* Move Input */
.move-input-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.input-wrapper {
  display: flex;
  gap: 8px;
}

.input-wrapper input {
  flex: 1;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 15px;
}

.input-wrapper input:focus {
  outline: none;
  border-color: var(--accent);
}

.input-wrapper input::placeholder {
  color: var(--text-muted);
}

.mic-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
}

.mic-btn svg {
  flex-shrink: 0;
}

/* Status */
.status-section {
  padding: 12px 16px;
  background: var(--surface);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.status {
  font-size: 14px;
  margin: 0;
}

.status.muted {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 4px;
}

.status.muted:empty {
  display: none;
}

/* Game Info */
.game-info {
  padding: 16px;
  background: var(--surface);
  border-radius: 10px;
  border: 1px solid var(--border);
}

.info-row {
  display: flex;
  gap: 32px;
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.info-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.info-value {
  font-size: 16px;
  font-weight: 600;
}

/* Collapsible Sections */
details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

summary {
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  user-select: none;
}

summary::-webkit-details-marker {
  margin-right: 8px;
}

details[open] summary {
  border-bottom: 1px solid var(--border);
}

.moves-list {
  list-style: none;
  padding: 12px 16px;
  max-height: 200px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.moves-list li {
  font-size: 13px;
  padding: 6px 10px;
  background: var(--bg);
  border-radius: 6px;
  font-family: 'SF Mono', 'Consolas', monospace;
}

.fen-text {
  padding: 12px 16px;
  font-size: 12px;
  font-family: 'SF Mono', 'Consolas', monospace;
  color: var(--text-muted);
  word-break: break-all;
}

.log-list {
  padding: 12px 16px;
  max-height: 200px;
  overflow-y: auto;
}

.log-entry {
  font-size: 13px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 8px;
  align-items: baseline;
}

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

.log-entry .time {
  color: var(--text-muted);
  font-size: 12px;
  flex-shrink: 0;
}

.log-entry .tag {
  background: var(--border);
  color: var(--text-muted);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  flex-shrink: 0;
}

.danger {
  color: var(--danger);
}

/* Footer */
.footer {
  margin-top: 48px;
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

.footer a {
  color: var(--accent);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

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

  #board {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
  }

  .board-section {
    align-items: center;
  }

  .game-controls {
    flex-direction: column;
  }

  .game-controls .btn {
    width: 100%;
  }

  .info-row {
    gap: 16px;
  }
}
