:root {
  --bg: #0b0f17;
  --bg-elev: #121826;
  --bg-card: #151c2c;
  --bg-soft: #1a2336;
  --line: rgba(148, 163, 184, 0.14);
  --text: #e8eef9;
  --muted: #93a0b8;
  --faint: #6b7a94;
  --primary: #3b82f6;
  --primary-2: #60a5fa;
  --accent: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;
  --violet: #a78bfa;
  --cyan: #22d3ee;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --font: "DM Sans", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --header-h: 72px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

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

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

.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.05) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, black 20%, transparent 75%);
  pointer-events: none;
  z-index: 0;
}

.bg-glow {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(700px 400px at 15% -10%, rgba(59, 130, 246, 0.22), transparent 60%),
    radial-gradient(600px 360px at 90% 10%, rgba(34, 211, 238, 0.12), transparent 55%),
    radial-gradient(500px 300px at 50% 100%, rgba(167, 139, 250, 0.1), transparent 50%);
  pointer-events: none;
  z-index: 0;
}

.container {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(16px);
  background: rgba(11, 15, 23, 0.78);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.logo-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--cyan));
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.35);
}

.logo-text span {
  color: var(--primary-2);
}

.main-nav {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0.5rem 0.8rem;
  border-radius: 999px;
  cursor: pointer;
  transition: 0.18s ease;
}

.nav-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.nav-btn.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.35), rgba(34, 211, 238, 0.2));
  box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.35);
}

.menu-toggle {
  display: none;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  border-radius: 10px;
  padding: 0.45rem 0.7rem;
  cursor: pointer;
}

/* Panels */
.tool-panel {
  padding: 2rem 0 3.5rem;
}

.tool-panel[hidden] {
  display: none !important;
}

.hero {
  text-align: center;
  padding: 2.5rem 0 2rem;
}

.eyebrow {
  display: inline-block;
  margin: 0 0 0.75rem;
  color: var(--cyan);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hero h1,
.panel-head h1 {
  margin: 0;
  font-size: clamp(1.9rem, 4vw, 3rem);
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.hero-lead,
.panel-desc {
  color: var(--muted);
  max-width: 640px;
  margin: 0.9rem auto 0;
}

.panel-desc {
  margin-left: 0;
}

.hero-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.status-pill {
  flex-shrink: 0;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  color: var(--muted);
}

.status-pill.ok {
  color: #86efac;
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.12);
}

.status-pill.warn {
  color: #fcd34d;
  border-color: rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.12);
}

.status-pill.err {
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.12);
}

.status-pill.run {
  color: #93c5fd;
  border-color: rgba(59, 130, 246, 0.35);
  background: rgba(59, 130, 246, 0.12);
}

/* Cards / grid */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.tool-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent), var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  cursor: pointer;
  transition: 0.2s ease;
  box-shadow: var(--shadow);
}

.tool-card:hover {
  transform: translateY(-3px);
  border-color: rgba(96, 165, 250, 0.35);
}

.tool-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  margin-bottom: 0.9rem;
  font-size: 1.35rem;
  background: var(--bg-soft);
}

.tool-icon.cam { background: rgba(59, 130, 246, 0.15); }
.tool-icon.mic { background: rgba(34, 197, 94, 0.15); }
.tool-icon.spk { background: rgba(245, 158, 11, 0.15); }
.tool-icon.kbd { background: rgba(167, 139, 250, 0.15); }
.tool-icon.hw { background: rgba(34, 211, 238, 0.15); }
.tool-icon.specs { background: rgba(244, 114, 182, 0.15); }

/* PC Specs panel */
.specs-download-card {
  margin-bottom: 1rem;
  border: 1px solid rgba(251, 191, 36, 0.28);
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.08), rgba(59, 130, 246, 0.06));
}

.specs-download-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.specs-download-actions {
  flex-shrink: 0;
}

