:root {
  color-scheme: light;
  --bg: #130f18;
  --paper: #251b2d;
  --paper-deep: #1a1421;
  --ink: #fff8ea;
  --muted: #d8c7ad;
  --line: rgba(233, 197, 122, 0.34);
  --accent: #c99a45;
  --accent-dark: #f0cf85;
  --rose: #d46e7f;
  --gold: #e6bc67;
  --amethyst: #5d3a75;
  --emerald: #1f6f68;
  --shadow: 0 26px 70px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(115deg, rgba(230, 188, 103, 0.18) 0 1px, transparent 1px 22%),
    linear-gradient(245deg, rgba(240, 207, 133, 0.12) 0 1px, transparent 1px 18%),
    conic-gradient(from 215deg at 50% -12%, rgba(230, 188, 103, 0.28), transparent 18%, rgba(93, 58, 117, 0.46) 34%, transparent 52%, rgba(31, 111, 104, 0.32) 72%, transparent 100%),
    linear-gradient(135deg, rgba(93, 58, 117, 0.52), rgba(19, 15, 24, 0.14) 42%, rgba(78, 18, 43, 0.42)),
    var(--bg);
  color: var(--ink);
  font-family: "Hiragino Sans", "Yu Gothic", "Meiryo", system-ui, sans-serif;
  line-height: 1.7;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at center, rgba(240, 207, 133, 0.16) 0 1px, transparent 1.5px),
    linear-gradient(rgba(255, 248, 234, 0.034) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 248, 234, 0.024) 1px, transparent 1px);
  background-size: 42px 42px, 84px 84px, 84px 84px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.86), transparent 82%);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent, rgba(230, 188, 103, 0.08), transparent),
    repeating-linear-gradient(135deg, transparent 0 18px, rgba(255, 248, 234, 0.018) 18px 19px);
  mix-blend-mode: screen;
}

button,
a,
input {
  font: inherit;
}

a {
  color: inherit;
}

.app-shell {
  position: relative;
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 56px;
  z-index: 1;
}

.intro {
  position: relative;
  display: grid;
  place-items: center;
  gap: 22px;
  min-height: min(640px, calc(100svh - 56px));
  padding: 64px 0 42px;
  text-align: center;
  overflow: hidden;
  border-radius: 8px;
}

.intro::before {
  content: "";
  position: absolute;
  inset: 8px -18px auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: 0.86;
  z-index: 2;
}

.intro::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 42px;
  width: min(620px, 86vw);
  height: min(620px, 86vw);
  transform: translateX(-50%) rotate(45deg);
  border: 1px solid rgba(230, 188, 103, 0.18);
  box-shadow:
    0 0 0 18px rgba(230, 188, 103, 0.035),
    inset 0 0 80px rgba(230, 188, 103, 0.055);
  pointer-events: none;
  z-index: 0;
}

.hero-video-frame {
  position: relative;
  z-index: 2;
  width: min(460px, 92vw);
  aspect-ratio: 9 / 11.2;
  border: 1px solid rgba(230, 188, 103, 0.42);
  border-radius: 8px;
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.45), 0 0 46px rgba(230, 188, 103, 0.14);
  overflow: hidden;
  background: #130f18;
  pointer-events: none;
}

.hero-video-frame::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: #130f18;
  z-index: 1;
}

.hero-video-frame::before {
  content: "";
  display: none;
}

.hero-video {
  display: block;
  width: 100%;
  height: auto;
  opacity: 0.9;
}

@media (prefers-reduced-motion: reduce) {
  .hero-video-frame {
    display: none;
  }
}

.intro-text {
  position: relative;
  z-index: 3;
  max-width: 780px;
  padding: 0;
}

.intro-text h1 {
  margin: 4px 0 16px;
  font-size: clamp(2.5rem, 8vw, 5.6rem);
  line-height: 1.05;
  letter-spacing: 0;
  color: #fff4d4;
  text-shadow: 0 5px 28px rgba(230, 188, 103, 0.26);
}

.lead {
  max-width: 620px;
  margin: 0 auto 24px;
  color: var(--muted);
  font-size: clamp(1rem, 2.8vw, 1.18rem);
}

