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

:root {
  --bg: #0f172a;
  --bg-soft: #020617;
  --card: #020617;
  --card-soft: #020617;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --border: #1f2937;
  --accent: #38bdf8;
  --accent-soft: rgba(56, 189, 248, 0.12);
  --danger: #f97373;
  --radius-lg: 18px;
  --shadow-soft: 0 18px 40px rgba(15, 23, 42, 0.9);
}

html, body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #1e293b 0, #020617 45%, #000 100%);
  color: var(--text);
  min-height: 100vh;
}

body {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.app-header {
  padding: 24px 16px 8px;
  text-align: center;
}

.app-header h1 {
  margin: 0 0 4px;
  font-size: 2rem;
  letter-spacing: 0.03em;
}

.tagline {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted);
}

.app-main {
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 8px 16px 32px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
}

@media (min-width: 960px) {
  .app-main {
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    align-items: flex-start;
  }
}

.card {
  background: radial-gradient(circle at top left, #020617, #020617);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(148, 163, 184, 0.12);
  box-shadow: var(--shadow-soft);
  padding: 18px 18px 16px;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  inset: -40%;
  background:
    radial-gradient(circle at 0 0, rgba(56, 189, 248, 0.09) 0, transparent 45%),
    radial-gradient(circle at 100% 0, rgba(129, 140, 248, 0.06) 0, transparent 40%);
  opacity: 0.7;
  pointer-events: none;
}

.card > * {
  position: relative;
}

.card h2 {
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 1.1rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #e5e7eb;
}

form {
  margin: 0;
}

.form-row {
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-row.two-col {
  flex-direction: row;
  gap: 12px;
}

.form-row.two-col > div {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

input[type="text"],
input[type="datetime-local"],
input[type="search"],
select,
textarea {
  background: rgba(15, 23, 42, 0.9);
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  padding: 8px 12px;
  font-size: 0.92rem;
  color: var(--text);
  outline: none;
  transition: border-color 0.12s ease, box-shadow 0.12s ease,
    background-color 0.12s ease;
}

textarea {
  border-radius: 14px;
  resize: vertical;
}

input[type="text"]:focus,
input[type="datetime-local"]:focus,
input[type="search"]:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.5);
  background: rgba(15, 23, 42, 1);
}

input::placeholder,
textarea::placeholder {
  color: rgba(148, 163, 184, 0.7);
}

input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  background: transparent;
  margin-top: 4px;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 5px;
  background: linear-gradient(
    90deg,
    rgba(56, 189, 248, 0.85),
    rgba(129, 140, 248, 0.9)
  );
  border-radius: 999px;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #0f172a;
  border: 2px solid #e5e7eb;
  margin-top: -5px;
}

input[type="range"]::-moz-range-track {
  height: 5px;
  background: linear-gradient(
    90deg,
    rgba(56, 189, 248, 0.85),
    rgba(129, 140, 248, 0.9)
  );
  border-radius: 999px;
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #0f172a;
  border: 2px solid #e5e7eb;
}

.form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 8px;
}

button {
  border-radius: 999px;
  border: none;
  padding: 7px 15px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  background: radial-gradient(circle at top left, #38bdf8, #0ea5e9);
  color: #0b1220;
  box-shadow: 0 8px 24px rgba(56, 189, 248, 0.45);
  transition: transform 0.1s ease, box-shadow 0.1s ease, filter 0.08s ease;
  white-space: nowrap;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 30px rgba(56, 189, 248, 0.6);
  filter: brightness(1.04);
}

button.secondary {
  background: rgba(15, 23, 42, 0.9);
  color: var(--text);
  border: 1px solid rgba(148, 163, 184, 0.6);
  box-shadow: none;
}

button.secondary:hover {
  box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.8);
}

button.danger {
  background: rgba(239, 68, 68, 0.2);
  color: #fecaca;
  border: 1px solid rgba(248, 113, 113, 0.9);
  box-shadow: none;
}

button.danger:hover {
  background: rgba(248, 113, 113, 0.3);
  box-shadow: 0 0 0 1px rgba(252, 165, 165, 0.9);
}

