:root {
  color-scheme: light;
  font-family: "Arial Rounded MT Bold", "Hiragino Maru Gothic ProN", "Hiragino Kaku Gothic ProN", system-ui, sans-serif;
  background: #fff7d9;
  color: #252039;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  min-height: 100dvh;
  background:
    radial-gradient(circle at 12% 8%, #ffe59c 0 4px, transparent 5px),
    radial-gradient(circle at 86% 15%, #bdeee5 0 6px, transparent 7px),
    #fff7d9;
}

button {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  min-height: 100dvh;
  max-width: 720px;
  margin: 0 auto;
  padding: max(24px, env(safe-area-inset-top)) 20px max(22px, env(safe-area-inset-bottom));
}

h1 {
  margin: 0;
  color: #ff6d45;
  font-size: clamp(1.5rem, 7vw, 2.1rem);
  letter-spacing: 0.03em;
  text-align: center;
}

.instruction {
  margin: 11px 0 14px;
  color: #574b68;
  font-size: clamp(0.92rem, 3.9vw, 1.05rem);
  font-weight: 700;
  line-height: 1.45;
  text-align: center;
}

.card-area {
  display: grid;
  place-items: center;
  min-height: 0;
  padding: 4px 0 18px;
}

.flashcard {
  position: relative;
  display: block;
  width: min(100%, 460px);
  aspect-ratio: 0.92;
  padding: 0;
  border: 0;
  border-radius: 28px;
  background: transparent;
  cursor: pointer;
  perspective: 1000px;
  -webkit-tap-highlight-color: transparent;
}

.flashcard:focus-visible {
  outline: 5px solid #4d72d8;
  outline-offset: 5px;
}

.card-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 5px solid #252039;
  border-radius: 28px;
  background: #ffffff;
  box-shadow: 0 10px 0 #e6c970;
  backface-visibility: hidden;
  transition: transform 360ms ease;
}

.card-front {
  padding: 24px;
}

.card-back {
  transform: rotateY(180deg);
}

.flashcard.is-flipped .card-front {
  transform: rotateY(-180deg);
}

.flashcard.is-flipped .card-back {
  transform: rotateY(0deg);
}

.word {
  max-width: 100%;
  overflow-wrap: anywhere;
  color: #3455bd;
  font-family: "Arial Rounded MT Bold", "Avenir Next", system-ui, sans-serif;
  font-size: clamp(3rem, 18vw, 6rem);
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1;
}

.card-back img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 12px;
}

.controls {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr;
  gap: 9px;
  padding-top: 8px;
}

.control-button {
  min-height: 56px;
  border: 3px solid #252039;
  border-radius: 16px;
  background: #ffffff;
  color: #252039;
  cursor: pointer;
  font-size: clamp(0.84rem, 4vw, 1rem);
  font-weight: 800;
  transition: transform 140ms ease, box-shadow 140ms ease;
  box-shadow: 0 4px 0 #c8b677;
  -webkit-tap-highlight-color: transparent;
}

.shuffle-button {
  background: #9de4d7;
}

.control-button:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #c8b677;
}

.control-button:focus-visible {
  outline: 4px solid #4d72d8;
  outline-offset: 2px;
}

@media (min-width: 600px) {
  .app-shell {
    padding-inline: 34px;
  }

  .flashcard {
    max-height: 62dvh;
  }
}

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