/* --------------------------------------------------------------------------- */
/* ELM DEVELOPMENT SERVER STYLES
/* --------------------------------------------------------------------------- */

[data-elm-hot="true"] {
  height: inherit;
}

/* --------------------------------------------------------------------------- */
/* RESET PADDING AND BOX-SIZING */
/* --------------------------------------------------------------------------- */

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", Arial, Helvetica, system-ui, sans-serif;
  overflow: hidden;
}

/* --------------------------------------------------------------------------- */
/* STYLED DEFAULTS
/* --------------------------------------------------------------------------- */

input, select {
  padding: 5px;
  font-family: inherit;
}

select {
  font-size: 10pt;
}

input[type="text"] {
  font-size: 10pt;
  padding: 6px 8px;
}

button {
  background: #d1d5db;
  font-family: inherit;
  font-size: 10pt;
  color: #111827;
  padding: 0.5rem;
  border-radius: 5px;
  border: none;
  border-bottom: 2px solid #9ca3af;
  margin-top: 2px;
  cursor: pointer;
}

button:hover {
  border-bottom: 4px solid #9ca3af;
  margin-top: 0px;
}

button:active {
  border-bottom: 0px;
  margin-top: 4px;
}

button.selected {
  border-bottom: 0px;
  margin-top: 4px;
  background: #6b7280;
  color: white;
}

.screen {
  background-color: #f1f5f9;
  opacity: 0.8;
  background-size: 10px 10px;
  background-image: repeating-linear-gradient(45deg, #cbd5e1 0, #cbd5e1 1px, #f1f5f9 0, #f1f5f9 50%);
}


/* --------------------------------------------------------------------------- */
/* SETTINGS SCREEN COMPONENT-SPECIFIC STYLES
/* --------------------------------------------------------------------------- */

#settings-screen {
  height: 100vh;
  width: 100vw;
  display: flex;
  justify-content: center;
  align-items: center;
}

.gomoku-title {
  font-family: cursive;
  font-weight: bold;
  font-size: 1.1em;
  letter-spacing: 1px;
  margin-left: 5px;
}

#settings-modal {
  padding: 1rem 2rem 2rem 2rem;
  width: 600px;
  background: white;
  position: relative;
  border-radius: 2px;
  border: 1px solid #94a3b8;
  border-top: 5px solid #64748b;
}

#settings-modal::after {
  content: "";
  position: absolute;
  top: 0px;
  left: 0;
  background: #64748b;
  border-top: 7px solid #64748b;
  border-left: 7px solid #64748b;
  border-bottom: 7px solid white;
  border-right: 7px solid white;
}

#settings-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #94a3b8;
}

#settings-modal-header-title, #settings-modal-header-team {
  margin: 0;
  padding: 0;
}

#settings-modal-header-title {
  font-size: 1.5em;
  font-weight: bold;
  letter-spacing: -1px;
  text-transform: uppercase;
}

#settings-modal-header-team {
  font-size: 0.8em;
  color: #777;
}

#settings-modal-intro {
  margin: 1rem 0;
}

#settings-modal-body {
  margin-top: 1.75rem;
  margin-bottom: 2.5rem;
}

.setting-picker-item {
  display: flex;
  flex-direction: column;
  margin-bottom: 0.75rem;
}

.setting-picker-item-label {
  font-size: 0.7em;
  color: #475569;
  margin-bottom: 3px;
  text-transform: uppercase;
}

.setting-picker-item-input-container {
  border: 1px solid #94a3b8;
  border-radius: 1px;
  display: flex;
}

.setting-picker-item-input-int-range, .setting-picker-item-input-float-range {
  margin: 0 1rem;
  flex: 1;
}

.setting-picker-item-input-value {
  margin: 0 1rem;
  display: flex;
  text-align: center;
  align-items: center;
}

.setting-picker-item-input-buttons {
  display: flex;
  gap: 1rem;
}

.setting-picker-item-button {
  flex: 1;
}

.setting-picker-item-button-Purple.selected {
  background: #a544ef;
}

.setting-picker-item-button-Red.selected {
  background:  #c53b22;
}

.setting-picker-item-button-Yellow.selected {
  background:  #e9c50e;
}

#settings-modal-footer {
  display: flex;
}