.specs-banner {
  border-radius: 12px;
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  border: 1px solid var(--line);
  font-size: 0.92rem;
  line-height: 1.45;
}

.specs-banner code {
  font-family: var(--mono);
  font-size: 0.84rem;
  background: rgba(0, 0, 0, 0.25);
  padding: 0.1rem 0.35rem;
  border-radius: 6px;
}

.specs-banner.ok {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.3);
  color: #bbf7d0;
}

.specs-banner.warn {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.3);
  color: #fde68a;
}

.specs-banner.err {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  color: #fecaca;
}

.specs-banner.info {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.3);
  color: #bfdbfe;
}

.specs-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-bottom: 1rem;
}

.sum-chip {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.55rem 0.75rem;
  min-width: 110px;
}

.sum-chip span {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.sum-chip strong {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.92rem;
  word-break: break-word;
  max-width: 220px;
}

.specs-tabbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1rem;
  padding: 0.35rem;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.specs-tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0.5rem 0.85rem;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.88rem;
  transition: 0.15s ease;
}

.specs-tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.specs-tab.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(244, 114, 182, 0.35), rgba(59, 130, 246, 0.35));
  box-shadow: inset 0 0 0 1px rgba(244, 114, 182, 0.35);
}

.specs-content {
  min-height: 200px;
}

.specs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
}

.specs-card {
  margin: 0;
}

.table-scroll {
  overflow-x: auto;
}

.data-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.82rem;
}

.data-table tr.bad td {
  color: #fca5a5;
}

.data-table tr.warn td {
  color: #fcd34d;
}

.warranty-form {
  display: grid;
  gap: 0.75rem;
}

.link-list {
  margin: 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.45rem;
  word-break: break-all;
}

.link-list a {
  color: var(--primary-2);
  text-decoration: underline;
}

.howto {
  color: var(--muted);
  line-height: 1.7;
}

.howto code {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--cyan);
}

/* Battery tab */
.battery-hero {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.battery-meter {
  position: relative;
  height: 52px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #0a0f18;
  overflow: hidden;
  display: grid;
  place-items: center;
}

.battery-meter-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: linear-gradient(90deg, #16a34a, #22c55e 55%, #eab308);
  opacity: 0.85;
  transition: width 0.35s ease;
}

.battery-meter span {
  position: relative;
  z-index: 1;
  font-weight: 800;
  font-size: 1.15rem;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.65);
}

.battery-health {
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 0.65rem 0.8rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.15rem;
}

.battery-health.ok {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.35);
  color: #bbf7d0;
}

.battery-health.warn {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.35);
  color: #fde68a;
}

.battery-health.err {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fecaca;
}

.battery-health.info {
  background: var(--bg-soft);
  color: var(--muted);
}

.battery-health small {
  opacity: 0.9;
}

@media (max-width: 560px) {
  .battery-hero {
    grid-template-columns: 1fr;
  }
}

.tool-card h2 {
  margin: 0 0 0.4rem;
  font-size: 1.15rem;
}

.tool-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.card-cta {
  display: inline-block;
  margin-top: 1rem;
  color: var(--primary-2);
  font-weight: 600;
  font-size: 0.9rem;
}

.info-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 2rem;
}

.info-strip > div {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
}

.info-strip strong {
  display: block;
  margin-bottom: 0.25rem;
}

.info-strip span {
  color: var(--muted);
  font-size: 0.92rem;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem;
  box-shadow: var(--shadow);
}

.card-title {
  margin: 0 0 0.85rem;
  font-size: 1rem;
}

.layout-2 {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 1rem;
}

.layout-2.tight {
  margin-top: 1.25rem;
  grid-template-columns: 1fr 1fr;
}

/* Buttons / fields */
.btn {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.65rem 1.1rem;
  cursor: pointer;
  font-weight: 600;
  transition: 0.15s ease;
  background: var(--bg-soft);
  color: var(--text);
}

