:root {
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-size: 26px;
  background-color: #27252b;
  color: #1c2024;
}

::selection {
  background: rgba(0, 0, 0, 0.14);
}

body {
  margin: 0;
  padding: 2rem;
}

#app {
  background-color: #c9e4ff;
  border-radius: 12px;
  padding: 1.5rem 2rem;
  box-shadow: 0 10px 30px rgba(16, 24, 32, 0.12);
}

h1 {
  display: flex;
  justify-content: center;
  font-family: 'Courier New', monospace;
  font-weight: 400;
  font-size: 1.2rem;
  text-shadow: 1px 1px 1px rgba(255, 255, 255, 0.5);
  white-space: nowrap;
  margin: 0;
  padding: 0;
  user-select: none;
  color: white;
  transition: color 500ms ease, opacity 500ms ease;
  animation: title-fade-in 500ms ease-out both;
}

@keyframes title-fade-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  h1 {
    animation: none;
  }

  .pane-fade-in {
    animation: none;
  }
}

.title-icon {
  width: 1.8rem;
  height: 1.8rem;
  display: block;
  flex-shrink: 0;
  align-self: flex-start;
}

h2 {
  margin: 0;
  font-size: 1rem;
}

main {
  display: grid;
  gap: 1rem;
}

.app-version {
  position: fixed;
  left: 0.75rem;
  bottom: 0.5rem;
  font-size: 0.6rem;
  font-family: 'Courier New', monospace;
  color: rgba(255, 255, 255, 0.55);
  user-select: none;
  pointer-events: none;
}

.toolbar {
  display: grid;
  gap: 0.5rem;
  align-items: center;
}

.model-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  border: 1px solid rgba(16, 24, 32, 0.16);
  border-radius: 999px;
  padding: 0.3rem 0.55rem 0.3rem 0.35rem;
  background: rgba(255, 255, 255, 0.8);
  color: inherit;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background-color 160ms ease-out, box-shadow 500ms ease-out,
    transform 160ms ease-out;
}

.model-switch:hover {
  background: rgba(255, 255, 255, 0.95);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(16, 24, 32, 0.1);
}

.model-switch:focus-visible {
  outline: 2px solid #1f2937;
  outline-offset: 2px;
}

.model-switch-track {
  width: 2.2rem;
  height: 1.2rem;
  border-radius: 999px;
  background: #a9b7c7;
  position: relative;
  transition: background-color 160ms ease-out;
}

.model-switch[aria-checked="true"] .model-switch-track {
  background: #3786da;
}

