* {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

/* Body Anpassungen */
body {
  margin: 0;
  padding: 10px;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #576083 0%, #6b6a6c 100%);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Container Mobile-optimiert */
.container {
  max-width: 100%;
  margin: 0 auto;
  background: white;
  padding: 15px;
  border-radius: 15px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

/* Header kleiner auf Mobile */
h1 {
  font-size: clamp(1.5rem, 5vw, 2.5rem);
  color: #3d404c;
  text-align: center;
  margin: 0 0 5px 0;
}

.subtitle {
  font-size: clamp(0.9rem, 3vw, 1.1rem);
  color: #666;
  text-align: center;
  margin-bottom: 15px;
}

/* Header mit Info Button Mobile */
.header-with-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.header-with-info h1 {
  flex: 1;
  margin: 0;
  text-align: left;
  font-size: clamp(1.3rem, 4.5vw, 2.5rem);
}

.header-with-info img {
  align-items: center;
  width: 30px;
  height: 30px;
}

.info-btn {
  position: static;
  transform: none;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  font-size: 1.1em;
}

.info-btn:hover {
  transform: scale(1.1);
}

/* Game Info Mobile-freundlich */
.game-info {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 15px;
}

.attempts {
  font-size: clamp(0.9rem, 3vw, 1.1rem);
  font-weight: bold;
  color: #3d404c;
  text-align: center;
}

.button-group {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.button-group button {
  flex: 1;
  min-width: 100px;
  padding: 10px 12px;
  font-size: clamp(0.85rem, 2.5vw, 1rem);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s;
  font-weight: 500;
}

/* Input Section Mobile */
.input-section {
  position: relative;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#figureInput {
  width: 100%;
  padding: 12px 15px;
  font-size: 16px; /* Verhindert Auto-Zoom auf iOS */
  border: 2px solid #ddd;
  border-radius: 8px;
  box-sizing: border-box;
  transition: border-color 0.3s;
}

#figureInput:focus {
  outline: none;
  border-color: #3d404c;
}

#submitBtn {
  width: 100%;
  padding: 12px 15px;
  font-size: 16px;
  background: #3d404c;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
  transition: background 0.3s;
  box-sizing: border-box;
}

#submitBtn:hover {
  background: #5568d3;
}

#submitBtn:active {
  transform: scale(0.98);
}

#submitBtn:disabled {
  background: #ccc;
  cursor: not-allowed;
}

/* Suggestions */
.suggestions {
  position: absolute;
  top: calc(100% - 10px); /* Berücksichtigt den Gap */
  left: 0;
  right: 0;
  background: white;
  border: 2px solid #3d404c;
  border-top: none;
  border-radius: 0 0 8px 8px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.suggestion-item {
  padding: 12px 15px;
  cursor: pointer;
  transition: background 0.2s;
  font-size: 16px;
  border-bottom: 1px solid #f0f0f0;
}

.suggestion-item:last-child {
  border-bottom: none;
}

.suggestion-item:hover,
.suggestion-item:active {
  background: #f0f0ff;
}

/* Responsive Anpassung */
@media (max-width: 768px) {
  .input-section {
      gap: 10px;
  }
  
  #figureInput,
  #submitBtn {
      width: 100%;
      box-sizing: border-box;
  }
}

/* Desktop: Input und Button nebeneinander */
@media (min-width: 769px) {
  .input-section {
      flex-direction: row;
      gap: 10px;
  }
  
  #figureInput {
      flex: 1;
  }
  
  #submitBtn {
      width: auto;
      min-width: 120px;
  }
  
  .suggestions {
      top: 100%;
  }
}

/* Guess Cards Mobile */
.guess-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-bottom: 15px;
  padding: 12px;
  background: #f8f9fa;
  border-radius: 10px;
}

.country-name {
  background: #3d404c;
  color: white;
  padding: 10px;
  border-radius: 8px;
  font-weight: bold;
  text-align: center;
  font-size: clamp(0.9rem, 3vw, 1.1rem);
}

