:root {
  --bg: #f1efe7;
  --panel: rgba(255, 252, 245, 0.92);
  --panel-strong: rgba(253, 247, 232, 0.98);
  --ink: #11221b;
  --muted: #526257;
  --line: rgba(17, 34, 27, 0.12);
  --accent: #d2693c;
  --accent-soft: rgba(210, 105, 60, 0.14);
  --safe: #2f7d63;
  --warn: #b86728;
  --danger: #9f3d2f;
  --shadow: 0 24px 80px rgba(17, 34, 27, 0.11);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Hiragino Sans", "Noto Sans JP", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(210, 105, 60, 0.22), transparent 28%),
    radial-gradient(circle at top right, rgba(47, 125, 99, 0.17), transparent 24%),
    linear-gradient(180deg, #faf6eb, var(--bg));
}

a {
  color: inherit;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0 64px;
}

.hero {
  display: grid;
  grid-template-columns: 1.4fr 0.9fr;
  gap: 24px;
  align-items: stretch;
  margin-bottom: 28px;
}

.hero-copy,
.hero-panel,
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.hero-copy {
  padding: 36px;
}

.hero-panel {
  padding: 28px;
  background: linear-gradient(180deg, rgba(17, 34, 27, 0.95), rgba(17, 34, 27, 0.86));
  color: #fff6ea;
}

.eyebrow,
.section-kicker {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.75rem;
  color: var(--muted);
}

.hero-panel .section-kicker,
.hero-panel p,
.hero-panel a {
  color: #fff1d2;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Gill Sans", "Avenir Next Condensed", "Hiragino Sans", sans-serif;
  line-height: 1.02;
}

h1 {
  font-size: clamp(2.4rem, 6vw, 4.8rem);
  max-width: 10ch;
}

h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
}

h3 {
  font-size: 1.05rem;
}

.lede {
  margin: 18px 0 24px;
  max-width: 62ch;
  color: var(--muted);
  font-size: 1.04rem;
}

.hero-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-chips span {
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid rgba(210, 105, 60, 0.18);
}

.hero-actions,
.capture-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.primary-link,
.secondary-link,
.session-link {
  text-decoration: none;
}

.primary-link,
.secondary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 18px;
  border-radius: 18px;
}

.primary-link {
  background: linear-gradient(135deg, #113b2d, #245946);
  color: #fffdf8;
  box-shadow: 0 18px 32px rgba(17, 59, 45, 0.24);
}

.secondary-link {
  border: 1px solid rgba(17, 34, 27, 0.14);
  background: rgba(255, 255, 255, 0.7);
}

.sample-list {
  padding-left: 18px;
}

.sample-list li + li {
  margin-top: 10px;
}

.dashboard-hero {
  margin-bottom: 24px;
}

.grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 24px;
  margin-bottom: 24px;
}

.card {
  padding: 28px;
}

.card-head {
  margin-bottom: 20px;
}

.session-form {
  display: grid;
  gap: 16px;
}

.two-col {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.meta-grid,
.support-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

label {
  display: grid;
  gap: 8px;
  font-size: 0.95rem;
}

label span {
  color: var(--muted);
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(17, 34, 27, 0.12);
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.84);
  color: var(--ink);
}

textarea {
  resize: vertical;
}

.toggle {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.reconstruction-toggle {
  padding: 16px 18px;
  border-radius: 20px;
  background: rgba(210, 105, 60, 0.08);
  border: 1px solid rgba(210, 105, 60, 0.16);
}

.toggle input {
  width: 22px;
  height: 22px;
}

button {
  border: 0;
  border-radius: 18px;
  background: linear-gradient(135deg, #113b2d, #245946);
  color: #fffdf8;
  padding: 16px 18px;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease;
  box-shadow: 0 18px 32px rgba(17, 59, 45, 0.24);
}

button:hover {
  transform: translateY(-1px);
}

.hint {
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.9rem;
}

.field-note {
  color: var(--muted);
  font-size: 0.82rem;
}

.capability-banner {
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(17, 59, 45, 0.08);
  border: 1px solid rgba(17, 59, 45, 0.12);
}

.camera-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 24px;
  background: rgba(17, 34, 27, 0.04);
  border: 1px solid var(--line);
}

.camera-stage {
  position: relative;
  min-height: 280px;
  border-radius: 20px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(17, 59, 45, 0.9), rgba(36, 89, 70, 0.74)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent);
}

.camera-preview {
  display: none;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-preview.is-live {
  display: block;
}

.camera-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  color: #fff1d2;
  line-height: 1.6;
}

