:root {
  --primary-bg: #1a0b2e;
  --secondary-bg: #2d1b4e;
  --accent-gold: #c5a059;
  --accent-glow: #ffd700;
  --text-light: #f0f0f0;
  --text-dim: #b8b8b8;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 90px;
}

* {
  box-sizing: border-box;
}

body {
  font-family: "Noto Serif JP", serif;
  background-color: var(--primary-bg);
  color: var(--text-light);
  margin: 0;
  padding: 0;
  line-height: 1.8;
  background-image: radial-gradient(
    circle at 50% 50%,
    #2a1b3d 0%,
    #1a0b2e 100%
  );
}

h2,
h3 {
  font-family: "Cinzel", serif;
  font-weight: 700;
  margin: 0;
}

/* --- Navigation & Logo --- */
.nav-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 30px;
  z-index: 1000;
  background: rgba(26, 11, 46, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(197, 160, 89, 0.2);
}

.logo-link {
  display: block;
  width: 50px;
  height: 50px;
  transition: transform 0.3s;
  cursor: pointer;
  will-change: transform;
}

.logo-link img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 0 5px rgba(197, 160, 89, 0.5));
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 15px;
}

.ppd-logo {
  height: 28px;
  width: auto;
  filter: drop-shadow(0 0 3px rgba(197, 160, 89, 0.3));
}

.logo-link:hover {
  transform: scale(1.1);
}

.main-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 30px;
}

.main-nav a {
  text-decoration: none;
  color: var(--accent-gold);
  font-family: "Cinzel", serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  transition: all 0.3s;
  text-transform: uppercase;
}

.main-nav a:hover {
  color: #fff;
  text-shadow: 0 0 8px var(--accent-gold);
}

/* --- Hero Section --- */
header {
  text-align: center;
  padding: 80px 20px 60px;
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid rgba(197, 160, 89, 0.2);
}

header::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url("../images/Potential_power_K.png");
  background-repeat: repeat;
  background-attachment: fixed;
  background-position: center;
  opacity: 0.3;
  z-index: -1;
}

h1 {
  font-family: "Shippori Mincho", serif;
  font-weight: 700;
  font-size: 2.5rem;
  line-height: 1.2;
  background: linear-gradient(to bottom, #ffffff 30%, #fbbf24 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  will-change: transform;
}

.subtitle {
  font-size: 1.1rem;
  color: var(--text-dim);
  letter-spacing: 0.05em;
  will-change: transform;
}

.english-title {
  font-family: "Cinzel", serif;
  font-size: 0.85rem;
  color: var(--accent-gold);
  letter-spacing: 0.2em;
  opacity: 0.6;
  margin-bottom: 5px;
  text-transform: uppercase;
}

/* --- Logic Explanation Section --- */
.logic-section {
  background: linear-gradient(
    180deg,
    var(--primary-bg) 0%,
    var(--secondary-bg) 100%
  );
  padding: 60px 20px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.logic-section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url("../images/Potential_power_K.png");
  background-repeat: repeat;
  background-attachment: fixed;
  background-position: center;
  opacity: 0.3;
  pointer-events: none;
}

.logic-section > * {
  position: relative;
  z-index: 1;
}

.section-title {
  color: var(--accent-gold);
  font-size: 1.4rem;
  margin-bottom: 40px;
  position: relative;
  display: inline-block;
}

.section-title::after {
  content: "";
  display: block;
  width: 300px;
  height: 2px;
  background: var(--accent-gold);
  margin: 10px auto 0;
}

.logic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 30px;
  max-width: 900px;
  margin: 0 auto;
}

.logic-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(197, 160, 89, 0.2);
  padding: 30px;
  border-radius: 8px;
  transition: transform 0.3s;
}

.logic-card:hover {
  transform: translateY(-5px);
  border-color: var(--accent-gold);
  background: rgba(255, 255, 255, 0.05);
}

.logic-icon {
  font-size: 2.5rem;
  margin-bottom: 15px;
  color: var(--accent-gold);
}

/* --- Form Section --- */
.container {
  max-width: 650px;
  margin: 50px auto;
  padding: 40px;
  background: rgba(20, 10, 30, 0.8);
  border: 1px solid var(--accent-gold);
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
  position: relative;
}

