/* 結構層：只放排版骨架，不放顏色、字型、裝飾（那些在 themes/） */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
}
body {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
#quiz {
  width: 100%;
  max-width: 520px;
  padding: 32px 16px 96px;
  position: relative;
  z-index: 1;
}
h1,
h2,
h3,
p {
  margin: 0;
}

.q-screen {
  display: flex;
  flex-direction: column;
  animation: q-in 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.q-intro,
.q-result {
  text-align: center;
  align-items: center;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  border: 0;
  background: none;
  padding: 0;
}
button:focus-visible {
  outline: 3px solid currentColor;
  outline-offset: 3px;
}

/* 進度 */
.q-progress {
  display: flex;
  align-items: center;
  gap: 12px;
}
.q-progress-track {
  flex: 1;
  overflow: hidden;
}
.q-progress-bar {
  height: 100%;
  width: calc(var(--p, 0) * 100%);
  transition: width 0.45s ease;
}
.q-progress-text {
  flex: none;
  font-variant-numeric: tabular-nums;
}

/* 選項 */
.q-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.q-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  line-height: 1.5;
}
.q-option-key {
  flex: none;
}
.q-back {
  align-self: center;
}

/* 結果 */
.q-card {
  width: 100%;
  text-align: left;
}
.q-result-desc {
  line-height: 1.85;
}
.q-traits {
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.q-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 16px 0 0;
}
.q-meta dt,
.q-meta dd {
  margin: 0;
}
.q-bars {
  width: 100%;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.q-bar-row {
  display: grid;
  grid-template-columns: 6em 1fr 3em;
  align-items: center;
  gap: 10px;
}
.q-bar-track {
  overflow: hidden;
}
.q-bar-fill {
  height: 100%;
  width: calc(var(--p, 0) * 100%);
  transition: width 0.9s 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.q-bar-value {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.q-dims {
  width: 100%;
  text-align: left;
  display: flex;
  flex-direction: column;
}
.q-dim-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.q-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 28px;
}

.q-toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%);
  padding: 10px 18px;
  border-radius: 999px;
  background: #222;
  color: #fff;
  font-size: 14px;
  z-index: 100;
  animation: q-in 0.3s both;
}

.q-sharebox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.45);
}
.q-sharebox-panel {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  background: #fff;
  color: #222;
}
.q-sharebox-text {
  width: 100%;
  font: inherit;
  font-size: 15px;
  line-height: 1.6;
  padding: 10px;
  resize: none;
}

@keyframes q-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