.btn:hover:not(:disabled) {
  filter: brightness(1.08);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, #2563eb, #0ea5e9);
  color: #fff;
  box-shadow: 0 10px 28px rgba(37, 99, 235, 0.35);
}

.btn-accent {
  background: linear-gradient(135deg, #16a34a, #22c55e);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--text);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  background: var(--bg-soft);
  border-color: var(--line);
}

.btn-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.btn-row.center {
  justify-content: center;
  margin-top: 1rem;
}

.btn-row.wrap {
  margin-top: 0.75rem;
}

.toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.field > span {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
}

.field select,
.field input[type="text"] {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.8rem;
}

.field-inline {
  max-width: 280px;
}

.field input[type="range"] {
  width: 100%;
  accent-color: var(--primary);
}

/* Video / media */
.video-stage {
  position: relative;
  aspect-ratio: 16 / 10;
  background: #000;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
}

.video-stage video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.video-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at center, rgba(30, 41, 59, 0.7), rgba(0, 0, 0, 0.85));
  color: var(--muted);
  text-align: center;
  padding: 1.5rem;
}

.video-overlay.hidden {
  display: none;
}

.photo-row {
  display: flex;
  gap: 0.6rem;
  overflow-x: auto;
  margin-top: 0.85rem;
}

.photo-row img {
  height: 72px;
  border-radius: 8px;
  border: 1px solid var(--line);
  cursor: pointer;
}

/* Tables / hints */
.info-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.info-table th,
.info-table td {
  padding: 0.55rem 0.2rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.info-table th {
  width: 42%;
  color: var(--muted);
  font-weight: 500;
}

.info-table .mono,
.mono {
  font-family: var(--mono);
  font-size: 0.8rem;
  word-break: break-all;
}

.hints {
  margin-top: 0.9rem;
  display: grid;
  gap: 0.5rem;
}

.hint {
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  font-size: 0.9rem;
  border: 1px solid var(--line);
  background: var(--bg-soft);
}

.hint.ok {
  border-color: rgba(34, 197, 94, 0.3);
  background: rgba(34, 197, 94, 0.1);
  color: #bbf7d0;
}

.hint.warn {
  border-color: rgba(245, 158, 11, 0.3);
  background: rgba(245, 158, 11, 0.1);
  color: #fde68a;
}

.hint.err {
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.1);
  color: #fecaca;
}

.hint.info {
  border-color: rgba(59, 130, 246, 0.3);
  background: rgba(59, 130, 246, 0.1);
  color: #bfdbfe;
}

/* Mic */
.meter-block {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
}

.meter-label {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 0.45rem;
}

.level-bar {
  height: 14px;
  border-radius: 999px;
  background: #0f172a;
  overflow: hidden;
  border: 1px solid var(--line);
}

.level-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #22c55e, #eab308 70%, #ef4444);
  transition: width 0.06s linear;
}

#micWave,
#micSpectrum {
  width: 100%;
  display: block;
  margin-top: 0.75rem;
  border-radius: 10px;
  background: #0a0f18;
}

.audio-player {
  width: 100%;
  margin-top: 0.85rem;
}

/* Speakers */
.speaker-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.spk-btn {
  border: 1px solid var(--line);
  background: var(--bg-soft);
  border-radius: 14px;
  padding: 1rem 0.75rem;
  cursor: pointer;
  text-align: center;
  transition: 0.15s ease;
}

.spk-btn:hover {
  border-color: rgba(96, 165, 250, 0.45);
  transform: translateY(-2px);
}

.spk-btn.active {
  border-color: rgba(34, 197, 94, 0.55);
  background: rgba(34, 197, 94, 0.12);
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.2);
}

.spk-icon {
  display: block;
  font-size: 1.3rem;
  margin-bottom: 0.35rem;
}

.spk-btn strong {
  display: block;
}

.spk-btn small {
  color: var(--muted);
}

