.activity-editor-state,
.activity-editor-saving {
  position: fixed;
  inset: 0;
  z-index: 360;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(7, 20, 18, .58);
}

.activity-editor-state > i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #1bbeaa;
}

.activity-editor-state__panel {
  width: min(360px, calc(100vw - 32px));
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .28);
}

.activity-editor-state__panel button {
  margin-top: 16px;
  border: 0;
  padding: 10px 14px;
  color: #fff;
  background: #1bbeaa;
  font: 800 14px 'Nunito', sans-serif;
  cursor: pointer;
}

.activity-editor-error,
.activity-editor-saving {
  color: #fff;
  font: 800 13px 'Nunito', sans-serif;
}

.activity-editor-error {
  position: fixed;
  top: 12px;
  left: 50%;
  z-index: 420;
  width: min(520px, calc(100vw - 24px));
  padding: 10px 12px;
  transform: translateX(-50%);
  background: #c83c4e;
  border-radius: 6px;
}

.activity-editor-saving {
  z-index: 410;
}

.score-keyboard-panel {
  overscroll-behavior: none;
  touch-action: none;
}

.score-keyboard-panel.series-counter-keyboard {
  touch-action: pan-y;
}

.series-counter-keyboard button {
  touch-action: manipulation;
}

.series-counter-keyboard .round-distance-wheel {
  touch-action: pan-y;
}

.record-editor-root select {
  font-size: 13px !important;
}

.long-text-editor-overlay {
  overscroll-behavior: none;
  touch-action: auto;
}

.long-text-editor-overlay > * {
  opacity: 1;
  transform: none;
}

.long-text-editor-overlay textarea {
  touch-action: pan-y;
}

.record-date-time-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, .98fr) minmax(0, .76fr);
  gap: 8px;
  margin-bottom: 12px;
}

@media (max-width: 390px) {
  .record-date-time-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, .95fr) minmax(0, .7fr);
    gap: 6px;
  }
}

