:root {
    --bg-color: #1a1a2e;
    --text-color: #ffffff;
    --primary-color: #4ecca3;
    --primary-hover: #45b393;
    --secondary-color: #ff3366;
    --secondary-hover: #e62e5c;
    --card-bg: rgba(255, 255, 255, 0.1);
    --tooth-color: #fdfdfd;
    --tooth-shadow: inset -2px -5px 10px rgba(0,0,0,0.2), 0px 4px 6px rgba(0,0,0,0.3);
    --tooth-pressed-color: #e0e0e0;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
    background: url('images/disci_bg.png') no-repeat center center;
    background-size: cover;
}

#app {
    width: 100%;
    max-width: 800px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
}

.screen {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.4s ease forwards;
}

.screen.active {
    display: flex;
}

/* Panel Background for screens that need it */
.screen-panel {
    background-color: var(--bg-color);
    padding: 40px;
    border-radius: 20px;
    border: 3px solid var(--primary-color);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    width: 90%;
    max-width: 450px;
    text-align: center;
}

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

/* Custom Scrollbar for Waiting Players Container */
#waiting-players-container::-webkit-scrollbar {
    width: 6px;
}

#waiting-players-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

#waiting-players-container::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
}

#waiting-players-container::-webkit-scrollbar-thumb:hover {
    background: var(--primary-hover);
}

.game-title {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 2rem;
    text-shadow: 0 4px 15px rgba(78, 204, 163, 0.4);
    text-align: center;
    background: linear-gradient(45deg, #4ecca3, #45b393);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.screen-title {
    font-size: 2rem;
    margin-bottom: 1.5rem;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    max-width: 300px;
}

.btn {
    padding: 15px 25px;
    border: none;
    border-radius: 12px;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.primary-btn {
    background-color: var(--primary-color);
    color: #1a1a2e;
    box-shadow: 0 4px 15px rgba(78, 204, 163, 0.4);
}

.primary-btn:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(78, 204, 163, 0.6);
}

.secondary-btn {
    background-color: var(--card-bg);
    color: var(--text-color);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
}

.secondary-btn:hover {
    background-color: rgba(255,255,255,0.2);
    transform: translateY(-2px);
}

.text-btn {
    background: none;
    color: rgba(255,255,255,0.6);
}

.text-btn:hover {
    color: white;
}

.input-group {
    margin-bottom: 1rem;
    width: 100%;
    max-width: 300px;
}

.input-group input {
    width: 100%;
    padding: 15px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(0,0,0,0.2);
    color: white;
    font-size: 1.1rem;
    outline: none;
    transition: border-color 0.3s;
}

.input-group input:focus {
    border-color: var(--primary-color);
}

.input-group select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 100%;
    padding: 15px 20px;
    border-radius: 12px;
    background: rgba(0,0,0,0.2) url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e") no-repeat right 15px center;
    background-size: 20px;
    color: white;
    border: 1px solid rgba(255,255,255,0.2);
    font-size: 1.1rem;
    font-weight: 600;
    outline: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.input-group select:hover,
.input-group select:focus {
    border-color: var(--primary-color);
    background-color: rgba(0,0,0,0.4);
    box-shadow: 0 0 15px rgba(78, 204, 163, 0.2), 0 4px 10px rgba(0,0,0,0.3);
}

.input-group select option {
    background-color: var(--bg-color);
    color: white;
    padding: 15px;
    font-size: 1.1rem;
    font-weight: 600;
}

/* Game Area */
.game-header {
    width: 100%;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 10;
}

.turn-and-round {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

#turn-indicator {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--primary-color);
    background: rgba(0,0,0,0.6);
    padding: 12px 30px;
    border-radius: 30px;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    margin: 0;
}

#round-indicator {
    font-size: 1.2rem;
    font-weight: 600;
    color: #fff;
    background: rgba(0,0,0,0.4);
    padding: 6px 20px;
    border-radius: 20px;
    backdrop-filter: blur(5px);
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    margin: 0;
}

.exit-btn {
    background-color: var(--secondary-color);
    color: white;
    padding: 8px 16px;
    font-size: 1rem;
    border-radius: 8px;
}

.exit-btn:hover {
    background-color: var(--secondary-hover);
}

.game-area {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
}

#crocodile-container {
    position: relative;
    width: 95vmin;
    max-width: 950px;
    aspect-ratio: 1 / 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.mouth-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: opacity 0.3s ease;
    z-index: 1;
    pointer-events: none; /* Let clicks pass through to teeth */
}

