.psd-app,
.psd-app * {
  box-sizing: border-box;
}

.psd-app {
  --psd-bg: #100b19;
  --psd-card: rgba(31, 23, 47, 0.78);
  --psd-card-strong: rgba(38, 28, 58, 0.92);
  --psd-text: #f5f0ff;
  --psd-muted: #c7b9dc;
  --psd-border: rgba(174, 122, 255, 0.26);
  --psd-purple: #8a4dff;
  --psd-purple-2: #be7cff;
  --psd-gold: #f4cc69;
  --psd-shadow: 0 24px 80px rgba(16, 10, 28, 0.44);
  width: 100%;
  max-width: 100%;
  margin: 24px auto;
  color: var(--psd-text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  line-height: 1.7;
}

.psd-app.psd-layout-card {
  max-width: 520px;
}

.psd-app.psd-layout-post,
.psd-app.psd-layout-wide,
.psd-app.psd-layout-full {
  max-width: 100%;
}

.psd-app.psd-layout-post .psd-screen,
.psd-app.psd-layout-wide .psd-screen,
.psd-app.psd-layout-full .psd-screen {
  max-width: 720px;
  margin-right: auto;
  margin-left: auto;
}

.psd-shell {
  position: relative;
  min-height: 720px;
  overflow: hidden;
  border-radius: 28px;
  background:
    radial-gradient(circle at 50% 0%, rgba(154, 93, 255, 0.28), transparent 36%),
    radial-gradient(circle at 95% 30%, rgba(244, 204, 105, 0.16), transparent 30%),
    linear-gradient(160deg, #090711 0%, #151022 46%, #0b0713 100%);
  box-shadow: var(--psd-shadow);
  border: 1px solid rgba(174, 122, 255, 0.18);
}

.psd-inner {
  position: relative;
  z-index: 2;
  min-height: 720px;
}

.psd-screen {
  min-height: 720px;
  padding: 34px 24px;
  display: flex;
  flex-direction: column;
}

.psd-landing,
.psd-loading {
  align-items: center;
  justify-content: center;
  text-align: center;
}

.psd-question {
  justify-content: flex-start;
}

.psd-stars {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.psd-star {
  position: absolute;
  display: block;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.8);
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.8);
  animation: psdTwinkle 2.8s ease-in-out infinite;
}

@keyframes psdTwinkle {
  0%, 100% { opacity: 0.28; transform: scale(0.75); }
  50% { opacity: 1; transform: scale(1.2); }
}

.psd-hero-gem,
.psd-loader-gem,
.psd-result-gem,
.psd-sub-gem {
  border-radius: 38% 62% 52% 48% / 44% 48% 52% 56%;
  transform: rotate(45deg);
  border: 1px solid rgba(255, 255, 255, 0.28);
}

.psd-hero-gem {
  width: 142px;
  height: 142px;
  margin-bottom: 30px;
  background: linear-gradient(135deg, #7b2fbe 0%, #9b59b6 48%, #f4cc69 100%);
  box-shadow: 0 0 70px rgba(154, 93, 255, 0.48), inset 0 2px 14px rgba(255,255,255,.28);
  animation: psdFloat 4.2s ease-in-out infinite;
}

@keyframes psdFloat {
  0%, 100% { transform: rotate(45deg) translateY(0); }
  50% { transform: rotate(45deg) translateY(-10px); }
}

.psd-kicker {
  margin: 0 0 8px;
  color: var(--psd-gold);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 700;
}

.psd-app h2,
.psd-app h3,
.psd-app h4,
.psd-app p {
  margin-top: 0;
}

.psd-app h2 {
  margin-bottom: 14px;
  color: var(--psd-text);
  font-size: clamp(26px, 5.6vw, 34px);
  line-height: 1.3;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-shadow: 0 0 26px rgba(174, 122, 255, 0.34);
}

.psd-lead {
  max-width: 390px;
  margin: 0 auto 24px;
  color: var(--psd-muted);
  font-size: 15px;
}

.psd-mini-cards {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 6px 0 28px;
}

.psd-mini-cards span,
.psd-chip {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 32px;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(244, 204, 105, 0.2);
  color: #f8e7ad;
  font-size: 12px;
  font-weight: 700;
}

.psd-primary-button,
.psd-secondary-button,
.psd-back,
.psd-option {
  appearance: none;
  border: 0;
  font: inherit;
  cursor: pointer;
}

.psd-primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 54px;
  padding: 13px 18px;
  border-radius: 18px;
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  text-decoration: none;
  background: linear-gradient(135deg, var(--psd-purple) 0%, var(--psd-purple-2) 100%);
  box-shadow: 0 14px 34px rgba(138, 77, 255, 0.34), inset 0 1px 0 rgba(255,255,255,.28);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.psd-primary-button:hover,
.psd-primary-button:focus-visible {
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 18px 42px rgba(138, 77, 255, 0.45), inset 0 1px 0 rgba(255,255,255,.32);
}

.psd-note {
  margin: 18px 0 0;
  color: rgba(199, 185, 220, 0.72);
  font-size: 12px;
}

.psd-question-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 34px;
}

.psd-back {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: #e9dfff;
  font-size: 30px;
  line-height: 1;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--psd-border);
}

.psd-progress-wrap {
  flex: 1;
}

.psd-progress-text {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  color: rgba(199, 185, 220, 0.82);
  font-size: 12px;
  letter-spacing: 0.05em;
}

.psd-progress {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
}