.container::before {
  content: "◆";
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--accent-gold);
  background: var(--primary-bg);
  padding: 0 10px;
}

.form-group {
  margin-bottom: 25px;
}

label {
  display: block;
  margin-bottom: 10px;
  color: var(--accent-gold);
  font-size: 0.95rem;
  letter-spacing: 0.05em;
}

input {
  width: 100%;
  padding: 15px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid #4a3b5e;
  color: white;
  font-family: "Noto Serif JP", serif;
  font-size: 1rem;
  border-radius: 4px;
  transition: border-color 0.3s;
}

input:focus {
  outline: none;
  border-color: var(--accent-gold);
  background: rgba(0, 0, 0, 0.5);
}

button.btn-analyze {
  width: 100%;
  padding: 18px;
  background: linear-gradient(135deg, #967bb6, #d4af37);
  border: none;
  color: #1a0b2e;
  font-family: "Cinzel", serif;
  font-size: 1.2rem;
  font-weight: bold;
  letter-spacing: 0.1em;
  cursor: pointer;
  margin-top: 20px;
  transition: all 0.3s;
}

button.btn-analyze:hover {
  filter: brightness(1.2);
  box-shadow: 0 0 20px rgba(212, 175, 55, 0.4);
}

/* --- Result Section (Customized for Profiling) --- */
#result-section {
  display: none;
  margin-top: 50px;
  padding-top: 30px;
  border-top: 1px solid rgba(197, 160, 89, 0.3);
  text-align: center;
  animation: fadeIn 1s ease;
}

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

.result-label {
  color: var(--text-dim);
  font-size: 0.9rem;
  letter-spacing: 0.2em;
  margin-bottom: 20px;
  font-family: "Cinzel", serif;
}

.result-stars {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  margin-bottom: 30px;
  font-size: 1rem;
  color: #ddd;
}

.star-badge {
  display: inline-block;
  padding: 5px 15px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  background: rgba(0,0,0,0.3);
}

.x-mark {
  color: var(--accent-gold);
  font-size: 1.2rem;
}

/* 傾斜宮のメイン表示 */
.keishaku-display {
  margin-bottom: 40px;
  position: relative;
  display: inline-block;
}

.keishaku-kanji {
  font-family: "Shippori Mincho", serif;
  font-size: 4rem;
  font-weight: 700;
  color: var(--accent-gold);
  text-shadow: 0 0 20px rgba(197, 160, 89, 0.5);
  line-height: 1.1;
}

.keishaku-reading {
  font-family: "Cinzel", serif;
  font-size: 1.2rem;
  color: #fff;
  opacity: 0.8;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: 5px;
}

/* 結果カード */
.result-card {
  text-align: left;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(197, 160, 89, 0.3);
  padding: 30px;
  border-radius: 4px;
  position: relative;
}

.result-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(to bottom, var(--accent-gold), #967bb6);
}

.card-title {
  color: var(--accent-gold);
  font-size: 1.1rem;
  margin: 10px 0 15px;
  text-align: center;
}

.card-text {
  font-size: 0.95rem;
  line-height: 1.8;
  color: #f0f0f0;
  margin-bottom: 20px;
  text-align: justify;
}

.card-list {
  list-style: none;
  padding: 0;
  margin: 0 0 20px;
}

.card-list li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 8px;
  font-size: 0.95rem;
}

.card-list li::before {
  content: "✦";
  position: absolute;
  left: 0;
  color: var(--accent-gold);
  font-size: 0.8rem;
  top: 3px;
}

.separator-line {
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 25px 0;
}

/* Footer & Responsive */
footer {
  text-align: center;
  padding: 40px;
  font-size: 0.8rem;
  color: var(--text-dim);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.sp-only { display: none; }
.pc-only { display: inline; }

@media (max-width: 600px) {
  h1 { font-size: 2rem; }
  .sp-only { display: inline; }
  .pc-only { display: none; }
  .container { padding: 20px; margin: 20px; width: auto; }
  
  .keishaku-kanji { font-size: 3rem; }
  .result-stars { flex-direction: column; gap: 5px; }
  .x-mark { transform: rotate(90deg); }
  
  /* Mobile Nav */
  .nav-bar { padding: 15px; }
  .logo-link { width: 40px; height: 40px; }
  .ppd-logo { height: 20px; }
}