:root {
  --uz-bg: #1e3a5f;
  --uz-fg: #eaf2ff;
  --ja-bg: #ffffff;
  --ja-fg: #16202b;
  --accent: #e0574d;
  --accent-active: #ff7a6e;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
  font-family: "Hiragino Sans", "Yu Gothic", "Segoe UI", system-ui, sans-serif;
}

#app {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  width: 100vw;
}

.panel {
  flex: 1 1 50%;
  min-height: 0;
  display: flex;
}

.panel--uz {
  background: var(--uz-bg);
  color: var(--uz-fg);
  transform: rotate(180deg);
}

.panel--ja {
  background: var(--ja-bg);
  color: var(--ja-fg);
}

.panel__inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 14px 18px calc(14px + env(safe-area-inset-bottom, 0px));
  min-height: 0;
  width: 100%;
}

.panel--uz .panel__inner {
  padding: 14px 18px calc(14px + env(safe-area-inset-top, 0px));
}

.panel__header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  opacity: 0.7;
  flex: 0 0 auto;
}

.panel__flag { font-size: 18px; }

.panel__main {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  overflow-y: auto;
  padding: 6px 0;
}

.panel__main p {
  margin: 0;
  font-size: clamp(30px, 8vw, 52px);
  line-height: 1.3;
  font-weight: 600;
  word-break: break-word;
}

.panel__main .placeholder {
  opacity: 0.35;
  font-weight: 400;
  font-size: clamp(18px, 5vw, 26px);
}

.panel__interim {
  flex: 0 0 auto;
  min-height: 22px;
  font-size: 18px;
  opacity: 0.75;
  padding: 2px 0 8px;
  word-break: break-word;
}

.panel__controls {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.mic-btn {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}

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

.mic-btn.is-listening {
  background: var(--accent-active);
  animation: pulse 1.1s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 122, 110, 0.55); }
  70% { box-shadow: 0 0 0 14px rgba(255, 122, 110, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 122, 110, 0); }
}

.mic-btn.is-unsupported {
  opacity: 0.35;
  cursor: not-allowed;
}

.text-form {
  flex: 1 1 auto;
  display: flex;
  gap: 8px;
  min-width: 0;
}

.text-form input {
  flex: 1 1 auto;
  min-width: 0;
  border-radius: 20px;
  border: 1px solid rgba(128, 128, 128, 0.4);
  padding: 10px 16px;
  font-size: 16px;
  background: rgba(128, 128, 128, 0.08);
  color: inherit;
}

.panel--uz .text-form input::placeholder { color: rgba(234, 242, 255, 0.5); }
.panel--ja .text-form input::placeholder { color: rgba(22, 32, 43, 0.4); }

.text-form button {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(128, 128, 128, 0.18);
  color: inherit;
  font-size: 18px;
  cursor: pointer;
}

.divider {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 2px;
  background: rgba(0, 0, 0, 0.15);
  transform: translateY(-1px);
  pointer-events: none;
}

.toast {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 13px;
  max-width: 80vw;
  text-align: center;
  z-index: 20;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.toast.is-visible {
  opacity: 1;
}
