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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #0a0a0a;
  color: #e0e0e0;
  min-height: 100vh;
}

.back-link {
  display: inline-block;
  margin-bottom: 16px;
  color: #888;
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s;
}

.back-link:hover { color: #fff; }

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

h1 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: #fff;
}

.subtitle {
  color: #888;
  font-size: 0.95rem;
  margin-bottom: 32px;
}

.controls {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
  align-items: center;
}

.input-group {
  position: relative;
}

.input-group .prefix {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #888;
  font-weight: 600;
  pointer-events: none;
}

#price-input {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 10px 12px 10px 28px;
  font-size: 1rem;
  color: #fff;
  width: 160px;
  outline: none;
  transition: border-color 0.2s;
}

#price-input:focus { border-color: #666; }

#company-select {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.9rem;
  color: #fff;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
}

#company-select:focus { border-color: #666; }

#search-input {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.9rem;
  color: #fff;
  width: 200px;
  outline: none;
  transition: border-color 0.2s;
}

#search-input:focus { border-color: #666; }

.export-buttons {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

.btn {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 0.85rem;
  color: #aaa;
  cursor: pointer;
  transition: all 0.2s;
}

.btn:hover { border-color: #555; color: #fff; }

#country-count {
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 12px;
}

.table-wrap {
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid #222;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

thead {
  position: sticky;
  top: 0;
  z-index: 1;
}

th {
  background: #141414;
  padding: 12px 14px;
  text-align: left;
  font-weight: 600;
  color: #888;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid #222;
  white-space: nowrap;
}

td {
  padding: 10px 14px;
  border-bottom: 1px solid #1a1a1a;
  white-space: nowrap;
}

tr:hover td { background: #141414; }

.region-row td {
  background: #0f0f0f;
  color: #aaa;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 14px;
  border-top: 1px solid #222;
  border-bottom: 1px solid #222;
}

.region-row:hover td { background: #0f0f0f; }

.col-country { font-weight: 500; color: #ddd; }
.col-currency { color: #666; font-size: 0.85rem; }
.col-price { font-weight: 600; color: #fff; text-align: right; font-variant-numeric: tabular-nums; }
.col-apple { color: #5eb0ef; text-align: right; font-variant-numeric: tabular-nums; }
.col-usd { color: #888; text-align: right; font-variant-numeric: tabular-nums; }
.col-ratio { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.col-sources { text-align: center; color: #555; font-size: 0.85rem; }

th:nth-child(3), th:nth-child(4), th:nth-child(5), th:nth-child(6) { text-align: right; }

.ratio-est { font-style: italic; opacity: 0.65; cursor: help; }
.est-row .col-price, .est-row .col-apple { opacity: 0.78; }

.ratio-lowest { color: #22c55e; }
.ratio-low { color: #86efac; }
.ratio-mid { color: #fbbf24; }
.ratio-par { color: #888; }
.ratio-high { color: #f87171; }

@media (max-width: 600px) {
  .controls { flex-direction: column; }
  #price-input, #company-select, #search-input { width: 100%; }
  .export-buttons { margin-left: 0; width: 100%; }
  .btn { flex: 1; text-align: center; }
  .container { padding: 20px 12px; }
  h1 { font-size: 1.4rem; }
}