.guess-card {
  background: white;
  padding: 12px;
  border-radius: 8px;
  text-align: center;
  transition: transform 0.2s;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.guess-card-label {
  font-size: clamp(0.75rem, 2.5vw, 0.9rem);
  color: white;
  margin-bottom: 5px;
  font-weight: 600;
}

.guess-card-value {
  font-size: clamp(0.85rem, 3vw, 1rem);
  font-weight: bold;
  color: white;
  margin-bottom: 5px;
}

.guess-card-arrow {
  font-size: clamp(1.2rem, 4vw, 1.5rem);
  font-weight: bold;
}

/* Message Mobile */
#message {
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 15px;
  text-align: center;
  font-weight: 500;
  font-size: clamp(0.9rem, 3vw, 1rem);
  line-height: 1.5;
}

/* Hint Box Mobile */
.hint-box {
  background: #fff3cd;
  border: 2px solid #ffc107;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 15px;
  text-align: center;
  font-size: clamp(0.9rem, 3vw, 1rem);
}

/* Legend Mobile */
.legend {
  margin-top: 20px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 10px;
}

.legend h3 {
  font-size: clamp(1rem, 3.5vw, 1.2rem);
  margin-bottom: 10px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: clamp(0.85rem, 2.8vw, 1rem);
}

/* Modal Mobile */
.modal-content {
  margin: 10px;
  padding: 20px;
  max-width: calc(100% - 20px);
  max-height: 90vh;
}

.modal-content h2 {
  font-size: clamp(1.3rem, 4vw, 1.8rem);
}

.info-text h3 {
  font-size: clamp(1rem, 3.5vw, 1.2rem);
}

.info-text p,
.info-text ul li {
  font-size: clamp(0.9rem, 3vw, 1rem);
}

/* Touch-optimierte Buttons */
button {
  min-height: 44px; /* Apple Empfehlung für Touch-Targets */
  touch-action: manipulation;
}

/*Scrollbar Mobile */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: #3d404c;
  border-radius: 10px;
}

/* Tablet Landscape */
@media (min-width: 600px) and (max-width: 1024px) {
  .guess-row {
      grid-template-columns: repeat(2, 1fr);
  }
  
  .country-name {
      grid-column: 1 / -1;
  }
}

/* Desktop */
@media (min-width: 1025px) {
  .container {
      max-width: 900px;
      padding: 30px;
  }
  
  .guess-row {
      grid-template-columns: 200px repeat(4, 1fr);
      gap: 10px;
  }
  
  .country-name {
      grid-column: auto;
  }
  
  .header-with-info h1 {
      text-align: center;
  }

  .header-with-info img {
    align-items: center;
    width: 35px;
    height: 35px;
}
  
  .info-btn {
      position: absolute;
      right: 0;

      font-weight: bold;
      top: 50%;
      transform: translateY(-50%);
      width: 40px;
      height: 40px;
  }
  
  .info-btn:hover {
      transform: translateY(-50%) scale(1.1);
  }
}

/* Landscape Modus auf Smartphones */
@media (max-height: 500px) and (orientation: landscape) {
  .container {
      padding: 10px;
  }
  
  h1 {
      font-size: 1.3rem;
      margin-bottom: 5px;
  }
  
  .subtitle {
      font-size: 0.85rem;
      margin-bottom: 10px;
  }
  
  .modal-content {
      margin: 5px;
      padding: 15px;
      max-height: 95vh;
  }
}

/* Verhindert Text-Selektion beim Doppeltippen */
.guess-card,
.country-name,
button {
  -webkit-user-select: none;
  user-select: none;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}


.container {
  max-width: 900px;
  margin: 0 auto;
  background: white;
  border-radius: 20px;
  padding: 30px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

h1 {
  text-align: center;
  color: #333;
  margin-bottom: 10px;
  font-size: 2.5em;
}

.subtitle {
  text-align: center;
  color: #666;
  margin-bottom: 30px;
  font-size: 1.1em;
}

.game-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 10px;
  flex-wrap: wrap;
  gap: 10px;
}

