
/* ---------- Google Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Cinzel+Decorative:wght@400;700;900&family=Cinzel:wght@400;500;600;700&family=Crimson+Text:ital,wght@0,400;0,600;1,400&display=swap');

/* ---------- CSS Variables ---------- */
:root {
  /* Magical palette */
  --night-deep: #0b0c1a;
  --night-mid: #12142b;
  --night-soft: #1a1d3d;
  --parchment: #f4ecd8;
  --parchment-dim: #e8dcc0;
  --gold: #d3a625;
  --gold-bright: #f0c75e;
  --gold-glow: rgba(211, 166, 37, 0.35);

  /* House colors */
  --gryffindor-red: #740001;
  --gryffindor-gold: #d3a625;
  --hufflepuff-yellow: #ecb939;
  --hufflepuff-black: #372e29;
  --ravenclaw-blue: #0e1a40;
  --ravenclaw-bronze: #946b2d;
  --slytherin-green: #1a472a;
  --slytherin-silver: #aaaaaa;

  /* Neutrals */
  --ink: #2c2416;
  --ink-light: #4b5563;
  --border-magic: rgba(211, 166, 37, 0.25);
  --border-magic-strong: rgba(211, 166, 37, 0.55);

  /* Layout */
  --radius: 10px;
  --radius-sm: 6px;
  --shadow-soft: 0 2px 12px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 20px rgba(211, 166, 37, 0.15);
}

/* ---------- Base / Reset ---------- */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Crimson Text', Georgia, 'Times New Roman', serif;
  margin: 0;
  padding: 0;
  color: var(--parchment);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
  line-height: 1.7;
  font-size: 17px;

  /* Deep night sky with subtle starfield */
  background-color: var(--night-deep);
  background-image:
    radial-gradient(ellipse at 15% 10%, rgba(211, 166, 37, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 85% 20%, rgba(14, 26, 64, 0.35) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(26, 71, 42, 0.12) 0%, transparent 55%),
    radial-gradient(1px 1px at 10% 15%, rgba(255, 255, 255, 0.7) 50%, transparent 100%),
    radial-gradient(1px 1px at 25% 40%, rgba(255, 255, 255, 0.5) 50%, transparent 100%),
    radial-gradient(1px 1px at 40% 8%, rgba(255, 255, 255, 0.6) 50%, transparent 100%),
    radial-gradient(1px 1px at 60% 25%, rgba(255, 255, 255, 0.4) 50%, transparent 100%),
    radial-gradient(1px 1px at 75% 55%, rgba(255, 255, 255, 0.55) 50%, transparent 100%),
    radial-gradient(1px 1px at 88% 12%, rgba(255, 255, 255, 0.6) 50%, transparent 100%),
    radial-gradient(1px 1px at 5% 65%, rgba(255, 255, 255, 0.45) 50%, transparent 100%),
    radial-gradient(1px 1px at 32% 78%, rgba(255, 255, 255, 0.5) 50%, transparent 100%),
    radial-gradient(1px 1px at 52% 48%, rgba(255, 255, 255, 0.35) 50%, transparent 100%),
    radial-gradient(1px 1px at 68% 72%, rgba(255, 255, 255, 0.5) 50%, transparent 100%),
    radial-gradient(1px 1px at 92% 62%, rgba(255, 255, 255, 0.4) 50%, transparent 100%),
    radial-gradient(1.5px 1.5px at 45% 90%, rgba(240, 199, 94, 0.6) 50%, transparent 100%),
    radial-gradient(1.5px 1.5px at 78% 35%, rgba(240, 199, 94, 0.5) 50%, transparent 100%),
    radial-gradient(1.5px 1.5px at 18% 52%, rgba(240, 199, 94, 0.45) 50%, transparent 100%);
  background-size: 100% 100%, 100% 100%, 100% 100%, 200px 200px, 200px 200px, 200px 200px, 200px 200px, 200px 200px, 200px 200px, 200px 200px, 200px 200px, 200px 200px, 200px 200px, 200px 200px, 200px 200px, 200px 200px;
  background-attachment: fixed;
}

/* ---------- Typography ---------- */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Cinzel Decorative', 'Cinzel', Georgia, serif;
  color: var(--gold-bright);
  letter-spacing: 0.02em;
  line-height: 1.3;
}

