:root {
  --paper: #efe6ee;
  --panel: #fff7ef;
  --ink: #201c2e;
  --muted: #6d6278;
  --line: #312857;
  --accent: #52418d;
  --accent-2: #a45f9f;
  --accent-soft: #d9cee9;
  --gold: #d7b46b;
  --screen: #fff8ef;
  --bubble: #fdf5ed;
  --reply: #dfeec1;
  --shadow: 0 5px 0 #251d42, 0 14px 28px rgba(22, 17, 39, 0.25);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 22% 10%, rgba(248, 214, 190, 0.55), transparent 28rem),
    radial-gradient(circle at 82% 12%, rgba(90, 75, 150, 0.22), transparent 24rem),
    linear-gradient(rgba(49, 40, 87, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(49, 40, 87, 0.035) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 248, 239, 0.9), rgba(232, 220, 236, 0.98)),
    var(--paper);
  background-size: auto, auto, 7px 7px, 7px 7px, auto;
  font-family: "MS PGothic", "MS Gothic", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  letter-spacing: 0;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    180deg,
    rgba(36, 31, 44, 0.045) 0,
    rgba(36, 31, 44, 0.045) 1px,
    transparent 1px,
    transparent 4px
  );
  mix-blend-mode: multiply;
  z-index: 5;
}

button,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.shell {
  width: min(920px, calc(100% - 28px));
  margin: 0 auto;
  padding: 42px 0 72px;
}

.page {
  display: none;
}

.page-active {
  display: block;
  animation: rise 420ms ease both;
}