.visual-ring {
  margin: 1.25rem auto 0;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at center, rgba(15, 23, 42, 0.9) 48%, transparent 49%),
    conic-gradient(from 180deg, var(--primary), var(--cyan), var(--violet), var(--primary));
  box-shadow: 0 0 40px rgba(59, 130, 246, 0.2);
}

.visual-ring.pulse {
  animation: pulse 1s ease-in-out infinite;
}

.ring-core {
  width: 118px;
  height: 118px;
  border-radius: 50%;
  background: var(--bg-card);
  display: grid;
  place-items: center;
  text-align: center;
  font-weight: 700;
  padding: 0.5rem;
  font-size: 0.92rem;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); filter: brightness(1); }
  50% { transform: scale(1.04); filter: brightness(1.15); }
}

.check-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}

.check-list li {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--muted);
}

.check-list li.done {
  color: #86efac;
}

.check-list .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--faint);
}

.check-list li.done .dot {
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.15);
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

.mt {
  margin-top: 1rem;
}

/* Keyboard */
.kbd-stats {
  display: flex;
  gap: 1rem;
}

.kbd-stats > div {
  min-width: 72px;
  text-align: center;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.45rem 0.6rem;
}

.kbd-stats span {
  display: block;
  font-weight: 700;
  font-size: 1.15rem;
}

.kbd-stats small {
  color: var(--muted);
  font-size: 0.75rem;
}

.seg {
  display: inline-flex;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.2rem;
  gap: 0.15rem;
}

.seg-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
}

.seg-btn.active {
  background: rgba(59, 130, 246, 0.25);
  color: #fff;
}

.progress {
  height: 8px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--line);
  overflow: hidden;
  margin-bottom: 1rem;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.2s ease;
}

.keyboard-wrap {
  overflow-x: auto;
  padding-bottom: 0.5rem;
}

.keyboard-board {
  display: grid;
  gap: 6px;
  min-width: 920px;
  user-select: none;
}

