/* Shared look of the Sight Maker and the Sight Gallery: the landing page's dark background
   and pink accent, in plain CSS so the tools need no script to be styled. */
:root {
  --bg: #0a0a0f;
  --panel: #13131b;
  --panel-2: #1a1a24;
  --panel-3: #22222e;
  --line: #2b2b3a;
  --line-2: #3a3a4d;
  --text: #ececf3;
  --muted: #a0a0b0;
  --faint: #6f6f84;
  --accent: #ff2a85;
  --accent-2: #ff5ca3;
  --accent-soft: rgba(255, 42, 133, 0.14);
  --ok: #3ddc84;
  --warn: #ffb547;
  --danger: #ff5468;
  --radius: 10px;
  --font: 'Outfit', 'Segoe UI', Roboto, Arial, sans-serif;
  --mono: ui-monospace, 'Cascadia Mono', Consolas, 'Courier New', monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--accent-2); }

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

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

[hidden] { display: none !important; }

kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 0 0.35em;
  border: 1px solid var(--line-2);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--panel-2);
  font-family: var(--mono);
  font-size: 0.82em;
  text-align: center;
  white-space: nowrap;
}

code { font-family: var(--mono); font-size: 0.9em; }

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 0.75rem 1.25rem;
  flex-wrap: wrap;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--line);
  background: rgba(19, 19, 27, 0.9);
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
}
.brand img { width: 30px; height: 30px; object-fit: contain; }
.brand b { color: var(--accent); }
.topbar h1 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--muted);
  padding-left: 1.1rem;
  border-left: 1px solid var(--line-2);
}
.topbar nav { margin-left: auto; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.topbar nav a { text-decoration: none; padding: 0.35rem 0.6rem; border-radius: 8px; }
.topbar nav a:hover { background: var(--panel-2); }

/* ---------- buttons and fields ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 36px;
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: var(--panel-3);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}
.btn:hover { background: #2c2c3b; border-color: #4a4a60; }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.danger { color: #ffd3d9; border-color: #5a2a33; background: #2a161b; }
.btn.danger:hover { background: #3a1b22; }
.btn.small { min-height: 30px; padding: 0.2rem 0.6rem; font-size: 0.88rem; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.btn-row > .btn { flex: 1 1 auto; }

input[type=text], input[type=number], select, textarea {
  width: 100%;
  min-height: 34px;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--line-2);
  border-radius: 7px;
  background: #0f0f16;
}
input[type=number] { font-family: var(--mono); font-size: 0.9rem; }
textarea { font-family: var(--mono); font-size: 0.8rem; line-height: 1.4; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; }
input[type=color] {
  width: 42px;
  height: 32px;
  padding: 2px;
  border: 1px solid var(--line-2);
  border-radius: 7px;
  background: #0f0f16;
  cursor: pointer;
}
input[type=range] { width: 100%; accent-color: var(--accent); }
input[type=checkbox], input[type=radio] { width: 17px; height: 17px; accent-color: var(--accent); flex: none; }

.field { display: grid; gap: 0.25rem; margin-bottom: 0.7rem; }
.field > span, .field > label { font-size: 0.85rem; color: var(--muted); }
.field-row { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; }
.field-row > input[type=number] { width: 6.5rem; flex: none; }
.check { display: flex; align-items: center; gap: 0.5rem; margin: 0.35rem 0; cursor: pointer; font-size: 0.92rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.grid2 .field { margin-bottom: 0.35rem; }
.hint { margin: 0.35rem 0 0.7rem; font-size: 0.82rem; color: var(--faint); }
.hint.warn { color: var(--warn); }
.hint.error { color: var(--danger); }
.tag {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0 0.4rem;
  border-radius: 999px;
  background: var(--panel-3);
  color: var(--faint);
  font-size: 0.72rem;
  vertical-align: 1px;
}

/* ---------- side panels ---------- */
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  margin-bottom: 0.65rem;
}
.panel > summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 0.85rem;
  cursor: pointer;
  list-style: none;
  font-weight: 600;
  font-size: 0.95rem;
  user-select: none;
}
.panel > summary::-webkit-details-marker { display: none; }
.panel > summary::after {
  content: '';
  width: 7px;
  height: 7px;
  margin-left: auto;
  border-right: 2px solid var(--faint);
  border-bottom: 2px solid var(--faint);
  transform: rotate(45deg);
  transition: transform 0.15s;
}
.panel[open] > summary::after { transform: rotate(225deg); }
.panel > summary .count { color: var(--accent-2); font-weight: 500; font-size: 0.85rem; }
.panel-body { padding: 0.1rem 0.85rem 0.85rem; }
.panel h3 { margin: 0.8rem 0 0.45rem; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--faint); }

/* ---------- dialogs and toasts ---------- */
dialog {
  width: min(640px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  padding: 0;
  border: 1px solid var(--line-2);
  border-radius: 14px;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}
dialog::backdrop { background: rgba(4, 4, 8, 0.7); }
.dialog-head { display: flex; align-items: center; gap: 1rem; padding: 0.9rem 1.1rem; border-bottom: 1px solid var(--line); }
.dialog-head h2 { margin: 0; font-size: 1.1rem; }
.dialog-head .btn { margin-left: auto; }
.dialog-body { padding: 0.4rem 1.1rem 1.1rem; overflow: auto; max-height: calc(100vh - 8rem); }
.dialog-body h3 { margin: 1rem 0 0.4rem; font-size: 0.95rem; color: var(--accent-2); }
.dialog-body p, .dialog-body li { color: #cfcfdc; font-size: 0.93rem; }
.dialog-body ol, .dialog-body ul { padding-left: 1.2rem; }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 0.35rem 0.9rem; font-size: 0.9rem; align-items: baseline; }
.keys dt { white-space: nowrap; }
.keys dd { margin: 0; color: #cfcfdc; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  width: max-content;
  max-width: calc(100vw - 2rem);
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: #1d1d28;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  font-size: 0.92rem;
  transform: translate(-50%, 1rem);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast.error { border-color: #6a2a36; }
.toast.ok { border-color: #22583a; }

.site-note { margin: 0.9rem 0.2rem 0.4rem; font-size: 0.78rem; color: var(--faint); }
.site-note a { color: var(--muted); }

@media (max-width: 560px) {
  .topbar { padding: 0.5rem 0.75rem; gap: 0.5rem 0.9rem; }
  .topbar h1 { font-size: 0.95rem; padding-left: 0.8rem; }
  .brand span { display: none; }
}
