:root {
  --mobile-accent: #f5c518;
  --mobile-accent-dark: #e0ad00;
  --mobile-glass: rgba(255, 255, 255, 0.92);
  --mobile-glass-border: rgba(226, 232, 240, 0.95);
  --mobile-text: #1e293b;
  --mobile-muted: #64748b;
  --mobile-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
  --dock-height: 290px;
}

body.mobile-ui {
  background: #e8ecef;
  color: var(--mobile-text);
  min-height: 100vh;
  overflow-x: hidden;
}

body.mobile-ui.has-dock {
  padding-bottom: var(--dock-height);
}

body.mobile-ui.dock-keyboard-hidden {
  --dock-height: 64px;
  padding-bottom: var(--dock-height);
}

.mobile-shell {
  position: relative;
  z-index: 1;
  width: min(430px, 100%);
  min-height: calc(100vh - var(--dock-height));
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding: 0 1rem;
}

.mobile-topbar {
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 0 0.75rem;
}

.topbar-spacer {
  width: 42px;
  height: 42px;
}

.mobile-topbar h2 {
  text-align: center;
  font-size: 1rem;
  font-weight: 600;
  color: var(--mobile-text);
}

.topbar-btn {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: #fff;
  border: 1px solid #e2e8f0;
  color: var(--mobile-text);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
  transition: transform 0.15s ease;
}

.topbar-btn:active {
  transform: scale(0.95);
}

.screen {
  display: none;
  flex-direction: column;
  flex: 1;
}

.screen.active {
  display: flex;
}

.mobile-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0.25rem 0 1rem;
}

.mobile-subtitle {
  text-align: center;
  color: var(--mobile-muted);
  font-size: 0.92rem;
  line-height: 1.55;
  margin: 0.5rem auto 1.25rem;
  max-width: 320px;
}

.glass-panel {
  width: 100%;
  background: var(--mobile-glass);
  border: 1px solid var(--mobile-glass-border);
  border-radius: 22px;
  padding: 1.35rem 1.25rem;
  box-shadow: var(--mobile-shadow);
}

.phone-entry-block label {
  display: block;
  font-size: 0.82rem;
  color: var(--mobile-muted);
  margin-bottom: 0.5rem;
}

.phone-big-display {
  font-size: clamp(1.4rem, 5.5vw, 1.85rem);
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--mobile-text);
  min-height: 2.4rem;
  margin-bottom: 1rem;
}

.phone-big-display .phone-placeholder {
  color: #cbd5e1;
  font-weight: 600;
}

.otp-row {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: nowrap;
  margin: 0.5rem 0 1rem;
}

.otp-cell {
  width: 48px;
  height: 56px;
  border-radius: 14px;
  background: #fff;
  border: 2px solid #e2e8f0;
  display: grid;
  place-items: center;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--mobile-text);
  transition: all 0.2s ease;
}

.otp-cell.active {
  border-color: #6366f1;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

.otp-cell.filled {
  border-color: #a5b4fc;
  background: #f8fafc;
}

.code-otp-cell {
  width: 44px;
  height: 52px;
  font-size: 1.15rem;
}

.btn-yellow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  width: 100%;
  padding: 1rem 1.25rem;
  border: none;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--mobile-accent) 0%, var(--mobile-accent-dark) 100%);
  color: #1f2937;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(245, 197, 24, 0.32);
  transition: transform 0.15s ease;
}

.btn-yellow:active:not(:disabled) {
  transform: scale(0.98);
}

.btn-yellow:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.mobile-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  background: transparent;
  border-top: none;
  box-shadow: none;
  padding: 0.5rem 1rem calc(0.5rem + env(safe-area-inset-bottom));
  pointer-events: none;
}

.mobile-dock > * {
  pointer-events: auto;
}

.vk-board {
  width: min(430px, 100%);
  margin: 0 auto 0.45rem;
  background: transparent;
}

.vk-board.is-hidden {
  display: none;
}

.vk-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  padding: 0.15rem 0;
}

.vk-key {
  height: 50px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.35);
  font-family: inherit;
  font-size: 1.28rem;
  font-weight: 600;
  color: var(--mobile-text);
  cursor: pointer;
  transition: transform 0.1s ease, background 0.15s ease;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.07);
}

.vk-key:active,
.vk-key.vk-key-pressed {
  transform: scale(0.94);
  background: rgba(255, 255, 255, 0.85);
}

.vk-key-empty {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  pointer-events: none;
}

.vk-key-back {
  font-size: 1.15rem;
  color: #475569;
}

.bottom-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  width: min(430px, 100%);
  margin: 0 auto;
}

.bottom-nav-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: auto;
  max-width: 100%;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  border: none;
  color: var(--mobile-muted);
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.25;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(8px);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
  text-align: center;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
}

.bottom-nav-item i {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.bottom-nav-item.active {
  background: rgba(238, 242, 255, 0.95);
  color: #4338ca;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.15);
}

.ai-orb-wrap {
  width: 200px;
  height: 200px;
  display: grid;
  place-items: center;
  position: relative;
  margin: 0 auto;
}

.ai-orb-glow {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.28) 0%, rgba(139, 92, 246, 0) 70%);
  pointer-events: none;
}