.model-switch-thumb {
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 50%;
  background: #ffffff;
  position: absolute;
  top: 0.15rem;
  left: 0.15rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 180ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.model-switch[aria-checked="true"] .model-switch-thumb {
  transform: translateX(1rem);
}

.model-switch-text {
  min-width: 5.4rem;
  text-align: center;
  font-weight: 600;
}

.language-picker {
  display: grid;
  gap: 0.45rem;
}

.language-picker-label {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: #243443;
}

.language-bubbles {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  gap: 0.45rem;
  width: 100%;
  min-width: 0;
  /* border: 1px solid rgba(16, 24, 32, 0.12); */
}

.language-bubble {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(16, 24, 32, 0.16);
  border-radius: 999px;
  padding: 0.4rem 0.75rem;
  background: rgba(255, 255, 255, 0.75);
  color: inherit;
  font: inherit;
  font-size: clamp(0.6rem, 2.8vw, 0.9rem);
  line-height: 1.1;
  text-align: center;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 500ms ease-out, border-color 500ms ease-out,
    box-shadow 220ms cubic-bezier(0.2, 0.8, 0.2, 1),
    transform 180ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.language-bubble:hover {
  background: rgba(255, 255, 255, 0.95);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(16, 24, 32, 0.1);
}

.language-bubble[data-selected="true"] {
  background: #3786da;
  border-color: #3786da;
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(14, 111, 215, 0.22);
}

.language-bubble:focus-visible {
  outline: 2px solid #1f2937;
  outline-offset: 2px;
}

.spinner {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  animation: spin 0.8s linear infinite;
}

.status-text {
  margin: 0;
  min-height: 1.25rem;
  font-size: 0.95rem;
}

.status-text-error {
  color: #9d1d1d;
}

.pane-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-sizing: border-box;
  width: calc(100vw - 4rem);
  max-width: 600px;
  position: fixed;
  left: 50%;
  top: 50vh;
  transform: translate(-50%, -50%);
  z-index: 1;
}

.pane-stack-connection-dot {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: #d32f2f;
  /* box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.85); */
  z-index: 2;
}

.pane-stack .pane {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(16, 24, 32, 0.12);
  border-radius: 10px;
  transition: height 500ms ease, transform 500ms ease, background-color 500ms ease, border-color 500ms ease;
}

.pane-stack .pane-textarea {
  min-height: 0;
  overflow: hidden;
  resize: none;
  transition: height 500ms ease;
}

.pane-stack-spinner {
  position: absolute;
  right: 0.75rem;
  bottom: 0.75rem;
  z-index: 1;
  border-color: rgba(0, 0, 0, 0.2);
  border-top-color: #000000;
}

.pane {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(16, 24, 32, 0.12);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  transition: height 500ms ease, transform 500ms ease, background-color 500ms ease, border-color 500ms ease, padding 500ms ease;
}

.pane-fade-in {
  animation: title-fade-in 500ms ease-out both;
}

.long-fade-in {
  animation: title-fade-in 500ms ease-in both;
}

.pane-no-header {
  display: flex;
}

.pane-transparent {
  background: transparent !important;
  border-color: transparent !important;
}

.pane-transparent .pane-textarea[readonly] {
  background: transparent;
}

.pane-transparent .pane-footer {
  background: transparent;
  border-top-color: transparent;
}

.pane-header {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid rgba(16, 24, 32, 0.12);
  background: rgba(255, 255, 255, 0.6);
}

.pane-textarea {
  box-sizing: border-box;
  width: 100%;
  min-height: 0;
  resize: none;
  border: 0;
  background: transparent;
  padding: 1rem;
  font: inherit;
  color: inherit;
  line-height: 1.45;
  outline: none;
  overflow: hidden;
  cursor: default;
  transition: height 500ms ease, transform 500ms ease, background-color 500ms ease, border-color 500ms ease, padding 500ms ease;
}

.pane-textarea::placeholder {
  color: #5c6672;
}

.pane-textarea[readonly] {
  background: rgba(255, 255, 255, 0.28);
  cursor: default;
  pointer-events: none;
}

.pane-footer {
  border-top: 1px solid rgba(16, 24, 32, 0.08);
  background: rgba(255, 255, 255, 0.18);
  padding: 0.65rem 1rem 0.75rem;
  min-width: 0;
  transition: height 500ms ease, transform 500ms ease, background-color 500ms ease, border-color 500ms ease, padding 500ms ease;
}

.transliteration-box {
  width: 100%;
  border: 0;
  background: transparent;
  color: #3c3519;
  padding: 0;
  cursor: pointer;
  border-radius: 0.5rem;
  overflow: hidden;
  transition: background-color 500ms ease, border-color 500ms ease, padding 500ms ease;
}

.transliteration-box:hover {
  background: rgba(50, 50, 50, 0.05);
}

.transliteration-box.is-collapsed:hover {
  background: rgba(255, 255, 255, 0.3);
}

.transliteration-box:disabled {
  cursor: default;
  pointer-events: none;
}

.transliteration-box:focus-visible {
  outline: 2px solid rgba(60, 53, 25, 0.35);
  outline-offset: 2px;
}

.transliteration-box.is-collapsed {
  padding: 0.1rem 0;
  background: rgba(255, 255, 255, 0.2);
}

.transliteration-collapsed-label {
  display: block;
  color: #5f5230;
  font-size: 0.84rem;
  min-height: 0;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  text-align: center;
  transition: max-height 500ms ease, opacity 350ms ease, padding 500ms ease;
}

.transliteration-collapsed-label.is-visible {
  min-height: 0.5em;
  max-height: 2rem;
  opacity: 1;
  padding: 0.1rem 0;
}

.transliteration-text {
  margin: 0;
  color: #3c3519;
  font-size: 0.92rem;
  line-height: 1.35;
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  text-align: center;
}

.transliteration-panel {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  padding-top: 0;
  padding-bottom: 0;
  border-top-color: transparent;
  /* transition: max-height 500ms ease, opacity 350ms ease, padding 500ms ease, border-color 500ms ease, background-color 500ms ease; */
}

.transliteration-panel.is-visible {
  max-height: 10rem;
  opacity: 1;
  padding-top: 0.65rem;
  padding-bottom: 0.75rem;
  border-top-color: rgba(16, 24, 32, 0.08);
}

.transliteration-box.has-value .transliteration-panel.is-visible {
  min-height: 1.35em;
}

@media (prefers-reduced-motion: reduce) {
  .pane,
  .pane-stack .pane,
  .pane-stack .pane-textarea,
  .pane-footer,
  .transliteration-collapsed-label,
  .transliteration-panel {
    transition: none;
  }
}

.pane-switch-row {
  width: 100%;
  max-width: 600px;
  margin-inline: auto;
  display: flex;
  justify-content: flex-end;
  margin-top: -0.35rem;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation: none;
  }

  .language-bubble,
  .translate-button,
  .model-switch,
  .model-switch-thumb,
  .model-switch-track {
    transition: background-color 120ms linear, border-color 120ms linear,
      box-shadow 120ms linear;
    transform: none;
  }
}

@media (max-width: 800px) {
  /* h1 {
    word-spacing: 0;
  } */

  /* body {
    padding: 1rem;
  }

  #app {
    padding: 1rem;
  } */

  /* .language-bubble { */
    /* font-size: clamp(0.6rem, 2.8vw, 0.9rem); */
  /* } */
}
