:root {
  --accent: #0c8599;
  --yes: #8ce99a;
  --yes-ink: #1b5e20;
  --no: #ffa8a8;
  --no-ink: #7a1f1f;
  --close: #ffe066;
  --line: #e9e6ef;
}

body {
  background:
    radial-gradient(circle at 10% 0%, #c5f6fa 0, transparent 40%),
    radial-gradient(circle at 90% 10%, #ffe8cc 0, transparent 40%),
    var(--bg);
}

.logo {
  margin: 0;
}

.logo span {
  background-image: linear-gradient(90deg, #0c8599, #f76707);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.modes {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.segmented {
  display: flex;
  flex: 1;
  gap: 4px;
  min-width: 0;
  margin: 0;
  padding: 4px;
  border: 0;
  border-radius: 14px;
  background: rgb(30 27 46 / 0.06);
}

#difficulty-switch {
  flex: none;
}

.segmented label {
  flex: 1;
}

.segmented input {
  position: absolute;
  opacity: 0;
}

.segmented span {
  display: block;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
  color: var(--muted);
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}

.segmented input:checked + span {
  color: var(--ink);
  background: var(--card);
  box-shadow: 0 2px 8px rgb(30 27 46 / 0.12);
}

.segmented input:focus-visible + span {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 8px 0 12px;
}

.counter {
  display: grid;
  margin: 0;
}

.counter__label {
  font-size: 0.8rem;
  color: var(--muted);
}

.counter__value {
  font-size: 1.6rem;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.give-up {
  padding: 10px 18px;
  border: 0;
  border-radius: 14px;
  font: inherit;
  font-weight: 700;
  color: #c92a2a;
  background: var(--card);
  box-shadow: var(--shadow), inset 0 0 0 1px var(--line);
  cursor: pointer;
  transition: transform 0.1s, opacity 0.2s;
}

.give-up:active {
  transform: scale(0.96);
}

.give-up:disabled {
  opacity: 0.4;
  cursor: default;
}

.give-up:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.search {
  position: relative;
  z-index: 2;
}

.search__icon {
  position: absolute;
  left: 16px;
  top: 50%;
  translate: 0 -50%;
  font-size: 1.1rem;
  pointer-events: none;
}

/* 16px Schrift verhindert, dass Safari beim Antippen hineinzoomt. */
.search__input {
  width: 100%;
  padding: 16px 16px 16px 48px;
  border: 2px solid var(--line);
  border-radius: 16px;
  font: inherit;
  font-size: 1rem;
  font-weight: 500;
  color: var(--ink);
  background: var(--card);
  box-shadow: var(--shadow);
}

.search__input:focus-visible {
  outline: none;
  border-color: var(--accent);
}

.search__input:disabled {
  opacity: 0.6;
}

.suggestions {
  position: absolute;
  inset: calc(100% + 6px) 0 auto;
  margin: 0;
  padding: 6px;
  list-style: none;
  border-radius: 16px;
  background: var(--card);
  box-shadow: 0 16px 40px rgb(30 27 46 / 0.18), 0 0 0 1px var(--line);
}

.suggestion {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  font-weight: 500;
  cursor: pointer;
}

.suggestion:hover,
.suggestion[aria-selected="true"] {
  background: #e3fafc;
}

.suggestion__flag svg {
  display: block;
  width: auto;
  height: 20px;
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgb(0 0 0 / 0.1);
}

.extras {
  margin: 10px 0 0;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  text-align: center;
}

.hint {
  min-height: 1.4em;
  margin: 4px 0;
  color: #c92a2a;
  font-size: 0.9rem;
  font-weight: 500;
  text-align: center;
}

.empty {
  margin-top: 40px;
  text-align: center;
  color: var(--muted);
  line-height: 1.5;
}

.empty__icon {
  margin: 0;
  font-size: 3.4rem;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  50% {
    translate: 0 -6px;
  }
}

.rules {
  margin-top: 24px;
  text-align: left;
}

.rules summary {
  width: fit-content;
  margin: 0 auto;
  padding: 6px 12px;
  font-weight: 700;
  color: var(--accent);
  cursor: pointer;
}

.rules ul {
  display: grid;
  gap: 8px;
  padding-left: 20px;
}

.tag {
  padding: 0 6px;
  border-radius: 6px;
  color: var(--ink);
}

.tag--yes {
  background: var(--yes);
}

.tag--no {
  background: var(--no);
}

.tag--close {
  background: var(--close);
}

.guesses {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.guess {
  padding: 14px;
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  animation: pop-in 0.3s ease-out;
}

.guess--hit {
  box-shadow: var(--shadow), 0 0 0 3px #40c057;
}

.guess__head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.guess__flag svg {
  display: block;
  width: auto;
  height: 28px;
  border-radius: 4px;
  box-shadow: 0 0 0 1px rgb(0 0 0 / 0.1);
}

.guess__name {
  flex: 1;
  margin: 0;
  font-size: 1.15rem;
}

.guess__direction {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  background: #e3fafc;
}

.compass {
  display: inline-block;
  color: var(--accent);
  font-size: 1.05rem;
  line-height: 1;
}

.guess__number {
  font-weight: 700;
  color: var(--muted);
}

.clues {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.clue {
  display: grid;
  align-content: center;
  gap: 2px;
  min-height: 60px;
  padding: 8px 4px;
  border-radius: 12px;
  text-align: center;
  animation: flip-in 0.4s ease-out both;
  animation-delay: calc(var(--i) * 70ms);
}

@keyframes flip-in {
  from {
    opacity: 0;
    transform: rotateX(80deg);
  }
}

.clue__label {
  font-size: 0.72rem;
  font-weight: 500;
  opacity: 0.8;
}

.clue__value {
  font-size: 0.95rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  hyphens: auto;
  overflow-wrap: anywhere;
}

.clue--yes {
  color: var(--yes-ink);
  background: var(--yes);
}

.clue--no {
  color: var(--no-ink);
  background: var(--no);
}

.clue--number {
  box-shadow: inset 0 0 0 1px var(--line);
}

.clue--number.clue--yes {
  box-shadow: none;
}

.clue--close {
  background: var(--close);
  box-shadow: none;
}

.clue__arrow {
  display: inline-block;
  color: var(--accent);
  animation: nudge 1.4s ease-in-out 0.6s 2;
}

@keyframes nudge {
  50% {
    translate: 0 -2px;
  }
}

.end {
  margin: 4px 0 16px;
  text-align: center;
  animation: pop-in 0.3s ease-out;
  box-shadow: var(--shadow), 0 0 0 3px #40c057;
}

.end--lost {
  box-shadow: var(--shadow), 0 0 0 3px #ffa8a8;
}

.end__title {
  margin: 0;
  font-size: 1.2rem;
}

.end__flag {
  display: flex;
  justify-content: center;
  margin-top: 16px;
}

.end__flag svg {
  display: block;
  width: auto;
  max-width: 100%;
  height: 90px;
  border-radius: 6px;
  box-shadow: 0 0 0 1px rgb(0 0 0 / 0.08), 0 4px 12px rgb(0 0 0 / 0.12);
}

.end__name {
  margin: 10px 0 0;
  font-size: 1.5rem;
  font-weight: 700;
}

.end__stats {
  margin: 6px 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.end__next {
  margin: 10px 0 0;
  font-weight: 500;
}

.end .btn {
  margin-top: 18px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
  }
}

@media (max-width: 380px) {
  .segmented span {
    padding: 8px 6px;
    font-size: 0.8rem;
  }
}
