:root {
  --bg: #1c1916;
  --card-bg: #262220;
  --accent: #c9a227;
  --text: #e8e0d5;
  --text-dim: #9a918a;
  --success: #7a9a6d;
  --border: #3d3632;
}

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

/* Base styles - mobile first */
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding: 16px;
  line-height: 1.6;
}

.container {
  max-width: 900px;
  margin: 0 auto;
}

h1 {
  text-align: center;
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  color: #c9c1b6;
}

.subtitle {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
  padding: 0 8px;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.card h2 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.input-row {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0;
}

.input-row input[type="text"] {
  flex: 1;
  border-radius: 8px 0 0 8px;
  border-right: none;
}

.input-row button {
  border-radius: 0 8px 8px 0;
  border-left: none;
  width: auto;
}

input[type="text"],
textarea {
  display: block;
  width: 100%;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  font-size: 1rem;
  color: var(--text);
  outline: none;
}

input[type="text"]:focus,
textarea:focus {
  border-color: var(--accent);
}

textarea {
  font-family: 'Consolas', 'Monaco', monospace;
  resize: vertical;
  min-height: 120px;
  margin-top: 16px;
}

button {
  display: block;
  width: 100%;
  background: linear-gradient(180deg, #e8c252 0%, #c9a227 50%, #a68620 100%);
  border: 2px solid #a68620;
  border-radius: 8px;
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 600;
  color: #2a2218;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.3);
  cursor: pointer;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.status {
  text-align: center;
  padding: 8px;
  margin-bottom: 16px;
  color: var(--text-dim);
  font-style: italic;
}

.status.loading::after {
  content: '';
  display: inline-block;
  width: 1em;
  animation: dots 1.5s infinite;
}

@keyframes dots {
  0%, 20% { content: ''; }
  40% { content: '.'; }
  60% { content: '..'; }
  80%, 100% { content: '...'; }
}

.results {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.mix-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  opacity: 0;
  transform: translateX(-20px);
}

.mix-row.visible {
  opacity: 1;
  transform: translateX(0);
}

.mix-word {
  font-weight: 600;
  color: var(--accent);
}

.divider {
  display: none;
}

.blend-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.blend-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.9rem;
  cursor: pointer;
  user-select: none;
  position: relative;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.blend-item:hover {
  border-color: var(--accent);
  background: rgba(201, 162, 39, 0.1);
}

.blend-item:active {
  transform: scale(0.97);
}

.blend-item.copied {
  background: var(--success);
  border-color: var(--success);
  color: var(--bg);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.card-header h2 {
  margin-bottom: 0;
}

.save-btn {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 6px 12px;
  font-size: 0.75rem;
  width: auto;
}

.count {
  text-align: center;
  color: var(--success);
  font-size: 1rem;
  margin-bottom: 16px;
  opacity: 0;
}

.count.visible {
  opacity: 1;
}

.progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin-bottom: 16px;
  overflow: hidden;
  opacity: 0;
}

.progress-bar.visible {
  opacity: 1;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  width: 0%;
}

.settings-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.setting {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-dim);
  font-size: 0.85rem;
}

.setting input {
  width: 60px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 8px;
  color: var(--text);
  text-align: center;
}

.setting input[type="checkbox"] {
  width: auto;
  margin-right: 4px;
}

.setting input[type="radio"] {
  width: auto;
  margin-right: 4px;
  margin-left: 8px;
}

.text-dim {
  color: var(--text-dim);
}

.weight-section {
  margin-bottom: 24px;
}

.weight-section:last-child {
  margin-bottom: 0;
}

.weight-label {
  font-size: 0.8rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.hint {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.75rem;
  margin-top: 12px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.hint.visible {
  opacity: 1;
}

/* Desktop styles */
@media (min-width: 600px) {
  body {
    padding: 32px;
  }

  h1 {
    font-size: 2.5rem;
  }

  .subtitle {
    font-size: 1rem;
    margin-bottom: 2rem;
  }

  .card {
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
  }

  .card h2 {
    font-size: 1rem;
    margin-bottom: 16px;
  }

  button {
    width: auto;
  }

  button:hover {
    filter: brightness(1.15);
  }

  button:active {
    transform: translateY(0);
  }


  .mix-row {
    flex-direction: row;
    align-items: flex-start;
  }

  .mix-word {
    min-width: 120px;
    text-align: right;
    padding: 6px 0;
    flex-shrink: 0;
  }

  .divider {
    display: block;
    width: 2px;
    background: var(--border);
    border-radius: 1px;
    align-self: stretch;
    min-height: 32px;
    flex-shrink: 0;
  }

  .blend-list {
    flex: 1;
  }
}
