:root {
  --main-color: #5F6B7A;
  --a-road: #D72638;
  --n-road: #F2B705;
  --background: #F8F9FA;
}

body.dark {
  --background: #121212;
}


/* Basis */

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow-x: hidden;
}

body {
  height: 100svh;
  min-height: 100svh;
  overflow: hidden;

  background: var(--background);
  color: var(--main-color);
  font-family: "Nunito", "Avenir Next", "Segoe UI", sans-serif;
  font-weight: 700;

  display: flex;
  flex-direction: column;
}

@supports (height: 100dvh) {
  body {
    height: 100dvh;
    min-height: 100dvh;
  }
}

.hidden {
  display: none !important;
}


/* Algemene knoppen */

button {
  border: 2px solid var(--main-color);
  background: transparent;
  color: var(--main-color);
  border-radius: 8px;
  padding: 12px;
  font-size: 1rem;
}


/* Header */

header {
  height: 56px;
  flex: 0 0 56px;

  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;

  padding: 10px 12px 0;
}


header h1 {
  display: none;
}


/* Hoofdlayout */

main {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;

  display: flex;
  flex-direction: column;

  gap: 10px;
  padding: 0 12px calc(132px + env(safe-area-inset-bottom));

  overflow-y: auto;
}


/* Ronde info */

#roundText,
#rules-button,
#settings-button {
  width: 100%;
  height: 36px;

  display: flex;
  align-items: center;
  justify-content: center;

  margin: 0;
  padding: 0 8px;
  box-sizing: border-box;

  border: 2px solid var(--main-color);
  border-radius: 8px;

  background: var(--background);
  color: var(--main-color);
}

/* Kaart */

#map-container {
  flex: 1 1 0;
  overflow: hidden;

  display: flex;
  justify-content: center;
  align-items: center;

  min-height: 0;
}

#mapObject {
  width: 100%;
  height: 100%;

  max-width: 100%;
  max-height: 100%;
  min-height: 0;

  display: block;
  object-fit: contain;
}


/* Onderste bedieningsgebied */

#answerPanel {
  width: auto;
  min-height: 0;

  display: flex;
  align-items: center;

  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 10;

  background: var(--background);
  padding-top: 8px;
}


/* Beide modi gebruiken dezelfde ruimte */

#textAnswerPanel,
#multipleChoicePanel {
  width: 100%;
}


/* Tekstinvoer modus */

#textAnswerPanel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
}


#answerInput {
  width: 100%;

  border: 2px solid var(--main-color);
  border-radius: 8px;

  background: var(--background);
  color: var(--main-color);

  padding: 12px;
  font-size: 1rem;
  font-family: inherit;
  font-weight: 500;
}

button,
input {
  font-family: inherit;
}


/* Rij met twee knoppen */

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}


#submitAnswerButton,
#passButton {
  width: 100%;
}


/* Meerkeuze modus */

#multipleChoicePanel {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;

  align-items: center;
}


.choice-button {
  width: 100%;
  min-height: 60px;

  font-size: 0.9rem;
}


@media (max-width: 640px), (max-height: 700px) {
  header {
    height: 48px;
    flex-basis: 48px;

    gap: 8px;
    padding: 8px 10px 0;
  }

  main {
    gap: 8px;
    padding: 0 10px calc(126px + env(safe-area-inset-bottom));
    overflow-y: auto;
  }

  #answerPanel {
    left: 10px;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom));
  }

  #roundText,
  #rules-button,
  #settings-button,
  .icon-button {
    height: 34px;
  }

  #map-container {
    min-height: 120px;
  }

  #textAnswerPanel {
    gap: 8px;
  }

  button,
  #answerInput {
    padding: 10px;
  }

  .button-row,
  #multipleChoicePanel {
    gap: 8px;
  }

  .choice-button {
    min-height: 48px;
    padding: 8px 6px;
  }
}


@media (max-width: 420px) {
  main {
    padding-bottom: calc(184px + env(safe-area-inset-bottom));
  }

  #multipleChoicePanel {
    grid-template-columns: 1fr;
  }

  .choice-button {
    min-height: 42px;
  }
}

/* Instellingen */

.icon-button {
  width: 100%;
  height: 36px;

  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.settings-overlay {
  position: fixed;
  inset: 0;

  background: rgba(0,0,0,0.35);

  display: flex;
  justify-content: center;
  align-items: center;

  padding: 18px;

  z-index: 1000;
}

.settings-overlay.hidden {
  display: none;
}


.settings-modal {
  width: min(100%, 460px);

  max-height: calc(100vh - 36px);

  overflow-y: auto;

  background: var(--background);
  color: var(--main-color);

  border: 2px solid var(--main-color);
  border-radius: 8px;

  padding: 24px;

  position: relative;
}


.close-button {
  position: absolute;

  top: 16px;
  right: 16px;
}


/* Startscherm en resultaat */

#startOverlay,
#resultPanel {
  position: absolute;
  inset: 0;

  z-index: 500;

  background: var(--background);

  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;

  text-align: center;

  gap: 16px;
  padding: 24px;
}


#startGameButton,
#nextRoundButton {
  padding: 14px 28px;
}


#resultTitle {
  margin: 0;
}

#roundScoreText,
#totalScoreText {
  font-weight: bold;
}
