:root {
  --color-bg-top: #f9e7d5;
  --color-bg-bottom: #f6c9b8;
  --color-surface: #fffaf4;
  --color-text: #49322f;
  --color-muted: #765a55;
  --color-primary: #a8443e;
  --color-primary-dark: #7f302f;
  --color-accent: #d98b4e;
  --color-border: #e7b29c;
  --shadow: 0 12px 30px rgb(105 54 45 / 12%);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--color-text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN",
    "Yu Gothic", Meiryo, sans-serif;
  line-height: 1.7;
  background: linear-gradient(160deg, var(--color-bg-top), var(--color-bg-bottom));
}

header,
main,
footer {
  width: min(100% - 32px, 920px);
  margin-inline: auto;
}

header {
  padding: 64px 0 34px;
  text-align: center;
}

.event-logo {
  display: block;
  width: min(100%, 720px);
  height: auto;
  margin: 0 auto 24px;
}

header p {
  margin: 0 0 8px;
  color: var(--color-primary-dark);
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

h1 {
  margin: 0;
  font-size: clamp(2.2rem, 7vw, 4rem);
  line-height: 1.2;
  letter-spacing: 0.08em;
}

main {
  padding: 0 0 36px;
}

.introduction {
  margin-bottom: 42px;
  text-align: center;
}

h2 {
  margin: 0 0 12px;
  font-size: clamp(1.35rem, 4vw, 1.8rem);
}

.introduction p {
  margin: 0;
  color: var(--color-muted);
}

.content-note {
  max-width: 720px;
  margin: -18px auto 34px;
  padding: 14px 18px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  color: var(--color-muted);
  font-size: 0.86rem;
  background: rgb(255 250 244 / 72%);
}

.content-note p {
  margin: 0;
}

.difficulty {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.difficulty > h2 {
  grid-column: 1 / -1;
  margin-bottom: 0;
  text-align: center;
}

.is-hidden {
  display: none !important;
}

.screen-panel {
  max-width: 720px;
  margin-inline: auto;
  padding: clamp(24px, 5vw, 42px);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  background: rgb(255 250 244 / 96%);
  box-shadow: var(--shadow);
}

.question-status {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--color-muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.question-status p {
  margin: 0;
}

.progress-bar {
  height: 8px;
  margin: 10px 0 30px;
  overflow: hidden;
  border-radius: 999px;
  background: #f0d8cc;
}

.progress-bar__value {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--color-accent);
  transition: width 240ms ease;
}

#question-title {
  margin-bottom: 24px;
}

.answer-list {
  display: grid;
  gap: 12px;
}

.answer-button {
  margin: 0;
  border: 2px solid var(--color-border);
  border-radius: 12px;
  color: var(--color-text);
  text-align: left;
  background: var(--color-surface);
  box-shadow: none;
}

.answer-button:hover:not(:disabled) {
  color: #fff;
  border-color: var(--color-primary);
  background: var(--color-primary);
}

.answer-button:disabled {
  cursor: default;
}

.answer-button.is-correct {
  color: #fff;
  border-color: #527b5d;
  background: #527b5d;
}

.answer-button.is-wrong {
  color: #fff;
  border-color: var(--color-primary);
  background: var(--color-primary);
}

.feedback {
  margin-top: 26px;
  padding: 22px;
  border-left: 5px solid var(--color-accent);
  border-radius: 10px;
  background: #fff1e7;
}

.feedback p {
  margin: 0 0 10px;
}

.feedback__judgement {
  color: var(--color-primary-dark);
  font-size: 1.35rem;
  font-weight: 800;
}

.feedback__source {
  color: var(--color-muted);
  font-size: 0.85rem;
}

.feedback button {
  margin-top: 18px;
}

.button-secondary {
  margin-top: 20px;
  color: var(--color-primary-dark);
  border: 2px solid var(--color-primary);
  background: transparent;
  box-shadow: none;
}

.button-secondary:hover {
  color: #fff;
  background: var(--color-primary-dark);
}

.result {
  text-align: center;
}

.result__score {
  margin: 16px 0 0;
  color: var(--color-primary-dark);
  font-size: clamp(1.6rem, 6vw, 2.6rem);
  font-weight: 800;
}

.badge-result {
  max-width: 520px;
  margin: 28px auto 0;
  padding: 24px;
  border: 1px solid var(--color-border);
  border-radius: 16px;
  background: #fff7ef;
}

.badge-maker {
  margin-top: 30px;
  padding-top: 26px;
  border-top: 1px solid var(--color-border);
}

.badge-maker h3 {
  margin: 0 0 8px;
  font-size: 1.15rem;
}

.badge-maker__description {
  margin: 0 0 18px;
  color: var(--color-muted);
  font-size: 0.9rem;
}

.file-button {
  display: block;
  width: 100%;
  padding: 14px 20px;
  border: 2px solid var(--color-primary);
  border-radius: 999px;
  color: var(--color-primary-dark);
  font-weight: 700;
  cursor: pointer;
}

.file-button:hover {
  color: #fff;
  background: var(--color-primary-dark);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.badge-editor {
  margin-top: 22px;
}

.badge-canvas {
  display: block;
  width: min(100%, 420px);
  height: auto;
  margin-inline: auto;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 6px 18px rgb(73 50 47 / 12%);
}

.badge-controls {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 10px 14px;
  align-items: center;
  margin-top: 22px;
  text-align: left;
}

.badge-controls label {
  color: var(--color-muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.badge-controls input[type="range"] {
  width: 100%;
  accent-color: var(--color-primary);
}

.badge-maker__actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 20px;
}

.badge-maker__actions button {
  margin-top: 0;
}

.badge-save-note {
  margin: 14px 0 0;
  color: var(--color-muted);
  font-size: 0.82rem;
}

.badge-save-fallback {
  margin-top: 20px;
  padding: 16px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: #fff;
}

.badge-save-fallback p {
  margin: 0 0 12px;
  color: var(--color-primary-dark);
  font-size: 0.88rem;
  font-weight: 700;
}

.badge-save-fallback img {
  display: block;
  width: min(100%, 420px);
  height: auto;
  margin-inline: auto;
}

.badge-result__heading,
.badge-result__name {
  margin: 0;
  font-weight: 700;
}

.badge-result__image {
  display: block;
  width: min(100%, 220px);
  height: auto;
  margin: 16px auto;
}

.download-button {
  display: block;
  width: 100%;
  margin-top: 18px;
  padding: 14px 20px;
  border-radius: 999px;
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  background: var(--color-primary);
  box-shadow: 0 5px 12px rgb(127 48 47 / 20%);
  transition: transform 160ms ease, background-color 160ms ease;
}

.download-button:hover {
  background: var(--color-primary-dark);
  transform: translateY(-2px);
}

.result__actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 30px;
}

.result-share {
  max-width: 520px;
  margin: 28px auto 0;
  padding: 22px;
  border: 1px solid var(--color-border);
  border-radius: 16px;
  background: rgb(255 250 244 / 82%);
}

.result-share p {
  margin: 12px 0 0;
  color: var(--color-muted);
  font-size: 0.82rem;
}

.x-share-button {
  margin-top: 0;
  color: #fff;
  background: #111;
  box-shadow: 0 5px 12px rgb(0 0 0 / 18%);
}

.x-share-button:hover {
  background: #333;
}

.result__actions button {
  margin-top: 0;
}

.quiz-card {
  display: flex;
  flex-direction: column;
  min-height: 280px;
  padding: 30px;
  border: 1px solid var(--color-border);
  border-radius: 18px;
  background: rgb(255 250 244 / 94%);
  box-shadow: var(--shadow);
}

.quiz-card__label {
  margin: 0;
  color: var(--color-accent);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.quiz-card h3 {
  margin: 4px 0 8px;
  font-size: 1.7rem;
}

.quiz-card > p:not(.quiz-card__label) {
  margin: 0 0 24px;
  color: var(--color-muted);
}

button {
  width: 100%;
  margin-top: auto;
  padding: 14px 20px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  font: inherit;
  font-weight: 700;
  background: var(--color-primary);
  box-shadow: 0 5px 12px rgb(127 48 47 / 20%);
  cursor: pointer;
  transition: transform 160ms ease, background-color 160ms ease;
}

button:hover {
  background: var(--color-primary-dark);
  transform: translateY(-2px);
}

button:focus-visible {
  outline: 3px solid rgb(217 139 78 / 45%);
  outline-offset: 4px;
}

footer {
  padding: 24px 0 36px;
  color: var(--color-muted);
  font-size: 0.85rem;
  text-align: center;
}

footer p {
  margin: 0;
}

@media (max-width: 680px) {
  header {
    padding-top: 44px;
  }

  .event-logo {
    margin-bottom: 18px;
  }

  .difficulty {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .quiz-card {
    min-height: 230px;
    padding: 24px;
  }

  .result__actions {
    grid-template-columns: 1fr;
  }

  .badge-controls,
  .badge-maker__actions {
    grid-template-columns: 1fr;
  }

  .badge-controls {
    gap: 4px;
  }

  .badge-controls input[type="range"] {
    margin-bottom: 10px;
  }
}
