@charset "UTF-8";
/**********************************
  *         Color Scheme          *
  *********************************/
:root {
  --foreground: #FFFFFF;
  --background: #E8EEF2;
  --background-deep: #D5E0E8;
  --surface: #FFFFFF;
  --text: #1F2A32;
  --text-muted: #5C6B75;
  --accent: #1899D6;
  --accent-light: #1CB0F6;
  --accent-deep: #0F7FB5;
  --correct: #58A700;
  --correct-light: #78C800;
  --incorrect: #d61899;
  --option: #4B5560;
  --option-hover: #5C6770;
  --shadow: 0 12px 40px rgba(31, 42, 50, 0.12);
  --shadow-soft: 0 4px 14px rgba(31, 42, 50, 0.08);
  --app-width: min(92vw, 36rem);
  --control-width: 55cqi;
  --progress-size: 48cqi;
  --progress-inner: 36cqi;
  --radius: clamp(14px, 4cqi, 22px);
  --radius-sm: 12px;
  color: var(--text);
  background: radial-gradient(1200px 600px at 10% -10%, #f7fbff 0%, transparent 55%), radial-gradient(900px 500px at 100% 0%, #e3f4ff 0%, transparent 50%), linear-gradient(160deg, var(--background) 0%, var(--background-deep) 100%);
  background-color: var(--background);
  background-attachment: fixed;
  font-family: "din-round", "Segoe UI", system-ui, -apple-system, sans-serif;
}

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

body {
  margin: 0;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/**********************************
  *          Text Styles          *
  *********************************/
h1 {
  font-family: inherit;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-align: center;
  text-transform: capitalize;
  font-size: clamp(1.4rem, 5.5cqi + 0.7rem, 2.35rem);
  line-height: 1.2;
  color: var(--text);
  margin: 0;
  padding-inline: 0.75rem;
  overflow-wrap: anywhere;
}

h4 {
  margin: 0 0 0.55rem;
  font-size: clamp(0.8rem, 2.8cqi, 0.95rem);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: center;
}

/**********************************
  *        app body Styles        *
  *********************************/
#app {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100dvh;
  padding: clamp(0.75rem, 3vw, 2rem);
}

.box {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  width: var(--app-width);
  margin: 0;
  gap: 1rem;
}

@keyframes fade-in {
  0% {
    opacity: 0;
    transform: translateY(8px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}
.fade-in {
  animation: fade-in 0.45s ease-out both;
}

/**********************************
  *     grid-container Styles     *
  *********************************/
.grid-container {
  container-type: inline-size;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
  row-gap: clamp(0.95rem, 5cqi, 1.6rem);
  background-color: var(--surface);
  padding-block: clamp(1.6rem, 10cqi, 3.1rem);
  padding-inline: clamp(1.1rem, 6cqi, 2.2rem);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.7);
  overflow: visible;
  position: relative;
  z-index: 2;
}

/* Keep answer rows a stable height as word length changes */
#word-prompt {
  min-height: 2.7em;
  display: flex;
  align-items: center;
  justify-content: center;
}

/**********************************
  *          Grid areas           *
  *********************************/
/* game component */
#progress-bar {
  grid-row: 1;
}

#word-prompt {
  grid-row: 2;
}

#button-1 {
  grid-row: 3;
}

#button-2 {
  grid-row: 4;
}

#button-3 {
  grid-row: 5;
}

/* language-selection component */
#src-lang-select {
  grid-row: 1;
}

#trg-lang-select {
  grid-row: 2;
}

.dropdown {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  justify-self: center;
  z-index: 1;
}

.dropdown.is-open,
.dropdown:has(.dropdown-content) {
  z-index: 20;
}

.dropdown .selection-button {
  width: var(--control-width);
}

.dropdown-content {
  position: absolute;
  top: calc(100% + 0.4rem);
  left: 50%;
  transform: translateX(-50%);
  width: var(--control-width);
  background-color: var(--surface);
  box-shadow: var(--shadow);
  z-index: 30;
  text-transform: capitalize;
  text-align: center;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(31, 42, 50, 0.08);
  overflow: hidden;
  animation: dropdown-in 0.16s ease-out both;
}

