:root {
  --x-color: #4FC3F7;
  --o-color: #FFD54F;
  --tablero-bg: #21242b;
  --board-border: #fff;
  --main-text: #f7f7f7;
  --info-bg: #22262f;
  --modal-bg: rgba(30,30,40,0.95);
  --modal-border: #3FC1C9;
  --win-color: #43E97B;
  --draw-color: #CCCCCC;
  --error-color: #FF758F;
}

body {
  margin: 0;
  background: var(--tablero-bg);
  color: var(--main-text);
  font-family: 'Segoe UI', Arial, sans-serif;
  min-height: 100vh;
}
#supertriqui-app {
  display: flex;
  flex-direction: row;
  width: 100vw;
  min-height: 100vh;
  align-items: flex-start;
}
#board-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-width: 320px;
  width: 60vw;
  background: var(--tablero-bg);
}
#board-section h1 {
  margin-top: 2rem;
  font-size: 2.3rem;
  letter-spacing: 0.04em;
  color: var(--win-color);
}
#board-wrapper {
  margin: 2rem 1.5rem 2rem 1.5rem;
  width: 95vw;
  max-width: 480px;
  aspect-ratio: 1/1;
  background: var(--tablero-bg);
  border-radius: 16px;
  box-shadow: 0 0 32px rgba(20,20,24,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: box-shadow 0.3s;
}
#btn-reiniciar {
  background: var(--win-color);
  color: #1e1e2b;
  border: none;
  font-size: 1.06em;
  border-radius: 11px;
  padding: 0.5em 1.7em;
  cursor: pointer;
  font-weight: 600;
  margin-bottom: 1.4rem;
  margin-top: 0.2rem;
  box-shadow: 0 2px 14px rgba(67,233,123,0.07);
}
#btn-reiniciar:hover {
  background: #43b47b;
  color: #fff;
}
#name-setup {
  margin-top: 2.2em;
  background: var(--info-bg);
  border-radius: 17px;
  padding: 1.1em 1.4em 1.7em 1.4em;
  box-shadow: 0 4px 22px rgba(30,50,50,0.13);
  display: flex;
  flex-direction: column;
  gap: 1.2em;
  min-width: 230px;
}
#name-setup label {
  font-size: 1.1em;
  margin-bottom: 0.6em;
  display: flex;
  align-items: center;
  gap: 0.5em;
}
#name-setup input {
  background: #1a1e27;
  color: #fafafa;
  font-size: 1.07em;
  border: 1.8px solid #3FC1C9;
  border-radius: 8px;
  padding: 0.2em 0.8em;
  margin-left: 0.4em;
  outline: none;
  transition: border 0.17s;
}
#name-setup input:focus {
  border: 1.8px solid var(--win-color);
}
#btn-iniciar {
  background: var(--x-color);
  color: #1e1e2b;
  border: none;
  font-size: 1em;
  border-radius: 10px;
  padding: 0.48em 1.4em;
  cursor: pointer;
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(80,200,250,0.09);
  margin-top: 0.4em;
  align-self: center;
}
#btn-iniciar:hover {
  background: var(--win-color);
}
.color-x {
  color: var(--x-color);
  font-weight: 700;
}
.color-o {
  color: var(--o-color);
  font-weight: 700;
}

#info-section {
  background: var(--info-bg);
  border-radius: 24px;
  margin: 3.1rem 2rem 2.5rem 2rem;
  padding: 2.2rem 2rem 2.3rem 2rem;
  min-width: 280px;
  width: 29vw;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.15rem;
  box-shadow: 0 4px 24px rgba(10,20,40,0.25);
  transition: box-shadow 0.3s;
}
#turn-info {
  font-size: 1.17em;
  margin-bottom: 0.8em;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.7em;
  justify-content: center;
}
#macro-mini {
  align-self: center;
  margin-bottom: 0.7em;
}
#winner-message {
  font-size: 1.08em;
  color: var(--win-color);
  font-weight: bold;
  margin-bottom: 0.5em;
  min-height: 1.3em;
  text-align: center;
}
#error-message {
  min-height: 1.2em;
  color: var(--error-color);
  font-weight: 600;
  font-size: 1em;
  margin-bottom: 0.6em;
  text-align: center;
}
#btn-instrucciones {
  background: var(--o-color);
  color: #21242b;
  border: none;
  font-size: 1em;
  border-radius: 10px;
  padding: 0.48em 1.5em;
  cursor: pointer;
  font-weight: 600;
  margin-top: 0.6em;
  align-self: center;
  box-shadow: 0 2px 12px rgba(255,213,79,0.11);
}
#btn-instrucciones:hover {
  background: var(--x-color);
  color: #21242b;
}
#instrucciones-modal {
  position: fixed;
  inset: 0;
  background: var(--modal-bg);
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}
#instrucciones-modal.hidden {
  display: none;
}
.modal-content {
  background: var(--info-bg);
  border: 3px solid var(--modal-border);
  border-radius: 22px;
  padding: 2rem 2rem 1.5rem 2rem;
  max-width: 420px;
  min-width: 250px;
  color: var(--main-text);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  font-size: 1.06em;
}
.modal-content h2 {
  margin-top: 0;
  color: var(--win-color);
  font-size: 1.23em;
}
.modal-content button {
  margin-top: 1.1em;
  background: var(--x-color);
  color: #1e1e2b;
  border: none;
  font-size: 1em;
  border-radius: 10px;
  padding: 0.38em 1.25em;
  cursor: pointer;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(80,200,250,0.11);
}
.modal-content button:hover {
  background: var(--win-color);
}