h1 {
  font-size: 28px;
  font-weight: 900;
  margin-top: 0;
  margin-bottom: 24px;
  text-align: center;
  text-shadow: 0 0 18px rgba(240, 199, 94, 0.35), 0 2px 4px rgba(0, 0, 0, 0.6);
  position: relative;
  padding-bottom: 16px;
}

h1::after {
  content: '';
  display: block;
  width: 120px;
  height: 2px;
  margin: 14px auto 0;
  background: linear-gradient(90deg, transparent, var(--gold), var(--gold-bright), var(--gold), transparent);
  border-radius: 2px;
  box-shadow: 0 0 10px var(--gold-glow);
}

h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 12px;
  text-shadow: 0 0 12px rgba(240, 199, 94, 0.25);
}

h3 {
  font-size: 18px;
  font-weight: 600;
  margin-top: 20px;
  margin-bottom: 8px;
  color: var(--gold);
}

h4 {
  font-size: 16px;
  font-weight: 600;
  margin-top: 16px;
  margin-bottom: 6px;
  color: var(--gold-bright);
  font-family: 'Cinzel', Georgia, serif;
}

p {
  margin-top: 10px;
  margin-bottom: 15px;
  color: var(--parchment-dim);
}

a {
  color: var(--gold-bright);
  text-decoration: none;
  transition: color 0.3s ease, text-shadow 0.3s ease;
}

a:hover {
  color: #fff;
  text-shadow: 0 0 10px var(--gold-glow);
}

strong {
  color: var(--gold-bright);
  font-weight: 600;
}

/* ---------- Header ---------- */
.header {
  background: linear-gradient(180deg, rgba(11, 12, 26, 0.98) 0%, rgba(18, 20, 43, 0.95) 100%);
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.5), 0 1px 0 var(--border-magic);
  top: 0;
  margin-bottom: 10px;
  position: relative;
  z-index: 100;
  backdrop-filter: blur(8px);
}

.header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), var(--gold-bright), var(--gold), transparent);
  opacity: 0.5;
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  height: 80px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-family: 'Cinzel Decorative', 'Cinzel', Georgia, serif;
  font-size: 22px;
  font-weight: 700;
  text-decoration: none;
  color: var(--gold-bright);
  letter-spacing: 0.04em;
  text-shadow: 0 0 14px rgba(240, 199, 94, 0.35);
  transition: text-shadow 0.3s ease;
}

.logo:hover {
  text-shadow: 0 0 24px rgba(240, 199, 94, 0.6);
  color: #fff;
}

.nav-links {
  display: flex;
  align-items: center;
}

.nav-links a {
  text-decoration: none;
  color: var(--parchment-dim);
  padding: 10px 16px;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 15px;
  letter-spacing: 0.05em;
  transition: color 0.3s ease, text-shadow 0.3s ease;
}

.nav-links a:hover {
  color: var(--gold-bright);
  text-shadow: 0 0 10px var(--gold-glow);
}

/* ---------- Hamburger ---------- */
.hamburger {
  display: none;
  cursor: pointer;
  padding: 10px;
  width: 30px;
  height: 30px;
  position: relative;
  background: none;
  border: none;
  box-shadow: none;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.hamburger:hover,
.hamburger:active,
.hamburger:focus {
  background: none;
  border: none;
  outline: none;
  box-shadow: none;
}

.hamburger-lines {
  display: block;
  width: 20px;
  height: 2px;
  background-color: var(--gold);
  position: relative;
  transition: background-color 0.3s ease;
}

.hamburger-lines::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 2px;
  background-color: var(--gold);
  top: -6px;
  left: 0;
  transition: transform 0.3s ease;
}

.hamburger-lines::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 2px;
  background-color: var(--gold);
  bottom: -6px;
  left: 0;
  transition: transform 0.3s ease;
}

.hamburger.active .hamburger-lines {
  background-color: transparent;
}

.hamburger.active .hamburger-lines::before {
  transform: rotate(45deg);
  top: 0;
}

.hamburger.active .hamburger-lines::after {
  transform: rotate(-45deg);
  bottom: 0;
}

/* ---------- Layout ---------- */
.container {
  display: flex;
  flex-wrap: wrap;
  max-width: 1200px;
  margin: auto;
  padding: 20px;
  width: 100%;
  flex-grow: 1;
  align-items: flex-start;
}

