:root {
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
}

html,
body {
  height: 100%;
}

body {
  background-color: #ecebe9;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100dvh;
  overflow: hidden;
  font-family:
    "Noto Sans JP",
    "Noto Sans KR",
    Outfit,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    sans-serif;
}

.app-container {
  background-color: #fdfcfb;
}

.app-container,
#top-header,
#src-row,
#back-row,
#target-wrap,
footer,
.show-button,
#status-row {
  transition:
    opacity 0.28s ease,
    transform 0.36s cubic-bezier(0.16, 1, 0.3, 1),
    border-radius 0.36s cubic-bezier(0.16, 1, 0.3, 1),
    background-color 0.36s ease,
    padding 0.36s cubic-bezier(0.16, 1, 0.3, 1);
}

.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Source text */
.src-label {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #a1a1aa;
}

.src {
  margin: 0;
  font-size: clamp(18px, 4.6vw, 22px);
  line-height: 1.5;
  font-weight: 500;
  color: #27272a;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.src.placeholder {
  color: #c8cad0;
}

/* Hero translation */
.target {
  margin: 0;
  font-size: clamp(34px, 7.5vw, 60px);
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-weight: 800;
  color: #0c0a09;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  width: 100%;
  align-self: flex-start;
}

.target.placeholder {
  font-weight: 600;
  color: #d4d4d8;
}

#target-wrap.is-recording {
  box-shadow:
    0 8px 30px -12px rgba(239, 68, 68, 0.25),
    inset 0 0 0 1px rgba(239, 68, 68, 0.18);
}

/* Show-to-them mode: Pocketalk-style upside-down display for the other person. */
#app-root.show-mode #top-header,
#app-root.show-mode #src-row,
#app-root.show-mode #back-row,
#app-root.show-mode #status-row {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.98);
}

#app-root.show-mode #hero {
  padding: 0;
  gap: 0;
}

#app-root.show-mode #target-wrap {
  flex: 1 1 auto;
  min-height: 0;
  border-radius: 0;
  background: #ffffff;
  box-shadow: none;
  padding: 28px;
  align-items: center;
}

#app-root.show-mode #target-text {
  transform: rotate(180deg);
  transform-origin: center;
  font-size: clamp(44px, 11vw, 76px);
  line-height: 1.16;
}

#app-root.show-mode footer {
  padding-top: 8px;
}

#app-root.show-mode #speak-button {
  display: none;
}

/* Meaning check (back-translation) */
.back-label-row {
  margin: 0 0 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.check-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background-color: #10b981;
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}

.check-icon.pending {
  background-color: #d4d4d8;
}

.back-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #a1a1aa;
}

.back {
  margin: 0;
  font-size: clamp(17px, 4.4vw, 21px);
  line-height: 1.5;
  color: #3f3f46;
  font-weight: 500;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  text-align: left;
}

/* Speak button morph */
#speak-button {
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.show-button {
  border: 1px solid rgba(24, 24, 27, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: #3f3f46;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 4px 14px -8px rgba(0, 0, 0, 0.22);
}

.show-button:active {
  transform: scale(0.96);
}

#app-root.show-mode .show-button {
  background: #18181b;
  color: #ffffff;
  border-color: #18181b;
}

#speak-button.is-recording {
  background-color: #ef4444;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.2);
}

.bar {
  width: 3px;
  background-color: white;
  border-radius: 99px;
  transform-origin: center;
  height: 4px;
  opacity: 0;
  transition: all 0.3s ease;
}

#speak-button.is-recording .bar {
  opacity: 1;
  animation: waveform 1.2s infinite ease-in-out alternate;
}

#speak-button.is-recording .bar:nth-child(1) {
  animation-delay: 0s;
  height: 12px;
}
#speak-button.is-recording .bar:nth-child(2) {
  animation-delay: -0.2s;
  height: 24px;
}
#speak-button.is-recording .bar:nth-child(3) {
  animation-delay: -0.4s;
  height: 16px;
}
#speak-button.is-recording .bar:nth-child(4) {
  animation-delay: -0.6s;
  height: 28px;
}
#speak-button.is-recording .bar:nth-child(5) {
  animation-delay: -0.8s;
  height: 14px;
}

@keyframes waveform {
  0% {
    transform: scaleY(0.4);
  }
  100% {
    transform: scaleY(1.4);
  }
}

/* Status dot */
@keyframes statusPulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

#status-dot.live {
  background-color: #ef4444;
  animation: statusPulse 2s infinite;
}

#status-dot.error {
  background-color: #ef4444;
}

[hidden] {
  display: none !important;
}
