:root {
  color-scheme: dark;
  --ground: #0d1117;
  --panel: #161b22;
  --surface: #21262d;
  --line: #30363d;
  --ink: #e6edf3;
  --muted: #a0aab6;
  --blue: #79b8ff;
  --orange: #f0a56e;
  --green: #4ac966;
  --red: #ff8b84;
  --radius: 8px;
  font-family: "Segoe UI", system-ui, "PingFang SC", "Noto Sans CJK SC", sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--ground); color: var(--ink); font-size: 14px; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 20px; letter-spacing: .02em; }
h2 { font-size: 15px; }
h3 { font-size: 14px; margin-block: 18px 8px; }
a { color: var(--blue); text-underline-offset: 3px; }
button, select, input { color: inherit; font: inherit; }
button, select, input:not([type=checkbox]) { min-height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; }
button { background: var(--surface); cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s; }
button:hover:not(:disabled) { background: #30363d; border-color: #57606a; }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled, input:disabled, select:disabled { color: var(--muted); cursor: not-allowed; }
input, select { background: var(--ground); }
input[type=checkbox] { margin: 0; accent-color: var(--blue); width: 16px; height: 16px; }
input::placeholder { color: var(--muted); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.primary { color: white; background: #237839; border-color: #3f9654; font-weight: 650; }
.primary:hover:not(:disabled) { background: #2c8744; }
.primary:disabled { background: var(--surface); border-color: var(--line); }
.muted { color: var(--muted); }
.skip { position: absolute; inset: 4px auto auto 12px; z-index: 3; transform: translateY(-200%); background: var(--panel); padding: 12px; }
.skip:focus { transform: none; }

.login-container { display: grid; min-height: 100vh; min-height: 100dvh; place-items: center; padding: 20px; }
.login-box { width: min(100%, 360px); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 30px; }
.login-box .network { color: var(--muted); font-size: 12px; font-weight: 600; }
.network span { margin-inline: 3px; }
.login-box h1 { color: var(--blue); font-size: 25px; margin-block: 10px 6px; }
.login-box > p:not(.network) { color: var(--muted); line-height: 1.5; }
.login-box button { width: 100%; margin-block: 20px 10px; min-height: 44px; }
.lock-message { min-height: 21px; font-size: 12px; }
.login-box .lock-message.error { color: var(--red); }

.main-container { width: min(1400px, 100%); margin-inline: auto; padding: 16px; }
.panel { min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.header, .snipe-panel { margin-bottom: 14px; padding: 12px 16px; }
.header, .header-left, .header-right, .connection { display: flex; align-items: center; gap: 14px; }
.header { justify-content: space-between; }
.header-left, .header-right, .connection { flex-wrap: wrap; }
.connection { font-size: 12px; color: var(--muted); gap: 7px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--orange); flex: none; }
.connection[data-state=online] .status-dot { background: var(--green); }
.connection[data-state=offline] .status-dot { background: var(--red); }
#chain-height, .token-block { font-variant-numeric: tabular-nums; }
.wallet-info { display: flex; align-items: baseline; gap: 6px; color: var(--muted); font-size: 12px; }
.wallet-info strong { font-weight: 600; }
.snipe-panel-header, .list-header, .dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.snipe-panel h2, .bought-list h2 { color: var(--orange); }
.status-badge, .token-badge { display: inline-block; padding: 3px 7px; border-radius: 4px; background: var(--surface); color: var(--muted); font-size: 11px; line-height: 1.4; }
.snipe-controls, .trade-settings { border: 0; padding: 0; margin: 12px 0 0; min-width: 0; }
.snipe-controls { display: flex; flex-wrap: wrap; gap: 8px 12px; color: var(--muted); }
.snipe-controls label, .display-filters label { display: inline-flex; align-items: center; gap: 7px; min-width: 0; font-size: 12px; }
.snipe-controls input:not([type=checkbox]), .snipe-controls select { width: 54px; }
.snipe-controls select { width: 78px; }
.snipe-controls label:nth-child(2) input { width: 74px; }
.snipe-controls input, .snipe-controls select, .snipe-controls button { min-height: 32px; }
.panel-note { margin-top: 9px; font-size: 12px; color: var(--muted); }

.content { display: grid; grid-template-columns: minmax(225px, 280px) minmax(0, 1fr); gap: 14px; }
.bought-list { min-height: 140px; }
.list-header { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.token-list .list-header { color: var(--blue); }
.list-header > p { font-size: 12px; }
.display-filters { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; padding: 8px 16px; border-bottom: 1px solid var(--line); }
.display-filters .check { min-height: 38px; }
.display-filters select { max-width: 155px; }
.paid-control { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; }
.paid-control button[aria-pressed=true] { color: var(--green); border-color: var(--green); }
.empty-list { padding: 26px 16px; color: var(--muted); text-align: center; line-height: 1.5; }
.tokens { list-style: none; margin: 0; padding: 0; }
.token-item { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 14px; padding: 11px 16px; min-height: 78px; }
.token-item + .token-item { border-top: 1px solid var(--surface); }
.token-item:hover { background: #1b2129; }
.token-item.new { animation: highlight 1s ease-out; }
.token-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.token-actions button { font-size: 12px; }
.token-identity { display: flex; align-items: center; min-width: 0; gap: 10px; }
.avatar { display: grid; place-items: center; width: 44px; height: 44px; background: var(--surface); border-radius: 50%; color: var(--muted); flex: none; overflow: hidden; font-weight: 650; }
.avatar > * { grid-area: 1/1; }
.avatar img { object-fit: cover; width: 100%; height: 100%; opacity: 0; }
.avatar img.image-ready { opacity: 1; }
.token-info, .token-name > * { min-width: 0; }
.token-name, .token-meta, .token-links { display: flex; align-items: center; flex-wrap: wrap; gap: 5px 7px; }
.token-name > * { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.token-name span { color: var(--blue); font-size: 12px; }
.token-meta { margin-top: 4px; }
.quote-badge { color: var(--orange); background: #302721; }
.token-links { justify-content: flex-end; }
.token-links a { display: inline-flex; align-items: center; min-height: 38px; padding-inline: 4px; }
.token-links button, .token-block { font: 12px ui-monospace, monospace; }
.token-block { flex-basis: 100%; color: var(--muted); text-align: right; }
footer { padding: 12px 0 2px; font-size: 12px; }
[data-enter] { animation: arrive .25s ease-out both; }
@keyframes arrive { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes highlight { from { background: #1c314a; } to { background: transparent; } }

dialog { width: min(480px, calc(100% - 28px)); max-height: calc(100% - 28px); border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--ink); padding: 18px; }
dialog::backdrop { background: #06090cb8; }
.dialog-head { margin-bottom: 13px; }
.trade-settings { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; }
.trade-settings legend { margin-bottom: 8px; font-weight: 650; }
.trade-settings legend span { margin-left: 5px; }
.trade-settings label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; }
.trade-settings input, form input { width: 100%; min-width: 0; }
form { display: grid; gap: 6px; }
form label { font-size: 12px; margin-top: 3px; }
form .primary { margin-top: 4px; }
#settings-message:not(:empty) { padding: 8px 0; color: var(--muted); }
#saved-quotes { padding: 0; margin: 8px 0 0; list-style: none; }
#saved-quotes li { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); padding: 6px 0; }
#saved-quotes span { overflow-wrap: anywhere; }

@media (max-width: 1010px) {
  .content { grid-template-columns: minmax(175px, 225px) minmax(0, 1fr); }
  .token-item { grid-template-columns: auto minmax(0, 1fr); gap: 4px 10px; }
  .token-links { grid-column: 2; justify-content: flex-start; }
  .token-block { flex-basis: auto; text-align: left; }
}
@media (max-width: 650px) {
  .main-container { padding: 10px; }
  .header, .snipe-panel { margin-bottom: 10px; padding: 10px 12px; }
  .header, .header-left, .header-right { gap: 6px 10px; }
  .header-left { align-items: start; flex-direction: column; }
  .wallet-info { gap: 3px; flex-direction: column; }
  .content { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .bought-list { min-height: 0; }
  .bought-list .empty-list { padding: 10px 12px; text-align: left; }
  .list-header, .display-filters, .token-item { padding-inline: 12px; }
  .snipe-controls { gap: 7px 9px; }
  .snipe-controls label { font-size: 11px; }
  .snipe-controls label:nth-child(2) input { width: 58px; }
  .snipe-controls input:not([type=checkbox]) { width: 42px; }
  .token-item { grid-template-columns: minmax(0, 1fr) auto; }
  .token-identity { grid-column: 1; grid-row: 1; }
  .token-actions { grid-column: 2; grid-row: 1; justify-content: end; gap: 5px; }
  .token-actions button { padding-inline: 7px; }
  .token-links { grid-column: 1 / -1; }
  button, select, input:not([type=checkbox]), .token-links a, .display-filters .check { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