@keyframes dropdown-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}
.dropdown-option {
  appearance: none;
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text);
  padding: 0.75rem 1rem;
  text-decoration: none;
  display: block;
  font-family: inherit;
  font-weight: 600;
  font-size: clamp(0.9rem, 3.2cqi, 1.05rem);
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.dropdown-option:hover,
.dropdown-option:focus-visible {
  background-color: rgba(28, 176, 246, 0.12);
  color: var(--accent-deep);
  outline: none;
}

.dropdown-option + .dropdown-option {
  border-top: 1px solid rgba(31, 42, 50, 0.06);
}

.progress-bar {
  --progress-color: var(--accent);
  --progress-track: #E6EDF2;
  border-radius: 50%;
  width: var(--progress-size);
  aspect-ratio: 1;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  justify-self: center;
  /* conic-gradient avoids the 0%/100% seam of the dual linear-gradient trick */
  background: conic-gradient(from 0deg, var(--progress-color) calc(var(--progress) * 1%), var(--progress-track) 0);
  box-shadow: inset 0 0 0 1px rgba(31, 42, 50, 0.04), var(--shadow-soft);
  transition: filter 0.35s ease;
}

.progress-bar-overlay {
  border-radius: 50%;
  width: var(--progress-inner);
  aspect-ratio: 1;
  height: auto;
  background: var(--surface);
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.progress-bar-overlay h1 {
  font-size: clamp(1.35rem, 6cqi, 2rem);
  color: var(--progress-color);
  letter-spacing: 0.01em;
  padding: 0;
  transition: color 0.35s ease;
}

.selection-button {
  appearance: none;
  background-color: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  box-sizing: border-box;
  color: var(--foreground);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-weight: 700;
  font-size: clamp(0.95rem, 3.5cqi, 1.15rem);
  letter-spacing: 0.03em;
  line-height: 1.25;
  margin: 0;
  outline: none;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 3.15rem;
  padding: 0.75rem 1rem;
  text-align: center;
  text-transform: capitalize;
  touch-action: manipulation;
  transition: filter 0.15s ease, transform 0.1s ease;
  user-select: none;
  -webkit-user-select: none;
  vertical-align: middle;
  white-space: nowrap;
  width: var(--control-width);
  max-width: 100%;
  justify-self: center;
  position: relative;
  /* Depth via shadow so press animation doesn't change layout size */
  box-shadow: 0 4px 0 var(--accent-deep), var(--shadow-soft);
}

.selection-button:focus-visible {
  outline: 3px solid rgba(28, 176, 246, 0.45);
  outline-offset: 3px;
}

.selection-button:hover:not(:disabled) {
  filter: brightness(1.06);
}

.selection-button:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--accent-deep), 0 2px 6px rgba(31, 42, 50, 0.08);
  filter: brightness(0.98);
}

.selection-button:disabled {
  cursor: default;
  opacity: 0.55;
  box-shadow: none;
}

.selection-button-correct {
  background-color: var(--correct);
  box-shadow: 0 4px 0 #458200, var(--shadow-soft);
}

.selection-button-correct:active:not(:disabled) {
  box-shadow: 0 1px 0 #458200, 0 2px 6px rgba(31, 42, 50, 0.08);
}

.selection-button-correct:hover:not(:disabled) {
  filter: brightness(1.05);
}