.eyebrow {
  margin: 0;
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.intro-actions,
.form-actions,
.cta-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.intro-actions {
  position: relative;
  z-index: 3;
  justify-content: center;
}

.primary-link,
.primary-button,
.secondary-button,
.ghost-button,
.secondary-link {
  min-height: 48px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 11px 18px;
  cursor: pointer;
  text-decoration: none;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.primary-link,
.primary-button {
  background: linear-gradient(135deg, #f1d991, #b87b28);
  color: #1a1020;
  box-shadow: 0 12px 30px rgba(201, 154, 69, 0.24);
}

.secondary-button,
.secondary-link,
.ghost-button {
  background: rgba(255, 248, 234, 0.08);
  border-color: var(--line);
  color: #fff4d4;
}

.primary-link:hover,
.primary-button:hover,
.secondary-button:hover,
.secondary-link:hover,
.ghost-button:hover {
  transform: translateY(-1px);
}

.notice,
.diagnosis-panel,
.side-panel,
.result-panel {
  position: relative;
  background:
    linear-gradient(180deg, rgba(255, 248, 234, 0.08), rgba(255, 248, 234, 0.035)),
    rgba(30, 22, 38, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.notice {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  padding: 16px 18px;
  color: var(--muted);
}

.notice strong {
  color: #fff4d4;
  white-space: nowrap;
}

.diagnosis-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 22px;
  align-items: start;
}

.diagnosis-panel,
.side-panel,
.result-panel {
  padding: clamp(18px, 4vw, 30px);
}

.diagnosis-panel::before,
.side-panel::before,
.result-panel::before {
  content: "";
  position: absolute;
  inset: 8px;
  pointer-events: none;
  border: 1px solid rgba(230, 188, 103, 0.16);
  border-radius: 6px;
}

.section-heading {
  margin-bottom: 18px;
}

.mobile-help {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.section-heading h2,
.result-header h2 {
  margin: 4px 0 0;
  font-size: clamp(1.45rem, 5vw, 2rem);
  line-height: 1.25;
  letter-spacing: 0;
  color: #fff4d4;
}

.question-list {
  display: grid;
  gap: 18px;
}

.upload-zone {
  display: grid;
  place-items: center;
  min-height: 240px;
  padding: 28px;
  border: 2px dashed rgba(230, 188, 103, 0.48);
  border-radius: 8px;
  background:
    radial-gradient(circle at center, rgba(230, 188, 103, 0.16), transparent 58%),
    rgba(255, 248, 234, 0.055);
  text-align: center;
  cursor: pointer;
}

.upload-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.upload-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
}

.upload-choice {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 248, 234, 0.08);
  color: #fff4d4;
  font-weight: 700;
}

.upload-choice--camera {
  background: linear-gradient(135deg, #f1d991, #b87b28);
  color: #1a1020;
}

.upload-zone strong {
  margin-top: 8px;
  font-size: 1.15rem;
}

.upload-zone small {
  max-width: 420px;
  color: var(--muted);
}

.upload-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(230, 188, 103, 0.16);
  color: #ffe9a9;
  font-size: 2rem;
  font-weight: 700;
  box-shadow: 0 0 24px rgba(230, 188, 103, 0.22);
}

.preview-panel {
  margin-top: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 248, 234, 0.08);
}

.preview-panel img {
  display: block;
  width: 100%;
  max-height: 520px;
  object-fit: contain;
  background: #211727;
}

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

.analysis-summary div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 248, 234, 0.07);
}

.analysis-summary strong,
.analysis-summary span {
  display: block;
}

.analysis-summary span {
  color: var(--muted);
}

.question {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 248, 234, 0.07);
}

.question h3 {
  margin: 0 0 12px;
  font-size: 1rem;
  line-height: 1.5;
  letter-spacing: 0;
}

.option-list {
  display: grid;
  gap: 10px;
}

.option {
  position: relative;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  background: rgba(255, 248, 234, 0.07);
}

.option input {
  width: 18px;
  height: 18px;
  margin: 3px 0 0;
  accent-color: var(--accent);
}

.option span {
  min-width: 0;
}

.option strong {
  display: block;
  line-height: 1.45;
}

.option small {
  display: block;
  color: var(--muted);
  line-height: 1.55;
}

.option:has(input:checked) {
  border-color: var(--accent);
  background: rgba(230, 188, 103, 0.13);
}

.form-actions {
  justify-content: flex-end;
  margin-top: 22px;
}

.form-message {
  min-height: 1.6em;
  margin: 12px 0 0;
  color: var(--rose);
  font-weight: 700;
}

.guide-list,
.result-grid ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.guide-list {
  display: grid;
  gap: 14px;
}

.guide-list li {
  display: grid;
  gap: 2px;
  border-left: 4px solid var(--gold);
  padding-left: 12px;
}

