
:root {
  --bg: #080808;
  --fg: #f4f4f1;
  --muted: rgba(244,244,241,.68);
  --faint: rgba(244,244,241,.34);
  --line: rgba(244,244,241,.18);
  --danger: #ffb0a3;
  --font: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, "Hiragino Kaku Gothic ProN", "Yu Gothic", "YuGothic", Meiryo, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; min-height: 100%; background: var(--bg); color: var(--fg); font-family: var(--font); }
body { overflow: hidden; -webkit-font-smoothing: antialiased; text-rendering: geometricPrecision; }
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
.hidden { display: none !important; }

.app-shell { min-height: 100svh; background: radial-gradient(circle at 50% 25%, #232323 0, #0b0b0b 42%, #050505 100%); }
.screen { min-height: 100svh; width: 100%; position: relative; }

.setup-screen { display: grid; place-items: center; padding: max(24px, env(safe-area-inset-top)) 22px max(24px, env(safe-area-inset-bottom)); }
.setup-bg { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(circle at 50% 34%, rgba(255,255,255,.14), transparent 28%), radial-gradient(circle at 40% 70%, rgba(255,255,255,.08), transparent 24%); filter: blur(24px); opacity: .65; }
.setup-card { position: relative; width: min(420px, 100%); padding: 4px; }
.eyebrow { margin: 0 0 16px; color: var(--faint); font-size: 10px; letter-spacing: .22em; text-align: center; }
.brand { margin: 0; font-weight: 500; letter-spacing: .06em; line-height: 1; color: var(--fg); white-space: nowrap; }
.brand-large { font-size: clamp(31px, 8vw, 45px); text-align: center; letter-spacing: .035em; }
.lead { margin: 18px auto 34px; max-width: 18em; text-align: center; color: var(--muted); font-size: 13px; line-height: 1.8; }
.field-label { display: block; margin: 0 0 10px; color: var(--muted); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }
.key-field { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 8px; width: 100%; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.045); backdrop-filter: blur(18px); padding: 12px 12px; }
.lock { color: var(--faint); text-align: center; font-size: 18px; transform: translateY(-1px); }
.key-input { width: 100%; min-width: 0; appearance: none; border: 0; outline: none; color: var(--fg); background: transparent; font-size: 15px; letter-spacing: .015em; }
.key-input::placeholder { color: var(--faint); }
.mini-button, .text-btn, .icon-btn, .ghost-btn, .save-btn, .primary-btn { appearance: none; border: 0; color: var(--fg); background: transparent; cursor: pointer; }
.mini-button { border-left: 1px solid var(--line); padding: 2px 0 2px 11px; color: var(--muted); font-size: 10px; letter-spacing: .16em; }
.check-row { display: flex; align-items: center; gap: 10px; margin: 16px 0 8px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.check-row input { width: 17px; height: 17px; accent-color: #f4f4f1; }
.note { margin: 0; color: var(--faint); font-size: 11px; line-height: 1.65; }
.setup-actions { display: flex; align-items: center; gap: 14px; margin-top: 26px; }
.primary-btn { flex: 1; height: 52px; border-radius: 18px; background: var(--fg); color: #050505; font-size: 13px; letter-spacing: .18em; font-weight: 700; }
.text-btn { padding: 14px 0; color: var(--muted); font-size: 11px; letter-spacing: .16em; }

.camera-screen { background: #000; }
.camera-shell {
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto auto auto auto 1fr;
  justify-items: center;
  align-content: start;
  padding: env(safe-area-inset-top) 16px calc(16px + env(safe-area-inset-bottom));
}
.topbar {
  width: min(100%, 560px);
  display: grid;
  grid-template-columns: 72px 1fr 72px;
  align-items: center;
  padding: 10px 0 14px;
}
.topbar .brand { text-align: center; font-size: 16px; font-weight: 500; }
.top-switch { justify-self: end; }
.icon-btn:disabled, .near-btn:disabled { opacity: .34; cursor: default; }
.icon-btn, .ghost-btn, .save-btn, .near-btn {
  min-width: 56px;
  height: 36px;
  border-radius: 999px;
  color: rgba(255,255,255,.82);
  background: rgba(255,255,255,.08);
  backdrop-filter: blur(14px);
  font-size: 11px;
  letter-spacing: .14em;
}
.near-actions {
  width: min(calc(100vw - 32px), 560px);
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}
.near-btn {
  min-width: 92px;
  padding: 0 16px;
}
.square-stage {
  position: relative;
  width: min(calc(100vw - 32px), 560px);
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 28px;
  background: #000;
  box-shadow: 0 20px 80px rgba(0,0,0,.46);
}
video, .still-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}
.still-image { z-index: 2; }
.stage-shade {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(0,0,0,.46), rgba(0,0,0,.08) 22%, transparent 38%, rgba(0,0,0,.10) 62%, rgba(0,0,0,.58) 100%);
}
.stage-brand {
  position: absolute;
  z-index: 5;
  left: 20px;
  right: 20px;
  top: 18px;
  text-align: center;
  color: rgba(255,255,255,.94);
  font-size: clamp(16px, 4.2vw, 22px);
  font-weight: 500;
  letter-spacing: .04em;
  text-shadow: 0 1px 14px rgba(0,0,0,.42);
}
.subtitle-layer {
  position: absolute;
  z-index: 6;
  left: 24px;
  right: 24px;
  bottom: 28px;
  text-align: center;
  pointer-events: none;
  text-shadow: 0 1px 18px rgba(0,0,0,.52), 0 1px 3px rgba(0,0,0,.65);
  animation: subtitleIn .42s ease both;
}
.subtitle-en { margin: 0 0 10px; font-size: clamp(14px, 3.8vw, 18px); font-weight: 400; letter-spacing: .02em; line-height: 1.35; color: rgba(255,255,255,.88); }
.subtitle-ja { margin: 0; font-size: clamp(20px, 5.8vw, 28px); font-weight: 500; letter-spacing: .035em; line-height: 1.42; color: #fff; }
@keyframes subtitleIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.loading-layer { position: absolute; z-index: 7; inset: 0; display: grid; place-items: center; align-content: center; gap: 18px; background: rgba(0,0,0,.28); backdrop-filter: blur(4px); color: rgba(255,255,255,.78); font-size: 12px; letter-spacing: .08em; }
.pulse { width: 48px; height: 48px; border-radius: 50%; border: 1px solid rgba(255,255,255,.42); position: relative; }
.pulse::after { content: ""; position: absolute; inset: 8px; border-radius: inherit; background: rgba(255,255,255,.82); animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { transform: scale(.55); opacity: .45; } 50% { transform: scale(1); opacity: .95; } }
.error-box { position: absolute; z-index: 9; left: 18px; right: 18px; top: 68px; padding: 14px 16px; border: 1px solid rgba(255,176,163,.32); border-radius: 16px; background: rgba(22,0,0,.68); color: var(--danger); font-size: 12px; line-height: 1.6; backdrop-filter: blur(14px); }
.controls {
  width: min(calc(100vw - 32px), 560px);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 14px;
  padding-top: 14px;
}
.side-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 78px;
}
.left-actions { justify-content: flex-start; }
.right-actions { justify-content: flex-end; }
.center-actions { display: grid; justify-items: center; align-items: center; }
.ghost-btn { min-width: 76px; padding: 0 14px; }
.save-btn:disabled { opacity: .34; cursor: default; }
.shutter {
  width: 82px;
  height: 82px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.9);
  background: rgba(255,255,255,.92);
  box-shadow: inset 0 0 0 7px rgba(0,0,0,.2), 0 10px 36px rgba(0,0,0,.24);
  cursor: pointer;
}
.shutter:active { transform: scale(.96); }
.mode-label { margin: 10px 0 0; color: rgba(255,255,255,.58); font-size: 10px; letter-spacing: .24em; }

@media (max-width: 420px) {
  .camera-shell { padding-left: 12px; padding-right: 12px; }
  .topbar {
    grid-template-columns: 62px 1fr 62px;
    padding-bottom: 12px;
  }
  .topbar .brand { font-size: 13px; }
  .square-stage { width: min(calc(100vw - 24px), 560px); border-radius: 22px; }
  .near-actions {
    width: min(calc(100vw - 24px), 560px);
    margin-top: 10px;
    gap: 8px;
  }
  .near-btn { min-width: 82px; height: 34px; padding: 0 12px; font-size: 10px; }
  .controls {
    width: min(calc(100vw - 24px), 560px);
    gap: 10px;
    padding-top: 12px;
  }
  .side-actions { gap: 8px; min-height: 72px; }
  .ghost-btn { min-width: 62px; height: 34px; padding: 0 11px; font-size: 10px; }
  .shutter { width: 74px; height: 74px; }
}