.content {
  flex: 1;
  background: linear-gradient(160deg, rgba(18, 20, 43, 0.92) 0%, rgba(26, 29, 61, 0.88) 100%);
  padding: 32px 36px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft), inset 0 1px 0 rgba(240, 199, 94, 0.08);
  border: 1px solid var(--border-magic);
  position: relative;
  overflow: hidden;
}

.content::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--gryffindor-red), var(--gryffindor-gold), var(--hufflepuff-yellow), var(--ravenclaw-bronze), var(--slytherin-green), var(--slytherin-silver));
  opacity: 0.7;
}

/* ---------- Sidebar ---------- */
.sidebar {
  flex: 0 0 300px;
  background: linear-gradient(160deg, rgba(18, 20, 43, 0.94) 0%, rgba(26, 29, 61, 0.9) 100%);
  color: var(--parchment);
  padding: 22px;
  border-radius: var(--radius);
  margin-left: 30px;
  box-shadow: var(--shadow-soft), inset 0 1px 0 rgba(240, 199, 94, 0.08);
  border: 1px solid var(--border-magic);
  align-self: flex-start;
}

.sidebar h3 {
  margin-top: 0;
  font-size: 18px;
  text-align: center;
  border-bottom: 1px solid var(--border-magic-strong);
  padding-bottom: 12px;
  color: var(--gold-bright);
  font-family: 'Cinzel Decorative', 'Cinzel', Georgia, serif;
  text-shadow: 0 0 12px rgba(240, 199, 94, 0.3);
}

.sidebar ul {
  list-style-type: none;
  padding: 0;
}

.sidebar ul li {
  margin-bottom: 10px;
}

.sidebar ul li a {
  text-decoration: none;
  color: var(--parchment-dim);
  font-weight: 500;
  display: block;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border-left: 3px solid transparent;
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, padding-left 0.3s ease;
}

.sidebar ul li a:hover {
  background-color: rgba(211, 166, 37, 0.08);
  color: var(--gold-bright);
  border-left-color: var(--gold);
  padding-left: 16px;
}

/* ---------- Info section ---------- */
#info {
  margin-top: 40px;
}

#info h2 {
  font-size: 20px;
  margin-bottom: 10px;
  color: var(--gold-bright);
}

#info h3 {
  font-size: 18px;
  margin-top: 18px;
  margin-bottom: 6px;
  color: var(--gold);
}

#info p {
  font-size: 16px;
  margin-top: 10px;
  margin-bottom: 15px;
  color: var(--parchment-dim);
}

#info ol,
#info ul {
  padding-left: 0;
  margin-left: 0;
  list-style-position: inside;
}

#info ol li,
#info ul li {
  padding-left: 0;
  margin-left: 0;
  color: var(--parchment-dim);
  margin-bottom: 10px;
  line-height: 1.65;
}

#info ul li strong {
  color: var(--gold-bright);
}

/* ---------- Editorial note ---------- */
.editorial-note {
  background: rgba(211, 166, 37, 0.06);
  border-left: 3px solid var(--gold);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 14px 18px;
  margin: 20px 0;
  font-size: 14.5px;
  color: var(--parchment-dim);
  line-height: 1.6;
}

.editorial-note strong {
  color: var(--gold-bright);
}

/* ---------- Tables ---------- */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-magic);
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  background: rgba(11, 12, 26, 0.5);
  border: 1px solid var(--border-magic);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

th,
td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid rgba(211, 166, 37, 0.12);
  color: var(--parchment-dim);
}

th {
  background: rgba(211, 166, 37, 0.1);
  font-weight: 700;
  color: var(--gold-bright);
  font-family: 'Cinzel', Georgia, serif;
  font-size: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: rgba(211, 166, 37, 0.04);
}

td strong {
  color: var(--gold-bright);
}

/* ---------- Calculator / Quiz container ---------- */
.calculator-container {
  max-width: 620px;
  margin: 28px auto;
  padding: 28px 26px;
  background: linear-gradient(160deg, rgba(26, 29, 61, 0.85) 0%, rgba(18, 20, 43, 0.9) 100%);
  border-radius: var(--radius);
  border: 1px solid var(--border-magic-strong);
  box-shadow: var(--shadow-soft), 0 0 40px rgba(211, 166, 37, 0.08), inset 0 1px 0 rgba(240, 199, 94, 0.1);
  position: relative;
  overflow: hidden;
}