@keyframes longTextEditorOpen {
  from { opacity: 0; transform: scale(.94) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.chat-modal-panel {
  max-height: calc(100vh - 24px);
  overflow: auto;
}

:root {
  --viewport-bottom-obstruction: 0px;
  --visual-viewport-height: 100vh;
  --visual-viewport-offset-top: 0px;
  --keyboard-cover-space: 0px;
  --ios-home-indicator-space: 0px;
  --ios-browser-toolbar-space: 0px;
}

@media (max-width: 767px) and (hover: none) {
  html,
  body,
  #root,
  #app {
    overflow-x: hidden !important;
    overscroll-behavior-x: none;
  }

  input,
  select,
  textarea {
    font-size: 16px !important;
  }

  select {
    /* Keep Safari's anti-zoom threshold while rendering the selected text near 13px. */
    font-size-adjust: .44;
    -webkit-text-size-adjust: 100%;
  }

  .record-editor-root select {
    font-size: 16px !important;
    font-size-adjust: .44;
  }

  .technical-modal-panel {
    height: calc(var(--visual-viewport-height, 100vh) - 74px) !important;
    max-height: calc(var(--visual-viewport-height, 100vh) - 74px) !important;
    margin-bottom: var(--viewport-bottom-obstruction, 0px) !important;
    padding-bottom: 0 !important;
  }

  .score-keyboard-panel {
    padding-bottom: env(safe-area-inset-bottom, 0px) !important;
  }

  .record-page-panel.technical-modal-panel {
    height: var(--visual-viewport-height, 100dvh) !important;
    min-height: var(--visual-viewport-height, 100dvh) !important;
    max-height: var(--visual-viewport-height, 100dvh) !important;
    margin-bottom: 0 !important;
  }

  .record-editor-root {
    position: fixed !important;
    inset: 0 !important;
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 100vh !important;
    height: 100lvh !important;
    min-height: 100vh !important;
    min-height: 100lvh !important;
    overflow-x: hidden !important;
    overflow-y: hidden !important;
    background: var(--record-editor-bg, #fff) !important;
  }

  .record-editor-backdrop {
    display: none !important;
  }

  .record-page-panel {
    width: 100% !important;
    max-width: 100% !important;
    height: var(--visual-viewport-height, 100dvh) !important;
    max-height: var(--visual-viewport-height, 100dvh) !important;
    overflow-x: hidden !important;
    scroll-padding-bottom: 96px !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding-top: env(safe-area-inset-top, 0px) !important;
  }

  .record-page-panel .chat-modal-handle {
    display: none !important;
  }
}

@media (max-width: 767px) and (hover: none) {
  :root.is-standalone .record-page-panel.technical-modal-panel {
    padding-left: 0 !important;
    padding-right: 0 !important;
    padding-bottom: 0 !important;
  }

  :root.is-standalone .record-page-panel.technical-modal-panel .technical-specific-panel {
    padding: 0 !important;
    border-left: 0 !important;
    border-right: 0 !important;
    border-bottom: 0 !important;
    border-radius: 0 !important;
  }

  :root.is-standalone .record-page-panel.technical-modal-panel .technical-entry-card {
    border-left: 0 !important;
    border-right: 0 !important;
    border-bottom: 0 !important;
    border-radius: 0 !important;
  }

  :root.is-standalone .record-page-panel.technical-modal-panel .score-keyboard-panel {
    padding-bottom: env(safe-area-inset-bottom, 0px) !important;
  }
}

@media (max-width: 767px) {
  html,
  body,
  #root,
  #app {
    overflow-x: hidden !important;
    overscroll-behavior-x: none;
  }

  :root.record-editor-open .mobile-scroll-region {
    overflow: hidden !important;
  }

  :root.record-editor-open,
  :root.record-editor-open body,
  :root.record-editor-open #app {
    height: 100%;
    overflow: hidden !important;
    overscroll-behavior: none !important;
  }

  .record-editor-root {
    position: fixed !important;
    inset: 0 !important;
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 100vh !important;
    height: 100lvh !important;
    min-height: 100vh !important;
    min-height: 100lvh !important;
    overflow-x: hidden !important;
    overflow-y: hidden !important;
    overscroll-behavior: contain !important;
    touch-action: pan-y;
    background: var(--record-editor-bg, #fff) !important;
  }

  .record-page-panel {
    width: 100% !important;
    max-width: 100% !important;
    height: var(--visual-viewport-height, 100dvh) !important;
    min-height: var(--visual-viewport-height, 100dvh) !important;
    max-height: var(--visual-viewport-height, 100dvh) !important;
    overflow-x: hidden !important;
    overscroll-behavior: contain !important;
    -webkit-overflow-scrolling: touch;
    scroll-padding-bottom: 96px !important;
    background: var(--record-editor-bg, #fff) !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding-top: env(safe-area-inset-top, 0px) !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  :root.keyboard-open .record-page-panel:not(.technical-modal-panel) {
    padding-bottom: 0 !important;
  }

  .record-page-panel.technical-modal-panel {
    height: var(--visual-viewport-height, 100dvh) !important;
    min-height: var(--visual-viewport-height, 100dvh) !important;
    max-height: var(--visual-viewport-height, 100dvh) !important;
    margin-bottom: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    padding-bottom: 0 !important;
  }

  .record-page-panel .chat-modal-handle {
    display: none !important;
  }

  .record-page-panel.technical-modal-panel .technical-specific-panel {
    padding-left: 0 !important;
    padding-right: 0 !important;
    border-left: 0 !important;
    border-right: 0 !important;
  }

  .record-page-panel.technical-modal-panel .technical-entry-card {
    border-left: 0 !important;
    border-right: 0 !important;
    overscroll-behavior: contain !important;
  }

  .record-page-panel .score-table-scroll {
    overscroll-behavior: contain !important;
    -webkit-overflow-scrolling: touch;
  }

  .score-keyboard-panel {
    padding-bottom: env(safe-area-inset-bottom, 0px) !important;
  }
}

.round-distance-wheel {
  scrollbar-width: none;
}

.round-config-modal-root,
.round-config-modal-root * {
  font-family: var(--app-font-family) !important;
}

.round-distance-wheel::-webkit-scrollbar {
  display: none;
}

.round-preset-modal-root {
  align-items: center !important;
  box-sizing: border-box;
  min-height: 100dvh;
  overflow: hidden;
  overscroll-behavior: contain;
  padding: 16px !important;
}

.round-preset-modal-panel {
  border-radius: 18px !important;
  max-height: calc(100dvh - 32px);
  overflow: auto;
  overscroll-behavior: contain;
  transform: translateY(-12dvh);
}

@media (min-width: 768px) {
  .round-config-modal-root {
    align-items: center !important;
    padding: 32px !important;
  }

  .round-config-modal-panel {
    width: min(460px, calc(100vw - 64px)) !important;
    border-radius: 18px !important;
    padding-bottom: 12px !important;
  }

  .round-preset-modal-panel {
    transform: none;
  }

  .chat-modal-root {
    position: fixed !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 32px !important;
  }

  .chat-modal-panel {
    width: min(540px, calc(100vw - 64px)) !important;
    max-height: min(82vh, 720px) !important;
    overflow: auto !important;
    border-radius: 24px !important;
    padding-bottom: 24px !important;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .28) !important;
  }

  .chat-modal-handle {
    display: none !important;
  }

  .chat-modal-title {
    font-size: 20px !important;
    line-height: 1.2 !important;
  }

  .chat-modal-subtitle {
    font-size: 13px !important;
    line-height: 1.35 !important;
  }

  .chat-modal-panel button {
    font-size: 14px !important;
  }

}
