:root {
  --bodyBackgroundColor: #ffffff;
  --bodyColor: #333;
  --modalBackgroundColor: #f5faff;
  --modalBorderColor: #b3d4fc;
  --playfieldBackgroundColor: #e0e0e0;
  --playfieldBorderColor: #333;
  --toggleThemeIcon: url('/img/moon.svg');
  --playfieldButtonBackgroundColorHover: #00000064;
  --playfieldButtonBackgroundColor: #00000019;
  --visitedLinkColor: #8d47ff;
  --buttonBackgroundColor: #c0c0c0;
  --buttonColor: #0e1b35;
  --settingsPanelBackgroundColor: #d1d1d1f0;
  --curveCountWarningColor: #ff0000;
}

@media (prefers-color-scheme: dark) {
  :root {
    --modalBackgroundColor: #333;
    --modalBorderColor: #888;
    --bodyBackgroundColor: #1e1e1e;
    --bodyColor: #e0e0e0;
    --playfieldBackgroundColor: #494949;
    --playfieldBorderColor: #444;
    --toggleThemeIcon: url('/img/sun.svg');
    --playfieldButtonBackgroundColorHover: #00000064;
    --playfieldButtonBackgroundColor: #00000019;
    --visitedLinkColor: #8d47ff;
    --buttonBackgroundColor: #33363b;
    --buttonColor: #69aef0;
    --settingsPanelBackgroundColor: #3D3D3DF0;
    --curveCountWarningColor: #FF5252;
  }
}

[data-theme="light"] {
  --bodyBackgroundColor: #ffffff;
  --bodyColor: #333;
  --modalBackgroundColor: #f5faff;
  --modalBorderColor: #b3d4fc;
  --playfieldBackgroundColor: #e0e0e0;
  --playfieldBorderColor: #333;
  --toggleThemeIcon: url('/img/moon.svg');
  --playfieldButtonBackgroundColorHover: #00000064;
  --playfieldButtonBackgroundColor: #00000019;
  --visitedLinkColor: #8d47ff;
  --buttonBackgroundColor: #c0c0c0;
  --buttonColor: #0e1b35;
  --settingsPanelBackgroundColor: #d1d1d1f0;
  --curveCountWarningColor: #ff0000;
}

[data-theme="dark"] {
  --modalBackgroundColor: #333;
  --modalBorderColor: #888;
  --bodyBackgroundColor: #1e1e1e;
  --bodyColor: #e0e0e0;
  --playfieldBackgroundColor: #494949;
  --playfieldBorderColor: #444;
  --toggleThemeIcon: url('/img/sun.svg');
  --playfieldButtonBackgroundColorHover: #00000064;
  --playfieldButtonBackgroundColor: #00000019;
  --visitedLinkColor: #8d47ff;
  --buttonBackgroundColor: #33363b;
  --buttonColor: #69aef0;
  --settingsPanelBackgroundColor: #3D3D3DF0;
  --curveCountWarningColor: #FF5252;
}

*:visited {
  color: var(--visitedLinkColor);
}

.pointModButton {
  height: 48px;
  aspect-ratio: 1;
  box-sizing: border-box;
}

#lightDarkToggleButton {
  content: var(--toggleThemeIcon);
}

#errorMessageDlg {
  z-index: 2000;
}

#errorMessage {
  color: #c21010;
}

.selected {
  border-style:dashed;
  border-width: 4px;
  border-color: rgb(177, 0, 0);
  border-radius: 10px;
}

.modal {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1000;

  background: var(--modalBackgroundColor);
  border: 1px solid var(--modalBorderColor);
  border-radius: 8px;
  padding: 4px 8px;
  box-shadow: 0 2px 8px rgba(0, 64, 175, 0.07);
  font-size: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

body,
html {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: Arial, sans-serif;
  transition: background-color 0.3s, color 0.3s;
  background-color: var(--bodyBackgroundColor);
  color: var(--bodyColor);
}

.hidden {
  display: none !important;
}

#topToolbarDiv {
  display: flex;
  align-items: center;
  gap: 10px;
}

