html {
  background-color: var(--color-ds-grid-bg);
  background-image: none;
  height: 100%;
  overflow: hidden;
}

body {
  display: flex;
  flex-direction: column;
  height: 100%;
  margin: 0;
  overflow: hidden;
  animation: scrollBackground 4s linear infinite;
}

@keyframes scrollBackground {
  0% {
    background-position: 0 0;
  }
  100% {
    background-position: -96px -96px;
  }
}

/* === SCORE BAR === */
.score-section {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
}

.player-label {
  font-weight: bold;
  white-space: nowrap;
  min-width: 28px;
  font-size: 0.9rem;
}

.score-track {
  display: flex;
  flex: 1;
  height: 18px;
  overflow: hidden;
  border: 2px solid var(--color-ds-darkgrey);
  background: white;
}

.score-track .p1-fill {
  width: 60%;
  background-color: var(--color-ds-fuschia);
}

.score-track .p2-fill {
  width: 40%;
  background-color: var(--color-ds-turquoise);
}

/* === ANIMATIONS === */
@keyframes consoleSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes barExpandY {
  from {
    transform: scaleY(0);
    transform-origin: top;
  }
  to {
    transform: scaleY(1);
    transform-origin: top;
  }
}

@keyframes barExpandYReverse {
  from {
    transform: scaleY(0);
    transform-origin: bottom;
  }
  to {
    transform: scaleY(1);
    transform-origin: bottom;
  }
}

