/* styles.css — shadcn-style dark theme, hand rolled, no cdn */
:root {
  --background: 240 10% 3.9%;
  --foreground: 0 0% 98%;
  --card: 240 10% 5.5%;
  --card-foreground: 0 0% 98%;
  --popover: 240 10% 5.5%;
  --border: 240 6% 14%;
  --input: 240 6% 16%;
  --primary: 0 0% 98%;
  --primary-foreground: 240 6% 10%;
  --secondary: 240 5% 12%;
  --secondary-foreground: 0 0% 98%;
  --muted: 240 5% 12%;
  --muted-foreground: 240 5% 63%;
  --accent: 240 5% 13%;
  --destructive: 0 72% 46%;
  --destructive-fg: 0 0% 98%;
  --success: 152 60% 44%;
  --info: 217 85% 60%;
  --warn: 38 92% 50%;
  --violet: 258 85% 68%;
  --ring: 240 5% 65%;
  --radius: 0.625rem;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { height: 100%; }

body {
  min-height: 100%;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.mono { font-family: var(--mono); }
.muted { color: hsl(var(--muted-foreground)); font-size: 12.5px; }
.muted-sm { color: hsl(var(--muted-foreground)); font-size: 12px; }
.spacer { flex: 1; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* topbar */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 28px;
  border-bottom: 1px solid hsl(var(--border));
  background: hsl(var(--background) / 0.82);
  backdrop-filter: blur(12px);
}
.brand { display: flex; align-items: center; gap: 13px; }
.mark {
  width: 38px; height: 38px; border-radius: calc(var(--radius) - 2px);
  display: grid; place-items: center; color: hsl(var(--violet));
  background: hsl(var(--secondary));
  border: 1px solid hsl(var(--border));
  box-shadow: 0 0 22px hsl(var(--violet) / 0.18);
}
.brand-text h1 { font-size: 15.5px; font-weight: 600; letter-spacing: 0.01em; }
.top-right { display: flex; align-items: center; gap: 9px; }

/* badges */
.badge {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 11px; border-radius: 999px;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--secondary));
  color: hsl(var(--muted-foreground));
  font-size: 12px; font-weight: 500;
  white-space: nowrap;
}
.badge.subtle { background: hsl(var(--muted)); }
.badge.mono { font-family: var(--mono); font-weight: 400; }
.badge-dot { width: 7px; height: 7px; border-radius: 50%; background: hsl(var(--ring) / 0.5); flex: none; }
.badge.on { border-color: hsl(var(--success) / 0.45); color: hsl(var(--success)); background: hsl(var(--success) / 0.08); }
.badge.on .badge-dot { background: hsl(var(--success)); box-shadow: 0 0 8px hsl(var(--success)); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 13.5px; font-weight: 500; font-family: inherit;
  cursor: pointer; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s, transform 0.1s;
  user-select: none;
}
.btn:focus-visible { outline: 2px solid hsl(var(--ring)); outline-offset: 2px; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; pointer-events: none; }
.btn.primary { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); }
.btn.primary:hover { background: hsl(var(--foreground) / 0.88); }
.btn.secondary { background: hsl(var(--secondary)); color: hsl(var(--foreground)); border-color: hsl(var(--border)); }
.btn.secondary:hover { background: hsl(var(--accent)); }
.btn.ghost { background: transparent; color: hsl(var(--muted-foreground)); border-color: hsl(var(--border)); }
.btn.ghost:hover { background: hsl(var(--accent)); color: hsl(var(--foreground)); }
.btn.destructive { background: hsl(var(--destructive) / 0.14); color: hsl(0 84% 70%); border-color: hsl(var(--destructive) / 0.4); }
.btn.destructive:hover { background: hsl(var(--destructive) / 0.24); }
.btn.sm { height: 29px; padding: 0 11px; font-size: 12.5px; }
.btn.icon-btn { width: 36px; padding: 0; }

/* layout */
.wrap { max-width: 1160px; margin: 22px auto 60px; padding: 0 22px; display: grid; gap: 16px; }

