/* =========================
   BASE / LAYOUT
========================= */
html:lang(ja) {
  font-family: "Noto Sans JP", "Hiragino Sans", sans-serif;
}

html:lang(en) {
  font-family: "Inter", system-ui, sans-serif;
}

body {
  padding: 0 2rem 1rem;
}

#container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

/* =========================
   TYPOGRAPHY
========================= */
p {
  margin: 0 0 8px;
  font-size: 1.15rem;
}

h1 {
  font-weight: 500;
  color: #5c3f98;
  padding: 1rem;
}

/* =========================
   DESCRIPTION BOX
========================= */
#description {
  width: 100%;
  max-width: 900px;
  padding: 1.5rem;
  color: #3d3d3d;
  border-radius: 10px;
  text-decoration: none;
  z-index: 0;
  background: linear-gradient(to bottom, #dbd2ec, #f3f0f9);
  max-height: 250px;
  overflow-y: scroll;
  box-sizing: border-box;
}

#description p {
  line-height: 1.8;
  margin-bottom: 1.5rem;
}

strong {
  color: #5a4fcf;
  font-weight: 600;
}

#note {
  padding-top: 1.5rem;
  max-width: 900px;
}

#logo {
  width: 4rem;
  height: 4rem;
}

#header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

/* =========================
   QUIZ LAYOUT
========================= */
#quiz {
  display: flex;
  flex-direction: column;
  width: 100%;
  gap: 2rem;
  justify-content: center;
  align-items: center;
  padding: 0rem 0.5rem;
  margin-top: 2rem;
}

#quizForm {
  width: 100%;
  max-width: 500px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 2rem;
}

/* (legacy / si aún lo usas en alguna parte) */
.question {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.question-top {
  width: 100%;
}

.question-label {
  font-weight: 400;
  margin: 0 0 8px;
  display: block;
  min-height: 7rem;
}

/* =========================
   NAV BUTTONS
========================= */
.nav {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

button {
  background-color: #f5effd;
  border: 1px solid #e3d4f9;
  color: #5c3f98;
  cursor: pointer;
  border-radius: 8px;
  transition: 0.3s;
  font-size: 1.1rem;
  padding: 0.8rem 1.5rem;
}

button:disabled {
  background-color: #e5e7f2;
  color: #a0a3b8;
  cursor: not-allowed;
  opacity: 0.7;
  box-shadow: none;
}

/* =========================
   QUESTION CARD
========================= */
.question-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  padding: 1rem 2rem;
  max-width: 700px;
  border-radius: 1rem;
  background: linear-gradient(to bottom, #dbd2ec, #f3f0f9);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.question-count {
  font-size: 0.9rem;
  opacity: 0.75;
  margin-bottom: 0.5rem;
  margin-top: 1rem;
}

/* =========================
   ANSWER OPTIONS (PANE)
========================= */
.pane {
  display: flex;
  justify-content: space-between;
  background-color: #f5edff;
  border: 2px solid #876ac1;
  border-radius: 8px;
  padding: 0.25rem;
  width: 400px;
  margin: 1rem 0;
  gap: 8px;
}

.option {
  flex: 1;
  text-align: center;
  position: relative;
  cursor: pointer;
  font-weight: 600;
  color: #5c3f98;
}

/* 
  IMPORTANT (bug fix):
  Antes tenías pointer-events: none; y eso puede impedir que el radio reciba el click
  o que dispare el change correctamente (según navegador / móvil).
  Este bloque lo deja invisible pero clickeable ocupando todo el label.
*/
.option input[type="radio"] {
  position: absolute;
  inset: 0; /* cubre todo el label */
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  pointer-events: auto;
}

.option input[type="radio"]:focus + span {
  outline: 2px solid #ab97d3;
  outline-offset: 2px;
}

.option span {
  display: block;
  padding: 0.5rem 0;
  transition: all 0.3s ease;
  border-radius: 6px;
}

/* Style for when option is selected */
.option input[type="radio"]:checked + span {
  background-color: #876ac1;
  color: white;
}

/*
Source - https://stackoverflow.com/a/10100209
Posted by NoviceCoding, modified by community. See post 'Timeline' for change history
Retrieved 2026-05-11, License - CC BY-SA 4.0
*/

::-webkit-scrollbar {
  -webkit-appearance: none;
  width: 7px;
}

::-webkit-scrollbar-thumb {
  border-radius: 4px;
  background-color: #876ac1;
  box-shadow: 0 0 1px rgba(255, 255, 255, 0.5);
}

/* =========================
   CHART / CANVAS
========================= */
.canvas-wrapper {
  width: 100%;
  max-width: 500px;
  aspect-ratio: 1 / 1;
  margin: auto;
}

canvas {
  width: 100% !important;
  height: 100% !important;
}

#results {
  margin-top: 4rem;
}

/* Responsive */
@media (max-width: 600px) {
  body {
    padding: 1rem;
  }

  #note {
    width: 80%;
    max-width: 80%;
  }

  .question-card {
    width: 80%;
    padding: 1rem 2rem;
    max-width: 80%;
  }

  .pane {
    width: 80%;
  }

  h1 {
    font-size: 1.25rem;
  }
}

@media (hover: hover) {
  button:hover {
    background-color: #5c3f98;
    box-shadow: 0 0 0 2px #7f58cd;
    color: #fff;
  }

  .option:hover span {
    background-color: #e3d4f9;
    color: #5c3f98;
  }

  /* Prevent hover effect when disabled */
  button:disabled:hover {
    background-color: #e5e7f2;
    color: #a0a3b8;
    box-shadow: none;
  }
}