.bar, .bar-lg {
  animation: barExpandY 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

.bar-lg-reverse {
  animation: barExpandYReverse 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

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

.error-shake {
  animation: shake 0.3s ease-in-out;
  color: red !important;
}

.text-error span {
  color: red !important;
}

/* === MAIN ARENA === */
.arena {
  display: flex;
  flex: 1;
  min-height: 0;
  gap: 8px;
  padding: 12px;
  justify-content: center;
}

/* === PLAYER PANEL === */
.alert.player-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px 24px;
  gap: 14px;
  min-height: 0;
  width: auto;
  align-items: stretch;
  align-content: flex-start;
  justify-content: flex-start;
  animation: consoleSlideIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

.p1-panel {
  border-image: none;
  border-color: var(--color-ds-fuschia);
  background: repeating-linear-gradient(
    color-mix(in oklab, var(--color-ds-fuschia), black 85%),
    color-mix(in oklab, var(--color-ds-fuschia), black 85%) 2px,
    color-mix(in oklab, var(--color-ds-fuschia), black 65%) 2px,
    color-mix(in oklab, var(--color-ds-fuschia), black 65%) 4px
  );
  background-size: 100% 4px;
}

.p2-panel {
  border-image: none;
  border-color: var(--color-ds-turquoise);
  background: repeating-linear-gradient(
    color-mix(in oklab, var(--color-ds-turquoise), black 85%),
    color-mix(in oklab, var(--color-ds-turquoise), black 85%) 2px,
    color-mix(in oklab, var(--color-ds-turquoise), black 65%) 2px,
    color-mix(in oklab, var(--color-ds-turquoise), black 65%) 4px
  );
  background-size: 100% 4px;
}

.player-name-bar {
  width: auto;
  height: auto;
  padding: 4px 20px;
  font-weight: bold;
  color: black;
  font-size: 1rem;
  cursor: default;
  pointer-events: none;
  background-image: url('https://unpkg.com/@spiritov/ds.css/dist/assets/images/button_active.png');
}

.player-name-wrap {
  display: flex;
  justify-content: flex-start;
}

/* === STREAK === */
.streak-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.streak-label {
  font-size: 0.9rem;
  font-weight: bold;
}

.streak-dots {
  display: flex;
  gap: 4px;
}

.streak-dot {
  width: 16px;
  height: 16px;
  border: 2px solid var(--color-ds-darkgrey);
  display: grid;
  place-items: center;
  font-size: 0.6rem;
}

.streak-dot.on {
  background-color: var(--color-ds-fuschia);
}

.p2-panel .streak-dot.on {
  background-color: var(--color-ds-turquoise);
}

.streak-dot.off {
  background-color: var(--color-ds-grid-bg);
}

/* === WORD CHIPS === */
.word-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
}

.word-chips button {
  width: auto;
  height: auto;
  padding: 6px 16px;
  font-size: 0.9rem;
  pointer-events: none;
  background-image: url('https://unpkg.com/@spiritov/ds.css/dist/assets/images/button_active.png');
}

/* === BIG WORD === */
.big-word-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

.big-word-area .pictochat-status {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100px;
  padding: 16px;
}

.big-word-area h1 {
  margin: 0;
  font-size: clamp(1.6rem, 3.5vw, 2.6rem);
  text-align: center;
  letter-spacing: 3px;
  line-height: 1.5;
}

.char-correct {
  color: var(--color-ds-lime);
}

.char-current {
  color: inherit;
  border-bottom: 3px solid var(--color-ds-yellow);
}

.char-remaining {
  color: var(--color-ds-slate);
}

/* === ATTACKED WORD STYLES === */
.attacked-word {
  color: black !important;
  background-color: #ffea00 !important;
  border-color: #ffea00 !important;
  background-image: none !important;
  text-shadow: none !important;
}

.attacked-correct {
}

.attacked-current {
}

.attacked-remaining {
}

/* === INPUT === */
.input-area {
  display: flex;
  justify-content: stretch;
}

.input-area .input-wrapper {
  flex: 1;
}

.input-area input[type='text'] {
  width: 100%;
  min-width: 100%;
  text-align: center;
}

/* === ATTACK COLUMN === */
.attack-column {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  width: 90px;
  flex-shrink: 0;
  padding: 8px 4px;
}

.attack-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.attack-direction {
  font-size: 0.7rem;
  font-weight: bold;
  text-align: center;
  color: var(--color-ds-darkgrey);
}

.attack-alert {
  width: 78px;
  min-height: auto;
  height: auto;
  padding: 6px 4px;
  font-size: 0.8rem;
  flex-direction: column;
  gap: 4px;
  text-align: center;
  align-items: center;
}

.attack-alert .attack-value {
  font-weight: bold;
  font-size: 1.1rem;
}

.attack-alert.p1-attack {
  border-image-source: none;
  border: 4px solid var(--color-ds-fuschia);
  background: repeating-linear-gradient(
    color-mix(in oklab, var(--color-ds-fuschia), black 70%),
    color-mix(in oklab, var(--color-ds-fuschia), black 70%) 2px,
    color-mix(in oklab, var(--color-ds-fuschia), black 50%) 2px,
    color-mix(in oklab, var(--color-ds-fuschia), black 50%) 4px
  );
}

.attack-alert.p2-attack {
  border-image-source: none;
  border: 4px solid var(--color-ds-turquoise);
  background: repeating-linear-gradient(
    color-mix(in oklab, var(--color-ds-turquoise), black 70%),
    color-mix(in oklab, var(--color-ds-turquoise), black 70%) 2px,
    color-mix(in oklab, var(--color-ds-turquoise), black 50%) 2px,
    color-mix(in oklab, var(--color-ds-turquoise), black 50%) 4px
  );
}

/* === MENU STYLES === */
.menu-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 20px;
  overflow: hidden;
  min-height: 0;
}

