:root {
  --deep-blue: #203D56;
  --light-blue: #4E677C;
  --yellow: #cab984;
  --card-box-shadow:
    0 5px 10px rgba(0, 0, 0, 0.15),
    0 0 0 4px rgba(255, 255, 255, 0.9),
    0 0 8px rgba(255, 255, 255, 0.3);
}

input,
button {
  font-size: 16px;
}

body {
  font-family: 'Segoe UI', sans-serif;
  height: 100dvh;
  background: url('assets/bg-squiggle-r.jpg') repeat;
  background-size: 550px 550px;
  background-color: #eace7d;
  padding: env(safe-area-inset-top, 0) 20px env(safe-area-inset-bottom, 0);
  display: flex;
  flex-direction: column;
  align-items: center;
  letter-spacing: -0.02em;
}

h1 {
  color: var(--deep-blue);
  text-transform: uppercase;
  font-size: 1.6em;
}

.lang-toggle-wrapper {
  width: 100%;
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
}

#lang-toggle {
  background-color: #fff;
  border: none;
  border-radius: 16px;
  padding: 6px 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  color: var(--deep-blue);
  margin-bottom: 20px;
}

.content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 50px;
  width: 100%;
  padding-bottom: 20px;
}

#card-container {
  position: relative;
  width: 100%;
  max-width: 360px;
  height: 425px;
  margin: 0 auto;
}

.card-stack {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
}

.card {
  background: #fff;
  border-radius: 30px;
  box-shadow: var(--card-box-shadow);
  width: 100%;
  min-height: 450px;
  padding: 40px;
  box-sizing: border-box;
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  text-align: center;
  transform-origin: center center;
  transition: transform 0.6s cubic-bezier(.8, .2, .1, 0.8), opacity 0.6s ease;
  pointer-events: none;
}

.card--current {
  z-index: 10;
  opacity: 1;
  background: #fff;
  transform: rotate(0deg) translateX(0%) scale(1);
  transition: transform 0.6s ease, opacity 0.6s ease;
  pointer-events: auto;
}

.card--out {
  animation: card-out 0.6s cubic-bezier(.8, .2, .1, 0.8) forwards;
  z-index: 1;
  background: #fff;
}

.card--in {
  animation: card-in 0.6s cubic-bezier(.8, .2, .1, 0.8) forwards;
  z-index: 10;
  background: #fff;
}

.card--stack {
  background: #fff;
  opacity: 0.9;
  pointer-events: none;
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
}

.card--stack:nth-child(1) {
  transform: rotate(-2deg) translateY(8px);
  z-index: 2;
}

.card--stack:nth-child(2) {
  transform: rotate(2deg) translateY(12px);
  z-index: 1;
}

@keyframes card-out {
  0% { z-index: 20; transform: translateX(0px) rotate(0deg); opacity: 1; }
  10% { z-index: 20; opacity: 1; }
  50% { z-index: 0; transform: translateX(-520px) rotate(-50deg) translateY(-50px); opacity: 1; }
  100% { z-index: 0; transform: translateX(0px) rotate(0deg) translateY(0px) scale(0.95); opacity: 1; }
}

@keyframes card-in {
  0% { z-index: 0; transform: translateX(0px) rotate(0deg) translateY(0px) scale(0.95); opacity: 1; }
  50% { z-index: 0; transform: translateX(-520px) rotate(-50deg) translateY(-50px); opacity: 1; }
  90% { z-index: 20; opacity: 1; }
  100% { z-index: 20; transform: translateX(0px) rotate(0deg); opacity: 1; }
}

.group {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 20px;
}

.difficulty {
  font-size: 12px;
  font-weight: 600;
  position: absolute;
  top: 24px;
  left: 24px;
  color: var(--light-blue);
  display: flex;
  align-items: center;
  gap: 6px;
}

.difficulty a {
  color: inherit;
  text-decoration: none;
  position: relative;
  font-weight: bold;
}

.difficulty a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 1px;
  background-color: currentColor;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.dot.green {background-color: #3bb65c; border: 3px solid #c3ffd3;}
.dot.orange {background-color: #f4a100; border: 3px solid #ffefce;}
.dot.red {background-color: #e03e3e; border: 3px solid #ffd1d1;}

@keyframes pulse {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.dot.red {
  background-color: #e03e3e;
  border: 3px solid #ffd1d1;
  animation: pulse .5s infinite;
}

.card .card-number {
  color: var(--deep-blue);
  font-size: 16px;
  font-weight: 600;
}

.card .category {
  font-size: 18px;
  color: var(--yellow);
}

.card .question {
  color: var(--deep-blue);
  font-size: 22px;
  font-weight: 600;
}

.reveal-button {
  background-color: #f5e8c3;
  border: 2px solid #e1d3ad;
  box-shadow: 0 0px 10px #ffffffcc;
  border-radius: 16px;
  padding: 6px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  color: var(--deep-blue);
  position: absolute;
  bottom: 45px;
  z-index: 10;
}

.reveal-button:hover {
  background-color: #fff8e3;
  border: 2px solid #e1d3ad;
}

.card .answer {
  font-size: 16px;
  font-weight: 600;
  color: var(--deep-blue);
  padding: 0 10px;
  transition: filter 0.4s ease;
  display: block;
}

.answer a {
  text-decoration: underline;
  text-underline-offset: 4px;
  color: var(--light-blue);
  pointer-events: none;
  display: inline-block;
  font-size: 14px;
  font-weight: 400;
  font-style: italic;
  margin-top: 4px;
}

.answer.blurred {
  filter: blur(8px);
  overflow: visible;
  display: block;
}

.answer:not(.blurred) a {
  pointer-events: auto;
}

.answer-line {
  font-size: 16px;
  font-weight: 600;
  color: var(--deep-blue);
}

.reference-line {
  margin-top: 2px;
  font-size: 14px;
  font-style: italic;
  color: var(--light-blue);
}

.reference-line a {
  text-decoration: underline;
  text-underline-offset: 4px;
  color: var(--light-blue);
  pointer-events: none;
  display: inline-block;
  margin-right: 4px;
  font-weight: 400;
  line-height: 1.35em;
}

.answer:not(.blurred) .reference-line a {
  pointer-events: auto;
}


.card .language {
  display: none;
}

#controls {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 0;
}

#controls button {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background-color: #fff;
  box-shadow: var(--card-box-shadow);
  border: none;
  font-size: 24px;
  color: var(--deep-blue);
  margin: 0 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

#controls button:hover:not(:disabled) {
  background-color: #f0f0f0;
}

#controls button:disabled {
  opacity: 0.4;
  cursor: default;
}

.oops {
  font-size: 28px;
  margin-bottom: 20px;
  color: var(--yellow);
}
.error {
  background: #fff;
  font-size: 20px;
  color: var(--deep-blue);
  font-weight: 600;
  border-radius: 30px;
  box-shadow: var(--card-box-shadow);
  width: 100%;
  min-height: 450px;
  padding: 40px;
  box-sizing: border-box;
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  transform-origin: center center;
}


/* iPhone Plus (e.g. 414px and up) */
@media (min-width: 414px) {
  #card-container {
    height: 520px;
  }

  .content {
    gap: 30px;
  }

  .card, .error {
    min-height: 525px;
  }

  .card .card-number {
    font-size: 18px;
  }

  .card .category {
    font-size: 20px;
  }

  .card .question {
    font-size: 28px;
  }
}

/* Larger than Plus (e.g. tablets, desktops) */
@media (min-width: 600px) {

}