:root {
  color-scheme: dark;
  --bg: #0b0f14;
  --bg-elev: #121823;
  --panel: #141c2a;
  --line: #263248;
  --text: #e8f0ff;
  --muted: #9fb0c9;
  --accent: #7bd3ff;
  --accent-2: #4de5b5;
  --danger: #ff6f6f;
  --shadow: rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: "Plus Jakarta Sans", "Sora", "DM Sans", system-ui, -apple-system, sans-serif;
  background: radial-gradient(120% 120% at 50% 0%, #131b28 0%, #0b0f14 55%, #090c11 100%);
  color: var(--text);
}

main {
  max-width: 980px;
  margin: 0 auto;
  padding: 20px 16px 90px;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

h1 {
  font-size: 1.6rem;
  letter-spacing: 0.02em;
  margin: 0;
}

h2 {
  font-size: 1.1rem;
  margin: 0 0 12px;
  color: var(--muted);
  font-weight: 600;
}

.card {
  background: linear-gradient(160deg, rgba(20, 28, 42, 0.95), rgba(12, 18, 28, 0.95));
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 10px 30px var(--shadow);
}

.grid {
  display: grid;
  gap: 16px;
}

.button-row {
  display: grid;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 20px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #111827;
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 56px;
  text-decoration: none;
}

.btn.primary {
  background: linear-gradient(145deg, #1b2b40, #0f1722);
  border-color: #30405a;
  color: var(--accent);
}

.btn.secondary {
  background: #0f1622;
  color: var(--muted);
}

.btn.cta {
  background: linear-gradient(145deg, #2c4860, #162639);
  border-color: #3c5873;
  color: #eaf6ff;
}

.btn:active {
  transform: translateY(1px);
}

.table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-size: 0.95rem;
}

.table th, .table td {
  border: 1px solid var(--line);
  padding: 10px 8px;
  text-align: center;
}

.table th {
  color: var(--muted);
  font-weight: 600;
  background: #101623;
}

.table td:first-child {
  font-weight: 700;
  color: var(--accent);
}

input, select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #2a3a54;
  background: #0f1724;
  color: var(--text);
  font-size: 1rem;
}

input:focus {
  outline: 2px solid rgba(123, 211, 255, 0.4);
  border-color: #3b506d;
}

label {
  font-size: 0.9rem;
  color: var(--muted);
  display: block;
  margin-bottom: 6px;
}

.pd-grid {
  display: grid;
  gap: 12px;
}

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

.toggle input {
  width: auto;
}

.accordion {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #0f1521;
}

.accordion summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 14px;
  font-weight: 600;
  color: var(--accent);
}

.accordion summary::-webkit-details-marker {
  display: none;
}

.accordion p {
  padding: 0 14px 14px;
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.action-bar {
  position: sticky;
  bottom: 0;
  background: rgba(10, 14, 20, 0.95);
  border-top: 1px solid var(--line);
  padding: 12px 16px;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  z-index: 20;
}

.action-bar .btn {
  flex: 1;
}

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

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #122031;
  border: 1px solid #263248;
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
}

.install-banner {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #0f1622;
  margin-bottom: 16px;
}

.install-banner.show {
  display: flex;
}

.pd-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.camera-wrap {
  position: relative;
  background: #05080d;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
}

#pdVideo, #pdCanvas {
  width: 100%;
  height: auto;
  display: block;
}

#pdCanvas {
  position: absolute;
  left: 0;
  top: 0;
}

.overlay-guide {
  position: absolute;
  left: 50%;
  top: 12%;
  transform: translateX(-50%);
  border: 2px dashed rgba(123, 211, 255, 0.8);
  border-radius: 10px;
  width: 220px;
  height: 140px;
  pointer-events: none;
}

.meter {
  height: 8px;
  background: #152235;
  border-radius: 999px;
  overflow: hidden;
}

.meter span {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #4de5b5, #7bd3ff);
  transition: width 0.2s ease;
}

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

@media (min-width: 760px) {
  main {
    padding: 30px 24px 40px;
  }

  .grid {
    grid-template-columns: 1.2fr 1fr;
  }

  .button-row {
    grid-template-columns: 1fr 1fr;
  }

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

  .action-bar {
    position: static;
    border: none;
    padding: 0;
    background: transparent;
  }
}