.option_button {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.7rem 1.25rem;
  font-family: inherit;
  font-size: clamp(0.9rem, 2.5vw, 1.05rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  border-radius: 999px;
  border: 1px solid rgba(31, 42, 50, 0.08);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  position: relative;
  z-index: 1;
  transition: background-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease, color 0.15s ease;
}

.option_button p {
  margin: 0;
}

.option_button:hover {
  background: #F4F8FB;
  color: var(--accent-deep);
  box-shadow: 0 6px 18px rgba(31, 42, 50, 0.1);
}

.option_button:active {
  transform: translateY(1px);
  box-shadow: var(--shadow-soft);
}

.option_button:focus-visible {
  outline: 3px solid rgba(28, 176, 246, 0.45);
  outline-offset: 3px;
}

.confetti {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100dvh;
  margin: 0;
  padding: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 1000;
}

.confetti-piece {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: var(--size);
  height: calc(var(--size) * 1.35);
  margin-left: calc(var(--size) / -2);
  background: var(--color);
  border-radius: 2px;
  opacity: 0;
  /* linear timing so keyframe spacing controls gravity / float */
  animation: confetti-physics var(--duration) linear var(--delay) forwards;
  will-change: transform, opacity;
}

.confetti-piece.is-circle {
  border-radius: 50%;
  height: var(--size);
}

.confetti-piece.is-strip {
  width: calc(var(--size) * 0.45);
  height: calc(var(--size) * 1.8);
  border-radius: 1px;
}

/*
  Launch from bottom-center, arc above the viewport, then a long floaty fall
  with left/right flutter on the way down.
*/
@keyframes confetti-physics {
  0% {
    opacity: 1;
    transform: translate3d(0, 0, 0) rotate(var(--start-rot));
  }
  /* quick launch */
  6% {
    opacity: 1;
    transform: translate3d(calc(var(--dx) * 0.4), calc(var(--apex) * 0.45), 0) rotate(calc(var(--start-rot) + var(--spin) * 0.1));
  }
  /* apex — slightly above top of screen */
  14% {
    opacity: 1;
    transform: translate3d(calc(var(--dx) * 0.88), var(--apex), 0) rotate(calc(var(--start-rot) + var(--spin) * 0.22));
  }
  /* slow start to the fall (float) */
  24% {
    opacity: 1;
    transform: translate3d(calc(var(--dx) * 0.94 + var(--wobble) * var(--flutter) * 0.55), calc(var(--apex) * 0.82), 0) rotate(calc(var(--start-rot) + var(--spin) * 0.34));
  }
  34% {
    opacity: 1;
    transform: translate3d(calc(var(--dx) * 0.98 - var(--wobble) * var(--flutter) * 0.85), calc(var(--apex) * 0.55), 0) rotate(calc(var(--start-rot) + var(--spin) * 0.45));
  }
  44% {
    opacity: 1;
    transform: translate3d(calc(var(--dx) * 1.02 + var(--wobble) * var(--flutter) * 1), calc(var(--apex) * 0.28), 0) rotate(calc(var(--start-rot) + var(--spin) * 0.56));
  }
  54% {
    opacity: 1;
    transform: translate3d(calc(var(--dx) * 1.05 - var(--wobble) * var(--flutter) * 0.9), calc(var(--apex) * 0.02), 0) rotate(calc(var(--start-rot) + var(--spin) * 0.66));
  }
  64% {
    opacity: 1;
    transform: translate3d(calc(var(--dx) * 1.08 + var(--wobble) * var(--flutter) * 0.75), 18vh, 0) rotate(calc(var(--start-rot) + var(--spin) * 0.76));
  }
  74% {
    opacity: 1;
    transform: translate3d(calc(var(--dx) * 1.1 - var(--wobble) * var(--flutter) * 0.95), 40vh, 0) rotate(calc(var(--start-rot) + var(--spin) * 0.84));
  }
  84% {
    opacity: 0.95;
    transform: translate3d(calc(var(--dx) * 1.12 + var(--wobble) * var(--flutter) * 0.7), 65vh, 0) rotate(calc(var(--start-rot) + var(--spin) * 0.92));
  }
  100% {
    opacity: 0;
    transform: translate3d(calc(var(--dx) * 1.15 - var(--wobble) * var(--flutter) * 0.35), 115vh, 0) rotate(calc(var(--start-rot) + var(--spin)));
  }
}
