:root {
  font-family: "Yu Gothic UI", "Yu Gothic", Meiryo, system-ui, sans-serif;
  color: #202020;
  background: #e9e9e9;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: linear-gradient(#f4f4f4, #dedede);
}

button { font: inherit; }

.demo-page {
  width: min(900px, 100%);
  margin: 0 auto;
  padding: 28px 18px;
}

.introduction {
  margin: 0 0 12px;
  color: #333;
  font-size: 16px;
}

.opencv-window {
  overflow: hidden;
  border: 1px solid #8f8f8f;
  border-radius: 8px;
  background: #000;
  box-shadow: 0 14px 38px rgb(0 0 0 / 28%);
}

.window-titlebar {
  display: flex;
  height: 38px;
  align-items: center;
  background: #f7f7f7;
  color: #171717;
  user-select: none;
}

.app-icon {
  width: 15px;
  height: 15px;
  margin-left: 12px;
  border: 2px solid #1687c9;
  border-radius: 3px;
}

.window-title {
  flex: 1;
  margin-left: 9px;
  font-family: "Segoe UI", sans-serif;
  font-size: 13px;
}

.window-buttons {
  display: flex;
  height: 100%;
}

.window-buttons span,
.window-close {
  display: grid;
  width: 45px;
  height: 100%;
  place-items: center;
  border: 0;
  background: transparent;
  color: #222;
  font-family: "Segoe UI", sans-serif;
  font-size: 15px;
}

.window-close { cursor: pointer; }
.window-close:hover { background: #c42b1c; color: #fff; }
.window-close:focus-visible { outline: 2px solid #1676c2; outline-offset: -3px; }

.image-area {
  position: relative;
  display: grid;
  min-height: 450px;
  place-items: center;
  overflow: hidden;
  background: #000;
}

video { display: none; }

canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  cursor: crosshair;
  touch-action: none;
}

.start-panel {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 14px;
  background: #1a1a1a;
  color: #ddd;
  text-align: center;
}

.start-panel[hidden] { display: none; }
.start-panel p { margin: 0; font-size: 15px; }

.start-panel button,
.controls button {
  min-height: 36px;
  padding: 7px 16px;
  border: 1px solid #888;
  border-radius: 3px;
  background: #f7f7f7;
  color: #111;
  cursor: pointer;
}

.start-panel button:hover,
.controls button:hover:not(:disabled) { background: #e6f2fb; border-color: #237fbd; }

button:focus-visible { outline: 3px solid rgb(35 127 189 / 35%); outline-offset: 2px; }
button:disabled { cursor: not-allowed; opacity: .45; }

.window-statusbar {
  display: flex;
  min-height: 28px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 10px;
  border-top: 1px solid #c8c8c8;
  background: #f3f3f3;
  color: #333;
  font-family: Consolas, "Yu Gothic UI", sans-serif;
  font-size: 12px;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}

.controls span { margin-left: auto; color: #666; font-size: 13px; }
.instructions { margin: 14px 0 0; font-size: 15px; line-height: 1.8; }
.privacy { margin: 6px 0 0; color: #666; font-size: 13px; }

@media (max-width: 700px) {
  .demo-page { padding: 14px 10px; }
  .image-area { min-height: 260px; }
  .window-buttons span { display: none; }
  .window-close { width: 42px; }
  .controls button { flex: 1 1 30%; }
  .controls span { width: 100%; margin-left: 0; }
  .window-statusbar { align-items: start; flex-direction: column; }
}