#start-game-button {
  background-color: #333;
  color: white;
  border-color: #000; 
  flex: 1;
  font-size: 1.5rem;
  text-transform: uppercase;
  font-weight: bold;
}

/* --------------------------------------------------------------------------- */
/* GAME SCREEN COMPONENT-SPECIFIC STYLES
/* --------------------------------------------------------------------------- */

#gameplay-screen {
  height: 100vh;
  width: 100vw;
  display: flex;
  align-items: center;
  justify-content: center;
}

#restart-button-container {
  position: fixed;
  top: 1rem;
  left: 1rem;
}

#restart-button {
  border: 0;
  margin: 0;
  background: #94a3b8;
  color: white;
  padding-left: 1rem;
  padding-right: 1rem;
}

button#restart-button:hover {
  border: 0;
  margin: 0;
  background: #475569;
}

button#restart-button:active {
  border: 0;
  margin: 0;
}

#rubberband-button-container {
  display: inline-flex;
  text-align: right;
  top: 1rem;
  left: 1rem;
}

#rubberband-button {
  border: 0;
  margin: 0;
  background: rgb(29, 124, 114);
  color: white;
  padding-left: 1rem;
  padding-right: 1rem;
}

button#rubberband-button:hover {
  border: 0;
  margin: 0;
  background: rgb(9, 50, 46);
}

button#rubberband-button:active {
  border: 0;
  margin: 0;
}

#undorubberband-button-container {
  display: inline-flex;
  text-align: right;
  top: 1rem;
  left: 1rem;
}

#undorubberband-button {
  border: 0;
  margin: 1px;
  background: rgb(171, 44, 44);
  color: white;
  padding-left: 1rem;
  padding-right: 1rem;
}

button#undorubberband-button:hover {
  border: 0;
  margin: 0;
  background: rgb(107, 22, 22);
}

button#undorubberband-button:active {
  border: 0;
  margin: 0;
}


#game-screen-container {
  display: flex;
  flex-direction: column;
}

#game-status {
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  text-align: center;
  font-weight: bold;
  font-size: 1.2em;
}

.status-lost {
  background: black;
}

.status-draw {
  background: #64748b;
}

.status-won .game-status-text, .status-lost .game-status-text, .status-draw .game-status-text {
  color: white !important;
}

.status-won.purple {
  background: #a544ef;
}

.status-won.yellow {
  background: #e9c50e;
}

.status-won.red {
  background:   #c53b22;
}

.game-status-text.purple {
  color: #a544ef;
}

.game-status-text.yellow {
  color: #e9c50e;
}

.game-status-text.red{
  color:   #c53b22;
}

#game-board-container {
  position: relative;
  margin-bottom: 1rem;
}

#game-board {
  margin: auto;
  width: 80vh;
  max-width: 90vw;
  height: 80vh;
  max-height: 90vw;
  display: grid;
  position: relative;
  background: rgb(0, 0, 0);
  border: 1px solid #64748b;
  z-index: 10;
}

.game-cell {
  position: relative;
  height: 100%;
}

.game-cell.empty {
  cursor: pointer;
}

.game-cell.empty:hover {
  background-color: #737b8c;
}

.game-cell-marker.empty {
  background: rgba(153, 214, 207, 0.437);
  background-color:rgb(111, 169, 162) ;
  height: 20%;
  width: 20%;
}

.game-cell-marker {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  height: 35%;
  width: 35%;
  border-radius: 99999px;
  z-index: 10;
  border-bottom: 5px solid black;
  animation-name: place-stone;
  animation-duration: 0.1s;
}

.game-cell-marker.purple {
  background: #a544ef;
  border-color: #991cb9;
}

.game-cell-marker.yellow {
  background: #e9c50e;
  border-color: #a18c03;
}

.game-cell-marker.red {
  background: #c53822;
  border-color:  #8f2313;
}

.game-cell-line.vertical {
  position: absolute;
  top: 0;
  left: 50%;
  height: 100%;
  width: 1px;
  border-left: 1px dashed #64748b;
  z-index: 0;
}

.game-cell-line.horizontal {
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: 1px;
  border-top: 1px dashed #64748b;
  z-index: 0;
}



.firework-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  z-index: 20;
  pointer-events: none;
  display: none;
}

.firework-container.show {
  display: block;
}

.flash {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 15;
  display: none;
  opacity: 0;
  animation: flash;
  animation-duration: 3s;
  pointer-events: none;
}

