html {
  --screen-gap: 12px;
  --garden-scale: 1;
  --garden-width: calc(300px * var(--garden-scale));
  --garden-height: calc(256px * var(--garden-scale));
  --grass-size: calc(128px * var(--garden-scale));
  --flower-size: calc(256px * var(--garden-scale));
  --fauna-size: calc(128px * var(--garden-scale));
  --tree-size: calc(220px * var(--garden-scale));
  height: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100%;
  min-height: 100dvh;
  margin: 0;
  font-family: Arial, sans-serif;
  font-size: 16px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

.app {
  min-height: 100dvh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
}

.card {
  width: min(100%, 332px);
  min-height: calc(100dvh - max(16px, env(safe-area-inset-top)) - max(16px, env(safe-area-inset-bottom)));
  display: flex;
  flex-direction: column;
}

.hidden {
  display: none;
}

.screen {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: var(--screen-gap);
}

.screen.hidden {
  display: none;
}

.start-screen {
  padding-top: 24px;
}

.start-actions {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: auto 0;
}

.start-icon {
  width: min(220px, calc(100% - 96px));
  margin: auto auto 24px;
  display: block;
  object-fit: contain;
}

.start-icon.hidden {
  display: none;
}

.start-garden-card {
  width: min(calc(var(--garden-width) + 24px), calc(100% - 8px));
  margin: auto auto 24px;
  display: flex;
  flex-direction: column;
}

.start-garden-card.hidden {
  display: none;
}

.start-garden-preview {
  margin: 0 auto;
}

.title {
  font-family: "Acme", Arial, sans-serif;
  font-size: 3rem;
  text-align: center;
  margin: 16px 0 0;
}

.word {
  font-family: "Acme", Arial, sans-serif;
  text-align: center;
  margin: 0;
}

.feedback,
.done-title,
.subtitle {
  margin: 0;
  text-align: center;
}

.completion-text {
  width: min(300px, calc(100% - 32px));
  margin: auto auto 0;
  padding-top: clamp(8px, 3vh, 24px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
  color: #1f2937;
}

.completion-prefix,
.completion-suffix {
  line-height: 1.3;
}

.completion-score {
  font-family: "Acme", Arial, sans-serif;
  font-size: clamp(3rem, 14vw, 4.5rem);
  line-height: 1;
  color: inherit;
}

.completion-text.hidden {
  display: none;
}

.answers {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--screen-gap);
  padding: 0 16px;
}

.answers.hidden {
  display: none;
}

.garden {
  position: relative;
  width: min(var(--garden-width), calc(100% - 32px));
  height: var(--garden-height);
  margin: auto auto 0;
  overflow: visible;
}

.garden.quiz-complete {
  width: min(calc(var(--garden-width) + 24px), calc(100% - 8px));
  margin-top: auto;
  border: 2px solid #000000;
  border-radius: 12px;
  overflow: hidden;
}

.perfect-score-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: #1f2937;
  pointer-events: none;
}

.perfect-score-badge.hidden {
  display: none;
}

.perfect-score-title {
  font-family: "Acme", Arial, sans-serif;
  font-size: 1.35rem;
  line-height: 1.05;
}

.perfect-score-date {
  font-size: 0.85rem;
  line-height: 1.2;
}

.garden-message {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: #1f2937;
  z-index: 3;
  pointer-events: none;
}

.garden-message.hidden {
  display: none;
}

