/* ── TOKENS ──────────────────────────────────────────── */
:root {
  --bg:          #080c10;
  --surface:     #0d1117;
  --surface-2:   #131920;
  --border:      #1c2733;
  --border-hi:   #2a3a4a;
  --text:        #c9d1d9;
  --text-muted:  #586374;
  --text-dim:    #3d4f5e;
  --accent:      #58a6ff;
  --accent-glow: rgba(88, 166, 255, 0.18);
  --accent-dim:  rgba(88, 166, 255, 0.08);
  --green:       #3fb950;
  --green-glow:  rgba(63, 185, 80, 0.15);
  --red:         #f85149;
  --red-glow:    rgba(248, 81, 73, 0.15);
  --gold:        #d29922;
  --radius:      10px;
  --font-mono:   'Space Mono', monospace;
  --font-sans:   'Syne', sans-serif;
}

/* ── RESET ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── NOISE OVERLAY ───────────────────────────────────── */
.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-size: 180px;
}

/* ── BODY ────────────────────────────────────────────── */
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 40px 20px 80px;
  position: relative;
  z-index: 1;
}

body::before {
  content: '';
  position: fixed;
  top: -200px;
  left: 50%;
  transform: translateX(-50%);
  width: 700px;
  height: 400px;
  background: radial-gradient(ellipse at center, rgba(88,166,255,0.06) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ── APP CONTAINER ───────────────────────────────────── */
.app {
  max-width: 760px;
  width: 100%;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* ── HEADER ──────────────────────────────────────────── */
.header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 24px 28px;
  border-bottom: 1px solid var(--border-hi);
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.logo {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-icon {
  font-size: 28px;
  color: var(--accent);
  line-height: 1;
  filter: drop-shadow(0 0 8px var(--accent));
}

.logo h1 {
  font-family: var(--font-sans);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #fff;
  line-height: 1.1;
}

.tagline {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin-top: 2px;
}

/* RATE WIDGET */
.rate-widget {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 16px;
  min-width: 160px;
  transition: border-color 0.3s;
}

.rate-widget.loaded {
  border-color: var(--green);
  box-shadow: 0 0 12px var(--green-glow);
}

.rate-widget.error {
  border-color: var(--red);
}

.rate-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-dim);
  flex-shrink: 0;
  transition: background 0.3s, box-shadow 0.3s;
}

.rate-dot.pulse {
  background: var(--green);
  box-shadow: 0 0 0 0 var(--green);
  animation: pulse 2s ease-in-out infinite;
}

.rate-dot.error {
  background: var(--red);
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(63,185,80,0.5); }
  50%       { box-shadow: 0 0 0 5px rgba(63,185,80,0); }
}

.rate-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.rate-value {
  display: block;
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
  color: var(--green);
  letter-spacing: -0.5px;
}

/* ── SECTIONS ────────────────────────────────────────── */
.section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  padding: 22px 28px;
}

.section:last-child {
  border-radius: 0 0 var(--radius) var(--radius);
}

.section-label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.section-num {
  color: var(--accent);
  opacity: 0.7;
}

.game-count {
  margin-left: auto;
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(88,166,255,0.2);
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 10px;
  letter-spacing: 0.5px;
}

/* ── ADD ROW ─────────────────────────────────────────── */
.add-row {
  display: grid;
  grid-template-columns: 1fr 110px auto;
  gap: 8px;
  align-items: center;
}

/* ── INPUTS ──────────────────────────────────────────── */
input[type="text"],
input[type="number"] {
  height: 42px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 0 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
}

input[type="text"]::placeholder,
input[type="number"]::placeholder {
  color: var(--text-dim);
}

input[type="text"]:focus,
input[type="number"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

/* Remove number arrows */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; }

/* ── BUTTONS ─────────────────────────────────────────── */
.btn {
  height: 42px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 0 16px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
  letter-spacing: 0.2px;
}

