@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap');

:root {
  --bg-c: #F2F0EB;
  --fg-c: #181818;
  --top-c: #4D604C;
  --bottom-c: #8CA084;
  --click-c: #8CA084;
  --input-c: #BCC6AD;
  --warn-c: #F45A44;
  --halert-c: #FF0;
  --font-header: "Arial", sans-serif;
  --font-main: "Inter", sans-serif;
}

* {
  box-sizing: border-box;
}

html, body, #app {
  height: 100%;
  width: 100%;
  padding: 0px;
  margin: 0px;
}

body {
  font-size: 20px;
  position: fixed;
}

#app {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  min-width: 100%;
}

header {
  width: 100%;
  font-family: var(--font-header);
  font-weight: bold;
  background-color: var(--top-c);
  color: var(--bg-c);
  height: calc(3em + env(safe-area-inset-top));
  display: flex;
  justify-content: center;
  align-items: end;
  padding: 1em;
  position: relative;
}

header svg path {
  color: var(--bg-c) !important;
}

main {
  font-family: var(--font-main);
  background-color: var(--bg-c);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 1em;
  text-align: center;
  flex-grow: 1;
  max-width: 500px;
}

main svg path {
  color: var(--fg-c);
}

footer {
  width: 100%;
  background-color: var(--bottom-c);
  color: var(--bg-c);
  min-height: 60px;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

footer svg path {
  color: var(--bg-c) !important;
}

/* Sync log styles */
pre.sync-log {
  background: #f5f5f5;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: monospace;
  text-align: left;
}

nav {
  display: flex;
  justify-content: space-between;
  gap: 1em;
}

header nav {
  width: 100%;
}

header nav :first-child {
  flex: 1;
  text-align: left;
}

header nav :last-child {
  flex: 1;
  text-align: right;
}

header button.icon.back {
  position: absolute;
  left: 0em;
  bottom: 0.5em;
}

header .alert {
  color: var(--halert-c);
  text-transform: uppercase;
}

main img {
  max-width: 90%;
}

button {
  background-color: var(--click-c);
  border: none;
  border-radius: 5px;
  color: var(--bg-c);
  font-size: 1em;
  font-weight: bold;
  padding: 0.5em 1em;
  min-width: 10ch;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none !important;
}

.clickable {
  cursor: pointer;
}

button.icon {
  border: none;
  background: none;
  min-width: unset;
  padding: unset;
}

button.icon svg {
  width: 48px;
  height: 48px;
  padding: 8px;
}

label {
  display: block;
  width: 100%;
  text-align: left;
}

input {
  width: 100%;
  border: 1px solid var(--fg-c);
  background-color: var(--input-c);
  padding: 1em;
  margin-bottom: 1em;
}

.spread {
  display: flex;
  justify-content: space-between;
}

/*** specific styles ***/

.logo {
  width: 150px;
}

.logo-2x {
  width: 450px;
}

button.icon.play {
  border: 1px solid var(--fg-c);
  border-radius: 100px;
}

/*** profile page ***/

.profile img {
  width: 200px;
  border-radius: 500px;
  margin: auto;
  display: block;
}

/*** hurting level calibration scanner ***/

.scan p {
  display: flex;
  min-height: 4em;
  min-width: 20ch; /* fix visual popping */
  flex-direction: column;
  align-items: center;
  user-select: none;
}

.scan .logo {
  width: 100px;
}

.scanner {
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none !important;
}

.scanner * {
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none !important;
}

.scanner img {
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none !important;
  pointer-events: none;
}

.scanner p .progress {
  display: block;
  height: 10px;
  width: 190px;
  background-color: var(--top-c);
  margin: 0.5em;
}

.scanner p .progress .completed {
  display: block;
  background-color: var(--warn-c);
  height: 10px;
}

.scanline {
  visibility: hidden;
  transform: translateY(10px);
}

.scanning .scanline {
  /* animate scanline moving down 300px slowly */
  animation: scan 3s linear forwards;
  visibility: visible;
}

@keyframes scan {
  to {
    transform: translateY(160px);
  }
}

/*** map ***/

.mapview {
  flex-grow: 1;
  width: 100vw;
  height: 100%;
  margin-top: -1em;
}

.mapview .leaflet-container {
  height: 100%;
}

.mapview .assignment-popup {
  font-size: 1.25em;
  font-weight: bold;
  text-align: center;
}

.mapview .leaflet-popup-content {
  margin: 8px;
}

.mapview .leaflet-popup-tip, .mapview .leaflet-popup-content-wrapper {
  background: #8CA084;
  border: 1px solid white;
}

.mapview .pos-controls {
  z-index: 1000;
  position: absolute;
  margin-left: 10px;
  background: white;
  border: 2px solid rgba(0,0,0,0.2);
  background-clip: padding-box;
  top: 100px;
  width: 34px;
  border-radius: 3px;
}

.mapview .pos-controls > div {
  margin: 4px 0;
}

.mapview .player-marker {
  border: 0px;
  background-color: transparent;
}

.mapview .assignment-marker {
  border: 0px;
  background-color: transparent;
}

.mapview .user-position {
  transform: translate(-32px, -32px);
}

.mapview .assignment-position {
  transform: translate(-20px, -40px);
}

.map-info {
  flex-shrink: 0;
}

/*** loading spinner ***/

#loading {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 1em;
  justify-content: center;
  align-items: center;
  background-color: var(--bg-c);
  z-index: 9999;
}