.hidden {
    opacity: 0;
    pointer-events: none;
}

#teeth-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2; /* Teeth on top of the open mouth image */
}

.tooth {
    position: absolute;
    width: 6%;
    height: 9%;
    background-color: var(--tooth-color);
    box-shadow: var(--tooth-shadow);
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), background-color 0.2s;
    transform: rotate(var(--rot, 0deg)) translateY(0) scaleY(1);
}

.tooth:hover {
    filter: brightness(1.1);
    transform: rotate(var(--rot, 0deg)) scale(1.05);
}

.tooth.bottom {
    border-radius: 40% 40% 10% 10% / 60% 60% 20% 20%;
    transform-origin: bottom center;
}

.tooth.bottom.pressed {
    transform: rotate(var(--rot, 0deg)) translateY(30%) scaleY(0.4) !important;
    background-color: var(--tooth-pressed-color);
    box-shadow: inset 0px 5px 10px rgba(0,0,0,0.5);
    pointer-events: none;
}

.tooth.top {
    border-radius: 10% 10% 40% 40% / 20% 20% 60% 60%;
    transform-origin: top center;
}

.tooth.top.pressed {
    transform: rotate(var(--rot, 0deg)) translateY(-30%) scaleY(0.4) !important;
    background-color: var(--tooth-pressed-color);
    box-shadow: inset 0px -5px 10px rgba(0,0,0,0.5);
    pointer-events: none;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--bg-color);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.modal-content h2 {
    font-size: 2.5rem;
    color: var(--secondary-color);
    margin-bottom: 10px;
}

.modal-content p {
    font-size: 1.2rem;
    margin-bottom: 30px;
    color: rgba(255,255,255,0.8);
}

.modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}


/* Animation for Crocodile snapping shut */
@keyframes snapShut {
    0% { transform: scale(1); }
    50% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

.crocodile-snap {
    animation: snapShut 0.3s ease-in-out;
}

/* Custom Notification (Toast) */
.toast-notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background-color: var(--bg-color);
    color: var(--text-color);
    padding: 15px 30px;
    border-radius: 12px;
    border-left: 5px solid var(--secondary-color);
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    font-size: 1.1rem;
    font-weight: 600;
    z-index: 9999;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.toast-notification.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* ── ULTRA-PREMIUM FLOATING (i) BUTTON & MODAL ── */
.global-how-to-btn {
  position: fixed;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  left: calc(20px + env(safe-area-inset-left, 0px));
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #1f4e3f 0%, #0d261e 70%, #05140f 100%);
  border: 2px solid #4ecca3;
  box-shadow: 
    0 8px 24px rgba(0, 0, 0, 0.75),
    inset 0 1px 2px rgba(255, 255, 255, 0.35),
    inset 0 -2px 6px rgba(0, 0, 0, 0.8),
    0 0 16px rgba(78, 204, 163, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 999999;
  outline: none;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.25s ease, border-color 0.25s ease;
  user-select: none;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

.how-to-btn-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #4ecca3;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.8));
  transition: color 0.25s ease, transform 0.25s ease;
}

.how-to-icon {
  stroke: #4ecca3;
  transition: stroke 0.25s ease, transform 0.25s ease;
}

.global-how-to-btn:hover {
  transform: translateY(-3px) scale(1.1);
  border-color: #ffffff;
  box-shadow: 
    0 12px 30px rgba(0, 0, 0, 0.85),
    inset 0 1px 2px rgba(255, 255, 255, 0.5),
    0 0 25px rgba(78, 204, 163, 0.6);
}

.global-how-to-btn:hover .how-to-icon {
  stroke: #ffffff;
  transform: scale(1.1);
}

.global-how-to-btn:active {
  transform: translateY(1px) scale(0.95);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.8);
}

/* Ambient Pulsing Aura Effect */
.btn-glow-ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1.5px solid rgba(78, 204, 163, 0.35);
  animation: auraPulse 2.8s infinite cubic-bezier(0.45, 0, 0.55, 1);
  pointer-events: none;
}

@keyframes auraPulse {
  0% { transform: scale(0.92); opacity: 0.85; }
  50% { transform: scale(1.18); opacity: 0.15; }
  100% { transform: scale(0.92); opacity: 0.85; }
}