.attempts {
  font-size: 1.2em;
  font-weight: bold;
  color: #3d404c;
}

.button-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.new-game-btn, .hint-btn, .give-up-btn {
  padding: 10px 20px;
  color: black;
  background-color: white;
  border: solid;
  border-width: 2px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1em;
  font-weight: bold;
  transition: all 0.3s;
}

.new-game-btn {
  border-color: #415ee0;
}

.new-game-btn:hover {
  background: #99a6f1;
}

.hint-btn {
  border-color: #e3b21e;
}

.hint-btn:hover {
  background: #d9c076;
}

.hint-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
  opacity: 0.6;
}

.give-up-btn {
  border-color: #e21e31;
}

.give-up-btn:hover {
  background: #d7848c;
}

.give-up-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
  opacity: 0.6;
}

.hint-box {
  background: #fff3cd;
  border: 2px solid #ffc107;
  border-radius: 10px;
  padding: 15px;
  margin-bottom: 20px;
  font-size: 1.1em;
  animation: slideDown 0.5s ease;
}

@keyframes slideDown {
  from {
      opacity: 0;
      transform: translateY(-20px);
  }
  to {
      opacity: 1;
      transform: translateY(0);
  }
}

.hint-box strong {
  color: #856404;
}

#hintText {
  color: #333;
  font-weight: bold;
}

.input-section {
  position: relative;
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

#figureInput {
  flex: 1;
  padding: 15px;
  font-size: 1.1em;
  border: 2px solid #ddd;
  border-radius: 10px;
  transition: border-color 0.3s;
}

#figureInput:focus {
  outline: none;
  border-color: #3d404c;
}

.suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 70px;
  background: white;
  border: 2px solid #ddd;
  border-top: none;
  border-radius: 0 0 10px 10px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
}

.suggestions.active {
  display: block;
}

.suggestion-item {
  padding: 10px 15px;
  cursor: pointer;
  transition: background 0.2s;
}

.suggestion-item:hover {
  background: #f0f0f0;
}

#submitBtn {
  padding: 15px 30px;
  background: #28a745;
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 1.1em;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.3s;
}

#submitBtn:hover {
  background: #218838;
}

.message {
  text-align: center;
  padding: 15px;
  margin-bottom: 20px;
  border-radius: 10px;
  font-weight: bold;
  font-size: 1.2em;
  display: none;
}

.message.success {
  background: #d4edda;
  color: #155724;
  display: block;
}

.message.fail {
  background: #f8d7da;
  color: #721c24;
  display: block;
}

.message.error {
  background: #f8d7da;
  color: #721c24;
  display: block;
}

.message.info {
  background: #d1ecf1;
  color: #0c5460;
  display: block;
}

.guesses-container {
  margin-top: 30px;
}

.guess-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 15px;
  animation: slideIn 0.5s ease;
}

@keyframes slideIn {
  from {
      opacity: 0;
      transform: translateY(-20px);
  }
  to {
      opacity: 1;
      transform: translateY(0);
  }
}

.guess-card {
  background: white;
  border: 2px solid #ddd;
  border-radius: 10px;
  padding: 15px;
  text-align: center;
  transition: transform 0.3s;
}

.guess-card:hover {
  transform: translateY(-5px);
}

.guess-card.correct {
  background: #28a745;
  color: white;
  border-color: #28a745;
}

.guess-card.close {
  background: #ffc107;
  color: #333;
  border-color: #ffc107;
}

.guess-card.miss {
  background: #dc3545;
  color: white;
  border-color: #dc3545;
}

.guess-card-label {
  font-size: 0.9em;
  font-weight: bold;
  margin-bottom: 5px;
  opacity: 0.8;
}