.calculator-container::before {
  content: '✦';
  position: absolute;
  top: 10px;
  left: 16px;
  font-size: 18px;
  color: var(--gold);
  opacity: 0.5;
}

.calculator-container::after {
  content: '✦';
  position: absolute;
  bottom: 10px;
  right: 16px;
  font-size: 18px;
  color: var(--gold);
  opacity: 0.5;
}

.measurement-input {
  margin-bottom: 20px;
}

.measurement-input label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--parchment);
}

.measurement-input input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-magic);
  border-radius: var(--radius-sm);
  font-size: 16px;
  background: rgba(11, 12, 26, 0.6);
  color: var(--parchment);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.measurement-input input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-glow);
}

.calculator-container input {
  padding: 10px;
  width: 100%;
  max-width: 100%;
  margin-bottom: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-magic);
  font-size: 1em;
  color: var(--parchment);
  background: rgba(11, 12, 26, 0.6);
  transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.calculator-container input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-glow);
}

.result-container {
  margin-top: 20px;
  padding: 20px;
  background: rgba(11, 12, 26, 0.6);
  border-radius: var(--radius-sm);
  text-align: center;
  border: 1px solid var(--border-magic);
}

/* ---------- Buttons ---------- */
.calc-btn {
  display: block;
  margin: 1.5rem auto;
  padding: 0.85rem 2.4rem;
  background: linear-gradient(135deg, var(--gryffindor-red) 0%, #9b1b1e 50%, var(--gryffindor-red) 100%);
  color: var(--parchment);
  border: 1px solid var(--gold);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: all 0.3s ease;
  width: fit-content;
  box-shadow: 0 2px 10px rgba(116, 0, 1, 0.4), inset 0 1px 0 rgba(240, 199, 94, 0.15);
  position: relative;
  overflow: hidden;
}

.calc-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(240, 199, 94, 0.2), transparent);
  transition: left 0.5s ease;
}