.hero {
  position: relative;
  margin-bottom: 18px;
  padding: 70px 24px 30px;
  border: 3px solid var(--line);
  border-radius: 10px 10px 2px 2px;
  background:
    linear-gradient(rgba(82, 65, 141, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(82, 65, 141, 0.035) 1px, transparent 1px),
    linear-gradient(180deg, #fff8ef, #f3e5ef);
  background-size: 6px 6px, 6px 6px, auto;
  box-shadow: var(--shadow);
}

.hero::before {
  content: "OC成分診断";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 42px;
  display: flex;
  align-items: center;
  padding: 0 18px;
  border-bottom: 3px solid var(--line);
  border-radius: 6px 6px 0 0;
  background:
    linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, #4b3a86, #5d4a98 62%, #8b5a9e);
  background-size: 100% 5px, auto;
  color: #fff8ef;
  font-size: 18px;
  font-weight: 800;
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 18px;
  padding: 6px 10px;
  border: 2px solid var(--line);
  border-radius: 5px;
  background: #fff8ef;
  color: #4b3a86;
  font-size: 13px;
  font-weight: 700;
}

.kicker span {
  padding: 2px 7px;
  border-radius: 3px;
  background: var(--accent);
  color: #fff8ef;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 20px;
  color: #191827;
  font-size: clamp(34px, 6vw, 58px);
  line-height: 1.08;
  font-weight: 900;
}

.hero-title {
  display: grid;
  gap: 10px;
  width: fit-content;
  max-width: 100%;
  margin-bottom: 22px;
  padding: 14px 18px 16px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(rgba(82, 65, 141, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(82, 65, 141, 0.035) 1px, transparent 1px),
    rgba(255, 253, 248, 0.72);
  background-size: 6px 6px, 6px 6px, auto;
  box-shadow: 4px 4px 0 rgba(49, 40, 87, 0.18);
}

.title-ribbon {
  width: fit-content;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--accent);
  color: #fff8ef;
  font-size: 14px;
  line-height: 1;
  font-weight: 900;
}

.title-main {
  display: block;
  font-size: clamp(36px, 6vw, 56px);
  line-height: 1.08;
}

.lead {
  margin-bottom: 18px;
  color: #383144;
  font-size: clamp(16px, 2vw, 20px);
  line-height: 1.85;
}

.privacy,
.subtle,
.input-meta {
  color: var(--muted);
  font-size: 14px;
}

.momo-promo {
  display: grid;
  grid-template-columns: minmax(96px, 150px) minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin-top: 20px;
  color: var(--ink);
  text-decoration: none;
  text-align: left;
}

.momo-promo img {
  display: block;
  width: 100%;
  max-height: 44px;
  object-fit: contain;
}

.momo-promo strong,
.momo-promo small {
  display: block;
}

.momo-promo strong {
  margin-bottom: 3px;
  font-size: 15px;
  line-height: 1.35;
}

.momo-promo small {
  color: #4c4657;
  font-size: 12px;
  line-height: 1.55;
}

.hero-promo {
  max-width: 620px;
  padding: 12px 14px;
  border-top: 1px solid rgba(49, 40, 87, 0.28);
  border-bottom: 1px solid rgba(49, 40, 87, 0.18);
  background:
    linear-gradient(rgba(82, 65, 141, 0.035) 1px, transparent 1px),
    rgba(255, 250, 241, 0.54);
  background-size: 6px 6px, auto;
}

.input-panel,
.section-block,
.share-zone {
  background: rgba(255, 253, 248, 0.86);
  border: 3px solid var(--line);
  border-radius: 9px;
  box-shadow: var(--shadow);
}

.input-panel {
  position: relative;
  padding: 58px 18px 18px;
  background:
    linear-gradient(rgba(82, 65, 141, 0.035) 1px, transparent 1px),
    linear-gradient(180deg, #fbf0f1, #efe1eb);
  background-size: 6px 6px, auto;
}

.input-panel::before {
  content: "OC設定入力";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 40px;
  display: flex;
  align-items: center;
  padding: 0 18px;
  border-bottom: 3px solid var(--line);
  border-radius: 5px 5px 0 0;
  background:
    linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    #4b3a86;
  background-size: 100% 5px;
  color: #fff8ef;
  font-size: 17px;
  font-weight: 800;
}

textarea {
  width: 100%;
  min-height: 330px;
  resize: vertical;
  border: 3px solid #312857;
  outline: 0;
  border-radius: 10px;
  padding: 22px;
  background:
    linear-gradient(rgba(82, 65, 141, 0.035) 1px, transparent 1px),
    var(--bubble);
  background-size: 100% 30px;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.8;
  box-shadow: inset 0 0 0 3px rgba(82, 65, 141, 0.14);
}

textarea::placeholder {
  color: #a09586;
}

.input-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 4px 8px;
}

.input-error {
  min-height: 22px;
  margin: 0 4px 14px;
  color: var(--accent-2);
  font-size: 14px;
  font-weight: 700;
}

.primary,
.secondary,
.ghost {
  min-height: 52px;
  border-radius: 7px;
  border: 3px solid var(--line);
  font-weight: 800;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.primary {
  width: 100%;
  min-height: 62px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.12) 1px, transparent 1px),
    linear-gradient(180deg, #6654a4, #4b3a86);
  background-size: 100% 5px, auto;
  color: #fff8ef;
  font-size: 19px;
  box-shadow: 0 4px 0 #251d42, 0 10px 18px rgba(36, 31, 44, 0.22);
}

.primary:hover,
.secondary:hover,
.ghost:hover {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #251d42, 0 6px 14px rgba(36, 31, 44, 0.2);
}

.primary:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
  box-shadow: none;
}

.loading-page {
  min-height: 70vh;
  place-items: center;
}

.loading-page.page-active {
  display: grid;
}

.loading-box {
  width: min(560px, 100%);
  text-align: center;
}

.loading-box h2 {
  margin-bottom: 28px;
  font-size: clamp(26px, 5vw, 44px);
}

.loading-line {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #eee4d5;
}

.loading-line span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--gold), var(--accent-2));
  transition: width 760ms ease;
}

.result-header {
  padding: 12px 0 26px;
}

.result-header p {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 18px;
}

.result-header h2 {
  margin-bottom: 0;
  font-size: clamp(30px, 5vw, 54px);
  line-height: 1.12;
}

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

.match-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.72);
}

.match-summary {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto 28px;
  gap: 12px;
  align-items: center;
  width: 100%;
  border: 0;
  padding: 16px 18px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.rank {
  color: var(--muted);
  font-weight: 800;
}

.match-title {
  display: block;
  font-size: 19px;
  font-weight: 800;
}

.match-work {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.mini-score {
  color: var(--accent);
  font-size: 22px;
  font-weight: 900;
}

.chevron {
  color: var(--muted);
  font-size: 22px;
}

.details {
  display: none;
  padding: 0 18px 18px 64px;
  color: #4d453c;
}

.match-item.open .details {
  display: block;
}

.match-item.open .chevron {
  transform: rotate(180deg);
}

.details h4 {
  margin: 16px 0 10px;
}

.details h4:first-child {
  margin-top: 0;
}

.checks {
  display: grid;
  gap: 8px;
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
}

.checks li::before {
  content: "✓";
  margin-right: 9px;
  color: var(--accent);
  font-weight: 900;
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-cloud span {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fffaf1;
  color: #4b443b;
  font-size: 13px;
  line-height: 1;
}

.section-block {
  margin-top: 34px;
  padding: 24px;
}

.section-block h3 {
  margin-bottom: 16px;
  font-size: 24px;
}

.trait-highlight {
  margin-top: 0;
  margin-bottom: 18px;
  text-align: center;
}

.trait-highlight h3 {
  margin-bottom: 20px;
}

.ai-comment {
  margin: 0;
  color: #40392f;
  font-size: 18px;
  line-height: 2;
  white-space: pre-line;
}

.traits {
  display: grid;
  gap: 16px;
}

.trait-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) 46px;
  gap: 14px;
  align-items: center;
}

.bar {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #eee4d5;
}

.bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--gold));
}

