﻿:root {
  color-scheme: light;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f6f4ef;
  color: #171717;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  user-select: none;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100svh;
  overflow: hidden;
}

img,
video {
  pointer-events: none;
}

.app-shell {
  display: block;
  min-height: 100svh;
  padding: 0;
}

.camera-screen,
.result-view {
  display: grid;
  min-height: 100svh;
  width: 100%;
}

.brand-row {
  align-items: center;
  color: #fff;
  display: flex;
  justify-content: space-between;
  left: 0;
  padding: max(14px, env(safe-area-inset-top)) 14px 10px;
  position: fixed;
  right: 0;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.45);
  top: 0;
  z-index: 2;
}

.brand-row p {
  font-size: 15px;
  font-weight: 800;
  margin: 0;
}

.brand-row span {
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  padding: 5px 9px;
}

.camera-switch-button {
  align-items: center;
  appearance: none;
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid rgba(255, 255, 255, 0.82);
  border-radius: 50%;
  box-shadow: 0 5px 18px rgba(0, 0, 0, 0.28), inset 0 0 0 1px rgba(23, 23, 23, 0.14);
  color: #171717;
  display: inline-flex;
  font: inherit;
  height: 58px;
  justify-content: center;
  min-height: 58px;
  padding: 0;
  position: relative;
  width: 58px;
}

.camera-switch-button:disabled {
  background: rgba(187, 182, 170, 0.72);
  box-shadow: none;
  color: rgba(23, 23, 23, 0.36);
}

.switch-camera-icon {
  background: currentColor;
  border-radius: 5px;
  display: block;
  height: 18px;
  position: relative;
  width: 26px;
}

.switch-camera-icon::before {
  background: #fff;
  border: 2px solid currentColor;
  border-radius: 50%;
  content: "";
  height: 10px;
  left: 6px;
  position: absolute;
  top: 2px;
  width: 10px;
}

.switch-camera-icon::after {
  align-items: center;
  background: #171717;
  border: 2px solid #fff;
  border-radius: 50%;
  color: #fff;
  content: "↻";
  display: flex;
  font-size: 12px;
  font-weight: 800;
  height: 18px;
  justify-content: center;
  line-height: 1;
  position: absolute;
  right: -13px;
  top: -11px;
  width: 18px;
}

.stage {
  background: #111;
  border-radius: 0;
  inset: 0;
  overflow: hidden;
  position: fixed;
  width: 100%;
  z-index: 0;
}

video,
.result-photo {
  display: block;
  height: 100svh;
  object-fit: cover;
  width: 100%;
}

.fallback {
  align-items: center;
  background: #1c1c1c;
  color: #fff;
  display: grid;
  font-size: 15px;
  inset: 0;
  line-height: 1.7;
  padding: 24px;
  position: absolute;
  text-align: center;
}

.fallback[hidden] {
  display: none;
}

.message {
  background: rgba(0, 0, 0, 0.58);
  border-radius: 8px;
  bottom: calc(82px + env(safe-area-inset-bottom));
  color: #fff;
  font-size: 14px;
  line-height: 1.6;
  left: 14px;
  margin: 0;
  min-height: 44px;
  padding: 10px 12px;
  position: fixed;
  right: 14px;
  z-index: 2;
}

.actions {
  bottom: max(14px, env(safe-area-inset-bottom));
  align-items: center;
  display: flex;
  gap: 18px;
  justify-content: center;
  left: 14px;
  position: fixed;
  right: 14px;
  z-index: 2;
}

button,
.button {
  appearance: none;
  background: #171717;
  border: 0;
  border-radius: 8px;
  color: #fff;
  display: inline-grid;
  font: inherit;
  font-weight: 800;
  min-height: 52px;
  place-items: center;
  text-align: center;
  text-decoration: none;
  width: 100%;
}

button:disabled {
  background: #bbb6aa;
  color: #fffaf0;
}

.capture-button {
  align-items: center;
  appearance: none;
  background: rgba(255, 255, 255, 0.92);
  border: 4px solid rgba(255, 255, 255, 0.96);
  border-radius: 50%;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.34), inset 0 0 0 2px rgba(23, 23, 23, 0.3);
  color: transparent;
  display: inline-flex;
  height: 76px;
  justify-content: center;
  min-height: 76px;
  padding: 0;
  width: 76px;
}

.capture-button:active:not(:disabled) {
  transform: scale(0.96);
}

.capture-button:disabled {
  background: rgba(187, 182, 170, 0.72);
  border-color: rgba(255, 255, 255, 0.54);
  box-shadow: none;
}

.capture-ring {
  background: #fff;
  border: 2px solid rgba(23, 23, 23, 0.28);
  border-radius: 50%;
  display: block;
  height: 54px;
  width: 54px;
}

.capture-button:disabled .capture-ring {
  background: #d8d2c6;
  border-color: rgba(255, 255, 255, 0.36);
}

.secondary {
  background: #fff;
  border: 1px solid #171717;
  color: #171717;
}

.processing {
  background: rgba(246, 244, 239, 0.94);
  display: grid;
  gap: 16px;
  inset: 0;
  place-content: center;
  position: fixed;
  text-align: center;
  z-index: 10;
}

.processing[hidden] {
  display: none;
}

.processing img {
  height: 120px;
  justify-self: center;
  width: 120px;
}

.processing p {
  font-size: 17px;
  font-weight: 800;
  margin: 0;
}

.result-shell {
  background: #111;
}

.result-photo {
  border-radius: 0;
  inset: 0;
  position: fixed;
  z-index: 0;
}

.result-summary {
  align-items: center;
  background: rgba(0, 0, 0, 0.58);
  border-radius: 8px;
  color: #fff;
  display: flex;
  justify-content: space-between;
  left: 14px;
  padding: 10px 12px;
  position: fixed;
  right: 14px;
  top: max(14px, env(safe-area-inset-top));
  z-index: 2;
}

.result-summary span {
  font-size: 13px;
  font-weight: 700;
}

.result-summary strong {
  background: #171717;
  border-radius: 999px;
  color: #fff;
  font-size: 17px;
  padding: 8px 14px;
}

.debug-panel {
  background: rgba(246, 244, 239, 0.94);
  border: 1px solid #d8d2c6;
  border-radius: 8px;
  bottom: calc(82px + env(safe-area-inset-bottom));
  display: grid;
  gap: 10px;
  left: 14px;
  max-height: 42svh;
  overflow: auto;
  padding: 12px;
  position: fixed;
  right: 14px;
  z-index: 2;
}

.debug-meta,
.score-label {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.debug-meta span,
.debug-panel p,
.score-label span,
.score-row code {
  color: #5f5a52;
  font-size: 12px;
}

.debug-meta strong {
  font-size: 13px;
}

.debug-panel p {
  line-height: 1.5;
  margin: 0;
}

.score-list {
  display: grid;
  gap: 8px;
}

.score-row {
  display: grid;
  gap: 4px;
}

.score-label b {
  font-size: 12px;
}

.score-track {
  background: #e3ded3;
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
}

.score-track span {
  background: #171717;
  border-radius: inherit;
  display: block;
  height: 100%;
}

.score-row code {
  justify-self: end;
}

@media (orientation: landscape) {
  .app-shell::before {
    align-items: center;
    background: #171717;
    color: #fff;
    content: "スマホを縦向きにしてください";
    display: grid;
    font-size: 18px;
    font-weight: 800;
    inset: 0;
    position: fixed;
    text-align: center;
    z-index: 20;
  }
}

