* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { width: 100%; height: 100%; overflow: hidden; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; user-select: none; }

/* ===== ФОН ===== */
.sky {
  position: fixed; inset: 0;
  background: linear-gradient(180deg,
    #0f0c29 0%, #302b63 25%, #7b2d8b 45%,
    #c0392b 58%, #e67e22 70%, #f39c12 76%,
    #1a6b8a 79%, #0d3349 100%);
  z-index: 0;
}
.sun {
  position: fixed; width: 68px; height: 68px;
  background: radial-gradient(circle, #fff9c4, #f9ca24, #f0932b);
  border-radius: 50%; top: 35%; left: 50%; transform: translateX(-50%);
  box-shadow: 0 0 40px 20px rgba(249,202,36,.4), 0 0 80px 40px rgba(240,147,43,.2);
  z-index: 1;
}
.mountains {
  position: fixed; bottom: 28%; width: 100%; height: 100px; z-index: 2;
  background:
    radial-gradient(ellipse 140px 90px at 16% 100%, #1a5c38 0%, transparent 70%),
    radial-gradient(ellipse 100px 70px at 84% 100%, #1a5c38 0%, transparent 70%),
    radial-gradient(ellipse 70px 55px at 50% 100%, #1d6b44 0%, transparent 70%);
}
.ocean {
  position: fixed; bottom: 0; width: 100%; height: 30%;
  background: linear-gradient(180deg, #1a6b8a 0%, #0d3349 60%, #081f2d 100%);
  z-index: 3; overflow: hidden;
}
.wave { position: absolute; width: 200%; height: 60px; top: -20px; left: -50%; border-radius: 43%; opacity: .55; }
.wave-1 { background: rgba(26,107,138,.8); animation: wave 7s linear infinite; }
.wave-2 { background: rgba(13,51,73,.6);   animation: wave 10s linear infinite reverse; top: -8px; }
.wave-3 { background: rgba(8,31,45,.5);    animation: wave 13s linear infinite; top: 4px; }
@keyframes wave { to { transform: rotate(360deg); } }

.palm { position: fixed; bottom: 27%; z-index: 4; }
.palm-left  { left: -14px; }
.palm-right { right: -14px; transform: scaleX(-1); }
.palm-trunk { width: 13px; height: 110px; background: linear-gradient(180deg,#5d4037,#795548,#4e342e); border-radius: 7px 7px 4px 4px; margin: 0 auto; transform: rotate(-8deg) translateY(8px); transform-origin: bottom center; }
.palm-leaves { position: absolute; top: -8px; left: 50%; transform: translateX(-50%) rotate(-8deg); transform-origin: bottom center; }
.leaf { position: absolute; width: 65px; height: 14px; background: linear-gradient(90deg,#1b5e20,#2e7d32,#43a047); border-radius: 50%; transform-origin: left center; }
.leaf-1{transform:rotate(-60deg) translateX(4px);}
.leaf-2{transform:rotate(-30deg) translateX(4px);}
.leaf-3{transform:rotate(0deg)   translateX(7px);}
.leaf-4{transform:rotate(30deg)  translateX(4px);}
.leaf-5{transform:rotate(60deg)  translateX(4px);}

/* ===== APP ===== */
.app { position: fixed; inset: 0; z-index: 10; display: flex; align-items: stretch; }
.screen { display: none; width: 100%; flex-direction: column; animation: fadeIn .3s ease; }
.screen.active { display: flex; }
@keyframes fadeIn { from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none} }

/* ===== ЭКРАН СТАРТА ===== */
#screen-start { align-items: center; justify-content: center; padding: 24px; }

.start-card {
  width: 100%; max-width: 380px;
  background: rgba(255,255,255,.12);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 32px;
  padding: 36px 28px 32px;
  text-align: center;
  box-shadow: 0 8px 40px rgba(0,0,0,.35);
  color: white;
  display: flex; flex-direction: column; align-items: center; gap: 24px;
}

.start-langs { display: flex; align-items: center; justify-content: center; gap: 20px; }
.start-side { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.start-flag { font-size: 52px; filter: drop-shadow(0 3px 6px rgba(0,0,0,.35)); }
.start-lang { font-size: 14px; font-weight: 600; color: rgba(255,255,255,.85); }
.start-divider { flex-shrink: 0; }

.start-desc {
  font-size: 15px; color: rgba(255,255,255,.7);
  line-height: 1.65; margin: 0;
}

.btn-start {
  width: 100%; padding: 20px;
  border: none; border-radius: 20px;
  background: linear-gradient(135deg, #11998e, #38ef7d);
  color: white; font-size: 18px; font-weight: 700;
  cursor: pointer; letter-spacing: .2px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  box-shadow: 0 6px 28px rgba(17,153,142,.55);
  transition: transform .15s, box-shadow .15s;
}
.btn-start:active { transform: scale(.96); box-shadow: 0 3px 14px rgba(17,153,142,.4); }
.btn-start-icon { font-size: 22px; }

/* ===== ЭКРАН LIVE ===== */
#screen-live { justify-content: space-between; }

.side {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  padding: 20px 24px;
  transition: background .4s;
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(255,255,255,.08);
}
.side.speaking { background: rgba(56,239,125,.07); }
.side.active-turn { background: rgba(56,239,125,.12); }
.side.active-turn .person-avatar {
  background: rgba(56,239,125,.2);
  border-color: rgba(56,239,125,.7);
}

/* Подсказка "нажми чтобы говорить" */
.tap-hint {
  font-size: 11px;
  color: rgba(255,255,255,.4);
  letter-spacing: .3px;
  margin-top: 2px;
  transition: opacity .3s;
}
.side.active-turn .tap-hint {
  color: rgba(56,239,125,.8);
  content: 'Говорите!';
}

.side-inner {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  width: 100%;
}
.flipped { transform: rotate(180deg); }

/* Аватар */
.person-avatar {
  position: relative;
  width: 88px; height: 88px;
  display: flex; align-items: center; justify-content: center;
  font-size: 50px;
  background: rgba(255,255,255,.1);
  border: 2px solid rgba(255,255,255,.2);
  border-radius: 50%;
  transition: background .3s, border-color .3s;
}
.person-avatar.speaking {
  background: rgba(56,239,125,.15);
  border-color: rgba(56,239,125,.6);
}
.person-avatar.translating {
  background: rgba(52,152,219,.15);
  border-color: rgba(52,152,219,.6);
}

.avatar-ring {
  position: absolute; inset: -6px;
  border-radius: 50%;
  border: 3px solid transparent;
  transition: border-color .25s, box-shadow .25s;
}
.person-avatar.speaking .avatar-ring {
  border-color: #38ef7d;
  box-shadow: 0 0 20px rgba(56,239,125,.6);
  animation: ring-pulse 1s ease-in-out infinite;
}
.person-avatar.translating .avatar-ring {
  border-color: #3498db;
  box-shadow: 0 0 20px rgba(52,152,219,.6);
  animation: ring-pulse 1.2s ease-in-out infinite;
}
@keyframes ring-pulse {
  0%,100%{box-shadow:0 0 16px rgba(56,239,125,.5);}
  50%{box-shadow:0 0 32px rgba(56,239,125,.9);}
}

.person-lang { font-size: 14px; font-weight: 600; color: rgba(255,255,255,.8); }

/* Пузырь речи */
.speech-bubble {
  min-height: 44px; width: 100%; max-width: 280px;
  background: rgba(0,0,0,.28);
  border-radius: 16px;
  padding: 10px 14px;
  font-size: 15px; color: rgba(255,255,255,.9); line-height: 1.45;
  text-align: center;
  opacity: 0; transition: opacity .3s;
}
.speech-bubble.visible { opacity: 1; }
.speech-bubble.translated { border-left: 3px solid #38ef7d; color: #a8f0c6; }

/* ===== ЦЕНТР ===== */
.center-panel {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  padding: 12px 24px;
  flex-shrink: 0;
}

.status-pill {
  display: flex; align-items: center; gap: 10px;
  background: rgba(0,0,0,.35);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 50px;
  padding: 10px 20px;
  color: white; font-size: 14px; font-weight: 500;
}

.status-dots { display: flex; gap: 5px; align-items: center; }
.sdot {
  width: 7px; height: 7px; border-radius: 50%;
  background: rgba(255,255,255,.4);
  animation: sdot-bounce 1.4s ease-in-out infinite;
}
.sdot:nth-child(2){animation-delay:.18s;}
.sdot:nth-child(3){animation-delay:.36s;}

.status-pill.listening .sdot  { background: #38ef7d; }
.status-pill.speaking .sdot   { background: #f9ca24; }
.status-pill.translating .sdot{ background: #3498db; }
.status-pill.idle .sdot       { background: rgba(255,255,255,.25); animation: none; }

@keyframes sdot-bounce {
  0%,80%,100%{transform:scale(.7);opacity:.5;}
  40%{transform:scale(1.2);opacity:1;}
}

.btn-stop {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 22px;
  border: 1.5px solid rgba(255,255,255,.3);
  border-radius: 50px;
  background: rgba(231,76,60,.25);
  color: rgba(255,255,255,.85);
  font-size: 14px; font-weight: 600;
  cursor: pointer;
  transition: background .2s;
}
.btn-stop:active { background: rgba(231,76,60,.5); }

/* ===== ШАПКА С ЛОГОТИПОМ ===== */
.app-header {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  pointer-events: none;
}
.voicecode-logo {
  font-family: 'SF Mono', 'Fira Code', 'Menlo', 'Courier New', monospace;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 3px;
  color: white;
  border: 1.5px solid #7dd8f8;
  border-radius: 10px;
  padding: 5px 16px;
  background: rgba(125,216,248,.08);
  backdrop-filter: blur(6px);
  white-space: nowrap;
  user-select: none;
}

/* ===== ЭКРАН ЗАВЕРШЕНИЯ ===== */
#screen-done { align-items: center; justify-content: center; padding: 24px; }
.done-icon { font-size: 64px; }
.done-title { font-size: 22px; font-weight: 700; }