.flash.show {
  display: block;
}

.flash.status-won {
  background: white;
}

.flash.status-lost {
  background: black;
}

.flash.status-draw {
  background: #475569;
}

/* --------------------------------------------------------------------------- */
/* GAME ANIMATIONS
/* --------------------------------------------------------------------------- */

@keyframes place-stone {
  from {
    margin-top: -5px;
  }

  to {
    margin-top: 0px;
  }
}

@keyframes flash {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

/* Pure CSS firework animation: */
/* Adapted from https://codepen.io/alvaromontoro/pen/MWrMEgW (Public CodePen MIT License) */
@keyframes firework {
  0% { transform: translate(var(--x), var(--initialY)); width: var(--initialSize); opacity: 1; }
  50% { width: 0.5vmin; opacity: 1; }
  100% { width: var(--finalSize); opacity: 0; }
}

/* @keyframes fireworkPseudo {
  0% { transform: translate(-50%, -50%); width: var(--initialSize); opacity: 1; }
  50% { width: 0.5vmin; opacity: 1; }
  100% { width: var(--finalSize); opacity: 0; }
}
 */
.firework,
.firework::before,
.firework::after
{
  --initialSize: 0.5vmin;
  --finalSize: 45vmin;
  --particleSize: 1vmin;
  --color1: yellow;
  --color2: khaki;
  --color3: white;
  --color4: lime;
  --color5: gold;
  --color6: mediumseagreen;
  --y: -30vmin;
  --x: -50%;
  --initialY: 60vmin;
  content: "";
  animation: firework 2s infinite;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, var(--y));
  width: var(--initialSize);
  aspect-ratio: 1;
  background: 
    /*
    radial-gradient(circle, var(--color1) var(--particleSize), #0000 0) 0% 0%,
    radial-gradient(circle, var(--color1) var(--particleSize), #0000 0) 100% 0%,
    radial-gradient(circle, var(--color1) var(--particleSize), #0000 0) 100% 100%,
    radial-gradient(circle, var(--color1) var(--particleSize), #0000 0) 0% 100%,
    */
    
    radial-gradient(circle, var(--color1) var(--particleSize), #0000 0) 50% 0%,
    radial-gradient(circle, var(--color2) var(--particleSize), #0000 0) 100% 50%,
    radial-gradient(circle, var(--color3) var(--particleSize), #0000 0) 50% 100%,
    radial-gradient(circle, var(--color4) var(--particleSize), #0000 0) 0% 50%,
    
    /* bottom right */
    radial-gradient(circle, var(--color5) var(--particleSize), #0000 0) 80% 90%,
    radial-gradient(circle, var(--color6) var(--particleSize), #0000 0) 95% 90%,
    radial-gradient(circle, var(--color1) var(--particleSize), #0000 0) 90% 70%,
    radial-gradient(circle, var(--color2) var(--particleSize), #0000 0) 100% 60%,
    radial-gradient(circle, var(--color3) var(--particleSize), #0000 0) 55% 80%,
    radial-gradient(circle, var(--color4) var(--particleSize), #0000 0) 70% 77%,
    
    /* bottom left */
    radial-gradient(circle, var(--color5) var(--particleSize), #0000 0) 22% 90%,
    radial-gradient(circle, var(--color6) var(--particleSize), #0000 0) 45% 90%,
    radial-gradient(circle, var(--color1) var(--particleSize), #0000 0) 33% 70%,
    radial-gradient(circle, var(--color2) var(--particleSize), #0000 0) 10% 60%,
    radial-gradient(circle, var(--color3) var(--particleSize), #0000 0) 31% 80%,
    radial-gradient(circle, var(--color4) var(--particleSize), #0000 0) 28% 77%,
    radial-gradient(circle, var(--color5) var(--particleSize), #0000 0) 13% 72%,
    
    /* top left */
    radial-gradient(circle, var(--color6) var(--particleSize), #0000 0) 80% 10%,
    radial-gradient(circle, var(--color1) var(--particleSize), #0000 0) 95% 14%,
    radial-gradient(circle, var(--color2) var(--particleSize), #0000 0) 90% 23%,
    radial-gradient(circle, var(--color3) var(--particleSize), #0000 0) 100% 43%,
    radial-gradient(circle, var(--color4) var(--particleSize), #0000 0) 85% 27%,
    radial-gradient(circle, var(--color5) var(--particleSize), #0000 0) 77% 37%,
    radial-gradient(circle, var(--color6) var(--particleSize), #0000 0) 60% 7%,
    
    /* top right */
    radial-gradient(circle, var(--color1) var(--particleSize), #0000 0) 22% 14%,
    radial-gradient(circle, var(--color1) var(--particleSize), #0000 0) 45% 20%,
    radial-gradient(circle, var(--color1) var(--particleSize), #0000 0) 33% 34%,
    radial-gradient(circle, var(--color1) var(--particleSize), #0000 0) 10% 29%,
    radial-gradient(circle, var(--color1) var(--particleSize), #0000 0) 31% 37%,
    radial-gradient(circle, var(--color1) var(--particleSize), #0000 0) 28% 7%,
    radial-gradient(circle, var(--color1) var(--particleSize), #0000 0) 13% 42%
    ;
  background-size: var(--initialSize) var(--initialSize);
  background-repeat: no-repeat;
}

.firework::before {
  --x: -50%;
  --y: -50%;
  --initialY: -50%;
/*   transform: translate(-20vmin, -2vmin) rotate(40deg) scale(1.3) rotateY(40deg); */
  transform: translate(-50%, -50%) rotate(40deg) scale(1.3) rotateY(40deg);
/*   animation: fireworkPseudo 2s infinite; */
}

.firework::after {
  --x: -50%;
  --y: -50%;
  --initialY: -50%;
/*   transform: translate(44vmin, -50%) rotate(170deg) scale(1.15) rotateY(-30deg); */
  transform: translate(-50%, -50%) rotate(170deg) scale(1.15) rotateY(-30deg);
/*   animation: fireworkPseudo 2s infinite; */
}

.firework:nth-child(2) {
  --x: 30vmin;
}

.firework:nth-child(2),
.firework:nth-child(2)::before,
.firework:nth-child(2)::after {
  --color1: pink;
  --color2: violet;
  --color3: fuchsia;
  --color4: orchid;
  --color5: plum;
  --color6: lavender;  
  --finalSize: 40vmin;
  left: 30%;
  top: 60%;
  animation-delay: -0.25s;
}

.firework:nth-child(3) {
  --x: -30vmin;
  --y: -50vmin;
}

.firework:nth-child(3),
.firework:nth-child(3)::before,
.firework:nth-child(3)::after {
  --color1: cyan;
  --color2: lightcyan;
  --color3: lightblue;
  --color4: PaleTurquoise;
  --color5: SkyBlue;
  --color6: lavender;
  --finalSize: 35vmin;
  left: 70%;
  top: 60%;
  animation-delay: -0.4s;
}


/* JW COMMENTS */
/* New styles I've added: */

.game-cell.noop:hover {
  background-color: inherit;
  cursor: inherit;
}

/* Clickable game cells in the band phase contain pegs that can be clicked. 
For now I'll just give them a really obvious red outline, but you can make it look prettier :) 
(e.g. could make the markers bigger or a different colour, the red outline might look a bit too much)
*/
.game-cell.band-phase-clickable {
  border: 1px solid rgb(0, 255, 183);
  cursor: pointer;
}

/* Change the background colour on hover */
.game-cell.band-phase-clickable:hover {
  background: rgb(0, 139, 123);
}

/* Change the styles of pegs that have been clicked */
.game-cell.band-phase-already-clicked {
  background: darkred;
}

/* Container for band lines */
#game-lines {
  position: absolute;
  background: red;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.band-container {
  width: 100%;
  height: 100%;
}

.band-line-container {
  width: 100%;
  height: 100%;
}

.rubberband-line {
  position: absolute;
  z-index: 50;
}

.rubberband-line.vertical {
  border-left: 2px solid white;
}


.rubberband-line.horizontal {
  border-bottom: 2px solid white;
}

/* Hacks to make diagonal lines using css linear gradients */
.rubberband-line.topleft-to-bottomright {
  background: 
    linear-gradient(to top right,
        rgba(255,255,255,0) 0%,
        rgba(255,255,255,0) calc(50% - 5px),
        rgba(255,255,255,1) 50%,
        rgba(255,255,255,0) calc(50% + 2px),
        rgba(255,255,255,0) 100%);
}

.rubberband-line.bottomleft-to-topright {
  background: 
    linear-gradient(to top left,
        rgba(255,255,255,0) 0%,
        rgba(255,255,255,0) calc(50% - 5px),
        rgba(255,255,255,1) 50%,
        rgba(255,255,255,0) calc(50% + 2px),
        rgba(255,255,255,0) 100%);
}

.purple .rubberband-line.horizontal {
  border-bottom: 2px solid #c598e7;
  background:2px solid #c598e7;
}
.purple .rubberband-line.vertical {
  background: 2px solid #c598e7;
  border-left : 2px solid #c598e7;
}

.purple .rubberband-line.bottomleft-to-topright {
  background: 
    linear-gradient(to top left,
        rgba(255,255,255,0) 0%,
        rgba(255,255,255,0) calc(50% - 5px),
        #c598e7 50%,
        rgba(255,255,255,0) calc(50% + 2px),
        rgba(255,255,255,0) 100%);
}

.purple .rubberband-line.topleft-to-bottomright {
  background: 
    linear-gradient(to top right,
        rgba(255,255,255,0) 0%,
        rgba(255,255,255,0) calc(50% - 5px),
        #c598e7 50%,
        rgba(255,255,255,0) calc(50% + 2px),
        rgba(255,255,255,0) 100%);
}

.yellow .rubberband-line.horizontal {
  border-bottom: 2px solid #e2d591;
  background:2px solid #e2d591;
}
.yellow .rubberband-line.vertical {
  background: 2px solid #e2d591;
  border-left : 2px solid #e2d591;
}

.yellow .rubberband-line.bottomleft-to-topright {
  background: 
    linear-gradient(to top left,
        rgba(255,255,255,0) 0%,
        rgba(255,255,255,0) calc(50% - 5px),
        #e2d591 50%,
        rgba(255,255,255,0) calc(50% + 2px),
        rgba(255,255,255,0) 100%);
}

.yellow .rubberband-line.topleft-to-bottomright {
  background: 
    linear-gradient(to top right,
        rgba(255,255,255,0) 0%,
        rgba(255,255,255,0) calc(50% - 5px),
        #e2d591 50%,
        rgba(255,255,255,0) calc(50% + 2px),
        rgba(255,255,255,0) 100%);
}

.red .rubberband-line.horizontal {
  border-bottom: 2px solid #e2a591;
  background:2px solid #e2a591;
}
.red .rubberband-line.vertical {
  background: 2px solid #e2a591;
  border-left : 2px solid #e2a591;
}

.red .rubberband-line.bottomleft-to-topright {
  background: 
    linear-gradient(to top left,
        rgba(255,255,255,0) 0%,
        rgba(255,255,255,0) calc(50% - 5px),
        #e2a591 50%,
        rgba(255,255,255,0) calc(50% + 2px),
        rgba(255,255,255,0) 100%);
}

/* Updated CSS for the score box */
.score-box {
  display: flex;
  align-items: center;
  height: 10vh;
  width: 10vw;
  padding: 15px;
  margin: 10px;
  background-color: #4CAF50; /* Green background color */
  color: rgb(0, 0, 0); /* White text color */
  border-radius: 8px;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Styling for the score text */
.score-text {
  font-weight: bold;
  align-items: center;
}

/* Styling for the score value */
.score-value {
  font-size: 20px;
  margin: 10px;
}
.score-box.purple {
  background-color: #a544ef;
}

.score-box.yellow {
  background-color: #e9c50e;
}

.score-box.red {
  background-color: #c53b22;
}

.red .rubberband-line.topleft-to-bottomright {
  background: 
    linear-gradient(to top right,
        rgba(255,255,255,0) 0%,
        rgba(255,255,255,0) calc(50% - 5px),
        #e2a591 50%,
        rgba(255,255,255,0) calc(50% + 2px),
        rgba(255,255,255,0) 100%);
}

/* JW COMMENTS: Extra styles for points contained in a polygon */
.game-cell.contained .game-cell-marker {
  border: 3px solid white;
}

.game-cell.contained.purple .game-cell-marker {
  border: 3px solid #a544ef;
}


.game-cell.contained.yellow .game-cell-marker {
  border: 3px solid #e9c50e;
}

.game-cell.contained.red .game-cell-marker {
  border: 3px solid #c53b22;
}