.share-zone {
  margin: 0 0 24px;
  padding: 24px;
  background:
    linear-gradient(rgba(82, 65, 141, 0.035) 1px, transparent 1px),
    linear-gradient(180deg, #fbf0f1, #efe1eb);
  background-size: 6px 6px, auto;
}

.share-card {
  position: relative;
  width: min(720px, 100%);
  margin: 0 auto;
  padding: 36px 34px 32px;
  overflow: hidden;
  border: 2px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(rgba(82, 65, 141, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(82, 65, 141, 0.028) 1px, transparent 1px),
    linear-gradient(180deg, #f6fbff, #fff8ef 62%, #f6edf5);
  background-size: 100% 8px, 8px 8px, auto;
  text-align: center;
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.58);
}

.share-card::before,
.share-card::after {
  content: "";
  position: absolute;
  left: 20px;
  right: 20px;
  height: 2px;
  background: var(--line);
}

.share-card::before {
  top: 16px;
}

.share-card::after {
  bottom: 16px;
}

.share-title {
  margin: 0 0 10px;
  color: var(--line);
  font-size: 22px;
  font-weight: 900;
}

.share-small {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.share-top-card {
  width: min(560px, 100%);
  margin: 0 auto;
  padding: 22px 18px 20px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.12)),
    #fffaf1;
  box-shadow: 0 3px 0 rgba(49, 40, 87, 0.86);
}

.share-top-label {
  display: inline-block;
  margin-bottom: 10px;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f0e8fb;
  color: var(--line);
  font-size: 13px;
  font-weight: 900;
}

.share-top-name {
  font-size: clamp(48px, 7vw, 74px);
  line-height: 1.04;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.share-top-score {
  margin-top: 6px;
  color: var(--accent);
  font-size: 44px;
  font-weight: 900;
}

.share-top-work {
  margin-top: 4px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 800;
}

.share-divider {
  width: min(360px, 70%);
  height: 1px;
  margin: 28px auto 22px;
  background: var(--line);
}

.share-label {
  margin: 18px 0 12px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 800;
}

.share-label-bottom {
  margin-top: 24px;
}

.share-name {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 68px;
  gap: 12px;
  align-items: center;
  width: min(500px, 100%);
  margin: 10px auto;
  padding: 12px 14px;
  border: 1px solid rgba(49, 40, 87, 0.42);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.72);
  color: var(--ink);
  text-align: center;
  font-size: 18px;
  font-weight: 900;
}

.share-name-rank {
  color: var(--gold);
  font-size: 15px;
  font-weight: 900;
}

.share-name-main {
  display: grid;
  gap: 2px;
  min-width: 0;
  justify-items: center;
}

.share-name-title {
  overflow-wrap: anywhere;
  line-height: 1.2;
}

.share-name-work {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.share-name-score {
  color: var(--accent);
  font-size: 20px;
}

.share-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 9px;
  width: min(560px, 100%);
  margin: 0 auto;
}

.share-tags span {
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fffaf1;
  color: var(--line);
  font-size: 13px;
  font-weight: 800;
}

.result-promo {
  margin: 24px auto 0;
  padding: 18px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(rgba(82, 65, 141, 0.035) 1px, transparent 1px),
    rgba(255, 253, 248, 0.9);
  background-size: 6px 6px, auto;
  box-shadow: 0 3px 0 #251d42, 0 10px 20px rgba(22, 17, 39, 0.16);
}

.actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.secondary {
  background: var(--accent);
  color: #fff;
}

.ghost {
  border-color: var(--line);
  background: transparent;
  color: var(--ink);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 680px) {
  .shell {
    width: min(100% - 16px, 940px);
    padding: 14px 0 48px;
  }

  .hero {
    margin-bottom: 12px;
    padding: 58px 14px 20px;
    border-width: 2px;
    border-radius: 8px 8px 2px 2px;
    box-shadow: 0 3px 0 #251d42, 0 10px 20px rgba(22, 17, 39, 0.2);
  }

  .hero::before {
    height: 36px;
    padding: 0 12px;
    border-bottom-width: 2px;
    font-size: 15px;
  }

  .kicker {
    margin-bottom: 14px;
    padding: 5px 8px;
    font-size: 12px;
  }

  h1 {
    margin-bottom: 16px;
    font-size: clamp(32px, 11vw, 42px);
    line-height: 1.12;
  }

  .hero-title {
    width: 100%;
    padding: 12px 12px 14px;
    gap: 8px;
  }

  .title-ribbon {
    font-size: 12px;
  }

  .title-main {
    font-size: clamp(31px, 9.8vw, 40px);
  }

  .lead {
    font-size: 15px;
    line-height: 1.75;
  }

  .momo-promo {
    grid-template-columns: minmax(78px, 116px) minmax(0, 1fr);
    gap: 9px;
    text-align: left;
  }

  .momo-promo img {
    max-width: 116px;
    max-height: 34px;
    margin: 0;
  }

  .momo-promo strong {
    font-size: 13px;
  }

  .momo-promo small {
    font-size: 11px;
    line-height: 1.45;
  }

  .hero-promo {
    max-width: 100%;
    padding: 10px;
  }

  .result-header p {
    font-size: 14px;
  }

  .result-header h2 {
    font-size: clamp(25px, 8vw, 32px);
    line-height: 1.24;
    overflow-wrap: anywhere;
  }

  .privacy,
  .input-meta {
    font-size: 12px;
  }

  .input-panel,
  .section-block,
  .share-zone {
    border-width: 2px;
    border-radius: 8px;
    box-shadow: 0 3px 0 #251d42, 0 10px 20px rgba(22, 17, 39, 0.18);
  }

  .input-panel {
    padding: 52px 12px 14px;
  }

  .input-panel::before {
    height: 36px;
    padding: 0 12px;
    border-bottom-width: 2px;
    font-size: 15px;
  }

  textarea {
    min-height: 260px;
    border-width: 2px;
    border-radius: 8px;
    padding: 14px;
    font-size: 15px;
    line-height: 1.7;
  }

  .input-meta,
  .actions {
    grid-template-columns: 1fr;
  }

  .input-meta {
    display: grid;
  }

  .section-block {
    margin-top: 22px;
    padding: 18px 14px;
  }

  .section-block h3 {
    font-size: 21px;
  }

  .match-summary {
    grid-template-columns: 24px minmax(0, 1fr) auto;
    gap: 8px;
    padding: 14px 12px;
  }

  .chevron {
    display: none;
  }

  .details {
    padding: 0 12px 16px;
  }

  .tag-cloud span,
  .share-tags span {
    max-width: 100%;
    white-space: normal;
    line-height: 1.35;
  }

  .trait-row {
    grid-template-columns: 78px minmax(0, 1fr) 40px;
    gap: 10px;
    font-size: 14px;
  }

  .share-zone {
    padding: 14px 10px;
  }

  .share-card {
    padding: 30px 14px 28px;
  }

  .share-top-card {
    padding: 18px 12px 17px;
  }

  .share-top-name {
    font-size: clamp(32px, 10.5vw, 40px);
  }

  .share-top-score {
    font-size: 32px;
  }

  .share-name {
    grid-template-columns: 36px minmax(0, 1fr) 56px;
    gap: 8px;
    padding: 11px 10px;
    font-size: 16px;
  }

  .share-name-rank {
    font-size: 13px;
  }

  .share-name-score {
    font-size: 17px;
  }

  .actions {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

@media (max-width: 430px) {
  h1 {
    font-size: clamp(30px, 10.5vw, 38px);
  }

  .title-main {
    font-size: clamp(29px, 9vw, 36px);
  }

  .momo-promo {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .momo-promo img {
    max-width: 124px;
  }

  .match-summary {
    grid-template-columns: 22px minmax(0, 1fr);
  }

  .mini-score {
    grid-column: 2;
    font-size: 18px;
  }

  .share-title {
    font-size: 19px;
  }

  .share-small,
  .share-label {
    font-size: 13px;
  }

  .share-top-label {
    font-size: 12px;
  }

  .share-top-work,
  .share-name-work {
    font-size: 11px;
  }

  .share-tags {
    gap: 7px;
  }

  .share-tags span {
    padding: 7px 9px;
    font-size: 12px;
  }
}