.loader {
  display: flex;
  justify-content: center;
  align-items: center;
}

.loader div {
  animation: spin 0.33s linear infinite;
  width: 48px;
  height: 48px;
  border-radius: 24px;
  border: 3px solid transparent;
  border-left: 3px solid #4D604C;
  border-right: 3px solid #4D604C;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/*** Swiper styles ***/

.swiper {
  --swiper-theme-color: var(--click-c);
  --swiper-pagination-top: 16em;

  width: 100%;
  padding: 20px 0;
}

.swiper-wrapper {
  display: flex;
  max-width: 10px;
  user-select: none;
}

.swiper-slide {
  background-color: var(--input-c);
  border-radius: 10px;
  padding: 15px;
  min-height: 17em;
  display: flex !important;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  text-align: center;
  color: var(--fg-c);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transition: all 0.3s ease;
  cursor: pointer;
  transform: scale(0.9);
  height: 100%;
}

.swiper-slide:hover {
  transform: scale(0.95);
}

.swiper-slide.disabled {
  filter: grayscale(100%);
}

.swiper-slide.completed {
  background-color: #FBCD35;
}

.swiper-slide > * {
  margin-top: 0.25em;
  margin-bottom: 0.25em;
}

.swiper-slide img {
  width: 3em;
}

.swiper-slide-active {
  background-color: var(--click-c);
  color: var(--fg-c);
  opacity: 1;
  transform: scale(1);
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.swiper-pagination {
  margin-top: 1em;
  padding-top: 1em;
}

.progress-bar-container {
  width: 80%;
  margin: 20px auto;
}

.progress-bar {
  height: 10px;
  background-color: var(--input-c);
  border-radius: 5px;
  overflow: hidden;
}

.progress-bar-inner {
  height: 100%;
  background-color: var(--click-c);
  width: 0%;
  transition: width 0.1s linear;
}

.assignment img {
  width: 5em;
}

.subtitle {
  min-height: 6.5em;
  max-width: 90%;
  font-size: 1.25em;
}

.question {
  width: 100%;
}

.question button {
  margin-top: 20px;
  min-width: 200px;
}

/*** timer ***/

.time.expired {
  color: var(--warn-c);
}

/*** devices ***/

@media (max-width: 400px), (max-height: 600px) {
  main {
    font-size: 0.95em;
  }

  p {
    margin: 0.5em;
  }

  .logo {
    width: 100px;
  }

  nav {
    display: flex;
    justify-content: space-between;
    width: 100vw;
    gap: 1em;
  }

  footer nav button {
    padding: 0px;
    min-width: 0px;
    margin: 0px 1em;
  }

  footer {
    padding-bottom: 1.5em;
  }
}

/*** incoming call ***/

.incoming-call {
  text-align: center;
}

.chat-log {
  height: 200px;
  overflow-y: scroll;
  border: 1px solid #ccc;
  padding: 10px;
  background-color: #f9f9f9;
  text-align: left;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.record-button-container {
  -webkit-tap-highlight-color: transparent;
}

.record-button-large {
  background-color: var(--click-c);
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: none;
  margin: 20px auto;
  min-width: unset;
  display: block;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

.record-button-large.recording {
  background-color: red;
}

.chat-message {
  margin-bottom: 12px;
  line-height: 1.4;
}

.chat-message strong {
  text-transform: capitalize;
  color: var(--top-c);
}

.chat-message.user {
  text-align: right;
}

.chat-message.user strong {
  color: var(--click-c);
}

.chat-message.error {
  color: var(--warn-c);
  font-weight: bold;
}

.chat-message.error strong {
  color: var(--warn-c);
}

.chat-message.transmitting {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #888;
  font-style: italic;
}

.knight-rider-loader {
  display: inline-block;
  width: 50px;
  height: 5px;
  position: relative;
  background-color: #e0e0e0;
  border-radius: 2px;
  overflow: hidden;
}
.knight-rider-loader::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 10px;
  background-color: #888;
  animation: knight-rider 1.5s ease-in-out infinite;
}
@keyframes knight-rider {
  0% { transform: translateX(-10px); }
  50% { transform: translateX(50px); }
  100% { transform: translateX(-10px); }
}
