*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  color: #333;
  background: #fff;
}

/* Layout */
.layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  min-height: 100vh;
}

@media (max-width: 768px) {
  .layout {
    grid-template-columns: 1fr;
  }
}

/* Left panel */
.panel-features {
  overflow-y: auto;
  padding: 16px;
  border-right: 1px solid #e0e0e0;
  background: #fafafa;
}

/* Right panel */
.panel-results {
  overflow-y: auto;
  padding: 16px;
}

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

.panel-header h1 {
  margin: 0;
  font-size: 1.4em;
  font-weight: 700;
}

/* Language toggle */
.lang-toggle {
  display: flex;
  gap: 2px;
}

.lang-btn {
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid #ccc;
  background: #fff;
  color: #666;
  cursor: pointer;
  border-radius: 3px;
}

.lang-btn:first-child {
  border-radius: 3px 0 0 3px;
}

.lang-btn:last-child {
  border-radius: 0 3px 3px 0;
}

.lang-btn.active {
  background: #333;
  color: #fff;
  border-color: #333;
}

/* Feature groups */
.feature-group {
  margin-bottom: 20px;
}

.feature-group h2 {
  margin: 0 0 8px 0;
  font-size: 1em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #444;
}

.feature-group h3 {
  margin: 10px 0 6px 0;
  font-size: 0.85em;
  font-weight: 600;
  color: #666;
}

/* Pills container */
.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* Pill button */
.pill {
  border-radius: 20px;
  padding: 6px 14px;
  cursor: pointer;
  border: 1px solid #ccc;
  background: #f5f5f5;
  font-size: 0.85em;
  color: #333;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  line-height: 1.2;
}

.pill:hover {
  border-color: #2c5f2e;
  background: #e8f5e9;
}

.pill.active {
  background: #2c5f2e;
  color: #fff;
  border-color: #2c5f2e;
}

/* Reset button */
.btn-reset {
  padding: 6px 14px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  font-size: 0.85em;
  color: #555;
}

.btn-reset:hover {
  background: #f0f0f0;
}

/* Tannin dimming */
.tannin-section.dimmed {
  opacity: 0.4;
  pointer-events: none;
}

/* Result rows */
.result-row {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 4px 10px;
  padding: 10px;
  border-bottom: 1px solid #eee;
}

.rank {
  font-weight: bold;
  color: #333;
  text-align: right;
}

.result-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.variety {
  font-weight: bold;
}

.region {
  color: #666;
  font-size: 0.9em;
}

/* Confidence bar */
.confidence-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.confidence-track {
  width: 80px;
  height: 8px;
  background: #eee;
  border-radius: 4px;
  position: relative;
  flex-shrink: 0;
}

.confidence-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: #2c5f2e;
  border-radius: 4px;
}

.confidence-label {
  font-size: 11px;
  color: #666;
  white-space: nowrap;
  min-width: 32px;
}

/* Feature tags — second grid row, spanning info + bar columns */
.feature-tags {
  grid-column: 2 / 4;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tag {
  border-radius: 3px;
  padding: 2px 6px;
  font-size: 11px;
}

.tag.matched {
  background: #d4edda;
  color: #155724;
}

.tag.conflict {
  background: #f8d7da;
  color: #721c24;
}
