:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #fbfdff;
  color: #17201b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: linear-gradient(180deg, #ffffff 0%, #f2f9fb 100%);
  overflow: hidden;
}

button {
  min-height: 52px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(90deg, #dc3b96 0%, #13bfe5 100%);
  color: #fff;
  font: inherit;
  font-weight: 750;
  text-transform: uppercase;
}

.app {
  width: min(100%, 480px);
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  padding: clamp(14px, 3dvh, 28px) 18px;
  overflow: hidden;
}

.screen {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: clamp(12px, 2.4dvh, 24px);
  overflow: hidden;
}

.hidden {
  display: none !important;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 1.75rem;
  line-height: 1.08;
}

header {
  display: grid;
  justify-items: center;
  text-align: center;
}

header p {
  margin-top: 6px;
  color: #566672;
  font-size: clamp(0.95rem, 2.4dvh, 1.1rem);
}

.product-logo {
  display: grid;
  gap: 2px;
  margin-bottom: clamp(4px, 1.2dvh, 10px);
  line-height: 1;
  justify-items: center;
}

.product-logo span,
.product-logo strong {
  display: block;
}

.product-logo span {
  color: #101925;
  font-size: clamp(1.85rem, min(12vw, 7dvh), 3.45rem);
  font-weight: 500;
  letter-spacing: 0;
}

.product-logo strong {
  width: fit-content;
  background: linear-gradient(90deg, #df3592 0%, #8f6ad4 52%, #12bfe6 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-size: clamp(2rem, min(13vw, 7.4dvh), 3.65rem);
  font-weight: 650;
  letter-spacing: 0;
}

.product-logo.compact span {
  font-size: clamp(1.1rem, 3dvh, 1.45rem);
}

.product-logo.compact strong {
  font-size: clamp(1.2rem, 3.2dvh, 1.55rem);
}

h2 {
  margin-top: 10px;
  font-size: 1.05rem;
  color: #334a54;
}

.language-list {
  display: grid;
  gap: clamp(8px, 1.4dvh, 10px);
  overflow-y: auto;
  padding-bottom: 2px;
}

.diagnostics {
  display: grid;
  gap: 8px;
}

.name-field {
  display: grid;
  gap: 7px;
}

.name-field span {
  color: #334a54;
  font-size: 0.9rem;
  font-weight: 800;
}

.name-field input {
  width: 100%;
  min-height: 50px;
  padding: 0 14px;
  border: 1px solid #dbeaf0;
  border-radius: 8px;
  background: #fff;
  color: #17201b;
  font: inherit;
  outline: none;
  box-shadow: 0 8px 24px rgb(15 74 96 / 6%);
}

.name-field input:focus {
  border-color: #13bfe5;
  box-shadow: 0 0 0 3px rgb(19 191 229 / 14%);
}

.diagnostic {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #dbeaf0;
  font-size: 0.9rem;
}

.diagnostic strong {
  color: #13a8d2;
}

.diagnostic.bad strong {
  color: #a43131;
}

.diagnostic small {
  grid-column: 1 / -1;
  color: #53665d;
  overflow-wrap: anywhere;
}

.language-button {
  width: 100%;
  min-height: clamp(52px, 8dvh, 62px);
  padding: 0 16px;
  display: grid;
  grid-template-columns: 44px 1fr 28px;
  align-items: center;
  text-align: left;
  background: #fff;
  color: #17201b;
  border: 1px solid #dbeaf0;
  box-shadow: 0 8px 24px rgb(15 74 96 / 8%);
  text-transform: none;
}

.language-button .flag {
  font-size: 1.8rem;
}

.language-button .play {
  color: #13a8d2;
  font-size: 1.2rem;
  text-align: right;
}

.language-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

footer {
  display: grid;
  gap: 6px;
  margin-top: auto;
  color: #566672;
  text-align: center;
}

.brand-footer,
.listen-brand-footer {
  color: #7b8794;
  font-size: 0.76rem;
}

.listen-brand-footer {
  margin-top: 0;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  color: #13a8d2;
  text-transform: uppercase;
}

.status::before {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: currentColor;
  content: "";
}

.tap-to-resume {
  display: grid;
  gap: 4px;
  justify-items: center;
  text-align: center;
  margin: 0 auto;
  padding: 14px 18px;
  border: 1px solid rgba(255, 210, 80, 0.55);
  border-radius: 14px;
  background: rgba(255, 193, 7, 0.12);
  animation: resume-pulse 1.6s ease-in-out infinite;
}

.tap-to-resume strong {
  font-size: 1.02rem;
}

.tap-to-resume span {
  font-size: 0.85rem;
  opacity: 0.75;
}

.tap-to-resume.hidden {
  display: none;
}

@keyframes resume-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.35); }
  50% { box-shadow: 0 0 0 10px rgba(255, 193, 7, 0); }
}

button.attention {
  animation: resume-pulse 1.6s ease-in-out infinite;
  border-color: rgba(255, 193, 7, 0.7);
}

.now-playing {
  margin-top: clamp(4px, 2dvh, 24px);
  display: grid;
  gap: clamp(6px, 1.4dvh, 14px);
  justify-items: center;
  text-align: center;
}

.selected-language {
  font-size: clamp(1.55rem, 4.5dvh, 2rem);
  font-weight: 850;
}

.subtitles {
  flex: 1;
  min-height: 0;
  display: grid;
  align-items: end;
  padding: clamp(4px, 1dvh, 8px) 4px;
  overflow: hidden;
}

.subtitle-lines {
  max-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding-right: 4px;
  scroll-behavior: smooth;
}

.subtitle-lines p {
  margin: 0;
  color: #17201b;
  font-size: 1.28rem;
  font-weight: 750;
  line-height: 1.32;
  overflow-wrap: anywhere;
  text-align: center;
}

.subtitle-lines p:not(:last-child) {
  color: #53665d;
  font-size: 1.08rem;
  font-weight: 650;
}

.subtitle-lines .placeholder {
  color: #53665d;
  text-align: center;
}

.actions {
  margin-top: auto;
  display: grid;
  gap: clamp(8px, 1.4dvh, 12px);
  flex: 0 0 auto;
}

.question-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid #dbeaf0;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 24px rgb(15 74 96 / 6%);
}

.question-panel div {
  display: grid;
  gap: 3px;
}

.question-panel strong {
  color: #17201b;
  font-size: 0.95rem;
}

.question-panel span {
  color: #566672;
  font-size: 0.84rem;
  line-height: 1.35;
}

.question-panel button {
  min-height: 42px;
  padding: 0 12px;
  font-size: 0.82rem;
  white-space: nowrap;
}

.question-panel.speaking {
  border-color: #13bfe5;
  background: #f1fbfe;
}

.secondary {
  background: #eaf5f8;
  color: #135668;
}

.debug {
  max-height: 240px;
  margin: 0;
  overflow: auto;
  padding: 12px;
  border-radius: 0 0 8px 8px;
  background: #17201b;
  color: #dff5ea;
  font-size: 0.78rem;
  white-space: pre-wrap;
}

.debug-panel {
  margin-top: 10px;
  border: 1px solid #b9cad1;
  border-radius: 8px;
  background: #fff;
}

.debug-panel summary {
  padding: 10px 12px;
  color: #173f50;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}

@media (max-height: 720px) {
  button {
    min-height: 46px;
  }

  .subtitle-lines p {
    font-size: 1.12rem;
  }

  .subtitle-lines p:not(:last-child) {
    font-size: 0.98rem;
  }
}