.global-how-to-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999999;
  padding: 15px;
  animation: fadeInHowToModal 0.25s ease-out forwards;
}

.global-how-to-modal.hidden {
  display: none !important;
}

.global-how-to-box {
  background: linear-gradient(165deg, #132e25 0%, #091913 100%);
  border: 2px solid #4ecca3;
  box-shadow: 0 0 35px rgba(0, 0, 0, 0.9), inset 0 1px 1px rgba(255, 255, 255, 0.15), 0 0 18px rgba(78, 204, 163, 0.25);
  color: #f8fafc;
  padding: 26px 28px;
  border-radius: 20px;
  width: min(92vw, 530px);
  position: relative;
  max-height: calc(88vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  font-family: 'Outfit', 'Inter', 'Poppins', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  -ms-overflow-style: none; /* IE and Edge */
  scrollbar-width: none; /* Firefox */}

.global-how-to-box::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
  background: transparent !important;
}
.global-how-to-box::-webkit-scrollbar-thumb {
  display: none !important;
}

.global-how-to-close {
  position: absolute;
  top: 14px;
  right: 18px;
  width: 36px !important;
  height: 36px !important;
  padding: 0 !important;
  border: none !important;
  background: transparent !important;
  color: #4ecca3;
  font-size: 2rem;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: color 0.2s ease, transform 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.global-how-to-close:hover {
  color: #ffffff;
  transform: scale(1.15);
}

.global-how-to-title {
  color: #4ecca3;
  font-size: 1.4rem;
  font-weight: 800;
  text-align: center;
  margin: 0 0 4px 0;
  letter-spacing: 0.4px;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.85);
  font-family: inherit;
}

.global-how-to-subtitle {
  color: #cbd5e1;
  font-size: 0.88rem;
  text-align: center;
  margin: 0 0 20px 0;
  font-weight: 500;
  letter-spacing: 0.2px;
  opacity: 0.95;
  font-family: inherit;
}

.global-how-to-content .rules-section {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(78, 204, 163, 0.25);
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 14px;
}

.global-how-to-content h4 {
  color: #4ecca3;
  font-size: 1.02rem;
  margin: 0 0 10px 0;
  font-weight: 700;
  letter-spacing: 0.2px;
  font-family: inherit;
}

.global-how-to-content p {
  font-size: 0.93rem;
  line-height: 1.65;
  color: #f1f5f9;
  margin: 0;
  font-weight: 400;
  letter-spacing: 0.15px;
  font-family: inherit;
}

.global-how-to-content ul, .global-how-to-content ol {
  margin: 0;
  padding-left: 22px;
  font-size: 0.92rem;
  color: #f1f5f9;
  line-height: 1.68;
  font-weight: 400;
  letter-spacing: 0.15px;
  font-family: inherit;
}

.global-how-to-content li {
  margin-bottom: 8px;
}

.global-how-to-content li strong {
  color: #ffffff;
  font-weight: 700;
}

.global-how-to-content li:last-child {
  margin-bottom: 0;
}

@keyframes fadeInHowToModal {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

/* ── MOBİL / DİK / YATIK EKRAN UYUMLULUĞU ── */
@media (max-width: 600px) {
  .global-how-to-btn {
    width: 44px;
    height: 44px;
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    left: calc(14px + env(safe-area-inset-left, 0px));
  }
  .how-to-icon {
    width: 20px;
    height: 20px;
  }
  .global-how-to-box {
    padding: 20px 20px;
    border-radius: 16px;
  
  -ms-overflow-style: none; /* IE and Edge */
  scrollbar-width: none; /* Firefox */}
  .global-how-to-title {
    font-size: 1.2rem;
  }
  .global-how-to-content .rules-section {
    padding: 12px 14px;
    margin-bottom: 12px;
  }
  .global-how-to-content p, .global-how-to-content ul, .global-how-to-content ol {
    font-size: 0.88rem;
    line-height: 1.6;
  }
}

@media (max-height: 500px) {
  .global-how-to-btn {
    width: 40px;
    height: 40px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    left: calc(10px + env(safe-area-inset-left, 0px));
  }
  .how-to-icon {
    width: 18px;
    height: 18px;
  }
  .global-how-to-box {
    max-height: 90vh;
    padding: 16px 18px;
  
  -ms-overflow-style: none; /* IE and Edge */
  scrollbar-width: none; /* Firefox */}
}
