:root {
  --kth-green: #0d4a2b;
  --kth-green-light: #1a6b3f;
  --kth-gold: #c9a227;
  --kth-bg: #f4f7f5;
  --kth-card: #ffffff;
  --kth-text: #1f2933;
  --kth-muted: #5f6b7a;
  --kth-border: rgba(13, 74, 43, 0.12);
  --kth-shadow: 0 18px 40px rgba(13, 74, 43, 0.12);
  --cursor-size: 22px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Inter, "Segoe UI", sans-serif;
  color: var(--kth-text);
  background: var(--kth-bg);
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--kth-border);
}

.brand {
  font-family: "Libre Caslon Text", Georgia, serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--kth-green);
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
}

.site-nav a {
  font-size: 0.95rem;
  color: var(--kth-muted);
  transition: color 0.2s ease;
}

.site-nav a:hover,
.site-nav a.active {
  color: var(--kth-green);
}

.hero {
  padding: 2rem 1.5rem 1rem;
  max-width: 1200px;
  margin: 0 auto;
}

.hero h1 {
  margin: 0 0 0.5rem;
  font-family: "Libre Caslon Text", Georgia, serif;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  color: var(--kth-green);
}

.hero p {
  margin: 0;
  max-width: 760px;
  line-height: 1.6;
  color: var(--kth-muted);
}

.security-banner {
  max-width: 1200px;
  margin: 0 auto 1rem;
  padding: 0.95rem 1.1rem;
  border-radius: 14px;
  border: 1px solid rgba(201, 162, 39, 0.35);
  background: #fff8e8;
  color: #7a5d00;
  line-height: 1.55;
  font-size: 0.92rem;
}

.security-banner[hidden] {
  display: none;
}

.app-layout {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(320px, 1.1fr);
  gap: 1.25rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 1.5rem 2rem;
}

.panel {
  background: var(--kth-card);
  border: 1px solid var(--kth-border);
  border-radius: 18px;
  box-shadow: var(--kth-shadow);
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--kth-border);
}

.panel-header h2 {
  margin: 0;
  font-size: 1.05rem;
}

.camera-wrap {
  position: relative;
  aspect-ratio: 4 / 3;
  background: #0b1410;
}

.camera-wrap video,
.camera-wrap canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

.camera-wrap canvas {
  pointer-events: none;
}

.camera-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 0.75rem;
  padding: 1.5rem;
  text-align: center;
  color: rgba(255, 255, 255, 0.82);
}

.camera-placeholder.hidden {
  display: none;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 1rem 1.25rem 1.25rem;
}

.btn {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 0.75rem 1.2rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--kth-green);
  color: #fff;
}

.btn-secondary {
  background: #e8f0eb;
  color: var(--kth-green);
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  padding: 0 1.25rem 1.25rem;
}

.status-card {
  padding: 0.9rem 1rem;
  border-radius: 14px;
  background: #f7faf8;
  border: 1px solid var(--kth-border);
}

.status-card span {
  display: block;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--kth-muted);
  margin-bottom: 0.35rem;
}

.status-card strong {
  font-size: 1rem;
  color: var(--kth-green);
}

.gesture-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  background: rgba(201, 162, 39, 0.14);
  color: #8a6d12;
  font-size: 0.92rem;
  font-weight: 700;
}

.gesture-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--kth-gold);
}

.demo-panel {
  display: flex;
  flex-direction: column;
  min-height: 520px;
}

.demo-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--kth-border);
}

.chip {
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--kth-border);
  background: #fff;
  font-size: 0.88rem;
  cursor: pointer;
}

.chip.active {
  background: var(--kth-green);
  color: #fff;
  border-color: var(--kth-green);
}

.scroll-demo {
  flex: 1;
  overflow: auto;
  padding: 1.25rem;
  scroll-behavior: auto;
}

.scroll-demo h3 {
  margin: 0 0 0.75rem;
  color: var(--kth-green);
}

.package-card,
.info-block {
  padding: 1rem;
  margin-bottom: 0.85rem;
  border-radius: 14px;
  border: 1px solid var(--kth-border);
  background: #fafcfb;
}

.package-card button,
.demo-actions button {
  margin-top: 0.75rem;
  padding: 0.65rem 1rem;
  border: none;
  border-radius: 10px;
  background: var(--kth-green-light);
  color: #fff;
  font: inherit;
  cursor: pointer;
}

.demo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  padding: 1rem 1.25rem 1.25rem;
  border-top: 1px solid var(--kth-border);
}

.log-box {
  min-height: 72px;
  padding: 0 1.25rem 1.25rem;
  color: var(--kth-muted);
  font-size: 0.9rem;
}

.gesture-help {
  padding: 0 1.25rem 1.25rem;
  color: var(--kth-muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.gesture-help ul {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
}

#virtual-cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--cursor-size);
  height: var(--cursor-size);
  margin-left: calc(var(--cursor-size) / -2);
  margin-top: calc(var(--cursor-size) / -2);
  border: 2px solid var(--kth-gold);
  border-radius: 50%;
  background: rgba(201, 162, 39, 0.25);
  box-shadow: 0 0 0 6px rgba(201, 162, 39, 0.12);
  pointer-events: none;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.08s linear;
}

#virtual-cursor.visible {
  opacity: 1;
}

#virtual-cursor.clicking {
  transform: scale(0.78);
  background: rgba(201, 162, 39, 0.55);
}

#virtual-cursor.scrolling {
  border-radius: 6px;
  transform: rotate(90deg);
}

body.gesture-active {
  cursor: none;
}

body.gesture-active .demo-panel,
body.gesture-active .scroll-demo,
body.gesture-active .chip,
body.gesture-active button {
  cursor: none;
}

@media (max-width: 900px) {
  .app-layout {
    grid-template-columns: 1fr;
  }

  .status-grid {
    grid-template-columns: 1fr;
  }

  .site-header {
    flex-direction: column;
    align-items: flex-start;
  }
}
