/* Things around the game: language picker, feedback button and the peek pop-up. */

/* ---------- Language picker + feedback button ---------- */
.lang-picker {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  z-index: 20;
}
.lang-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 6px 14px 6px 10px;
  font: inherit;
  font-weight: 900;
  font-size: 15px;
  color: var(--ink);
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 999px;
  box-shadow: 0 4px 0 var(--ink);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.15s var(--bounce), box-shadow 0.15s, background 0.2s;
}
@media (hover: hover) {
  .lang-button:hover { transform: translateY(-2px) rotate(-1.5deg); box-shadow: 0 6px 0 var(--ink); }
}
.lang-button:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.lang-button:focus-visible { outline: 4px solid var(--cyan); outline-offset: 3px; }
.lang-picker.open .lang-button { background: var(--yellow); transform: rotate(-2deg); }
.lang-globe {
  width: 24px;
  height: 24px;
  flex: none;
  padding: 2px;
  border-radius: 50%;
  background: var(--cyan);
  border: 2px solid var(--ink);
  fill: none;
  stroke: var(--ink);
  stroke-width: 2;
}
.lang-picker.open .lang-globe { animation: spinOnce 0.6s var(--bounce); }
@keyframes spinOnce { from { transform: rotate(-180deg) scale(0.6); } }
.lang-chevron {
  width: 12px;
  height: 8px;
  flex: none;
  fill: none;
  stroke: var(--ink);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.3s var(--bounce);
}
.lang-picker.open .lang-chevron { transform: rotate(180deg); }

.lang-menu {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  min-width: 220px;
  max-width: calc(100vw - 24px);
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--paper);
  border: 4px solid var(--ink);
  border-radius: 20px;
  box-shadow: 0 7px 0 var(--ink);
  transform-origin: calc(100% - 28px) -12px;
  animation: menuPop 0.35s var(--bounce);
  outline: none;
}
.lang-menu:focus-visible { box-shadow: 0 7px 0 var(--ink), 0 0 0 4px var(--cyan); }
/* Little speech-bubble tail pointing at the button. */
.lang-menu::before {
  content: '';
  position: absolute;
  top: -11px;
  right: 22px;
  width: 16px;
  height: 16px;
  background: var(--paper);
  border-left: 4px solid var(--ink);
  border-top: 4px solid var(--ink);
  border-top-left-radius: 4px;
  transform: rotate(45deg);
}
@keyframes menuPop {
  0% { opacity: 0; transform: scale(0.4) rotate(6deg); }
  100% { opacity: 1; transform: none; }
}
.lang-option {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 8px 12px;
  border-radius: 14px;
  color: var(--ink);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  animation: popIn 0.4s var(--bounce) backwards;
  transition: background 0.15s, transform 0.2s var(--bounce);
}
.lang-option:nth-child(1) { animation-delay: 0.04s; }
.lang-option:nth-child(2) { animation-delay: 0.08s; }
.lang-option:nth-child(3) { animation-delay: 0.12s; }
.lang-option:nth-child(4) { animation-delay: 0.16s; }
.lang-option.active { background: #ffe9a8; transform: translateX(-3px) rotate(-0.5deg); }
.lang-option.on { background: var(--yellow); }
.lang-text { display: flex; flex-direction: column; line-height: 1.15; }
.lang-name { font-weight: 900; font-size: 17px; }
.lang-hint { font-size: 12px; font-weight: 800; color: #6b5a8e; }
.lang-check {
  width: 26px;
  height: 26px;
  flex: none;
  padding: 4px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: var(--pink);
  fill: none;
  stroke: #fff;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
  transform: scale(0);
}
.lang-option.on .lang-check { opacity: 1; transform: none; animation: popIn 0.45s var(--bounce) 0.2s backwards; }

/* "Gimme feedback!" button, shown on the home and game over screens. */
.feedback-link {
  font-weight: 900;
  font-size: 16px;
  color: var(--ink);
  text-decoration: none;
  background: var(--cyan);
  border: 3px solid var(--ink);
  border-radius: 999px;
  padding: 10px 20px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  box-shadow: 0 4px 0 var(--ink);
  transform: rotate(-2deg);
  transition: transform 0.15s var(--bounce), box-shadow 0.15s;
  margin-top: 4px;
}
@media (hover: hover) {
  .feedback-link:hover { transform: translateY(-2px) rotate(1deg) scale(1.04); box-shadow: 0 6px 0 var(--ink); }
}
.feedback-link:active { transform: translateY(3px) rotate(-2deg); box-shadow: 0 1px 0 var(--ink); }
.feedback-link:focus-visible { outline: 4px solid var(--yellow); outline-offset: 3px; }
.screen {
  width: 100%;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.center { text-align: center; align-items: center; }
.list { display: flex; flex-direction: column; gap: 12px; width: 100%; }
.actions { display: flex; gap: 12px; justify-content: space-between; align-items: center; flex-wrap: wrap; width: 100%; }
.actions .btn-xl { flex: 1 1 auto; }
.actions.stack { flex-direction: column; align-items: stretch; }

/* ---------- Modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(20, 5, 46, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.25s ease-out;
}
.modal.closing { animation: fadeOut 0.25s ease-in forwards; }
.modal-card {
  width: 100%;
  max-width: 480px;
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  background: var(--paper);
  border: 4px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: 0 8px 0 var(--ink);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: center;
  animation: popIn 0.5s var(--bounce);
}
.modal-card .card { box-shadow: 0 4px 0 var(--ink); text-align: left; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes fadeOut { to { opacity: 0; } }

