:root {
  --left-brightness: 1;
  --left-contrast: 1;
  --right-brightness: 1;
  --right-contrast: 1;
  --right-eye-color: lime; /* default green */
}

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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #080d16 0%, #030e20 100%); 
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem;
  min-height: 100vh;
}

header,
footer {
  margin-bottom: 2rem;
  text-align: center;
}

header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

header p {
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.6;
  opacity: 0.9;
}

.controls {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  justify-content: center;
}

.controls fieldset {
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 1.5rem;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(42, 82, 152, 0.95), rgba(30, 60, 114, 0.95));
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  min-width: 200px;
}

/* Collapsible Controls */
.controls-container {
  width: 100%;
  margin-bottom: 2rem;
}

.controls-header {
  background: linear-gradient(135deg, rgba(42, 82, 152, 0.95), rgba(30, 60, 114, 0.95));
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  padding: 1rem 1.5rem;
  cursor: pointer;
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #e0e6ff;
  font-weight: 600;
  user-select: none;
}

.controls-header:hover {
  background: linear-gradient(135deg, rgba(52, 92, 162, 0.95), rgba(40, 70, 124, 0.95));
  border-color: rgba(255, 255, 255, 0.3);
}

.controls-toggle {
  font-size: 1.2rem;
  transition: transform 0.3s ease;
  color: #e0e6ff;
}

.controls-header.collapsed .controls-toggle {
  transform: rotate(-90deg);
}

.controls-content {
  overflow: hidden;
  transition: max-height 0.3s ease-out, padding 0.3s ease-out;
  max-height: 1000px;
  padding-top: 1rem;
}

.controls-content.collapsed {
  max-height: 0;
  padding-top: 0;
}

.controls legend {
  font-weight: 600;
  color: #e0e6ff;
  padding: 0 10px;
  font-size: 14px;
}

.controls label {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 12px;
  color: #e0e6ff;
  font-weight: 500;
}

.controls label span {
  display: block;
  margin-bottom: 8px;
}

/* Modern Select Styling */
select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
  color: #fff;
  font-family: 'Segoe UI', sans-serif;
  font-size: 14px;
  cursor: pointer;
  outline: none;
  backdrop-filter: blur(10px);
}

select:hover {
  border-color: rgba(255, 255, 255, 0.3);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.1));
}

select option {
  background: #2a5298;
  color: #fff;
}

/* Modern Slider Styling */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(to right, #4facfe 0%, #00f2fe 100%);
  outline: none;
  margin: 8px 0;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(79, 172, 254, 0.3);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
  transition: all 0.3s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
  transition: all 0.3s ease;
}

.game-board {
  display: grid;
  grid-template-columns: repeat(4, 80px);
  grid-gap: 10px;
  margin-bottom: 1rem;
}

.card {
  position: relative;
  width: 80px;
  height: 80px;
  perspective: 600px;
  cursor: pointer;
}

.card.flipped .inner {
  transform: rotateY(180deg);
}

.inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.4s;
  transform-style: preserve-3d;
}

.face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 2rem;
  background: #444;
  border-radius: 8px;
}

.face.back {
  transform: rotateY(180deg);
}

.face-layer {
  position: absolute;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.face-layer.left-eye {
  clip-path: inset(0 50% 0 0);
  background-color: red;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: transparent;
  filter: brightness(var(--left-brightness)) contrast(var(--left-contrast));
}

.face-layer.right-eye {
  clip-path: inset(0 0 0 50%);
  background-color: var(--right-eye-color);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: transparent;
  filter: brightness(var(--right-brightness)) contrast(var(--right-contrast));
}

.stats {
  margin-bottom: 2rem;
  display: flex;
  gap: 1.5rem; /* Adjusted gap */
  justify-content: center;
  flex-wrap: wrap;
  background: linear-gradient(135deg, rgba(42, 82, 152, 0.5), rgba(30, 60, 114, 0.5));
  padding: 1rem 2rem;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 80px;
}

.stat-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: #e0e6ff;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: #fff;
  line-height: 1;
}

.stat-value span[data-i18n="stats.secondsUnit"] {
  font-size: 1rem;
  font-weight: 500;
  margin-left: 2px;
  opacity: 0.8;
}

/* Modern Button Styling */
button {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  font-family: 'Segoe UI', sans-serif;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  margin: 4px;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
  background: linear-gradient(135deg, #5a6fd8 0%, #6b42a6 100%);
}

button:active {
  transform: translateY(0);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}


.credit {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: #aaa;
  text-align: center;
}

.credit a {
  color: #eee;
  text-decoration: underline;
}

.credit a:hover {
  color: #fff;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-content {
  background: linear-gradient(135deg, rgba(42, 82, 152, 0.95), rgba(30, 60, 114, 0.95));
  padding: 2rem;
  border-radius: 16px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.modal-content h2 {
  margin-bottom: 1rem;
}

.modal-content p {
  margin-bottom: 1.5rem;
}

.modal-content button {
  padding: 0.75rem 1.5rem;
}

.card.matched .face {
  border: 2px solid gold;
}

.card.mismatched .face {
  animation: shake 0.5s;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