.ai-orb {
  width: 132px;
  height: 132px;
  border-radius: 50%;
  background: linear-gradient(145deg, #6366f1 0%, #8b5cf6 45%, #ec4899 100%);
  box-shadow: 0 0 50px rgba(139, 92, 246, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  animation: orbPulse 2.8s ease-in-out infinite;
  position: relative;
  z-index: 1;
}

.ai-orb span {
  width: 10px;
  height: 32px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  animation: orbBars 1.4s ease-in-out infinite;
}

.ai-orb span:nth-child(2) {
  animation-delay: 0.2s;
}

.ai-orb-ring {
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  border: 2px solid rgba(99, 102, 241, 0.2);
  animation: orbRing 4s linear infinite;
}

.ai-orb.recording {
  animation: orbPulseActive 0.8s ease-in-out infinite;
}

.ai-orb.processing span {
  animation: orbBars 0.7s ease-in-out infinite;
}

.record-content {
  justify-content: space-between;
  min-height: calc(100vh - var(--dock-height) - 72px);
}

.record-hint {
  margin-bottom: 0.75rem;
}

.voice-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 0.5rem 0 1rem;
}

.record-status {
  min-height: 1.4rem;
  text-align: center;
  font-size: 0.88rem;
  color: #6366f1;
  font-weight: 500;
  padding: 0 1rem;
}

.record-alert-wrap {
  width: 100%;
}

.record-actions {
  width: 100%;
  padding-top: 0.5rem;
}

.mic-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  margin-top: 0.25rem;
}

.mic-hold-hint,
.mic-speaking-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: #6366f1;
  letter-spacing: 0.01em;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.mic-hold-hint.is-hidden,
.record-hint.is-hidden {
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  visibility: hidden;
  height: 0;
  margin: 0;
  overflow: hidden;
}

.mic-speaking-label {
  color: #ec4899;
  animation: speakPulse 0.9s ease-in-out infinite;
}

.mic-btn-large {
  width: 84px;
  height: 84px;
  font-size: 2rem;
  position: relative;
}

.mobile-ui .mic-btn {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: linear-gradient(145deg, #6366f1, #8b5cf6);
  box-shadow: 0 14px 32px rgba(99, 102, 241, 0.3);
  border: 3px solid rgba(255, 255, 255, 0.85);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.mic-btn-ring {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid rgba(99, 102, 241, 0.35);
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.mic-wrap:hover .mic-btn:not(.recording) {
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 18px 36px rgba(99, 102, 241, 0.38);
}

.mic-wrap:hover .mic-btn-ring {
  opacity: 1;
  transform: scale(1);
  animation: micRingPulse 1.6s ease-out infinite;
}

.mic-wrap:active .mic-btn:not(.recording),
.mic-btn:active:not(.recording) {
  transform: translateY(-2px) scale(1.03);
}

.mic-wrap:active .mic-btn-ring,
.mic-btn:focus-visible .mic-btn-ring {
  opacity: 1;
  transform: scale(1);
  animation: micRingPulse 1.6s ease-out infinite;
}

.mobile-ui .mic-btn.recording {
  background: linear-gradient(145deg, #ec4899, #8b5cf6);
  transform: scale(1.08);
  box-shadow: 0 0 0 10px rgba(236, 72, 153, 0.12);
}

@keyframes micRingPulse {
  0% { transform: scale(1); opacity: 0.75; }
  100% { transform: scale(1.22); opacity: 0; }
}

@keyframes speakPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

@keyframes orbPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

@keyframes orbPulseActive {
  0%, 100% { transform: scale(1.06); }
  50% { transform: scale(1.12); }
}

@keyframes orbBars {
  0%, 100% { transform: scaleY(1); }
  50% { transform: scaleY(0.55); }
}

@keyframes orbRing {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.record-panel,
.check-panel {
  width: 100%;
}

.mobile-ui .transcript-box {
  display: none !important;
}

.success-box {
  text-align: center;
}

.success-note {
  margin: 0.35rem auto 0.85rem;
  max-width: 300px;
  font-size: 0.88rem;
  line-height: 1.55;
}

.success-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.1rem;
}

.btn-compact {
  width: 100%;
  padding: 0.72rem 1rem;
  font-size: 0.92rem;
  font-weight: 600;
  border-radius: 14px;
  min-height: 46px;
}

.success-actions .btn-yellow {
  padding: 0.72rem 1rem;
  font-size: 0.92rem;
  font-weight: 600;
  box-shadow: 0 8px 18px rgba(245, 197, 24, 0.24);
}

.success-actions .btn-outline {
  padding: 0.68rem 1rem;
  font-size: 0.92rem;
  font-weight: 600;
  border-width: 1.5px;
}

.success-title {
  font-size: 1.25rem;
  margin: 0.75rem 0 0.35rem;
}

.mobile-ui .code-display {
  margin: 0.85rem 0 0.25rem;
}

.mobile-ui .code-display span {
  background: #fff;
  border: 2px solid #c7d2fe;
  color: #4338ca;
  border-radius: 12px;
  width: 40px;
  height: 48px;
  font-size: 1.1rem;
}

.pdf-panel {
  width: 100%;
  margin-top: 1rem;
  padding: 1.15rem;
  border-radius: 18px;
  background: #fff;
  border: 1px solid #e2e8f0;
}

.pdf-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.pdf-panel-header h3 {
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-yellow.btn-inline {
  width: auto;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
}

.mobile-ui .alert {
  width: 100%;
  margin-bottom: 0.75rem;
  border-radius: 12px;
}

.mobile-result-card {
  width: 100%;
  margin-top: 0.75rem;
}

.phone-full {
  font-weight: 600;
  color: #0f766e;
  letter-spacing: 0.02em;
}

@media (min-width: 768px) {
  .mobile-shell {
    padding-top: 0.5rem;
  }
}

body.mobile-ui .letter-fullscreen,
body.mobile-ui .result-fullscreen {
  background: #e8ecef;
}

body.mobile-ui .letter-fullscreen-topbar,
body.mobile-ui .result-fullscreen-topbar {
  padding-left: 0.75rem;
  padding-right: 0.75rem;
}

body.mobile-ui .letter-fullscreen-body,
body.mobile-ui .result-fullscreen-body {
  padding: 0.75rem 0.5rem 1rem;
}
