/* Isolierter Container für Shopify-Kompatibilität */
.escape-game-wrapper {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: linear-gradient(135deg, #fff9f1 0%, #fde8e4 100%);
  padding: 20px;
  min-height: 100vh;
  position: relative;
  isolation: isolate;
}

/* Reset für alle Elemente innerhalb des Wrappers */
.escape-game-wrapper * {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Container - Responsive */
.escape-game-wrapper .container {
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
  background: white;
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(237, 78, 57, 0.1);
  overflow: hidden;
}

/* Header - Responsive */
.escape-game-wrapper .header {
  background: linear-gradient(135deg, #ed4e39 0%, #ff7262 100%);
  color: white;
  padding: clamp(20px, 5vw, 30px);
  text-align: center;
}

.escape-game-wrapper .header h1 {
  font-size: clamp(1.8rem, 5vw, 2.5rem);
  margin-bottom: 10px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
  line-height: 1.2;
}

.escape-game-wrapper .header p {
  font-size: clamp(0.95rem, 2.5vw, 1.1rem);
  opacity: 0.95;
  line-height: 1.4;
}

/* Content Area - Responsive */
.escape-game-wrapper .content {
  padding: clamp(20px, 4vw, 30px);
}

/* Messages - Responsive */
.escape-game-wrapper .success-message,
.escape-game-wrapper .error-message {
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 20px;
  display: none;
  animation: slideDown 0.5s ease;
  font-size: clamp(0.9rem, 2vw, 1rem);
  line-height: 1.5;
}

.escape-game-wrapper .success-message.show,
.escape-game-wrapper .success-message.active {
  display: block;
  background: linear-gradient(135deg, #4caf50, #66bb6a);
  color: white;
  box-shadow: 0 4px 6px rgba(76, 175, 80, 0.2);
}

.escape-game-wrapper .error-message.show,
.escape-game-wrapper .error-message.active {
  display: block;
  background: linear-gradient(135deg, #f44336, #ef5350);
  color: white;
  box-shadow: 0 4px 6px rgba(244, 67, 54, 0.2);
}

/* Code Section - Responsive */
.escape-game-wrapper .code-section {
  background: #fff9f1;
  border-radius: 10px;
  padding: clamp(20px, 4vw, 25px);
  margin-bottom: 30px;
  border: 2px solid #fde8e4;
}

.escape-game-wrapper .code-section h2 {
  color: #ed4e39;
  margin-bottom: 15px;
  font-size: clamp(1.3rem, 3vw, 1.5rem);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Form Description */
.escape-game-wrapper .form-description {
  margin-bottom: 20px;
  color: #666;
  font-size: clamp(0.9rem, 2vw, 0.95rem);
  line-height: 1.4;
}

/* Form Elements - Touch-friendly & Responsive */
.escape-game-wrapper .form-group {
  margin-bottom: clamp(15px, 3vw, 20px);
}

.escape-game-wrapper label {
  display: block;
  margin-bottom: 8px;
  color: #333;
  font-weight: 500;
  font-size: clamp(0.9rem, 2vw, 1rem);
}

.escape-game-wrapper input[type="text"],
.escape-game-wrapper input[type="number"],
.escape-game-wrapper select {
  width: 100%;
  padding: clamp(10px, 2vw, 12px);
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 16px; /* Prevents iOS zoom */
  transition: all 0.3s ease;
  background: white;
  -webkit-appearance: none;
  appearance: none;
}

/* Custom select arrow */
.escape-game-wrapper select {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3e%3cpath fill='%23333' d='M10.293 3.293L6 7.586 1.707 3.293A1 1 0 00.293 4.707l5 5a1 1 0 001.414 0l5-5a1 1 0 10-1.414-1.414z'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 20px;
  padding-right: 40px;
}

.escape-game-wrapper input[type="text"]:focus,
.escape-game-wrapper input[type="number"]:focus,
.escape-game-wrapper select:focus {
  outline: none;
  border-color: #ed4e39;
  box-shadow: 0 0 0 3px rgba(237, 78, 57, 0.15);
}

/* Button - Responsive & Touch-friendly */
.escape-game-wrapper button {
  background: linear-gradient(135deg, #ed4e39, #ff7262);
  color: white;
  border: none;
  padding: clamp(12px, 2.5vw, 14px) clamp(20px, 4vw, 30px);
  border-radius: 8px;
  font-size: clamp(0.95rem, 2vw, 1.05rem);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 6px rgba(237, 78, 57, 0.2);
  display: inline-block;
  width: 100%;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.escape-game-wrapper button:hover:not(:disabled) {
  background: linear-gradient(135deg, #d63f2b, #ed4e39);
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(237, 78, 57, 0.3);
}

.escape-game-wrapper button:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(237, 78, 57, 0.2);
}

.escape-game-wrapper button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Tab Buttons (falls benötigt) */
.escape-game-wrapper .tab-button {
  background: #f5f5f5;
  color: #666;
  padding: 10px 20px;
  border-radius: 25px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 14px;
  font-weight: normal;
  width: auto;
  min-width: 120px;
  margin: 5px;
}

.escape-game-wrapper .tab-button:hover {
  background: #fff9f1;
  border-color: #ed4e39;
  transform: none;
}

.escape-game-wrapper .tab-button.active {
  background: #ed4e39;
  color: white;
  border-color: #ed4e39;
}

/* Highscore Table - Responsive */
.escape-game-wrapper .highscore-table {
  margin-top: 30px;
}

.escape-game-wrapper .highscore-table h2 {
  color: #ed4e39;
  margin-bottom: 15px;
  font-size: clamp(1.3rem, 3vw, 1.8rem);
  text-align: left;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.escape-game-wrapper .highscore-note {
  color: #666;
  font-size: clamp(0.85rem, 2vw, 0.95rem);
  margin-bottom: 20px;
  line-height: 1.4;
}

/* Table Container for horizontal scroll - WICHTIG FÜR MOBILE! */
.escape-game-wrapper .table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -10px;
  padding: 0 10px;
}

.escape-game-wrapper table {
  width: 100%;
  min-width: 400px;
  border-collapse: collapse;
  background: white;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.escape-game-wrapper thead {
  background: linear-gradient(135deg, #ed4e39 0%, #ff7262 100%);
  color: white;
}

.escape-game-wrapper th,
.escape-game-wrapper td {
  padding: clamp(10px, 2vw, 15px);
  text-align: left;
  font-size: clamp(0.85rem, 2vw, 1rem);
}

.escape-game-wrapper th {
  font-weight: 600;
  text-transform: uppercase;
  font-size: clamp(0.75rem, 1.8vw, 0.9rem);
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.escape-game-wrapper tbody tr {
  border-bottom: 1px solid #f0f0f0;
  transition: background 0.3s ease;
}

.escape-game-wrapper tbody tr:hover {
  background: #fff9f1;
}

.escape-game-wrapper tbody tr:last-child {
  border-bottom: none;
}

/* Rank Styling */
.escape-game-wrapper .rank,
.escape-game-wrapper td:first-child {
  font-weight: bold;
  color: #ed4e39;
  font-size: clamp(1rem, 2.5vw, 1.2rem);
}

/* Medal colors for top 3 */
.escape-game-wrapper tbody tr:nth-child(1) td:first-child {
  color: #ffd700;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.escape-game-wrapper tbody tr:nth-child(2) td:first-child {
  color: #c0c0c0;
  text-shadow: 0 0 10px rgba(192, 192, 192, 0.3);
}

.escape-game-wrapper tbody tr:nth-child(3) td:first-child {
  color: #cd7f32;
  text-shadow: 0 0 10px rgba(205, 127, 50, 0.3);
}

.escape-game-wrapper .time {
  font-family: "SF Mono", "Monaco", "Inconsolata", "Fira Code", monospace;
  font-weight: 600;
}

/* Animations */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================ */
/* RESPONSIVE BREAKPOINTS                      */
/* ============================================ */

/* Mobile Specific - Smartphones */
@media (max-width: 640px) {
  .escape-game-wrapper {
    padding: 10px;
  }
  
  .escape-game-wrapper .container {
    border-radius: 12px;
  }
  
  .escape-game-wrapper .header {
    padding: 20px 15px;
  }
  
  .escape-game-wrapper .content {
    padding: 15px;
  }
  
  .escape-game-wrapper .code-section {
    padding: 15px;
    margin-bottom: 20px;
  }
  
  /* Kompaktere Tabelle */
  .escape-game-wrapper table {
    min-width: 320px;
    font-size: 0.85rem;
  }
  
  .escape-game-wrapper th,
  .escape-game-wrapper td {
    padding: 8px 6px;
  }
  
  .escape-game-wrapper th:first-child,
  .escape-game-wrapper td:first-child {
    padding-left: 10px; /* KORRIGIERT */
  }
  
  /* Button full width on mobile */
  .escape-game-wrapper button {
    width: 100%;
    padding: 14px;
    font-size: 1rem;
  }
  
  /* Tab buttons responsive */
  .escape-game-wrapper .tab-button {
    width: 100%;
    margin: 5px 0;
  }
}

/* Very small devices */
@media (max-width: 380px) {
  .escape-game-wrapper .header h1 {
    font-size: 1.5rem;
  }
  
  .escape-game-wrapper table {
    font-size: 0.8rem;
    min-width: 280px;
  }
  
  .escape-game-wrapper th {
    font-size: 0.7rem;
    padding: 6px 4px;
  }
  
  .escape-game-wrapper td {
    padding: 6px 4px;
    word-break: break-word;
  }
}

/* Tablet */
@media (min-width: 641px) and (max-width: 1024px) {
  .escape-game-wrapper .container {
    margin: 20px auto;
  }
  
  .escape-game-wrapper button {
    width: auto;
    min-width: 200px;
  }
  
  .escape-game-wrapper .tab-button {
    width: auto;
    min-width: 120px;
  }
}

/* Touch devices optimizations */
@media (hover: none) and (pointer: coarse) {
  .escape-game-wrapper input[type="text"],
  .escape-game-wrapper input[type="number"],
  .escape-game-wrapper select {
    padding: 14px;
    font-size: 16px;
  }
  
  .escape-game-wrapper button {
    padding: 14px 24px;
  }
  
  /* Größere Touch-Bereiche für Tab-Buttons */
  .escape-game-wrapper .tab-button {
    padding: 12px 24px;
  }
}

/* Landscape mode for small devices */
@media (max-height: 500px) and (orientation: landscape) {
  .escape-game-wrapper {
    padding: 10px;
  }
  
  .escape-game-wrapper .header {
    padding: 15px;
  }
  
  .escape-game-wrapper .header h1 {
    font-size: 1.5rem;
    margin-bottom: 5px;
  }
  
  .escape-game-wrapper .form-group {
    margin-bottom: 10px;
  }
  
  .escape-game-wrapper input[type="text"],
  .escape-game-wrapper input[type="number"],
  .escape-game-wrapper select {
    padding: 8px;
  }
}

/* Accessibility - Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .escape-game-wrapper * {
    animation: none !important;
    transition: none !important;
  }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  .escape-game-wrapper input[type="text"]:focus,
  .escape-game-wrapper input[type="number"]:focus,
  .escape-game-wrapper select:focus {
    outline: 3px solid #ed4e39;
    outline-offset: 2px;
  }
}

/* Dark Mode Support (optional) */
@media (prefers-color-scheme: dark) {
  .escape-game-wrapper {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
  }
  
  .escape-game-wrapper .container {
    background: #2a2a2a;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  }
  
  .escape-game-wrapper .code-section {
    background: #333333;
    border-color: #444444;
  }
  
  .escape-game-wrapper input[type="text"],
  .escape-game-wrapper input[type="number"],
  .escape-game-wrapper select {
    background: #3a3a3a;
    color: #e0e0e0;
    border-color: #555555;
  }
  
  .escape-game-wrapper label {
    color: #e0e0e0;
  }
  
  .escape-game-wrapper .form-description,
  .escape-game-wrapper .highscore-note {
    color: #b0b0b0;
  }
  
  .escape-game-wrapper table {
    background: #2a2a2a;
  }
  
  .escape-game-wrapper tbody tr:hover {
    background: #333333;
  }
  
  .escape-game-wrapper tbody tr {
    border-bottom-color: #444444;
  }
  
  .escape-game-wrapper td {
    color: #e0e0e0;
  }
}

/* Print Styles */
@media print {
  .escape-game-wrapper {
    background: white;
    padding: 0;
  }
  
  .escape-game-wrapper .header {
    background: none;
    color: #333;
  }
  
  .escape-game-wrapper button,
  .escape-game-wrapper .code-section {
    display: none;
  }
  
  .escape-game-wrapper table {
    box-shadow: none;
    border: 1px solid #ccc;
  }
}