.card {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  box-shadow: 0 1px 2px hsl(0 0% 0% / 0.3), 0 12px 32px hsl(0 0% 0% / 0.22);
  overflow: hidden;
}
.card-head { padding: 16px 20px 0; }
.card-head.row { display: flex; align-items: center; padding-bottom: 12px; }
.card-head h2 { font-size: 14.5px; font-weight: 600; letter-spacing: 0.01em; }
.card-body { padding: 16px 20px 20px; display: grid; gap: 16px; }

/* tabs */
.tabs {
  display: inline-flex; padding: 3px; gap: 3px;
  background: hsl(var(--muted));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
}
.tab {
  height: 32px; padding: 0 18px;
  border: 0; background: transparent; color: hsl(var(--muted-foreground));
  font: inherit; font-size: 13px; font-weight: 500;
  border-radius: calc(var(--radius) - 3px); cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.tab:hover { color: hsl(var(--foreground)); }
.tab.active {
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  box-shadow: 0 1px 3px hsl(0 0% 0% / 0.35);
}

/* fields */
.field { display: grid; gap: 7px; }
.field > label, .label-row label {
  font-size: 13px; font-weight: 500; color: hsl(var(--foreground));
}
.label-row { display: flex; align-items: center; justify-content: space-between; }
.hint { color: hsl(var(--muted-foreground)); font-size: 12px; line-height: 1.55; }
input[type="text"], input[type="password"], input[type="number"], textarea {
  width: 100%;
  background: hsl(var(--background));
  border: 1px solid hsl(var(--input));
  color: hsl(var(--foreground));
  border-radius: var(--radius);
  padding: 9px 12px;
  font: inherit; font-size: 13.5px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input::placeholder, textarea::placeholder { color: hsl(var(--muted-foreground) / 0.65); }
input:focus, textarea:focus { outline: none; border-color: hsl(var(--ring)); box-shadow: 0 0 0 3px hsl(var(--ring) / 0.18); }
input[type="number"] { font-family: var(--mono); }
textarea {
  min-height: 148px; resize: vertical;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.65;
}
.two { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

/* drop zone */
.drop {
  border: 1.5px dashed hsl(var(--input));
  border-radius: var(--radius);
  background: hsl(var(--background) / 0.5);
  color: hsl(var(--muted-foreground));
  padding: 20px 16px;
  text-align: center;
  display: grid; gap: 5px; place-items: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.drop:hover, .drop:focus-visible, .drop.drag {
  border-color: hsl(var(--violet) / 0.7);
  color: hsl(var(--foreground));
  background: hsl(var(--violet) / 0.05);
  outline: none;
}
.drop strong { color: hsl(var(--foreground)); font-weight: 600; }

/* run row */
.runrow { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.runrow .btn.primary { height: 40px; padding: 0 22px; }
.runrow .btn.destructive { height: 40px; }
.progress { flex: 1; min-width: 180px; height: 8px; border-radius: 999px; background: hsl(var(--muted)); overflow: hidden; border: 1px solid hsl(var(--border)); }
.bar { height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, hsl(var(--violet)), hsl(var(--info))); transition: width 0.5s ease; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
.stat-card {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 14px 16px 13px;
  position: relative; overflow: hidden;
  box-shadow: 0 1px 2px hsl(0 0% 0% / 0.25);
}
.stat-card:before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 2.5px;
  background: hsl(var(--ring) / 0.4);
}
.stat-card.ok:before { background: hsl(var(--success)); }
.stat-card.violet:before { background: hsl(var(--violet)); }
.stat-card.info:before { background: hsl(var(--info)); }
.stat-card.bad:before { background: hsl(var(--destructive)); }
.stat-card.warn:before { background: hsl(var(--warn)); }
.stat-label { font-size: 11.5px; font-weight: 500; letter-spacing: 0.07em; text-transform: uppercase; color: hsl(var(--muted-foreground)); }
.stat-value { font-size: 25px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }

/* work grid */
.grid2 { display: grid; grid-template-columns: 1.5fr 1fr; gap: 16px; }
.terminal, .reslist {
  margin: 0 14px 14px;
  background: hsl(240 8% 4%);
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) - 2px);
  height: 308px;
  overflow: auto;
}
.terminal { padding: 10px 13px; font-family: var(--mono); font-size: 12.3px; line-height: 1.75; }
.reslist { padding: 9px; display: grid; gap: 6px; align-content: start; }
.empty { color: hsl(var(--muted-foreground) / 0.55); text-align: center; padding: 54px 12px; font-size: 12.5px; font-family: var(--mono); }

.lg { animation: fadein 0.25s ease; }
.lg .t { color: hsl(var(--muted-foreground) / 0.5); }
.lg .tag {
  display: inline-block; padding: 0 6px; margin-right: 7px;
  border-radius: 5px; font-size: 10px; letter-spacing: 0.06em;
  border: 1px solid hsl(var(--border)); color: hsl(var(--muted-foreground));
  background: hsl(var(--secondary));
  vertical-align: 1px;
}
.lg.info { color: hsl(240 6% 72%); }
.lg.ok { color: hsl(var(--success)); } .lg.ok .tag { color: hsl(var(--success)); border-color: hsl(var(--success) / 0.4); background: hsl(var(--success) / 0.08); }
.lg.bad { color: hsl(0 78% 68%); } .lg.bad .tag { color: hsl(0 78% 68%); border-color: hsl(var(--destructive) / 0.45); background: hsl(var(--destructive) / 0.1); }
.lg.warn { color: hsl(var(--warn)); } .lg.warn .tag { color: hsl(var(--warn)); border-color: hsl(var(--warn) / 0.4); background: hsl(var(--warn) / 0.08); }
.lg.cap { color: hsl(var(--info)); } .lg.cap .tag { color: hsl(var(--info)); border-color: hsl(var(--info) / 0.45); background: hsl(var(--info) / 0.09); }
.lg.boost { color: hsl(var(--violet)); } .lg.boost .tag { color: hsl(var(--violet)); border-color: hsl(var(--violet) / 0.45); background: hsl(var(--violet) / 0.09); }
@keyframes fadein { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

.res {
  display: flex; gap: 9px; align-items: flex-start;
  padding: 8px 11px; border-radius: calc(var(--radius) - 3px);
  background: hsl(240 7% 6%);
  border: 1px solid hsl(var(--border));
  font-family: var(--mono); font-size: 12px; line-height: 1.55;
  animation: fadein 0.25s ease;
}
.res i { width: 7px; height: 7px; border-radius: 50%; flex: none; margin-top: 5px; background: hsl(var(--muted-foreground) / 0.6); }
.res.joined i { background: hsl(var(--success)); }
.res.boosted i { background: hsl(var(--violet)); box-shadow: 0 0 8px hsl(var(--violet) / 0.9); }
.res.boosted { border-color: hsl(var(--violet) / 0.4); }
.res.joined { border-color: hsl(var(--success) / 0.32); }
.res.partial i { background: hsl(var(--warn)); }
.res.partial { border-color: hsl(var(--warn) / 0.32); }
.res.invalid i, .res.failed i { background: hsl(var(--destructive)); }
.res.invalid, .res.failed { border-color: hsl(var(--destructive) / 0.3); }

.foot { text-align: center; color: hsl(var(--muted-foreground) / 0.7); font-size: 12px; padding: 4px 0 0; }

/* server details + preview */
.sd-head { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.sd-ico {
  width: 40px; height: 40px; border-radius: 10px; flex: none;
  display: grid; place-items: center;
  background: hsl(217 85% 60% / 0.12);
  border: 1px solid hsl(217 85% 60% / 0.28);
  color: hsl(217 85% 65%);
}
.sd-meta h3 { font-size: 15.5px; font-weight: 700; letter-spacing: 0.01em; }
.preview {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: hsl(240 7% 6.5%);
  border: 1px solid hsl(217 85% 60% / 0.35);
  animation: pvIn 0.4s cubic-bezier(0.2, 0.9, 0.25, 1.12);
}
.preview[hidden] { display: none !important; }
@keyframes pvIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}
.pv-iconwrap {
  position: relative; flex: none;
  width: 56px; height: 56px;
  border-radius: 14px;
  overflow: hidden;
  display: grid; place-items: center;
  background: hsl(240 6% 12%);
  box-shadow: 0 0 0 1px hsl(var(--border)), 0 0 18px hsl(var(--violet) / 0.22);
  animation: pvPop 0.45s cubic-bezier(0.2, 1.3, 0.4, 1) both;
}
@keyframes pvPop {
  from { opacity: 0; transform: scale(0.55); }
  to { opacity: 1; transform: scale(1); }
}
#pvIcon {
  width: 56px; height: 56px;
  object-fit: cover;
  display: none;
}
#pvDefault {
  position: absolute;
  color: hsl(var(--muted-foreground));
}
.pv-meta { min-width: 0; }
.pv-meta h3 {
  font-size: 15px; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  animation: pvSlide 0.35s ease both;
}
@keyframes pvSlide {
  from { opacity: 0; transform: translateX(-8px); }
  to { opacity: 1; transform: none; }
}
.pv-id { font-size: 11.5px; color: hsl(var(--muted-foreground)); margin-top: 1px; }
.pv-badges { margin-left: auto; display: flex; gap: 8px; flex: none; }
.pv-pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 13px;
  border-radius: 999px;
  background: hsl(var(--secondary));
  border: 1px solid hsl(var(--border));
  color: hsl(var(--foreground));
  font-size: 12.5px; font-weight: 600;
  font-variant-numeric: tabular-nums;
  animation: pvSlide 0.4s ease both;
}
.pv-pill svg { color: hsl(var(--muted-foreground)); }
.pv-pill.boost {
  background: hsl(var(--violet) / 0.13);
  border-color: hsl(var(--violet) / 0.45);
}
.pv-pill.boost svg { color: hsl(var(--violet)); }