.calc-btn:hover {
  background: linear-gradient(135deg, #9b1b1e 0%, var(--gryffindor-red) 50%, #9b1b1e 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(116, 0, 1, 0.5), 0 0 20px var(--gold-glow), inset 0 1px 0 rgba(240, 199, 94, 0.2);
  color: #fff;
}

.calc-btn:hover::before {
  left: 100%;
}

.calc-btn:active {
  transform: translateY(0);
}

.calc-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ---------- Gender selection / Start button ---------- */
.gender-selection {
  margin: 2rem 0;
  text-align: center;
}

.gender-selection h3 {
  font-family: 'Cinzel Decorative', 'Cinzel', Georgia, serif;
  color: var(--gold-bright);
  font-size: 19px;
  margin-bottom: 18px;
  text-shadow: 0 0 14px rgba(240, 199, 94, 0.3);
}

.gender-btn {
  padding: 0.9rem 2rem;
  margin: 0 0.5rem;
  background: linear-gradient(135deg, rgba(26, 29, 61, 0.9) 0%, rgba(18, 20, 43, 0.95) 100%);
  border: 1.5px solid var(--gold);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--gold-bright);
  transition: all 0.3s ease;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.gender-btn:hover {
  background: linear-gradient(135deg, var(--gryffindor-red) 0%, #9b1b1e 100%);
  color: #fff;
  border-color: var(--gold-bright);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(116, 0, 1, 0.4), 0 0 18px var(--gold-glow);
}

.gender-btn.selected {
  background: linear-gradient(135deg, var(--gryffindor-red) 0%, #9b1b1e 100%);
  color: #fff;
  border-color: var(--gold-bright);
  transform: scale(1.04);
  box-shadow: 0 4px 16px rgba(116, 0, 1, 0.5), 0 0 20px var(--gold-glow);
}

/* ---------- Quiz ---------- */
.quiz-container {
  display: none;
  max-width: 800px;
  margin: 0 auto;
}

.question {
  margin: 1.5rem 0;
  padding: 1.5rem;
  background: rgba(11, 12, 26, 0.5);
  border-radius: var(--radius);
  border: 1px solid var(--border-magic);
  box-shadow: var(--shadow-soft);
  animation: fadeIn 0.4s ease-out;
}

.question h3 {
  color: var(--gold-bright);
  margin-bottom: 1rem;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 17px;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  margin-top: 1rem;
}

.option-btn {
  background: rgba(26, 29, 61, 0.7);
  border: 1.5px solid var(--border-magic);
  border-radius: var(--radius-sm);
  padding: 13px 22px;
  font-size: 16px;
  font-family: 'Crimson Text', Georgia, serif;
  color: var(--parchment);
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
}

.option-btn:hover {
  background: rgba(211, 166, 37, 0.1);
  border-color: var(--gold);
  transform: translateY(-1px);
  box-shadow: 0 2px 10px rgba(211, 166, 37, 0.12);
}

.option-btn:active {
  transform: scale(0.98);
}

.option-btn.selected {
  background: linear-gradient(135deg, var(--slytherin-green) 0%, #1e5631 100%);
  color: #fff;
  border-color: var(--slytherin-silver);
  box-shadow: 0 0 16px rgba(26, 71, 42, 0.5);
}

.option-btn.selected:hover {
  background: linear-gradient(135deg, #1e5631 0%, var(--slytherin-green) 100%);
  border-color: var(--parchment);
}

.option {
  padding: 0.8rem 1rem;
  background: rgba(26, 29, 61, 0.7);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.3s ease;
  border-left: 4px solid transparent;
  color: var(--parchment);
}

.option:hover {
  background: rgba(211, 166, 37, 0.08);
  transform: translateX(5px);
}

.option.selected {
  background: linear-gradient(135deg, var(--slytherin-green) 0%, #1e5631 100%);
  color: #fff;
  border-left-color: var(--gold);
  transform: translateX(5px);
}

/* ---------- Progress bar ---------- */
.progress-container {
  width: 100%;
  background: rgba(11, 12, 26, 0.6);
  border-radius: 0.5rem;
  margin: 1rem 0;
  border: 1px solid var(--border-magic);
  overflow: hidden;
}

.progress-bar {
  height: 0.55rem;
  background: linear-gradient(90deg, var(--gryffindor-red), var(--gryffindor-gold), var(--hufflepuff-yellow));
  border-radius: 0.5rem;
  width: 0%;
  transition: width 0.4s ease, background-color 0.3s ease;
  box-shadow: 0 0 12px var(--gold-glow);
}

/* ---------- Result ---------- */
#result {
  display: none;
  padding: 2rem;
  background: linear-gradient(160deg, rgba(26, 29, 61, 0.85) 0%, rgba(18, 20, 43, 0.9) 100%);
  border-radius: var(--radius);
  margin-top: 2rem;
  border: 1px solid var(--border-magic-strong);
  box-shadow: var(--shadow-soft), 0 0 30px rgba(211, 166, 37, 0.1);
  animation: fadeIn 0.6s ease-out;
}

#result h2 {
  text-align: center;
  font-size: 24px;
  color: var(--gold-bright);
  text-shadow: 0 0 18px rgba(240, 199, 94, 0.35);
}

#personality-result {
  color: var(--gold-bright);
  font-family: 'Cinzel Decorative', 'Cinzel', Georgia, serif;
  font-weight: 900;
}

.type-description {
  margin-top: 1.5rem;
  line-height: 1.7;
}

.type-description h3 {
  color: var(--gold);
  margin: 1.2rem 0 0.5rem;
}

.strengths-description {
  color: var(--parchment-dim);
  font-size: 16px;
  line-height: 1.7;
  margin-top: 12px;
}

/* ---------- Likert scale ---------- */
.likert-scale {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 0.5rem;
}

.likert-scale label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem 1rem;
  border: 1.5px solid var(--border-magic);
  border-radius: var(--radius-sm);
  background: rgba(26, 29, 61, 0.6);
  cursor: pointer;
  font-size: 16px;
  color: var(--parchment);
  transition: border-color 0.2s ease, background-color 0.2s ease,
    box-shadow 0.2s ease, transform 0.1s ease;
  user-select: none;
}

/* hide native radio but keep accessible */
.likert-scale input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  margin: 0;
  pointer-events: none;
}

/* custom radio circle */
.likert-scale label::before {
  content: "";
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(211, 166, 37, 0.45);
  border-radius: 50%;
  background: transparent;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.likert-scale label:hover {
  border-color: var(--gold);
  background: rgba(211, 166, 37, 0.08);
  box-shadow: 0 2px 8px rgba(211, 166, 37, 0.12);
}

.likert-scale input[type="radio"]:focus-visible + span,
.likert-scale label:focus-within {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-glow);
}

.likert-scale label:has(input[type="radio"]:checked) {
  border-color: var(--gold);
  background: rgba(211, 166, 37, 0.12);
  box-shadow: 0 2px 10px rgba(211, 166, 37, 0.18);
}

.likert-scale label:has(input[type="radio"]:checked)::before {
  border-color: var(--gold);
  background: var(--gold);
  box-shadow: inset 0 0 0 3px var(--night-mid);
}

.likert-scale label:active {
  transform: scale(0.985);
}

/* Likert option variant (horizontal) */
.likert-option {
  flex: 1;
  padding: 12px 8px;
  text-align: center;
  border: 1px solid var(--border-magic);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.3s ease;
  background: rgba(26, 29, 61, 0.7);
  color: var(--parchment-dim);
  font-size: 14px;
}

.likert-option:hover {
  background: rgba(211, 166, 37, 0.1);
  border-color: var(--gold);
  color: var(--parchment);
}

.likert-option.selected {
  background: linear-gradient(135deg, var(--slytherin-green) 0%, #1e5631 100%);
  color: #fff;
  border-color: var(--gold);
  font-weight: bold;
  transform: scale(1.03);
  box-shadow: 0 2px 10px rgba(26, 71, 42, 0.4);
}

/* ---------- Language selector ---------- */
.language-selector {
  margin-bottom: 20px;
  text-align: center;
}

.language-selector h4 {
  margin-bottom: 10px;
  color: var(--gold-bright);
  font-size: 16px;
  font-family: 'Cinzel', Georgia, serif;
}

.language-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  max-width: 800px;
  margin: 0 auto;
}

.language-links a {
  padding: 5px 12px;
  background: rgba(26, 29, 61, 0.7);
  border: 1px solid var(--border-magic);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--parchment-dim);
  font-size: 14px;
  transition: all 0.3s ease;
}

