/* OGÓLNE USTAWIENIA STRONY */
body {
    background-color: #121212;
    color: #d0d0d0;
    font-family: 'Courier New', Courier, monospace;
    margin: 0;
    display: flex;
    flex-direction: column;
    height: 100vh; /* Pełna wysokość ekranu */
    overflow: hidden; /* Brak paska przewijania na body */
}

/* OKNO GRY (LOG) */
#game-output {
    flex: 1; /* Zajmuje całą dostępną przestrzeń */
    padding: 15px;
    overflow-y: auto; /* Przewijanie tylko w tym oknie */
    white-space: pre-wrap; /* Zachowuje formatowanie tekstu z serwera */
    font-size: 15px;
    line-height: 1.5;
    background: #121212;
}

/* PASEK NA DOLE (INPUT) */
#input-area {
    background: #1e1e1e;
    padding: 10px;
    display: flex;
    gap: 10px;
    border-top: 1px solid #333;
    /* Fix dla iPhone/Safari, żeby pasek nie chował się za UI przeglądarki */
    padding-bottom: env(safe-area-inset-bottom); 
}

/* POLE TEKSTOWE */
input {
    flex: 1;
    background: #000;
    border: 1px solid #444;
    color: white;
    padding: 12px;
    font-size: 16px; /* 16px zapobiega auto-zoomowaniu na iPhone */
    border-radius: 4px;
    outline: none;
}
input:focus { border-color: #666; }

/* PRZYCISK WYŚLIJ */
button#send-btn {
    background: #333;
    color: white;
    border: 1px solid #444;
    padding: 0 20px;
    border-radius: 4px;
    font-weight: bold;
    text-transform: uppercase;
    cursor: pointer;
	min-width: 80px;
    touch-action: manipulation;
}
button#send-btn:active { background: #555; }

/* PRZYCISK DŹWIĘKU (Prawy górny róg) */
#sound-toggle {
    position: absolute;
    top: 10px;
    right: 20px;
    background: rgba(0,0,0,0.6);
    border: 1px solid #555;
    color: #888;
    padding: 5px 10px;
    font-size: 20px;
    z-index: 100;
    border-radius: 5px;
    cursor: pointer;
}
#sound-toggle.active {
    color: #4caf50;
    border-color: #4caf50;
}

/* STYLIZACJA ELEMENTÓW WEWNĄTRZ GRY */
a { color: #4a90e2; text-decoration: none; }

/* PASEK PRZEWIJANIA (Webkit) */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #121212; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }

/* --- EFEKT WSTRZĄSU (SHAKE) --- */

/* Definicja animacji 'shake-anim' */
@keyframes shake-anim {
  0% { transform: translate(1px, 1px) rotate(0deg); }
  10% { transform: translate(-1px, -2px) rotate(-1deg); }
  20% { transform: translate(-3px, 0px) rotate(1deg); }
  30% { transform: translate(3px, 2px) rotate(0deg); }
  40% { transform: translate(1px, -1px) rotate(1deg); }
  50% { transform: translate(-1px, 2px) rotate(-1deg); }
  60% { transform: translate(-3px, 1px) rotate(0deg); }
  70% { transform: translate(3px, 1px) rotate(-1deg); }
  80% { transform: translate(-1px, -1px) rotate(1deg); }
  90% { transform: translate(1px, 2px) rotate(0deg); }
  100% { transform: translate(1px, -2px) rotate(-1deg); }
}

/* Klasa CSS, którą JavaScript będzie dodawał do body */
.shake {
  /* Uruchom animację na 0.5 sekundy */
  animation: shake-anim 0.5s;
  
  /* Uruchom tylko raz */
  animation-iteration-count: 1; 
  
  /* Ważne: żeby animacja działała na body, nie może ono mieć domyślnego static */
  position: relative; 
}