/* checker */
select {
  width: 100%;
  background: hsl(var(--background));
  border: 1px solid hsl(var(--input));
  color: hsl(var(--foreground));
  border-radius: var(--radius);
  padding: 9px 12px;
  font: inherit; font-size: 13.5px;
}
.ck-filters { gap: 10px !important; padding-bottom: 12px !important; }
.ck-row { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.ck-lbl { font-size: 12px; color: hsl(var(--muted-foreground)); min-width: 70px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  height: 27px; padding: 0 12px;
  border-radius: 999px;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--secondary));
  color: hsl(var(--muted-foreground));
  font: inherit; font-size: 12px; font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.chip:hover { color: hsl(var(--foreground)); border-color: hsl(var(--input)); }
.chip.active {
  background: hsl(var(--foreground));
  color: hsl(var(--background));
  border-color: hsl(var(--foreground));
}
.ck-age { width: 90px !important; height: 27px; padding: 0 10px !important; font-size: 12.5px; }

.ck-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 10px;
  padding: 4px 16px 16px;
  max-height: 560px;
  overflow: auto;
}
.ck-card {
  display: flex; gap: 11px; align-items: center;
  padding: 11px 13px;
  background: hsl(240 7% 6%);
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  animation: fadein 0.25s ease;
  min-width: 0;
}
.ck-card.valid { border-color: hsl(var(--success) / 0.35); }
.ck-card.locked { border-color: hsl(var(--warn) / 0.4); }
.ck-card.invalid, .ck-card.error { border-color: hsl(var(--destructive) / 0.32); }
.ck-ava {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  object-fit: cover;
  background: hsl(240 6% 16%);
  display: grid; place-items: center;
  color: hsl(var(--muted-foreground));
}
.ck-card.valid .ck-ava { box-shadow: 0 0 0 2px hsl(var(--success) / 0.5); }
.ck-card.locked .ck-ava { box-shadow: 0 0 0 2px hsl(var(--warn) / 0.55); }
.ck-body { min-width: 0; flex: 1; }
.ck-name {
  font-size: 13px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ck-badges { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 4px; }
.bdg {
  font-size: 10.5px; font-weight: 600;
  padding: 2px 8px; border-radius: 999px;
  border: 1px solid hsl(var(--border));
  color: hsl(var(--muted-foreground));
  background: hsl(var(--secondary));
  white-space: nowrap;
}
.bdg.v { color: hsl(var(--success)); border-color: hsl(var(--success) / 0.45); background: hsl(var(--success) / 0.08); }
.bdg.l { color: hsl(var(--warn)); border-color: hsl(var(--warn) / 0.45); background: hsl(var(--warn) / 0.08); }
.bdg.i { color: hsl(0 78% 68%); border-color: hsl(var(--destructive) / 0.45); background: hsl(var(--destructive) / 0.08); }
.bdg.n { color: hsl(var(--violet)); border-color: hsl(var(--violet) / 0.5); background: hsl(var(--violet) / 0.1); }
.bdg.d { color: hsl(var(--info)); border-color: hsl(var(--info) / 0.45); background: hsl(var(--info) / 0.08); }

body.mode-checker #runStats,
body.mode-checker #grid2 { display: none; }
body.mode-checker #targetField,
body.mode-checker #preview { display: none; }
body:not(.mode-checker) #checkerSection,
body:not(.mode-checker) #chkStats { display: none; }

/* dialog */
.dialog-root { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; }
.dialog-root[hidden] { display: none; }
.overlay { position: absolute; inset: 0; background: hsl(0 0% 0% / 0.66); backdrop-filter: blur(4px); animation: fadein 0.18s ease; }
.dialog {
  position: relative; width: min(620px, 94vw); max-height: 92vh; overflow: auto;
  background: hsl(var(--popover));
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) + 4px);
  box-shadow: 0 24px 70px hsl(0 0% 0% / 0.6);
  animation: dialogIn 0.2s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