.language-links a:hover {
  background: rgba(211, 166, 37, 0.12);
  border-color: var(--gold);
  color: var(--gold-bright);
  box-shadow: 0 0 10px var(--gold-glow);
}

/* ---------- MBTI options ---------- */
.mbti-options {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin: 20px 0;
}

.mbti-option {
  padding: 15px 18px;
  border: 2px solid var(--border-magic);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.3s ease;
  background: rgba(26, 29, 61, 0.6);
  color: var(--parchment-dim);
}

.mbti-option:hover {
  border-color: var(--gold);
  background: rgba(211, 166, 37, 0.08);
  color: var(--parchment);
}

.mbti-option.selected {
  background: linear-gradient(135deg, var(--slytherin-green) 0%, #1e5631 100%);
  color: white;
  border-color: var(--gold);
  font-weight: bold;
  transform: scale(1.03);
  box-shadow: 0 2px 12px rgba(26, 71, 42, 0.5);
}

/* ---------- Radio groups ---------- */
.conversion-options {
  display: flex;
  gap: 20px;
  margin: 20px 0;
  justify-content: center;
}

.radio-group {
  position: relative;
  cursor: pointer;
}

.radio-group input[type="radio"] {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}

.radio-group label {
  display: inline-block;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  background: rgba(26, 29, 61, 0.7);
  color: var(--parchment-dim);
  font-weight: 500;
  transition: all 0.3s ease;
  border: 2px solid transparent;
  cursor: pointer;
  user-select: none;
}

.radio-group input[type="radio"]:checked + label {
  background: rgba(211, 166, 37, 0.15);
  color: var(--gold-bright);
  border-color: var(--gold);
  box-shadow: 0 0 12px var(--gold-glow);
}

.radio-group label:hover {
  background: rgba(211, 166, 37, 0.1);
  border-color: var(--border-magic-strong);
}

.radio-group input[type="radio"]:focus + label {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.radio-group input[type="radio"]:active + label {
  transform: scale(0.98);
}

.radio-group input[type="radio"]:disabled + label {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---------- Checkbox ---------- */
.input-group input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  width: 20px;
  height: 20px;
  border: 2px solid var(--gold);
  border-radius: 4px;
  margin-right: 10px;
  cursor: pointer;
  position: relative;
  background: transparent;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.input-group input[type="checkbox"]:checked {
  background: var(--gold);
  border-color: var(--gold);
}

.input-group input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 1px;
  width: 6px;
  height: 12px;
  border: solid var(--night-deep);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* ---------- Product table ---------- */
.product-table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  background: rgba(11, 12, 26, 0.5);
  border: 1px solid var(--border-magic);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.product-table th,
.product-table td {
  padding: 15px;
  text-align: left;
  border-bottom: 1px solid rgba(211, 166, 37, 0.12);
  color: var(--parchment-dim);
}

.product-table th {
  background: rgba(211, 166, 37, 0.1);
  color: var(--gold-bright);
  font-family: 'Cinzel', Georgia, serif;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.product-table-image {
  width: 150px;
  height: 150px;
  object-fit: contain;
  transition: transform 0.2s;
}

.product-table-image:hover {
  transform: scale(1.05);
}

.table-amazon-button {
  display: inline-block;
  padding: 9px 18px;
  background: linear-gradient(135deg, var(--gold) 0%, #b8911f 100%);
  color: var(--night-deep);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  text-align: center;
  font-weight: 700;
  font-size: 14px;
  border: 1px solid var(--gold-bright);
}

.table-amazon-button:hover {
  background: linear-gradient(135deg, var(--gold-bright) 0%, var(--gold) 100%);
  color: var(--night-deep);
  box-shadow: 0 0 14px var(--gold-glow);
  transform: translateY(-1px);
}

.product-title {
  color: var(--parchment);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.1em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
  max-height: 2.8em;
  margin-bottom: 10px;
  text-overflow: ellipsis;
  transition: color 0.3s ease;
}

.product-title:hover {
  color: var(--gold-bright);
  text-shadow: 0 0 8px var(--gold-glow);
}

.number-cell {
  font-weight: bold;
  color: var(--gold);
  width: 50px;
  font-family: 'Cinzel', Georgia, serif;
}

.image-cell {
  width: 170px;
}

.button-cell {
  width: 150px;
}

/* ---------- Calculator cards ---------- */
.calculator-cards {
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.calculator-cards ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.calculator-cards li {
  background: linear-gradient(160deg, rgba(26, 29, 61, 0.8) 0%, rgba(18, 20, 43, 0.85) 100%);
  border-radius: var(--radius);
  border: 1px solid var(--border-magic);
  box-shadow: var(--shadow-soft);
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  overflow: hidden;
}

.calculator-cards li a {
  display: block;
  padding: 20px;
  color: var(--parchment);
  text-decoration: none;
  font-size: 1.1em;
  font-weight: 700;
  font-family: 'Cinzel', Georgia, serif;
  position: relative;
  transition: color 0.3s ease;
}

.calculator-cards li:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 0 20px var(--gold-glow);
  border-color: var(--gold);
}

.calculator-cards li:hover a {
  color: var(--gold-bright);
}

/* ---------- Footer ---------- */
.footer {
  text-align: center;
  padding: 20px;
  background: linear-gradient(0deg, rgba(11, 12, 26, 0.98) 0%, rgba(18, 20, 43, 0.95) 100%);
  border-top: 1px solid var(--border-magic);
  margin-top: 20px;
  position: relative;
}

.footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), var(--gold-bright), var(--gold), transparent);
  opacity: 0.4;
}

.footer p {
  padding: 3px;
  font-size: 0.82em;
  color: var(--ink-light);
  font-family: 'Crimson Text', Georgia, serif;
}

.footer p a {
  color: var(--gold);
  text-decoration: none;
  padding: 10px;
  transition: color 0.3s ease;
}

.footer p a:hover {
  color: var(--gold-bright);
}

/* ---------- Animations ---------- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 12px var(--gold-glow); }
  50% { box-shadow: 0 0 24px rgba(240, 199, 94, 0.4); }
}

/* ---------- Responsive: ≤900px ---------- */
@media (max-width: 900px) {
  .header {
    margin-bottom: 0;
  }

  .logo {
    font-size: 19px;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 60px;
    right: 0;
    background: linear-gradient(160deg, rgba(18, 20, 43, 0.98) 0%, rgba(11, 12, 26, 0.99) 100%);
    width: 220px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--border-magic);
    padding: 20px;
    border-radius: 0 0 var(--radius) var(--radius);
    z-index: 50;
  }

  .nav-links.active {
    display: block;
  }

  .nav-links a {
    display: block;
    padding: 12px 10px;
    color: var(--parchment-dim);
    border-bottom: 1px solid rgba(211, 166, 37, 0.08);
  }

  .nav-links a:last-child {
    border-bottom: none;
  }

  .hamburger {
    display: block;
  }

  .container {
    flex-direction: column;
    padding: 15px;
    margin: 0;
  }

  .sidebar {
    flex: 0 0 auto;
    margin-left: 0;
    margin-top: 20px;
    width: 100%;
    max-width: 100%;
    order: 1;
    padding: 18px;
  }

  .content {
    order: 0;
    margin-bottom: 20px;
    padding: 22px 20px;
    width: 100%;
    max-width: 100%;
  }

  h1 {
    font-size: 22px;
    margin-bottom: 16px;
  }

  .sidebar h3 {
    font-size: 16px;
  }

  #info h2 {
    font-size: 18px;
  }

  #info h3 {
    font-size: 1em;
  }

  label, select, button {
    font-size: 16px;
  }

  select, button {
    padding: 8px;
  }

  #result-name {
    font-size: 28px;
  }

  #common-link h2 {
    font-size: 18px;
  }

  #common-link li {
    flex: 1 0 calc(50% - 10px);
  }
}