.camera-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.subtle-button {
  background: linear-gradient(135deg, rgba(17, 59, 45, 0.12), rgba(36, 89, 70, 0.18));
  color: var(--ink);
  box-shadow: none;
  border: 1px solid rgba(17, 59, 45, 0.16);
}

.subtle-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.capture-tray {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.capture-card {
  padding: 10px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid var(--line);
}

.capture-card img {
  width: 100%;
  aspect-ratio: 1.15;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 8px;
}

.capture-card-placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1.15;
  margin-bottom: 8px;
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(17, 59, 45, 0.14), rgba(36, 89, 70, 0.2)),
    rgba(255, 255, 255, 0.72);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.capture-card p,
.capture-card small {
  margin: 0;
}

.camera-modal-open {
  overflow: hidden;
}

.camera-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(5, 12, 10, 0.92);
}

.camera-modal-shell {
  display: grid;
  grid-template-rows: auto 1fr auto;
  width: 100%;
  height: 100%;
  color: #fff7ea;
  background:
    radial-gradient(circle at top right, rgba(210, 105, 60, 0.16), transparent 24%),
    radial-gradient(circle at bottom left, rgba(47, 125, 99, 0.18), transparent 28%),
    rgba(5, 12, 10, 0.92);
}

.camera-modal-topbar,
.camera-modal-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
}

.camera-modal-copy,
.camera-modal-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.camera-modal-actions .subtle-button {
  color: #fff7ea;
  background: linear-gradient(135deg, rgba(255, 247, 234, 0.18), rgba(255, 247, 234, 0.08));
  border: 1px solid rgba(255, 247, 234, 0.28);
  box-shadow: none;
  text-shadow: 0 1px 2px rgba(5, 12, 10, 0.36);
}

.camera-modal-actions .subtle-button:hover {
  background: linear-gradient(135deg, rgba(255, 247, 234, 0.24), rgba(255, 247, 234, 0.12));
}

.camera-modal-actions .subtle-button:disabled {
  color: rgba(255, 247, 234, 0.62);
  border-color: rgba(255, 247, 234, 0.16);
}

.camera-modal-copy {
  flex-wrap: wrap;
}

.camera-mode-badge {
  margin: 0;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 247, 234, 0.12);
  border: 1px solid rgba(255, 247, 234, 0.24);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.camera-modal-status,
.camera-guidance {
  margin: 0;
  max-width: 72ch;
  color: rgba(255, 247, 234, 0.88);
}

.camera-modal-stage {
  position: relative;
  min-height: 0;
}

.camera-modal-stage .camera-preview {
  min-height: 100%;
}

.guide-frame {
  position: absolute;
  border: 2px solid rgba(255, 247, 234, 0.88);
  border-radius: 24px;
  box-shadow:
    0 0 0 200vmax rgba(5, 12, 10, 0.2),
    0 0 0 1px rgba(17, 34, 27, 0.24) inset;
}

.guide-panel {
  position: absolute;
  right: 20px;
  bottom: 20px;
  display: grid;
  gap: 8px;
  width: min(180px, 42vw);
  padding: 12px;
  border-radius: 18px;
  background: rgba(5, 12, 10, 0.56);
  border: 1px solid rgba(255, 247, 234, 0.18);
  backdrop-filter: blur(10px);
}

.guide-panel p {
  margin: 0;
  font-size: 0.78rem;
  color: rgba(255, 247, 234, 0.78);
}

.guide-panel img {
  width: 100%;
  aspect-ratio: 0.7;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid rgba(255, 247, 234, 0.16);
}

.camera-shutter {
  min-width: 132px;
  border-radius: 999px;
  background: linear-gradient(135deg, #d2693c, #b14f2f);
  box-shadow: 0 18px 32px rgba(210, 105, 60, 0.32);
}

.camera-shutter:disabled,
.camera-done-button:disabled {
  opacity: 0.45;
}

.optional-panel {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.52);
  overflow: hidden;
}

.optional-panel summary {
  cursor: pointer;
  list-style: none;
  padding: 16px 18px;
  font-weight: 600;
}

.optional-panel summary::-webkit-details-marker {
  display: none;
}

.optional-body {
  padding: 0 18px 18px;
}

.status-panel {
  display: grid;
  gap: 14px;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 120px;
  padding: 10px 14px;
  border-radius: 999px;
  font-weight: 700;
}

.pill.clear,
.pill.completed {
  background: rgba(47, 125, 99, 0.12);
  color: var(--safe);
}

.pill.warning,
.pill.processing,
.pill.queued,
.pill.conditional {
  background: rgba(184, 103, 40, 0.12);
  color: var(--warn);
}

