:root {
  --bg: #0b1220;
  --bg-2: #121a2b;
  --card: #172235;
  --card-open: #1b2940;
  --ink: #eef2f7;
  --muted: #8b97ab;
  --line: rgba(255, 255, 255, 0.08);
  --navy: #3d6ea8;
  --copper: #d4894a;
  --command: #b7f0c4;
  --command-bg: #10251a;
  --danger: #f0a3a3;
  --radius: 16px;
  --font: "SF Pro Text", "Segoe UI", "Noto Sans", sans-serif;
  --mono: "SF Mono", "Menlo", "Cascadia Code", "Liberation Mono", monospace;
  --top: env(safe-area-inset-top, 0px);
  --bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.4;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  padding-bottom: var(--bottom);
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.app {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100dvh;
}

.top-bar {
  position: sticky;
  top: 0;
  z-index: 8;
  padding: calc(10px + var(--top)) 16px 10px;
  background: linear-gradient(180deg, #0b1220 70%, rgba(11, 18, 32, 0.86));
  backdrop-filter: blur(12px);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.brand-text { flex: 1; min-width: 0; }

.brand-text h1 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: -0.03em;
}

.brand-text p {
  margin: 1px 0 0;
  color: var(--muted);
  font-size: 0.75rem;
}

.logo svg { display: block; }

.icon-btn,
.btn {
  border: 0;
  border-radius: 999px;
  padding: 8px 14px;
  background: #24324a;
  color: var(--ink);
}

.icon-btn {
  font-size: 0.82rem;
  font-weight: 650;
}

.btn.primary {
  background: var(--copper);
  color: #1a120c;
  font-weight: 700;
  width: 100%;
  padding: 12px 16px;
  margin: 8px 0;
}

.btn { width: 100%; padding: 12px 16px; }

.search-wrap input {
  width: 100%;
  border: 0;
  border-radius: 14px;
  background: var(--bg-2);
  padding: 12px 14px;
  outline: none;
}

.search-wrap input::placeholder { color: #6f7c91; }

.chip-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 16px 8px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.chip-scroll::-webkit-scrollbar { display: none; }

.chip {
  flex: 0 0 auto;
  border: 0;
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--card);
  color: var(--ink);
  font-size: 0.82rem;
  white-space: nowrap;
}

.chip.active {
  background: #dce7f5;
  color: #102033;
  font-weight: 700;
}

.chip .dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

.result-line {
  margin: 0;
  padding: 4px 18px 10px;
  color: var(--muted);
  font-size: 0.78rem;
}

.card-list {
  padding: 0 12px calc(24px + var(--bottom));
  display: grid;
  gap: 10px;
}

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

.card.open { background: var(--card-open); }

.card-top {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.command-code {
  margin: 0;
  flex: 1;
  font-family: var(--mono);
  font-size: 0.86rem;
  color: var(--command);
  background: var(--command-bg);
  border-radius: 10px;
  padding: 10px 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.star {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.25rem;
  padding: 2px 4px;
  line-height: 1;
}

.star.on { color: var(--copper); }

.meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.75rem;
}

.cat-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.copy-btn {
  width: 100%;
  margin-top: 10px;
  border: 0;
  border-radius: 12px;
  padding: 12px;
  background: #2b4d78;
  color: white;
  font-weight: 700;
}

.copy-btn.copied {
  background: #1f6a45;
}

.details {
  display: none;
  margin-top: 10px;
  color: #c9d3e2;
  font-size: 0.92rem;
}

.card.open .details { display: block; }

.details p { margin: 0 0 8px; }

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

.tags { display: flex; flex-wrap: wrap; gap: 6px; }

.tag {
  font-size: 0.72rem;
  background: #24324a;
  border-radius: 999px;
  padding: 3px 8px;
  color: #b8c4d6;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 16px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + var(--bottom));
  transform: translateX(-50%);
  background: #f4efe6;
  color: #17202a;
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  z-index: 20;
  max-width: 90%;
}

.sheet {
  position: fixed;
  inset: 0;
  z-index: 30;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.sheet-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: #1a2436;
  border-radius: 20px 20px 0 0;
  padding: 10px 20px calc(20px + var(--bottom));
  max-width: 520px;
  margin: 0 auto;
}

.sheet-handle {
  width: 42px;
  height: 4px;
  border-radius: 4px;
  background: #3b4a63;
  margin: 6px auto 14px;
}

.sheet-panel h2 { margin: 0 0 8px; font-size: 1.15rem; }

.sheet-lead, .install-steps {
  color: var(--muted);
  font-size: 0.92rem;
}

.install-steps {
  padding-left: 18px;
}

.install-steps li { margin: 0 0 8px; }

.install-steps strong { color: var(--ink); }