.kbd-row {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.key {
  --w: 1;
  min-width: calc(42px * var(--w));
  height: 42px;
  flex: var(--w) 0 auto;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: linear-gradient(180deg, #1e293b, #111827);
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 600;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 0 4px;
  line-height: 1.1;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.35);
  transition: 0.08s ease;
}

.key.wide-1-25 { --w: 1.25; }
.key.wide-1-5 { --w: 1.5; }
.key.wide-1-75 { --w: 1.75; }
.key.wide-2 { --w: 2; }
.key.wide-2-25 { --w: 2.25; }
.key.wide-2-75 { --w: 2.75; }
.key.wide-6 { --w: 6.25; }
.key.space { --w: 6.25; }

.key.active {
  background: linear-gradient(180deg, #2563eb, #1d4ed8);
  border-color: rgba(147, 197, 253, 0.55);
  transform: translateY(1px);
}

.key.done {
  background: linear-gradient(180deg, #16a34a, #15803d);
  border-color: rgba(134, 239, 172, 0.45);
  color: #ecfdf5;
}

.key.missing {
  outline: 1px dashed rgba(245, 158, 11, 0.5);
}

.missing-keys {
  min-height: 120px;
  max-height: 220px;
  overflow: auto;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.6;
}

/* Hardware diagnostics */
.score-row {
  display: flex;
  gap: 1.25rem;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  margin: 1rem 0;
  box-shadow: var(--shadow);
}

.score-ring {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  text-align: center;
  background:
    radial-gradient(circle at center, var(--bg-card) 58%, transparent 59%),
    conic-gradient(var(--accent) 0deg, var(--line) 0deg);
  flex-shrink: 0;
}

.score-ring span {
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1;
}

.score-ring small {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
}

.score-summary {
  color: var(--muted);
}

.diag-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
}

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

.diag-card h3 {
  margin: 0 0 0.75rem;
  font-size: 0.98rem;
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

.badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge.ok { background: rgba(34, 197, 94, 0.15); color: #86efac; }
.badge.warn { background: rgba(245, 158, 11, 0.15); color: #fcd34d; }
.badge.err { background: rgba(239, 68, 68, 0.15); color: #fca5a5; }
.badge.info { background: rgba(59, 130, 246, 0.15); color: #93c5fd; }

.diag-card dl {
  margin: 0;
  display: grid;
  gap: 0.4rem;
}

.diag-card dt {
  color: var(--muted);
  font-size: 0.82rem;
}

.diag-card dd {
  margin: 0 0 0.35rem;
  font-size: 0.92rem;
  word-break: break-word;
}

.log {
  font-family: var(--mono);
  font-size: 0.8rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.9rem;
  max-height: 280px;
  overflow: auto;
  white-space: pre-wrap;
  color: var(--muted);
  line-height: 1.55;
}

.log .ok { color: #86efac; }
.log .warn { color: #fcd34d; }
.log .err { color: #fca5a5; }
.log .info { color: #93c5fd; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 1.5rem 0 2.5rem;
  color: var(--muted);
  font-size: 0.9rem;
  position: relative;
  z-index: 1;
}

.site-footer p {
  margin: 0.25rem 0;
}

/* Responsive */
@media (max-width: 960px) {
  .layout-2,
  .layout-2.tight {
    grid-template-columns: 1fr;
  }

  .info-strip {
    grid-template-columns: 1fr;
  }

  .speaker-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .menu-toggle {
    display: inline-grid;
  }

  .main-nav {
    display: none;
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    background: rgba(11, 15, 23, 0.96);
    border-bottom: 1px solid var(--line);
    padding: 0.75rem;
    flex-direction: column;
  }

  .main-nav.open {
    display: flex;
  }

  .header-inner {
    position: relative;
  }
}

@media (max-width: 560px) {
  .speaker-grid {
    grid-template-columns: 1fr;
  }

  .panel-head {
    flex-direction: column;
  }

  .score-row {
    flex-direction: column;
    text-align: center;
  }
}

/* Mode badge */
.mode-row {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.5rem;
}

.mode-badge {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}

.mode-badge.web {
  color: #93c5fd;
  border-color: rgba(59, 130, 246, 0.35);
  background: rgba(59, 130, 246, 0.12);
}

.mode-badge.local {
  color: #86efac;
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.12);
}

/* Home layout */
.home-top {
  margin-bottom: 1.5rem;
}

.home-top-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.home-tests-title {
  margin: 0.15rem 0 0.35rem;
  font-size: clamp(1.6rem, 3.5vw, 2.15rem);
  letter-spacing: -0.03em;
}

.home-tests-lead {
  margin: 0;
  max-width: 36rem;
}

.home-top-actions {
  margin: 0;
  justify-content: flex-end;
}

.tool-grid-primary {
  grid-template-columns: repeat(4, 1fr);
  margin-top: 0.25rem;
}

.tool-card-lg {
  min-height: 180px;
}

.tool-grid-secondary {
  margin-top: 0.85rem;
  grid-template-columns: repeat(3, 1fr);
}

/* Web / Local tags on cards */
.tool-card {
  position: relative;
}

.tag-web,
.tag-local {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
}

.tag-web {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
}

.tag-local {
  background: rgba(244, 114, 182, 0.15);
  color: #f9a8d4;
}

/* Download panel */
.download-hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.download-steps .howto {
  margin-top: 0.5rem;
}

.mode-list {
  margin: 0.75rem 0 1rem;
  padding-left: 1.15rem;
  color: var(--muted);
  line-height: 1.55;
}

@media (max-width: 1000px) {
  .tool-grid-primary {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 800px) {
  .download-hero {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .tool-grid-primary,
  .tool-grid-secondary {
    grid-template-columns: 1fr;
  }
}

/* Screen testing tool */
.tool-icon.screen {
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.2), rgba(59, 130, 246, 0.25));
}

.screen-stage {
  position: relative;
  min-height: 280px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--bg-soft);
  overflow: hidden;
  margin: 0.75rem 0 1rem;
  outline: none;
}

.screen-stage:fullscreen,
.screen-stage:-webkit-full-screen {
  min-height: 100vh;
  border: none;
  border-radius: 0;
  margin: 0;
}

.screen-stage-idle {
  display: grid;
  place-content: center;
  text-align: center;
  padding: 2rem 1.25rem;
  color: var(--muted);
  min-height: 280px;
}

.screen-stage.screen-solid {
  min-height: 320px;
}

.screen-stage.screen-uniform {
  background: #050505;
  min-height: 320px;
}

.screen-stage.screen-checker {
  min-height: 320px;
  background-image:
    linear-gradient(45deg, #000 25%, transparent 25%),
    linear-gradient(-45deg, #000 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #000 75%),
    linear-gradient(-45deg, transparent 75%, #000 75%);
  background-size: 2px 2px;
  background-color: #fff;
}

.screen-hint-badge {
  position: absolute;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  max-width: min(90%, 40rem);
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  backdrop-filter: blur(6px);
  pointer-events: none;
}

.screen-color-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.5rem;
}

.screen-swatch {
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  background: var(--sw, #333);
  cursor: pointer;
  padding: 0;
}

.screen-swatch.active {
  outline: 2px solid var(--primary-2);
  outline-offset: 2px;
  border-color: #fff;
}

.screen-gradient-stack {
  display: grid;
  grid-template-rows: repeat(4, 1fr);
  height: 100%;
  min-height: 280px;
}

.screen-grad {
  width: 100%;
  min-height: 70px;
}

.screen-grad.g-gray {
  background: linear-gradient(90deg, #000, #fff);
}
.screen-grad.g-red {
  background: linear-gradient(90deg, #000, #f00);
}
.screen-grad.g-green {
  background: linear-gradient(90deg, #000, #0f0);
}
.screen-grad.g-blue {
  background: linear-gradient(90deg, #000, #00f);
}

.screen-text-panel {
  padding: 1.25rem 1.5rem;
  color: var(--text);
  background: #0a0e16;
  min-height: 280px;
}

.screen-text-panel h2 {
  margin: 0 0 0.75rem;
  font-size: 1.35rem;
}

.screen-lorem {
  margin: 0.35rem 0;
  letter-spacing: 0.01em;
}

.screen-lorem.small {
  font-size: 0.85rem;
}

.screen-lorem.mono {
  font-family: var(--mono);
  font-size: 0.95rem;
}

.screen-pixel-grid {
  margin: 1rem 0;
  height: 64px;
  background-image:
    linear-gradient(#fff 1px, transparent 1px),
    linear-gradient(90deg, #fff 1px, transparent 1px);
  background-size: 4px 4px;
  background-color: #111;
  border: 1px solid var(--line);
}

.screen-contrast-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 1fr);
  min-height: 280px;
  height: 100%;
}

.screen-contrast-grid .cc {
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.9rem;
}

.screen-contrast-grid .cc.black {
  background: #000;
  color: #444;
}
.screen-contrast-grid .cc.white {
  background: #fff;
  color: #222;
}
.screen-contrast-grid .cc.step {
  background: #0d0d0d;
  color: #666;
}
.screen-contrast-grid .cc.step2 {
  background: #1a1a1a;
  color: #777;
}
.screen-contrast-grid .cc.step3 {
  background: #333;
  color: #aaa;
}
.screen-contrast-grid .cc.step4 {
  background: #808080;
  color: #111;
}

.screen-test-grid {
  margin-top: 0.25rem;
}

.tool-grid-secondary {
  grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 1000px) {
  .tool-grid-secondary {
    grid-template-columns: repeat(2, 1fr);
  }
}