@keyframes dialogIn { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }
.dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px 0; }
.dialog-head h2 { font-size: 16px; font-weight: 600; }
.dialog-body { padding: 16px 22px 6px; display: grid; gap: 16px; }
.dialog-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 16px 22px 20px; margin-top: 10px;
  border-top: 1px solid hsl(var(--border));
}
.testline {
  font-family: var(--mono); font-size: 12.3px; line-height: 1.6;
  padding: 11px 13px; border-radius: var(--radius);
  background: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  color: hsl(var(--muted-foreground));
  min-height: 42px;
}
.testline.good { color: hsl(var(--success)); border-color: hsl(var(--success) / 0.4); }
.testline.bad { color: hsl(0 78% 68%); border-color: hsl(var(--destructive) / 0.45); }

/* toasts */
#toasts { position: fixed; right: 18px; bottom: 18px; z-index: 90; display: grid; gap: 9px; max-width: min(400px, 88vw); }
.toast {
  padding: 12px 15px; border-radius: var(--radius);
  background: hsl(var(--popover));
  border: 1px solid hsl(var(--border));
  box-shadow: 0 14px 34px hsl(0 0% 0% / 0.5);
  font-size: 13px;
  animation: toastIn 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.15);
}
.toast.ok { border-color: hsl(var(--success) / 0.5); }
.toast.bad { border-color: hsl(var(--destructive) / 0.5); }
@keyframes toastIn { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }

/* scrollbars */
.terminal::-webkit-scrollbar, .reslist::-webkit-scrollbar, .dialog::-webkit-scrollbar, textarea::-webkit-scrollbar { width: 9px; }
.terminal::-webkit-scrollbar-thumb, .reslist::-webkit-scrollbar-thumb, .dialog::-webkit-scrollbar-thumb, textarea::-webkit-scrollbar-thumb {
  background: hsl(var(--border)); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box;
}
.terminal::-webkit-scrollbar-thumb:hover, .reslist::-webkit-scrollbar-thumb:hover { background: hsl(var(--input)); background-clip: padding-box; }

@media (max-width: 980px) {
  .stats { grid-template-columns: repeat(3, 1fr); }
  .grid2 { grid-template-columns: 1fr; }
  .two { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 620px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .two { grid-template-columns: 1fr; }
  .topbar { padding: 12px 16px; }
  .wrap { padding: 0 14px; }
  .brand-text p { display: none; }
}
