:root {
  color-scheme: dark;
  --bg: #0b111b;
  --bg-elevated: #0d131f;
  --bg-panel: #111722;
  --bg-panel-2: #151e2d;
  --bg-panel-3: #1a2537;
  --surface-0: rgba(0, 209, 255, 0.02);
  --surface-1: rgba(0, 209, 255, 0.04);
  --surface-2: rgba(168, 85, 247, 0.09);
  --surface-strong: rgba(0, 209, 255, 0.12);
  --surface-tint: rgba(79, 172, 254, 0.06);
  --surface-tint-strong: rgba(79, 172, 254, 0.14);
  --border: rgba(0, 209, 255, 0.18);
  --border-strong: rgba(0, 209, 255, 0.35);
  --text: #f2f8ff;
  --text-strong: #ffffff;
  --muted: #a4afbd;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #f87171;
  --info: #00d1ff;
  --purple: #a855f7;
  --cyan: #00d1ff;
  --shell-blur: 18px;
  --shadow: 0 24px 64px rgba(0, 0, 0, 0.52);
  --shadow-soft: 0 10px 28px rgba(0, 0, 0, 0.38);
  --shadow-lift: 0 18px 42px rgba(0, 0, 0, 0.48);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 12px;
  --radius-xs: 10px;
  --radius: 16px;
  --focus-ring: 0 0 0 3px rgba(0, 209, 255, 0.26);
  --container-max: 1500px;
  --font-sans: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 8% 10%, rgba(0, 209, 255, 0.17), transparent 26%),
    radial-gradient(circle at 84% 4%, rgba(168, 85, 247, 0.14), transparent 24%),
    radial-gradient(circle at 50% 100%, rgba(34, 197, 94, 0.08), transparent 24%),
    linear-gradient(180deg, #0b111b 0%, #0d1117 100%);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: auto;
  pointer-events: none;
  z-index: -1;
  border-radius: 999px;
  filter: blur(56px);
  opacity: 0.55;
}

body::before {
  top: -120px;
  left: -80px;
  width: 300px;
  height: 300px;
  background: rgba(0, 209, 255, 0.16);
}

body::after {
  right: -120px;
  top: 18vh;
  width: 340px;
  height: 340px;
  background: rgba(168, 85, 247, 0.12);
}

body::selection {
  background: rgba(0, 209, 255, 0.28);
  color: var(--text-strong);
}

h1,
h2,
h3,
h4,
h5,
h6,
p {
  margin: 0;
}

h1,
h2,
h3 {
  letter-spacing: 0.02em;
}

a {
  color: inherit;
  text-decoration: none;
}

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

button,
input,
select {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
}

::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.26);
  background-clip: content-box;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.024);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.02em;
  white-space: nowrap;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.badge--success {
  border-color: rgba(34, 197, 94, 0.38);
  color: var(--success);
  background: rgba(34, 197, 94, 0.14);
}

.badge--warning {
  border-color: rgba(245, 158, 11, 0.36);
  color: var(--warning);
  background: rgba(245, 158, 11, 0.14);
}

.badge--danger {
  border-color: rgba(248, 113, 113, 0.38);
  color: var(--danger);
  background: rgba(248, 113, 113, 0.14);
}

.badge--info {
  border-color: rgba(0, 209, 255, 0.38);
  color: var(--info);
  background: rgba(0, 209, 255, 0.14);
}

.badge--stale {
  border-color: rgba(255, 196, 86, 0.28);
  color: #ffd27d;
  background: rgba(255, 196, 86, 0.12);
}

.badge--muted {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.02);
}

.field {
  display: grid;
  gap: 6px;
}

.field__label {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.field__input {
  width: 100%;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  outline: none;
  color: var(--text);
  background: rgba(255, 255, 255, 0.028);
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    background-color 0.16s ease,
    transform 0.16s ease;
}

.field__input::placeholder {
  color: rgba(143, 157, 182, 0.72);
}

.field__input:focus {
  border-color: rgba(100, 167, 255, 0.34);
  box-shadow: var(--focus-ring);
  background: rgba(255, 255, 255, 0.04);
}

.field__input[readonly] {
  opacity: 0.9;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 15px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  transition:
    transform 0.16s ease,
    border-color 0.16s ease,
    background-color 0.16s ease,
    color 0.16s ease,
    box-shadow 0.16s ease,
    filter 0.16s ease;
  white-space: nowrap;
  -webkit-user-select: none;
  user-select: none;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.04);
}

.button:active:not(:disabled) {
  transform: translateY(0);
}

.button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.button--primary {
  background: linear-gradient(120deg, rgba(0, 242, 254, 0.24), rgba(79, 172, 254, 0.22));
  border-color: rgba(0, 209, 255, 0.48);
  color: #ebfbff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 0 18px rgba(0, 209, 255, 0.2);
}