.menu-box {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 270px;
  max-height: 100%;
  min-height: 0;
  flex-shrink: 1;
  overflow-y: auto;
  padding: 32px 24px;
  text-align: center;
  margin: 0 auto;
  animation: consoleSlideIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

.menu-box::-webkit-scrollbar {
  width: 12px;
}
.menu-box::-webkit-scrollbar-track {
  background: var(--color-ds-slate);
  border-left: 2px solid #000;
}
.menu-box::-webkit-scrollbar-thumb {
  background: var(--color-ds-darkgrey);
  border: 2px solid #000;
}

.menu-box button {
  width: 100%;
  box-sizing: border-box;
}

.menu-box h2 {
  margin: 0 0 16px 0;
  color: black;
}

.game-logo {
  font-size: 4.5rem;
  font-weight: bold;
  color: var(--color-ds-fuschia);
  text-align: center;
  margin: 40px 0 32px 0;
  text-transform: uppercase;
  letter-spacing: 4px;
  animation: consoleSlideIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

.menu-box button {
  width: 100%;
  padding: 4px 12px;
  min-height: 44px;
  font-size: 1.05rem;
  cursor: pointer;
  text-align: center;
  display: flex;
  justify-content: center;
  align-items: center;
}

.menu-box button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.hidden-panel {
  visibility: hidden;
  pointer-events: none;
}

/* === RESPONSIVE === */
@media (max-width: 700px) {
  .arena {
    flex-direction: column;
  }

  .attack-column {
    flex-direction: row;
    width: 100%;
    justify-content: center;
    padding: 4px;
  }
}

/* === OVERLAYS === */
@keyframes blink {
  50% { opacity: 0; }
}
.blink-text {
  animation: blink 1s step-end infinite;
}

.modal-overlay {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  backdrop-filter: blur(2px);
  animation: consoleSlideIn 0.3s ease-out both;
}

.modal-box {
  background: #f8f9fa;
  padding: 24px;
  border: 4px solid var(--color-ds-slate);
  border-radius: 8px;
  text-align: center;
  width: 90%;
  max-width: 320px;
  box-shadow: 4px 4px 0px rgba(0,0,0,0.3);
  box-sizing: border-box;
}

.modal-box input {
  box-sizing: border-box;
  width: 100%;
}

.countdown-overlay {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.2);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999;
}

.countdown-text {
  font-size: 8rem;
  font-weight: bold;
  color: white;
  text-shadow: 4px 4px 0px var(--color-ds-fuschia);
  animation: consoleSlideIn 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

/* === CUSTOM RANGE SLIDER === */
/* === CUSTOM RANGE SLIDER === */
input[type=range].vol-slider {
  -webkit-appearance: none !important;
  appearance: none !important;
  width: 100% !important;
  background: transparent !important;
  margin: 8px 0 16px 0 !important;
  display: block !important;
  border: none !important;
  position: relative !important;
  z-index: 10 !important;
}

input[type=range].vol-slider::-webkit-slider-runnable-track {
  width: 100% !important;
  height: 8px !important;
  cursor: pointer !important;
  background: var(--color-ds-slate, #6c757d) !important;
  border: 2px solid #000 !important;
  border-radius: 4px !important;
}

input[type=range].vol-slider::-webkit-slider-thumb {
  height: 24px !important;
  width: 16px !important;
  border-radius: 2px !important;
  background: var(--color-ds-fuschia, #e91e63) !important;
  cursor: pointer !important;
  -webkit-appearance: none !important;
  appearance: none !important;
  margin-top: -10px !important;
  border: 2px solid #000 !important;
  box-shadow: 2px 2px 0px rgba(0,0,0,0.5) !important;
}

/* Firefox */
input[type=range].vol-slider::-moz-range-track {
  width: 100% !important;
  height: 8px !important;
  cursor: pointer !important;
  background: var(--color-ds-slate, #6c757d) !important;
  border: 2px solid #000 !important;
  border-radius: 4px !important;
}

input[type=range].vol-slider::-moz-range-thumb {
  height: 24px !important;
  width: 16px !important;
  border-radius: 2px !important;
  background: var(--color-ds-fuschia, #e91e63) !important;
  cursor: pointer !important;
  border: 2px solid #000 !important;
  box-shadow: 2px 2px 0px rgba(0,0,0,0.5) !important;
}

input[type=range].vol-slider:focus {
  outline: none !important;
}

/* === TOGGLE SWITCH === */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--color-ds-slate);
  transition: .2s;
  border: 2px solid #000;
  box-shadow: 2px 2px 0px rgba(0,0,0,0.5);
  border-radius: 4px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 12px;
  width: 12px;
  left: 3px;
  bottom: 2px;
  background-color: white;
  transition: .2s;
  border: 2px solid #000;
  border-radius: 2px;
}

input:checked + .toggle-slider {
  background-color: var(--color-ds-fuschia);
}

input:checked + .toggle-slider:before {
  transform: translateX(18px);
}

.toggle-label-text {
  font-size: 0.85rem;
  font-weight: bold;
  line-height: 1.2;
}