#logInButtonDiv {
  display: flex;
  align-items: center;
  gap: 10px;
}

#loginMessage {
  align-content: center;
}

#logInForm {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 15px;
  margin: 0 auto;
  align-items: center;
}

#registerForm {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 15px;
  margin: 0 auto;
  align-items: center;
}

#registerForm #passwordHint {
  grid-column: 1 / -1;
  margin: 5px 0;
  font-size: 0.85rem;
  opacity: 0.8;
}

#container {
  display: flex;
  flex-direction: column;
  align-items: center;

  justify-content: flex-start;
  min-height: 100vh;
  height: auto;
  padding-top: 20px;
  text-align: center;
  box-sizing: border-box;
}

#scoreDiv {
  position: absolute;
  top: 10px;
  left: 10px;
}

#pointManagementDiv {
  display: flex;
  gap: 10px;
  position: absolute;
  top: 10px;
  right: 10px;
}

#menuButtonDiv {
  position: absolute;
  bottom: 10px;
  right: 10px;
}

#rateButtonDiv {
  position: absolute;
  bottom: 10px;
  left: 10px;
}

.playfieldButton {
  background-color: var(--playfieldButtonBackgroundColor);
  border-radius: 10px;
}

.playfieldButton:hover {
  background-color: var(--playfieldButtonBackgroundColorHover);
}

#rateDiv {
  flex-direction: row;
}

#topToolbarDiv {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  height: 32px;
}

#topToolbarDiv * {
  height: 32px !important;
}

h1 {
  margin-top: 5px;
  margin-bottom: 20px;
}

.helpers {
  position: absolute;
  font-size: 0.75rem;
  left: 50%;
  bottom: 4px;
  transform: translateX(-50%);
}

#playfieldDiv {
  position: relative;
  background-color: var(--playfieldBackgroundColor);
  border: 2px solid var(--playfieldBorderColor);
  border-radius: 10px;
  overflow: hidden;
}

#playfield {
  display: block;
  margin: auto;
}

/* Styles for desktop */
@media (min-width: 768px) {
  #playfieldDiv {
    width: 75vh;
    /* Set width based on height */
    height: 75vh;
    /* Set height to make it square */
  }

  #playfield {
    width: 100%;
    /* Make the canvas take full width */
    height: 100%;
    /* Make the canvas take full height */
    aspect-ratio: 1;
    /* Maintain a 1:1 aspect ratio */
  }
}

/* Styles for mobile */
@media (max-width: 767px) {
  #playfieldDiv {
    width: 75vw;
    /* Set width based on viewport width */
    height: 75vw;
    /* Set height to make it square */
  }

  #playfield {
    width: 100%;
    /* Make the canvas take full width */
    height: 100%;
    /* Make the canvas take full height */
    aspect-ratio: 1;
    /* Maintain a 1:1 aspect ratio */
  }
}

#footer {
  margin-top: 4px;
  margin-bottom: 4px;
}

#footer a {
  display: inline-block;
  line-height: 0; /* Removes tiny gaps at the bottom of images */
}

#footer img {
  width: 32px;
  height: auto;
}

#welcomeSplashFooter {
  display: flex;
  gap: 4px;
}

#titleSuperscript {
  font-size: 16px;
}

#tutorialPanes {
  display: flex;
  align-items: center;
}

.tutorialPane {
  max-width: 100%;
  max-height: 100%;
  height: auto;
  width: auto;
}

button {
  font-size: 20px;
  background-color: var(--buttonBackgroundColor);
  color: var(--buttonColor);
  border-radius: 8px;
}

#curveCountWarningDiv {
  position: absolute;
  bottom: 30px;
  color: var(--curveCountWarningColor);
  left: 50%;
  font-weight: bold;
  transform: translateX(-50%);
}