@media (max-width: 800px), (orientation: portrait) {
  #supertriqui-app {
    flex-direction: column;
    align-items: center;
    width: 100vw;
  }
  #board-section, #info-section {
    width: 96vw;
    min-width: unset;
    max-width: unset;
    margin: 1.2rem auto;
  }
  #info-section {
    margin-top: 0.5rem;
    margin-bottom: 2.5rem;
    width: 90vw;
  }
  #board-wrapper {
    max-width: 97vw;
    margin-top: 0.7rem;
  }
}

@media (max-width: 420px) {
  #macro-mini svg { width: 64px !important; height: 64px !important;}
  .modal-content { padding: 0.5rem 0.4rem; font-size: 0.98em;}
}

.hidden { display: none !important; }

#macro-mini {
  align-self: center;
  margin-bottom: 0.7em;
  display: flex;
  justify-content: center;
  width: 66px;
  height: 66px;
}
#macro-mini svg {
  width: 66px !important;
  height: 66px !important;
  display: block;
}

#dificultad-cpu {
  margin: 1.1em 0 0.5em 0;
  font-size: 1em;
  display: flex;
  gap: 1.5em;
  justify-content: flex-start;
}

#cpu-thinking {
  color: #8ff3fc;
  font-weight: 600;
  margin: 0.2em 0 0.8em 0;
  display: flex;
  align-items: center;
  gap: 0.6em;
  font-size: 1em;
}
.cpu-icon {
  display: inline-block;
  width: 22px; height: 22px;
  border: 3px solid #45e3ff;
  border-right: 3px solid transparent;
  border-radius: 50%;
  animation: cpu-spin 1s linear infinite;
}
@keyframes cpu-spin {
  0% { transform: rotate(0deg);}
  100% { transform: rotate(360deg);}
}
@media (max-width: 750px), (orientation: portrait) {
  #supertriqui-app {
    flex-direction: column !important;
    align-items: center;
    width: 100vw;
  }
  #board-section, #info-section {
    width: 99vw;
    min-width: unset;
    max-width: unset;
    margin: 0.5rem auto;
    box-sizing: border-box;
  }
  #info-section {
    margin-top: 0.4rem;
    margin-bottom: 1.7rem;
    width: 97vw;
    padding: 1.1rem 0.7rem 1.3rem 0.7rem;
    min-width: 0;
    max-width: 99vw;
    border-radius: 19px;
  }
  #board-section {
    width: 99vw;
    padding: 0;
  }
  #board-wrapper {
    max-width: 97vw;
    width: 97vw;
    margin: 1.1rem auto 0.3rem auto;
    border-radius: 14px;
  }
  #name-setup {
    min-width: 0;
    width: 97vw;
    padding: 0.8em 0.5em 1.2em 0.5em;
    border-radius: 15px;
    font-size: 0.97em;
  }
  #dificultad-cpu {
    gap: 1em;
  }
  #macro-mini {
    margin-bottom: 0.5em;
  }
  #macro-mini svg {
    width: 54px !important;
    height: 54px !important;
  }
  .modal-content {
    max-width: 99vw;
    min-width: 0;
    padding: 0.7em 0.3em 0.8em 0.4em;
    font-size: 0.99em;
  }
}
@media (max-width: 440px) {
  #macro-mini svg { width: 40px !important; height: 40px !important;}
  #info-section { padding: 0.8rem 0.2rem 1.1rem 0.2rem;}
}