/* ---------- Responsive: ≤768px ---------- */
@media (max-width: 768px) {
  .calculator-cards ul {
    grid-template-columns: 1fr;
  }

  .calculator-cards {
    padding: 10px;
  }

  .size-option {
    padding: 8px 15px;
    min-width: 70px;
  }

  .primary-size {
    font-size: 2.5em;
  }

  .product-table thead {
    display: none;
  }

  .product-table,
  .product-table tbody,
  .product-table tr,
  .product-table td {
    display: block;
    width: 100%;
    text-align: center;
  }

  .product-table tr {
    margin-bottom: 30px;
    border: 1px solid var(--border-magic);
    border-radius: var(--radius);
    padding: 15px;
    box-shadow: var(--shadow-soft);
    background: rgba(11, 12, 26, 0.4);
  }

  .product-table td {
    border: none;
    padding: 8px;
  }

  .number-cell {
    font-size: 1.2em;
    color: var(--gold);
    margin-bottom: 10px;
  }

  .image-cell {
    margin: 0 auto;
  }

  .product-table-image {
    width: 200px;
    height: 200px;
    margin: 0 auto;
  }

  .product-title {
    font-size: 1.1em;
    margin: 15px 0;
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
  }

  .button-cell {
    margin-top: 15px;
  }

  .table-amazon-button {
    width: 100%;
    max-width: 200px;
    margin: 0 auto;
    padding: 12px 20px;
  }

  .number-cell::before {
    content: "#";
  }

  .mbti-options {
    flex-direction: column;
  }

  .likert-scale {
    flex-direction: column;
    gap: 8px;
  }

  .likert-option {
    padding: 10px;
  }

  .gender-selection {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  .gender-btn {
    margin: 0;
    width: 100%;
    padding: 1rem;
  }

  .options {
    flex-direction: column;
  }

  .option {
    padding: 1rem;
  }

  .question {
    padding: 1.2rem;
    margin: 1.2rem 0;
  }

  #result {
    padding: 1.5rem;
  }

  .calc-btn {
    width: 100%;
    padding: 1rem;
  }

  .likert-scale label {
    padding: 0.7rem 0.9rem;
    font-size: 15px;
    gap: 0.65rem;
  }
}

/* ---------- Tablet: 769–1024 ---------- */
@media (min-width: 769px) and (max-width: 1024px) {
  .options {
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
  }
}

/* ---------- Small mobile: ≤480px ---------- */
@media (max-width: 480px) {
  .likert-scale label {
    padding: 0.65rem 0.85rem;
    font-size: 14.5px;
    gap: 0.6rem;
  }

  .product-table-image {
    width: 150px;
    height: 150px;
  }

  .product-table tr {
    padding: 10px;
  }

  .product-title {
    font-size: 1em;
    max-width: 250px;
  }

  .calculator-container {
    padding: 20px 16px;
  }

  .content {
    padding: 18px 16px;
  }

  h1 {
    font-size: 20px;
  }
}

/* ---------- Accessibility: reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- Scrollbar (WebKit) ---------- */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: var(--night-deep);
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--gold) 0%, var(--ravenclaw-bronze) 100%);
  border-radius: 5px;
  border: 2px solid var(--night-deep);
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--gold-bright) 0%, var(--gold) 100%);
}

/* ---------- Text selection ---------- */
::selection {
  background: rgba(211, 166, 37, 0.35);
  color: #fff;
}