.psd-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--psd-purple), var(--psd-gold));
  transition: width 0.3s ease;
}

.psd-question-main {
  margin-bottom: 26px;
  text-align: center;
}

.psd-emoji {
  margin-bottom: 12px;
  font-size: 44px;
  filter: drop-shadow(0 0 16px rgba(244, 204, 105, 0.46));
}

.psd-options {
  display: grid;
  gap: 12px;
}

.psd-option {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  padding: 15px 14px;
  border-radius: 18px;
  text-align: left;
  color: var(--psd-text);
  background: var(--psd-card);
  border: 1px solid var(--psd-border);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.psd-option:hover,
.psd-option:focus-visible,
.psd-option.is-selected {
  transform: translateY(-1px);
  border-color: rgba(244, 204, 105, 0.56);
  background: rgba(55, 39, 81, 0.96);
}

.psd-option-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: #f8e7ad;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(244, 204, 105, 0.22);
}

.psd-loading {
  padding-left: 28px;
  padding-right: 28px;
}

.psd-loader-gem {
  width: 104px;
  height: 104px;
  margin-bottom: 34px;
  background: linear-gradient(135deg, #7b2fbe 0%, #9b59b6 55%, #f4cc69 100%);
  box-shadow: 0 0 70px rgba(154, 93, 255, 0.48), inset 0 2px 14px rgba(255,255,255,.28);
  animation: psdSpin 1.5s linear infinite;
}

@keyframes psdSpin {
  from { transform: rotate(45deg); }
  to { transform: rotate(405deg); }
}

.psd-loading-dots {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.psd-loading-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--psd-gold);
  animation: psdPulse 1s ease-in-out infinite;
}

.psd-loading-dots span:nth-child(2) { animation-delay: 0.15s; }
.psd-loading-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes psdPulse {
  0%, 100% { opacity: 0.34; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-5px); }
}

.psd-result {
  gap: 18px;
}

.psd-result > h2 {
  text-align: center;
  margin-bottom: 0;
}

.psd-result > .psd-kicker {
  text-align: center;
}

.psd-main-card,
.psd-sub-card {
  position: relative;
  overflow: hidden;
  background: var(--psd-card-strong);
  border: 1px solid var(--psd-border);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.1);
}

.psd-main-card {
  padding: 24px 18px 20px;
  border-radius: 24px;
  text-align: center;
}

.psd-rank {
  position: absolute;
  top: 14px;
  right: 14px;
  padding: 4px 10px;
  border-radius: 999px;
  color: #24170a;
  background: linear-gradient(135deg, #f4cc69, #fff0ad);
  font-size: 12px;
  font-weight: 900;
}

.psd-result-gem {
  width: 98px;
  height: 98px;
  margin: 6px auto 22px;
}

.psd-name-en {
  margin-bottom: 4px;
  color: rgba(199, 185, 220, 0.78);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.psd-main-card h3 {
  margin-bottom: 10px;
  color: #fff;
  font-size: 28px;
  line-height: 1.25;
}

.psd-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
  margin-bottom: 18px;
}

.psd-meaning {
  margin: 0 0 18px;
  color: var(--psd-muted);
  text-align: left;
  font-size: 14px;
}

.psd-detail-list {
  margin: 0 0 18px;
  text-align: left;
}

.psd-detail-list div {
  padding: 12px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.psd-detail-list dt {
  margin-bottom: 4px;
  color: var(--psd-gold);
  font-size: 12px;
  font-weight: 900;
}

.psd-detail-list dd {
  margin: 0;
  color: var(--psd-text);
  font-size: 13px;
}

.psd-two-columns {
  display: grid;
  gap: 12px;
  text-align: left;
}

.psd-two-columns > div {
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.psd-two-columns h4 {
  margin-bottom: 8px;
  color: var(--psd-gold);
  font-size: 13px;
}

.psd-two-columns ul {
  margin: 0;
  padding-left: 1.25em;
  color: var(--psd-muted);
  font-size: 13px;
}

.psd-cta {
  margin-top: 18px;
}

.psd-sub-results h3 {
  margin: 0 0 10px;
  font-size: 16px;
  color: var(--psd-text);
}

.psd-sub-card {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  padding: 13px;
  border-radius: 18px;
}

.psd-sub-rank {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #24170a;
  background: var(--psd-gold);
  font-weight: 900;
  font-size: 12px;
}

.psd-sub-gem {
  width: 40px;
  height: 40px;
}

.psd-sub-card h3 {
  margin: 0 0 2px;
  color: var(--psd-text);
  font-size: 15px;
}

.psd-sub-card p {
  margin: 0;
  color: var(--psd-muted);
  font-size: 12px;
}

.psd-secondary-button {
  width: 100%;
  min-height: 48px;
  padding: 11px 16px;
  border-radius: 16px;
  color: var(--psd-text);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--psd-border);
  font-weight: 800;
  transition: background 0.16s ease, transform 0.16s ease;
}

.psd-secondary-button:hover,
.psd-secondary-button:focus-visible {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

@media (max-width: 520px) {
  .psd-app {
    margin: 18px auto;
  }

  .psd-shell,
  .psd-inner,
  .psd-screen {
    min-height: 680px;
  }

  .psd-shell {
    border-radius: 22px;
  }

  .psd-app.psd-layout-wide .psd-shell,
  .psd-app.psd-layout-full .psd-shell {
    border-radius: 0;
  }

  .psd-screen {
    padding: 28px 18px;
  }

  .psd-mini-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}