.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.list-header h2 {
  margin: 0;
}

.list-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.list-controls input[type="search"] {
  min-width: 160px;
}

.list-controls select {
  min-width: 110px;
}

.table-wrapper {
  position: relative;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(15, 23, 42, 0.85);
  overflow: hidden;
}

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

thead {
  background: rgba(15, 23, 42, 0.95);
}

th, td {
  padding: 6px 10px;
  text-align: left;
  border-bottom: 1px solid rgba(30, 41, 59, 0.95);
}

th {
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-size: 0.7rem;
}

tbody tr:nth-child(even) {
  background: rgba(15, 23, 42, 0.95);
}

tbody tr:hover {
  background: rgba(30, 64, 175, 0.4);
}

.badge {
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border: 1px solid rgba(148, 163, 184, 0.6);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.badge-stake-low {
  border-color: rgba(45, 212, 191, 0.9);
  background: rgba(34, 197, 175, 0.08);
}

.badge-stake-low .badge-dot {
  background: rgb(34, 197, 175);
}

.badge-stake-medium {
  border-color: rgba(251, 191, 36, 0.9);
  background: rgba(251, 191, 36, 0.08);
}

.badge-stake-medium .badge-dot {
  background: rgb(251, 191, 36);
}

.badge-stake-high {
  border-color: rgba(248, 113, 113, 0.95);
  background: rgba(248, 113, 113, 0.1);
}

.badge-stake-high .badge-dot {
  background: rgb(248, 113, 113);
}

.badge-outcome-pending {
  border-color: rgba(148, 163, 184, 0.9);
  background: rgba(148, 163, 184, 0.08);
}

.badge-outcome-pending .badge-dot {
  background: rgb(148, 163, 184);
}

.badge-outcome-positive {
  border-color: rgba(34, 197, 94, 0.9);
  background: rgba(22, 163, 74, 0.15);
}

.badge-outcome-positive .badge-dot {
  background: rgb(22, 163, 74);
}

.badge-outcome-negative {
  border-color: rgba(248, 113, 113, 0.95);
  background: rgba(248, 113, 113, 0.15);
}

.badge-outcome-negative .badge-dot {
  background: rgb(220, 38, 38);
}

.badge-outcome-mixed {
  border-color: rgba(96, 165, 250, 0.9);
  background: rgba(59, 130, 246, 0.14);
}

.badge-outcome-mixed .badge-dot {
  background: linear-gradient(135deg, rgb(59, 130, 246), rgb(234, 179, 8));
}

.empty-state {
  margin: 12px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
}

.export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
  justify-content: space-between;
  align-items: center;
}

.import-label {
  position: relative;
  overflow: hidden;
  border-radius: 999px;
  border: 1px dashed rgba(148, 163, 184, 0.7);
  padding: 7px 14px;
  font-size: 0.86rem;
  color: var(--muted);
  cursor: pointer;
}

.import-label input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.app-footer {
  text-align: center;
  padding: 12px 12px 16px;
  font-size: 0.8rem;
  color: var(--muted);
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: radial-gradient(circle at top, #020617, #020617);
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.95);
  padding: 16px 18px 14px;
  width: min(420px, 92vw);
}

.modal-content h3 {
  margin: 0 0 10px;
  font-size: 1.05rem;
}

.modal .form-actions {
  justify-content: flex-end;
  margin-top: 10px;
}

.update-link {
  font-size: 0.8rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.8);
  padding: 3px 10px;
  cursor: pointer;
  background: rgba(15, 23, 42, 0.9);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.update-link:hover {
  background: rgba(30, 64, 175, 0.6);
}

.update-link span {
  font-size: 0.9rem;
}

@media (max-width: 600px) {
  .card {
    padding: 14px 12px;
    border-radius: 16px;
  }

  .form-row.two-col {
    flex-direction: column;
  }

  th, td {
    padding: 6px 7px;
  }

  .list-controls {
    justify-content: stretch;
  }

  .list-controls input[type="search"] {
    flex: 1;
    min-width: 0;
  }
}