.grass-layer {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.grass-blade {
  position: absolute;
  bottom: 0;
  width: var(--grass-size);
  height: var(--grass-size);
  transform-origin: bottom center;
  pointer-events: none;
  mask-repeat: no-repeat;
  mask-position: center bottom;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center bottom;
  -webkit-mask-size: contain;
}

.garden-flower {
  position: absolute;
  bottom: 0;
  width: var(--flower-size);
  height: var(--flower-size);
  pointer-events: none;
  transform: translateX(-50%);
  z-index: 1;
}

.garden-fauna {
  position: absolute;
  width: var(--fauna-size);
  height: var(--fauna-size);
  pointer-events: none;
  transform: translateX(-50%);
  z-index: 1;
}

.garden-tree {
  position: absolute;
  bottom: 0;
  width: var(--tree-size);
  height: var(--tree-size);
  pointer-events: none;
  transform: translateX(-50%);
  z-index: -1;
}

.garden-flower .flower-layer {
  position: absolute;
  inset: 0;
}

.garden-fauna .flower-layer {
  position: absolute;
  inset: 0;
}

.garden-tree .flower-layer {
  position: absolute;
  inset: 0;
}

.flower-layer {
  position: absolute;
  inset: 0;
  background-color: currentColor;
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
}

.quiz-header {
  display: grid;
  grid-template-columns: 56px 1fr 56px;
  align-items: center;
  gap: 12px;
  width: min(300px, calc(100% - 32px));
  margin: 0 auto;
}

.progress-wrap {
  display: flex;
  justify-content: flex-start;
}

.progress-spacer {
  width: 56px;
  height: 56px;
}

.pin-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  padding: 0;
  justify-self: end;
  border: none;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
}

.pin-button.hidden {
  display: none;
}

.pin-icon {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.pin-button.pinned {
  color: #2e9b4b;
}

.progress {
  --progress-angle: 0deg;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background: conic-gradient(#0099cc 0deg var(--progress-angle), #d1d5db var(--progress-angle) 360deg);
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
  position: relative;
  color: #111827;
  z-index: 0;
}

.progress.hidden {
  display: none;
}

.progress::before {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background-color: #ffffff;
  z-index: -1;
}

.start-button {
  display: block;
  width: 180px;
  min-height: 56px;
  margin: 0 auto;
  font-family: "Acme", Arial, sans-serif;
  font-size: 1.3rem;
  background-color: #0099cc;
  color: #ffffff;
  border-radius: 10px;
}

#finish-button {
  margin-top: 8px;
}

.secondary-button {
  background-color: #94a3b8;
}

.answer-button {
  appearance: none;
  -webkit-appearance: none;
  display: block;
  width: min(300px, 100%);
  min-height: 48px;
  padding: 12px 16px;
  box-sizing: border-box;
  font-size: 1rem;
  color: #111827;
  background-color: #f3f4f6;
  border: 1px solid #d1d5db;
  white-space: normal;
  overflow-wrap: break-word;
  border-radius: 10px;
  -webkit-tap-highlight-color: transparent;
}

.answer-button:focus,
.answer-button:active,
.answer-button:focus-visible {
  color: #111827;
  background-color: #f3f4f6;
  border-color: #d1d5db;
  outline: none;
}

.answer-button.correct {
  background-color: #2e9b4b;
  border-color: #2e9b4b;
  color: #ffffff;
}

.answer-button.wrong {
  background-color: #c73a3a;
  border-color: #c73a3a;
  color: #ffffff;
}

.review-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
}

@media (max-height: 820px) {
  html {
    --garden-scale: 0.88;
    --screen-gap: 10px;
  }

  .app {
    padding-top: max(12px, env(safe-area-inset-top));
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }
}

@media (max-height: 720px) {
  html {
    --garden-scale: 0.76;
    --screen-gap: 8px;
  }

  .app {
    padding-top: max(8px, env(safe-area-inset-top));
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }

  .answers {
    padding-left: 12px;
    padding-right: 12px;
  }
}

.review-card {
  position: relative;
  width: min(300px, 100%);
  padding: 12px 16px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  background-color: #f8fafc;
}

.review-delete-button {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 50%;
  background-color: transparent;
  color: #6b7280;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

.review-word {
  margin: 0 0 8px;
  text-align: center;
}

.review-definition {
  margin: 0;
  text-align: center;
}

.review-empty {
  margin: 0;
  text-align: center;
  color: #6b7280;
}