.button--primary:hover:not(:disabled) {
  background: linear-gradient(120deg, rgba(0, 242, 254, 0.34), rgba(79, 172, 254, 0.32));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 0 22px rgba(0, 209, 255, 0.32);
}

.button--success {
  background: linear-gradient(120deg, rgba(34, 197, 94, 0.22), rgba(0, 209, 255, 0.12));
  border-color: rgba(34, 197, 94, 0.45);
  color: #dbffe9;
  box-shadow: 0 0 16px rgba(34, 197, 94, 0.18);
}

.button--success:hover:not(:disabled) {
  background: linear-gradient(120deg, rgba(34, 197, 94, 0.32), rgba(0, 209, 255, 0.18));
}

.button--warning {
  background: linear-gradient(120deg, rgba(168, 85, 247, 0.22), rgba(79, 172, 254, 0.18));
  border-color: rgba(168, 85, 247, 0.42);
  color: #fff0c8;
  box-shadow: 0 0 16px rgba(168, 85, 247, 0.16);
}

.button--warning:hover:not(:disabled) {
  background: linear-gradient(120deg, rgba(168, 85, 247, 0.3), rgba(79, 172, 254, 0.24));
}

.button--danger {
  background: linear-gradient(120deg, rgba(248, 113, 113, 0.24), rgba(255, 126, 95, 0.2));
  border-color: rgba(248, 113, 113, 0.46);
  color: #ffe1e1;
  box-shadow: 0 0 16px rgba(248, 113, 113, 0.18);
}

.button--danger:hover:not(:disabled) {
  background: linear-gradient(120deg, rgba(248, 113, 113, 0.32), rgba(255, 126, 95, 0.28));
}

.button--ghost {
  border-color: var(--border);
  background: linear-gradient(120deg, rgba(168, 85, 247, 0.12), rgba(79, 172, 254, 0.1));
  color: var(--text);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.button--ghost:hover:not(:disabled) {
  border-color: var(--border-strong);
  background: linear-gradient(120deg, rgba(168, 85, 247, 0.2), rgba(79, 172, 254, 0.18));
  box-shadow: 0 0 18px rgba(0, 209, 255, 0.14);
}

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

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 22px;
  color: var(--text);
}

.toggle input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--success);
}

.input,
.select {
  width: 100%;
  min-width: 68px;
  padding: 10px 11px;
  border-radius: 12px;
  border: 1px solid var(--border);
  color: var(--text);
  background: rgba(255, 255, 255, 0.028);
  outline: none;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    background-color 0.16s ease,
    transform 0.16s ease;
}

.input::placeholder,
.select::placeholder {
  color: rgba(143, 157, 182, 0.72);
}

.input:focus,
.select:focus {
  border-color: rgba(100, 167, 255, 0.32);
  box-shadow: var(--focus-ring);
  background: rgba(255, 255, 255, 0.04);
}

.input[disabled],
.select[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.input--error {
  border-color: rgba(255, 117, 130, 0.62);
  box-shadow: 0 0 0 2px rgba(255, 117, 130, 0.14);
}

.coin-autocomplete {
  position: relative;
  min-width: 132px;
}

.coin-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 8;
  display: grid;
  gap: 4px;
  max-height: 220px;
  overflow: auto;
  padding: 8px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: linear-gradient(180deg, rgba(16, 23, 39, 0.98), rgba(12, 18, 32, 0.97));
  box-shadow: var(--shadow-soft);
}

.coin-dropdown__item {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
  text-align: left;
  padding: 8px 10px;
  min-height: 34px;
}

.coin-dropdown__item:hover {
  border-color: rgba(100, 167, 255, 0.3);
  background: rgba(100, 167, 255, 0.12);
}

.coin-dropdown__item.is-active,
.coin-dropdown__item:focus-visible {
  border-color: rgba(100, 167, 255, 0.55);
  background: rgba(100, 167, 255, 0.2);
  outline: none;
}

.coin-dropdown__item.is-active {
  box-shadow: inset 0 0 0 1px rgba(100, 167, 255, 0.35);
}

.coin-autocomplete__hint {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  line-height: 1.3;
  color: rgba(143, 157, 182, 0.85);
  letter-spacing: 0.02em;
}

.coin-error {
  margin-top: 6px;
  text-align: left;
  font-size: 11px;
  line-height: 1.35;
  color: #ff9ba5;
}

.inline-actions {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.icon-btn {
  min-width: 36px;
  min-height: 36px;
  padding: 0 10px;
}

.empty-state {
  padding: 14px 15px;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
  line-height: 1.55;
}

.code {
  margin: 0;
  padding: 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(4, 10, 22, 0.74);
  color: #dbe7ff;
  overflow: auto;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--font-mono);
}

code {
  padding: 0.15em 0.35em;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: #e5efff;
}

img,
svg {
  max-width: 100%;
  display: block;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