.btn-icon {
  font-size: 16px;
  line-height: 1;
  font-weight: 400;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #080c10;
}

.btn-primary:hover {
  background: #79bbff;
  border-color: #79bbff;
  box-shadow: 0 0 16px var(--accent-glow);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}

.btn-ghost:hover {
  background: var(--surface-2);
  border-color: var(--border-hi);
  color: var(--text);
  transform: translateY(-1px);
}

.btn-danger {
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
}

.btn-danger:hover {
  background: var(--red-glow);
  border-color: var(--red);
  color: var(--red);
  transform: translateY(-1px);
}

/* ── FEEDBACK ────────────────────────────────────────── */
.feedback {
  font-family: var(--font-mono);
  font-size: 11px;
  min-height: 18px;
  margin-top: 8px;
  letter-spacing: 0.3px;
  transition: all 0.2s;
}

.feedback.ok  { color: var(--green); }
.feedback.err { color: var(--red); }

/* ── EMPTY STATE ─────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 40px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.empty-icon {
  font-size: 32px;
  color: var(--text-dim);
}

.empty-state p {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 0.5px;
}

/* ── GAME LIST ───────────────────────────────────────── */
.game-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.game-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: border-color 0.2s, transform 0.15s;
  animation: slideIn 0.2s ease forwards;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.game-item:hover {
  border-color: var(--border-hi);
  transform: translateX(2px);
}

.game-name {
  font-size: 14px;
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.game-prices {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  text-align: right;
}

.game-prices .ars {
  color: var(--gold);
  font-weight: 700;
}

.game-delete {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-dim);
  font-size: 14px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.15s;
  padding: 0;
}

.game-delete:hover {
  background: var(--red-glow);
  color: var(--red);
}

/* ── LIST FOOTER ─────────────────────────────────────── */
.list-footer {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.total-block {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.7;
  color: var(--text-muted);
}

.total-block .total-amount {
  font-size: 15px;
  font-weight: 700;
  color: var(--gold);
}

.total-block .total-usd {
  color: var(--accent);
}

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

/* ── TOOLS SECTION ───────────────────────────────────── */
.tools-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.tool-group .section-label {
  margin-bottom: 10px;
}

.tool-row {
  display: flex;
  gap: 8px;
}

/* ── SEARCH RESULTS ──────────────────────────────────── */
.search-results {
  list-style: none;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.search-results li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  animation: slideIn 0.15s ease;
}

.search-results li .s-name {
  color: var(--text);
  font-weight: 700;
}

.search-results li .s-price {
  color: var(--gold);
}

.no-results {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  padding: 6px 0;
}

/* ── RESPONSIVE ──────────────────────────────────────── */
@media (max-width: 600px) {
  body { padding: 0 0 60px; }

  .app { gap: 1px; }

  .header { border-radius: 0; padding: 18px 16px; }
  .section { padding: 18px 16px; }
  .section:last-child { border-radius: 0; }

  .add-row {
    grid-template-columns: 1fr 90px;
    grid-template-rows: auto auto;
  }

  .add-row input[type="number"] { grid-column: 2; grid-row: 1; }
  .add-row input[type="text"]   { grid-column: 1; grid-row: 1; }
  .add-row .btn-primary         { grid-column: 1 / -1; width: 100%; justify-content: center; }

  .tools-grid { grid-template-columns: 1fr; }

  .list-footer { flex-direction: column; align-items: flex-start; }
  .list-actions { width: 100%; }
  .list-actions .btn { flex: 1; justify-content: center; }

  .header-top { flex-direction: column; align-items: flex-start; }
  .rate-widget { width: 100%; }
}

/* ── FOOTER ──────────────────────────────────────────── */
.footer {
  text-align: center;
  padding: 24px 20px;
  margin-top: 40px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  width: 100%;
  max-width: 760px;
}

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

.footer a:hover {
  opacity: 0.75;
}
