:root {
  --ink: #2c3550;
  --sub: #5b6785;
  --card: rgba(255, 255, 255, 0.94);
  --accent: #2f7de1;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: #cfe6fb; color: var(--ink);
  font-family: "Hiragino Maru Gothic ProN", "Hiragino Sans", "Noto Sans JP", "Yu Gothic", system-ui, sans-serif;
  overscroll-behavior: none;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  -webkit-text-size-adjust: 100%;
}
#frame { position: fixed; inset: 0; overflow: hidden; }
#view { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#cam { position: absolute; left: 0; top: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

button { font: inherit; color: inherit; cursor: pointer; border: 0; touch-action: manipulation; }

/* 見ている間 */
#hud { position: absolute; inset: 0; pointer-events: none; }
#hud-top {
  position: absolute; left: 0; right: 0; top: calc(var(--sat) + 8px);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
#badge, #hint {
  background: rgba(255, 255, 255, 0.88); border-radius: 999px; padding: 4px 12px;
  font-size: 13px; line-height: 1.4; box-shadow: 0 1px 4px rgba(40, 60, 100, 0.18);
}
#badge b { color: var(--accent); }
#hint { font-size: 12px; color: var(--sub); }
#btn-adjust {
  position: absolute; right: calc(var(--sar) + 10px); bottom: calc(var(--sab) + 10px);
  pointer-events: auto; min-width: 56px; min-height: 40px; padding: 6px 14px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.9); font-size: 14px; box-shadow: 0 1px 4px rgba(40, 60, 100, 0.25);
}

/* 調整パネル */
#panel {
  position: absolute; left: calc(var(--sal) + 8px); right: calc(var(--sar) + 8px); bottom: calc(var(--sab) + 8px);
  max-width: 420px; margin: 0 auto; background: var(--card); border-radius: 16px; padding: 10px 14px 12px;
  box-shadow: 0 4px 18px rgba(40, 60, 100, 0.3); font-size: 14px;
}
#panel[hidden], #hud[hidden], #start[hidden], #hint[hidden], .msg[hidden] { display: none; }
.panel-head { display: flex; align-items: center; justify-content: space-between; }
.panel-head h2 { margin: 0; font-size: 15px; }
#btn-close, #btn-center {
  min-height: 40px; padding: 6px 14px; border-radius: 10px; background: #e8eefb; font-size: 14px;
}
.row { display: block; margin-top: 8px; }
.row.two { display: flex; gap: 10px; align-items: center; }
.row span { display: flex; justify-content: space-between; }
#strength { width: 100%; height: 32px; margin: 2px 0 0; accent-color: var(--accent); touch-action: pan-x; }
#stats { flex: 1; font-size: 12px; line-height: 1.5; color: var(--sub); font-variant-numeric: tabular-nums; white-space: pre-line; }
#preview { width: 72px; height: 96px; border-radius: 8px; background: #dfe6f2; flex: none; }
.note { margin: 0; font-size: 11px; line-height: 1.5; color: var(--sub); }

/* はじめる画面 */
#start {
  position: absolute; inset: 0; display: flex; flex-direction: column; overflow: auto;
  padding: calc(var(--sat) + 16px) calc(var(--sar) + 16px) calc(var(--sab) + 16px) calc(var(--sal) + 16px);
  background: rgba(214, 228, 245, 0.55);
}
.card {
  margin: auto; width: 100%; max-width: 360px; background: var(--card); border-radius: 20px;
  padding: 22px 20px 18px; text-align: center; box-shadow: 0 6px 24px rgba(40, 60, 100, 0.25);
}
.card h1 { margin: 0 0 10px; font-size: 22px; line-height: 1.35; }
.card p { margin: 0 0 10px; font-size: 14px; line-height: 1.6; }
.card .privacy span { display: inline-block; }
.card .privacy { font-size: 12px; color: var(--sub); background: #eef3fc; border-radius: 10px; padding: 8px 10px; }
#btn-start {
  display: block; width: 100%; min-height: 60px; margin: 14px 0 10px; border-radius: 16px;
  background: var(--accent); color: #fff; font-size: 22px; font-weight: 700; letter-spacing: 0.08em;
  box-shadow: 0 4px 0 #1f5cb0;
}
#btn-start:active { transform: translateY(2px); box-shadow: 0 2px 0 #1f5cb0; }
#btn-nocam { min-height: 40px; padding: 6px 14px; border-radius: 10px; background: transparent; color: var(--sub); font-size: 13px; text-decoration: underline; }
.msg { margin-top: 10px !important; font-size: 13px !important; color: var(--ink); background: #fff4cf; border-radius: 10px; padding: 8px 10px; }
.msg button { margin-left: 6px; padding: 4px 10px; border-radius: 8px; background: #fff; border: 1px solid #c9b46a; }
#version {
  position: absolute; right: calc(var(--sar) + 10px); bottom: calc(var(--sab) + 8px);
  font-size: 12px; color: var(--sub); background: rgba(255, 255, 255, 0.7); border-radius: 8px; padding: 2px 8px;
}