.guide-list span {
  color: var(--muted);
}

.result-panel {
  min-height: calc(100svh - 56px);
  margin-top: 0;
}

.result-header {
  max-width: 760px;
}

.result-header p:last-child {
  color: var(--muted);
}

.score-cards,
.result-grid,
.line-reading-grid {
  display: grid;
  gap: 14px;
}

.score-cards {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 22px 0;
}

.score-card,
.result-grid article,
.line-reading-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 248, 234, 0.07);
  padding: 16px;
}

.reading-block {
  margin: 24px 0;
}

.reading-block .section-heading {
  margin-bottom: 14px;
}

.reading-block h3 {
  margin: 4px 0 0;
  color: #fff4d4;
  font-size: clamp(1.25rem, 4vw, 1.65rem);
  line-height: 1.3;
}

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

.line-reading-card {
  display: grid;
  gap: 7px;
}

.line-reading-card p {
  margin: 0;
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 700;
}

.line-reading-card h4 {
  margin: 0;
  color: #fff4d4;
  font-size: 1.08rem;
}

.line-reading-card strong {
  color: var(--gold);
}

.line-reading-card span,
.reading-note {
  color: var(--muted);
}

.reading-note {
  margin: 14px 0 0;
  font-size: 0.92rem;
}

.score-card strong {
  display: block;
  font-size: 0.88rem;
}

.score-bar {
  width: 100%;
  height: 8px;
  margin-top: 10px;
  border-radius: 999px;
  background: rgba(255, 248, 234, 0.14);
  overflow: hidden;
}

.score-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #7fd0bf, #e6bc67);
}

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

.result-grid h3,
.cta-band h3 {
  margin: 0 0 10px;
  font-size: 1.05rem;
}

.result-grid li {
  position: relative;
  padding-left: 18px;
  color: var(--muted);
}

.result-grid li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.72em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold);
}

.cta-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 18px;
  padding: 18px;
  border-radius: 8px;
  border: 1px solid rgba(230, 188, 103, 0.28);
  background:
    linear-gradient(135deg, rgba(93, 58, 117, 0.42), rgba(31, 111, 104, 0.24)),
    rgba(255, 248, 234, 0.08);
}

.cta-band p {
  margin: 0;
  color: var(--muted);
}

@media (max-width: 860px) {
  .diagnosis-layout {
    grid-template-columns: 1fr;
  }

  .intro {
    min-height: auto;
  }

  .side-panel {
    order: -1;
  }

  .score-cards,
  .result-grid,
  .line-reading-grid,
  .analysis-summary {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: min(100% - 18px, 1120px);
    padding-top: 10px;
    padding-bottom: 34px;
  }

  .intro {
    min-height: calc(100svh - 28px);
    gap: 16px;
    padding: 34px 0 24px;
  }

  .intro::after {
    top: 76px;
    width: 84vw;
    height: 84vw;
  }

  .intro-text h1 {
    font-size: clamp(1.85rem, 10.5vw, 3.1rem);
    line-height: 1.08;
    white-space: nowrap;
  }

  .hero-video-frame {
    width: 100%;
    aspect-ratio: 9 / 11;
  }

  .hero-video-frame::after {
    height: 2px;
    background: #130f18;
  }

  .hero-video-frame::before {
    display: none;
  }

  .hero-video {
    width: 100%;
    height: auto;
  }

  .lead {
    font-size: 1rem;
    line-height: 1.75;
  }

  .intro-actions,
  .form-actions,
  .cta-actions,
  .cta-band,
  .notice {
    flex-direction: column;
  }

  .primary-link,
  .primary-button,
  .secondary-button,
  .ghost-button,
  .secondary-link {
    width: 100%;
  }

  .question {
    padding: 14px;
  }

  .diagnosis-panel,
  .side-panel,
  .result-panel {
    padding: 18px 14px;
  }

  .section-heading h2,
  .result-header h2 {
    font-size: 1.42rem;
  }

  .upload-zone {
    min-height: 210px;
    padding: 22px 16px;
  }

  .upload-zone strong {
    font-size: 1.08rem;
  }

  .upload-zone small,
  .mobile-help,
  .guide-list span,
  .result-grid li,
  .line-reading-card span {
    font-size: 0.94rem;
  }

  .upload-actions,
  .upload-choice {
    width: 100%;
  }

  .form-actions {
    gap: 10px;
    margin-top: 16px;
  }

  .analysis-summary div,
  .score-card,
  .result-grid article,
  .line-reading-card {
    padding: 14px;
  }

}