.guess-card-value {
  font-size: 1.1em;
  font-weight: bold;
  margin-bottom: 5px;
}

.guess-card-arrow {
  font-size: 1.5em;
  font-weight: bold;
}

.country-name {
  grid-column: 1 / -1;
  background: #3d404c;
  color: white;
  padding: 10px;
  border-radius: 10px;
  font-size: 1.2em;
  font-weight: bold;
  text-align: center;
}

.legend {
  margin-top: 30px;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 10px;
}

.legend h3 {
  margin-bottom: 15px;
  color: #333;
}

.legend-item {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
  gap: 10px;
}

.color-box {
  width: 30px;
  height: 30px;
  border-radius: 5px;
  display: inline-block;
}

.color-box.correct {
  background: #28a745;
}

.color-box.close {
  background: #ffc107;
}

.color-box.miss {
  background: #dc3545;
}

.arrow {
  font-size: 1.5em;
  font-weight: bold;
  margin: 0 5px;
}

@media (max-width: 768px) {
  .guess-row {
      grid-template-columns: repeat(2, 1fr);
  }
  
  h1 {
      font-size: 2em;
  }
  
  .game-info {
      flex-direction: column;
      align-items: stretch;
  }
  
  .button-group {
      justify-content: center;
  }
}

/* Header mit Info Button */
.header-with-info {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  margin-bottom: 10px;
}

.info-btn {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  background: white;
  color: black;
  border: none;
  border-radius: 50%;
  width: 45px;
  height: 15px;
  font-size: 20px;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.info-btn:hover {
  background: #adb1b2;
  transform: translateY(-50%) scale(1.1);
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background-color: white;
  margin: 5% auto;
  padding: 30px;
  border-radius: 15px;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  animation: slideDown 0.3s ease;
  position: relative;
}

@keyframes slideDown {
  from {
      transform: translateY(-50px);
      opacity: 0;
  }
  to {
      transform: translateY(0);
      opacity: 1;
  }
}

.close-btn {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.3s;
  line-height: 20px;
}

.close-btn:hover,
.close-btn:focus {
  color: #000;
}

.modal-content h2 {
  color: #3d404c;
  margin-bottom: 20px;
  text-align: center;
}

.info-text h3 {
  color: #333;
  margin-top: 20px;
  margin-bottom: 10px;
  font-size: 1.2em;
}

.info-text p {
  color: #555;
  line-height: 1.6;
  margin-bottom: 15px;
}

.info-text ul {
  list-style: none;
  padding-left: 0;
}

.info-text ul li {
  padding: 8px 0;
  color: #555;
  line-height: 1.6;
}

.color-indicator {
  font-weight: bold;
  font-family: Arial, Helvetica, sans-serif;
  padding: 2px 8px;
  border-radius: 5px;
}

.color-indicator.correct {
  background: #28a745;
  color: white;
}

.color-indicator.close {
  background: #ffc107;
  color: #333;
}

.color-indicator.miss {
  background: #dc3545;
  color: #333;
}



/* Responsive */
@media (max-width: 768px) {
  .modal-content {
      margin: 10% 20px;
      padding: 20px;
  }
  
  .header-with-info {
      flex-direction: column;
      gap: 10px;
  }
  
  .info-btn {
      position: static;
      transform: none;
  }
  
  .info-btn:hover {
      transform: scale(1.1);
  }
}

/* Next Puzzle Countdown */


/* Animation wenn unter 1 Stunde */
.countdown-timer.urgent {
  animation: pulse 2s ease-in-out infinite;
  color: #ffd700;
}

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

/* Mobile Anpassung */
@media (max-width: 768px) {
  .next-puzzle-countdown {
      padding: 12px 15px;
      margin-bottom: 15px;
      text-align: center;
  }
  
  .countdown-label {
      font-size: 0.85rem;
      margin-bottom: 5px;
      text-align: center;
  }
  
  .countdown-timer {
      font-size: 1.5rem;
      letter-spacing: 1px;
  }
}