.pill.critical,
.pill.failed,
.pill.not_recommended {
  background: rgba(159, 61, 47, 0.12);
  color: var(--danger);
}

.pill.recommended {
  background: rgba(47, 125, 99, 0.12);
  color: var(--safe);
}

.result-block {
  padding: 16px;
  border-radius: 18px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
}

.result-block ul {
  margin: 12px 0 0;
  padding-left: 20px;
}

.result-block li + li {
  margin-top: 10px;
}

.result-image-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 14px;
}

.result-image-card {
  display: grid;
  gap: 12px;
  padding: 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid var(--line);
  min-width: 0;
}

.result-image-frame {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  background: rgba(17, 34, 27, 0.08);
  aspect-ratio: 3 / 4;
  width: 100%;
  max-width: 100%;
}

.result-image-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.image-overlay.empty {
  background: linear-gradient(180deg, rgba(17, 34, 27, 0.02), transparent 40%);
}

.annotation-box {
  position: absolute;
  border: 3px solid var(--warn);
  border-radius: 10px;
  background: rgba(184, 103, 40, 0.12);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.82) inset;
}

.annotation-box.low {
  border-color: var(--safe);
  background: rgba(47, 125, 99, 0.12);
}

.annotation-box.high {
  border-color: var(--danger);
  background: rgba(159, 61, 47, 0.12);
}

.annotation-box span {
  position: absolute;
  top: -1px;
  left: -1px;
  padding: 4px 8px;
  border-radius: 0 0 10px 0;
  background: rgba(17, 34, 27, 0.86);
  color: #fff7ea;
  font-size: 0.72rem;
  line-height: 1.2;
}

.result-image-meta {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.result-image-meta p,
.result-image-meta small {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.obstacle-detail {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.5;
}

.image-finding-list {
  min-width: 0;
}

.finding-preview {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}

.finding-details {
  margin-top: 8px;
}

.finding-details summary {
  cursor: pointer;
  color: var(--safe);
  font-size: 0.9rem;
  font-weight: 600;
}

.finding-details summary::-webkit-details-marker {
  color: var(--safe);
}

.finding-full {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.55;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.session-list {
  display: grid;
  gap: 12px;
}

.session-item {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid var(--line);
  display: grid;
  gap: 6px;
}

.session-accordion {
  padding: 0;
  overflow: hidden;
}

.session-accordion summary {
  cursor: pointer;
  list-style: none;
  padding: 16px;
  font-weight: 600;
}

.session-accordion summary::-webkit-details-marker {
  display: none;
}

.session-accordion-body {
  display: grid;
  gap: 8px;
  padding: 0 16px 16px;
}

.session-accordion-body p {
  margin: 0;
  color: var(--muted);
}

.session-link-inline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid rgba(17, 34, 27, 0.14);
  background: rgba(255, 255, 255, 0.8);
  text-decoration: none;
}

.session-link-inline:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(17, 34, 27, 0.08);
}

.capture-shell {
  width: min(980px, calc(100% - 24px));
}

.capture-card-page,
.detail-hero {
  margin-bottom: 24px;
}

.detail-prompt {
  margin: 0;
  max-width: 60ch;
  color: var(--muted);
}

.session-id-badge {
  display: inline-flex;
  align-items: center;
  margin: 10px 0 0;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(17, 59, 45, 0.08);
  border: 1px solid rgba(17, 59, 45, 0.12);
  color: var(--muted);
  font-size: 0.88rem;
  font-family: "SFMono-Regular", "Menlo", "Consolas", monospace;
}

@media (max-width: 960px) {
  .hero,
  .grid {
    grid-template-columns: 1fr;
  }

  .result-image-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding-top: 20px;
  }

  .hero-copy,
  .hero-panel,
  .card {
    border-radius: 22px;
    padding: 22px;
  }

  .two-col,
  .meta-grid,
  .support-grid {
    grid-template-columns: 1fr;
  }

  .camera-modal-topbar,
  .camera-modal-bottom {
    flex-direction: column;
    align-items: stretch;
  }

  .camera-modal-actions {
    width: 100%;
    justify-content: space-between;
  }

  .guide-panel {
    width: min(160px, 48vw);
    right: 14px;
    bottom: 92px;
  }

  .result-image-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-color-scheme: dark) {
  .camera-modal-actions .subtle-button {
    color: #fffdf6;
    background: linear-gradient(135deg, rgba(255, 253, 246, 0.24), rgba(255, 253, 246, 0.12));
    border-color: rgba(255, 253, 246, 0.34);
  }
}
