:root {
  --bg: #10141c;
  --bg-2: #161c27;
  --card: #1b2330;
  --line: #2a3548;
  --text: #e9eef6;
  --muted: #93a0b5;
  --eu: #003399;
  --yellow: #f5c518;
  --yellow-dim: #c49a10;
  --free: #3dd68c;
  --taken: #ef6b73;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  --radius: 16px;
  --plate-font: "Euro Plate", EuroPlate, sans-serif;
}

@font-face {
  font-family: "Euro Plate";
  src: url("/fonts/EuroPlate.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(0, 51, 153, 0.28), transparent 50%),
    radial-gradient(800px 400px at 100% 0%, rgba(245, 197, 24, 0.08), transparent 40%),
    var(--bg);
  color: var(--text);
  font: 16px/1.45 "Segoe UI", system-ui, sans-serif;
}

button, input, select {
  font: inherit;
  color: inherit;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: #0f141c;
  padding: 0.1em 0.4em;
  border-radius: 6px;
}

.hidden { display: none !important; }

.topbar, main, .tabs {
  width: min(1120px, calc(100% - 32px));
  margin-left: auto;
  margin-right: auto;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 28px 0 12px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand strong {
  display: block;
  font-size: 1.25rem;
  letter-spacing: 0.02em;
}

.brand span:last-child {
  color: var(--muted);
  font-size: 0.9rem;
}

.eu {
  width: 42px;
  height: 52px;
  border-radius: 6px 0 0 6px;
  background: linear-gradient(#003399, #002266);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  box-shadow: inset -8px 0 0 var(--yellow);
}

.top-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.status-line {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: right;
}

.tabs {
  display: flex;
  gap: 8px;
  padding: 8px 0 20px;
}

.tabs button {
  background: transparent;
  border: 0;
  color: var(--muted);
  padding: 10px 14px;
  border-radius: 999px;
  cursor: pointer;
}

.tabs button.active {
  background: var(--card);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line);
}

main { padding-bottom: 48px; }

.grid-2 {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 16px;
  margin-bottom: 16px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

h1, h2 {
  margin: 0 0 8px;
  font-size: 1.2rem;
}

.kicker {
  margin: 0 0 4px;
  color: var(--yellow);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.72rem;
}

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

label {
  display: block;
  margin: 12px 0;
  color: var(--muted);
  font-size: 0.85rem;
}

input, select {
  width: 100%;
  margin-top: 6px;
  background: #10161f;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}

input:focus, select:focus, button:focus-visible {
  outline: 2px solid var(--yellow);
  outline-offset: 1px;
}

.plate-inputs, .filters {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.plate-inputs { grid-template-columns: 70px 1fr 1fr; }

.checks {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  margin: 8px 0 16px;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--text);
}

.check input { width: auto; margin: 0; }

.row-actions, .inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.inline-form { margin: 12px 0 4px; }
.inline-form input { width: 110px; margin: 0; }
#q-letters, #add-letters { text-transform: uppercase; }

.btn {
  background: #10161f;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 16px;
  cursor: pointer;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn.busy:disabled {
  opacity: 1;
  cursor: wait;
}

.btn.primary {
  background: var(--yellow);
  color: #1a1403;
  border-color: var(--yellow);
  font-weight: 700;
}

.btn.busy {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.spinner {
  width: 1em;
  height: 1em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  display: inline-block;
  animation: spin 0.7s linear infinite;
  flex: none;
}

.spinner.lg {
  width: 28px;
  height: 28px;
  border-width: 3px;
  border-color: var(--yellow);
  border-right-color: transparent;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-block {
  margin-top: 16px;
  padding: 18px;
  border-radius: 14px;
  background: #10161f;
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.loading-block p { margin: 0; }

.loading-bar {
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: #10161f;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px var(--line);
}

.loading-bar > span {
  display: block;
  height: 100%;
  width: 40%;
  border-radius: inherit;
  background: var(--yellow);
  animation: loading-slide 1.1s ease-in-out infinite;
}

@keyframes loading-slide {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(280%); }
}

.loading-plates {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.plate-skeleton {
  display: inline-block;
  width: 148px;
  height: 40px;
  border-radius: 8px;
  background: linear-gradient(90deg, #141b26 20%, #2a3548 50%, #141b26 80%);
  background-size: 200% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
}

@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.btn.danger {
  color: var(--taken);
  border-color: transparent;
  background: transparent;
  padding: 6px 8px;
}

.pill {
  background: #10161f;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.8rem;
}

.plates {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.plate {
  display: inline-flex;
  align-items: stretch;
  background: #f4f1e6;
  color: #111;
  border-radius: 8px;
  overflow: hidden;
  min-width: 148px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
  font-family: var(--plate-font);
  font-weight: normal;
  letter-spacing: 0.04em;
  text-decoration: none;
  text-transform: uppercase;
}

.plate b {
  background: var(--eu);
  color: #fff;
  width: 28px;
  display: grid;
  place-items: center;
  font-size: 0.75rem;
}

.plate span {
  padding: 8px 12px 7px;
  font-size: 1.15rem;
}

.result-hero {
  margin-top: 16px;
  padding: 18px;
  border-radius: 14px;
  background: #10161f;
  border: 1px solid var(--line);
}

.result-hero.free { border-color: rgba(61, 214, 140, 0.5); }
.result-hero.taken { border-color: rgba(239, 107, 115, 0.45); }

.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.8rem;
  font-weight: 700;
}

.badge.free { background: rgba(61, 214, 140, 0.16); color: var(--free); }
.badge.taken { background: rgba(239, 107, 115, 0.16); color: var(--taken); }

.list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
}

.list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.list .meta {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 4px 0 0;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 10, 16, 0.72);
  display: grid;
  place-items: center;
  z-index: 20;
}

.login-card { width: min(420px, calc(100% - 32px)); }

.error { color: var(--taken); }

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: var(--yellow);
  color: #1a1403;
  padding: 12px 16px;
  border-radius: 12px;
  font-weight: 650;
  z-index: 30;
  box-shadow: var(--shadow);
}

.toast.error { background: var(--taken); color: #fff; }

@media (max-width: 840px) {
  .topbar, .top-actions, .grid-2, .plate-inputs, .filters {
    display: grid;
    grid-template-columns: 1fr;
  }
  .top-actions { justify-items: start; }
  .status-line { text-align: left; }
}
