/* Planšetes ievades skats. Paredzēts stāvus lietošanai; lieli pieskāriena laukumi. */
html, body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body.tablet {
  background: var(--carmine);
  color: var(--white);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.app {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  height: var(--vvh, 100dvh);
  transform: translateY(var(--vv-top, 0px));
  display: flex;
  flex-direction: column;
  padding: max(20px, env(safe-area-inset-top)) max(28px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(28px, env(safe-area-inset-left));
  overflow: hidden;
}

.t-cloud {
  position: absolute;
  left: 50%;
  bottom: -18vh;
  width: max(150vw, 1100px);
  aspect-ratio: 2.1;
  transform: translateX(-50%);
  background: url("/img/cloud.svg") center / contain no-repeat;
  opacity: 0.55;
  pointer-events: none;
}

.t-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: none;
}

.t-logo {
  height: clamp(64px, 11vh, 110px);
  width: auto;
  margin: -12px 0 0 -20px;
}

.t-demo {
  padding: 6px 16px;
  border: 2px solid var(--coral);
  border-radius: 999px;
  color: var(--coral);
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.12em;
}

.t-main {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding-bottom: 4vh;
}

.t-question {
  margin: 0 0 clamp(20px, 4vh, 44px);
  font-weight: 800;
  font-size: clamp(32px, 5.4vw, 60px);
  line-height: 1.08;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.t-form[hidden] { display: none; }

.t-form {
  display: flex;
  flex-direction: column;
}

.t-hint {
  margin-bottom: 12px;
  font-weight: 500;
  font-size: clamp(19px, 2.4vw, 24px);
  color: var(--lilac);
}

.t-input {
  display: block;
  width: 100%;
  min-height: 2.6em;
  resize: none;
  padding: 16px 20px;
  font: 700 clamp(26px, 3.6vw, 36px) / 1.2 var(--font);
  color: var(--white);
  background: rgba(255, 255, 255, 0.07);
  border: 2px solid rgba(200, 200, 220, 0.45);
  border-radius: 18px;
  outline: none;
  caret-color: var(--coral);
  transition: border-color 160ms ease, background-color 160ms ease;
  -webkit-appearance: none;
  appearance: none;
}

.t-input:focus {
  border-color: var(--coral);
  background: rgba(255, 255, 255, 0.1);
}

.t-input[aria-invalid="true"] {
  border-color: var(--coral);
}

.t-input:read-only { opacity: 0.75; }

.t-meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  min-height: 34px;
  margin: 10px 2px 18px;
}

.t-message {
  margin: 0;
  font-weight: 500;
  font-size: clamp(17px, 2.2vw, 21px);
  line-height: 1.3;
  color: var(--pink);
}

.t-message.is-error { color: #FF8A8D; font-weight: 700; }

.t-counter {
  flex: none;
  font-weight: 700;
  font-size: clamp(17px, 2.2vw, 21px);
  color: var(--lilac);
  font-variant-numeric: tabular-nums;
}

.t-counter.is-near { color: var(--pink); }
.t-counter.is-over { color: #FF8A8D; }

.t-submit {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: 100%;
  min-height: 84px;
  padding: 0 24px;
  border: 0;
  border-radius: 18px;
  background: var(--coral);
  color: var(--carmine);
  font: 800 clamp(26px, 3.4vw, 34px) / 1 var(--font);
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: transform 120ms ease, background-color 160ms ease, opacity 160ms ease;
}

.t-submit:active { transform: scale(0.985); background: #FF6367; }
.t-submit:focus-visible { outline: 3px solid var(--pink); outline-offset: 3px; }
.t-submit:disabled { cursor: default; }

.t-spinner {
  display: none;
  width: 26px;
  height: 26px;
  border: 3px solid rgba(75, 0, 35, 0.3);
  border-top-color: var(--carmine);
  border-radius: 50%;
  animation: t-spin 0.8s linear infinite;
}

.t-submit.is-sending .t-spinner { display: block; }
.t-submit.is-sending { opacity: 0.85; }

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

.t-paused {
  padding: 36px 32px;
  border: 2px solid rgba(200, 200, 220, 0.4);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.06);
}

.t-paused[hidden] { display: none; }

.t-paused-title {
  margin: 0 0 10px;
  font-weight: 800;
  font-size: clamp(26px, 3.4vw, 36px);
  color: var(--pink);
}

.t-paused-sub {
  margin: 0;
  font-weight: 500;
  font-size: clamp(18px, 2.3vw, 23px);
  color: var(--lilac);
}

.t-offline {
  position: relative;
  flex: none;
  margin: 0 auto;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.25);
  font-size: 16px;
  font-weight: 500;
  color: var(--pink);
  text-align: center;
}

.t-offline[hidden] { display: none; }

/* Apstiprinājums — tikai pēc servera apstiprinājuma. */
.t-thanks {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
  text-align: center;
  background: var(--carmine);
  animation: t-thanks-in 380ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.t-thanks[hidden] { display: none; }

.t-thanks-icon {
  width: clamp(96px, 16vmin, 150px);
  height: auto;
  margin-bottom: 18px;
  animation: t-pop 600ms cubic-bezier(0.3, 1.5, 0.5, 1) 80ms backwards;
}

.t-thanks-title {
  margin: 0;
  font-weight: 800;
  font-size: clamp(40px, 7vw, 72px);
  line-height: 1.05;
}

.t-thanks-sub {
  margin: 14px 0 0;
  font-weight: 500;
  font-size: clamp(19px, 2.6vw, 26px);
  color: var(--lilac);
}

.t-thanks-bar {
  width: min(320px, 60vw);
  height: 6px;
  margin-top: 36px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.t-thanks-bar span {
  display: block;
  height: 100%;
  background: var(--coral);
  transform-origin: 0 50%;
  animation: t-bar var(--thanks-ms, 2600ms) linear forwards;
}

@keyframes t-thanks-in { from { opacity: 0; } }
@keyframes t-pop { from { transform: scale(0.4); opacity: 0; } }
@keyframes t-bar { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* Atvērta ekrāna tastatūra vai zems ekrāns (ainava): kompakts izkārtojums. */
.app.is-compact .t-logo { height: 52px; margin-top: -10px; }
.app.is-compact .t-cloud { display: none; }
.app.is-compact .t-main { justify-content: flex-start; padding-bottom: 0; padding-top: 4px; }
.app.is-compact .t-question { font-size: clamp(22px, 3.2vw, 32px); margin-bottom: 12px; }
.app.is-compact .t-hint { display: none; }
.app.is-compact .t-input { min-height: 0; padding: 10px 16px; font-size: 26px; }
.app.is-compact .t-meta { margin: 6px 2px 10px; min-height: 26px; }
.app.is-compact .t-submit { min-height: 60px; font-size: 26px; }

.app.is-tiny .t-header { display: none; }
.app.is-tiny .t-question { font-size: 20px; margin-bottom: 8px; }

@media (prefers-reduced-motion: reduce) {
  .t-thanks, .t-thanks-icon { animation: none; }
  .t-spinner { animation-duration: 2s; }
}
