:root {
	--bg: #060b18;
	--surface: #0d1428;
	--surface2: #131d35;
	--border: rgba(99, 179, 237, 0.15);
	--accent: #38bdf8;
	--accent2: #818cf8;
	--accent3: #34d399;
	--danger: #f87171;
	--text: #e2e8f0;
	--muted: #64748b;
	--glow: 0 0 40px rgba(56, 189, 248, 0.15);
}

* {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
	-webkit-tap-highlight-color: transparent;
}
.lang-select {
  flex: 1;
  min-width: 0;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 6px;
  color: var(--text);
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 0.78rem;
  cursor: pointer;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}body {
	background: var(--bg);
	color: var(--text);
	font-family: 'Space Mono', monospace;
	min-height: 100dvh;
	display: flex;
	flex-direction: column;
	overflow-x: hidden;
}

body::before {
	content: '';
	position: fixed;
	inset: 0;
	background:
		radial-gradient(ellipse 80% 50% at 20% -20%, rgba(56, 189, 248, 0.08) 0%, transparent 60%),
		radial-gradient(ellipse 60% 40% at 80% 110%, rgba(129, 140, 248, 0.08) 0%, transparent 60%);
	pointer-events: none;
	z-index: 0;
}

.app {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  /* Add safe area padding so content clears the notch/dynamic island */
  padding: env(safe-area-inset-top, 20px) 16px
           calc(12px + env(safe-area-inset-bottom, 0px))
           16px;
  overflow: hidden;
}

header {
  padding: max(20px, env(safe-area-inset-top, 20px)) 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
        font-family: 'Syne', sans-serif;
        font-weight: 800;
        font-size: 1.25rem;
        letter-spacing: -0.02em;
        color: var(--accent);
}
.logo span {
        color: var(--accent2);
}

.model-badge {
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: 10px;
        padding: 6px 12px;
        color: var(--muted);
        font-size: 0.7rem;
        letter-spacing: 0.05em;
}

.lang-bar {
        display: flex;
        align-items: center;
        gap: 8px;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: 16px;
        padding: 10px 16px;
        margin-bottom: 20px;
}

.lang-tag {
        flex: 1;
        text-align: center;
        font-family: 'Syne', sans-serif;
        font-weight: 700;
        font-size: 0.95rem;
        padding: 6px 10px;
        border-radius: 10px;
        transition: all 0.3s;
}
.lang-tag.active-en {
        background: rgba(56, 189, 248, 0.15);
        color: var(--accent);
}
.lang-tag.active-id {
        background: rgba(52, 211, 153, 0.15);
        color: var(--accent3);
}
.lang-tag.inactive {
        color: var(--muted);
}

.swap-btn {
        background: none;
        border: 1px solid var(--border);
        border-radius: 8px;
        width: 36px;
        height: 36px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        color: var(--muted);
        font-size: 1rem;
        transition: all 0.3s;
        flex-shrink: 0;
}
.swap-btn:active {
        transform: rotate(180deg) scale(0.9);
        color: var(--accent);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 14px 16px;
  margin-bottom: 10px;
  transition: border-color 0.3s;
  flex-shrink: 0;
}
.card.active {
        border-color: rgba(56, 189, 248, 0.4);
        box-shadow: var(--glow);
}

.card-label {
        font-size: 0.65rem;
        text-transform: uppercase;
        letter-spacing: 0.12em;
        color: var(--muted);
        margin-bottom: 10px;
}

.card-text {
  font-family: 'Space Mono', monospace;
  font-size: 0.9rem;
  line-height: 1.5;
  min-height: 44px;
  word-break: break-word;
  color: var(--text);
}.card-text.placeholder {
	color: var(--muted);
	font-style: italic;
}

.card-actions {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
	margin-top: 12px;
}

.icon-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 14px;
  color: var(--muted);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Space Mono', monospace;
  min-height: 40px;
  min-width: 40px;
}
.icon-btn:active {
  transform: scale(0.94);
  color: var(--accent);
}

.result-card {
	background: linear-gradient(135deg, rgba(52, 211, 153, 0.05), rgba(129, 140, 248, 0.05));
	border-color: rgba(52, 211, 153, 0.2);
}
.result-card .card-label {
	color: var(--accent3);
}
.result-card .card-text {
	color: #a7f3d0;
}

.mic-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  flex: 1;
  justify-content: center;
  min-height: 0;
}

.mic-outer {
  position: relative;
  width: 120px;
  height: 120px;
  flex-shrink: 0;
}

.mic-ring {	position: absolute;
	inset: 0;
	border-radius: 50%;
	border: 2px solid rgba(56, 189, 248, 0.2);
}
.mic-ring.pulse {
	animation: ringPulse 1.2s ease-out infinite;
}
.mic-ring:nth-child(2) {
	animation-delay: 0.4s;
}
.mic-ring:nth-child(3) {
	animation-delay: 0.8s;
}

@keyframes ringPulse {
	0% {
		transform: scale(1);
		opacity: 0.6;
	}
	100% {
		transform: scale(1.6);
		opacity: 0;
	}
}

.mic-btn {
	position: absolute;
	inset: 16px;
	border-radius: 50%;
	background: linear-gradient(145deg, #0f2040, #0a1628);
	border: 2px solid var(--border);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: all 0.2s;
	box-shadow:
		0 8px 32px rgba(0, 0, 0, 0.4),
		inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.mic-btn.recording {
	background: linear-gradient(145deg, #1a0f30, #0f0820);
	border-color: rgba(248, 113, 113, 0.5);
	box-shadow:
		0 0 40px rgba(248, 113, 113, 0.2),
		inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.mic-btn.processing {
	border-color: rgba(56, 189, 248, 0.5);
	animation: processingPulse 1.5s ease-in-out infinite;
}
@keyframes processingPulse {
	0%,
	100% {
		box-shadow: 0 0 20px rgba(56, 189, 248, 0.1);
	}
	50% {
		box-shadow: 0 0 40px rgba(56, 189, 248, 0.3);
	}
}
.mic-btn:active {
	transform: scale(0.96);
}

.mic-icon {
  font-size: 2rem;
  transition: all 0.3s;
  user-select: none;
}
.mic-status {
	font-size: 0.8rem;
	color: var(--muted);
	text-align: center;
	letter-spacing: 0.05em;
	height: 20px;
	transition: all 0.3s;
}
.mic-status.recording-status {
	color: var(--danger);
}
.mic-status.processing-status {
	color: var(--accent);
}
.mic-status.success-status {
	color: var(--accent3);
}

.waveform {
	display: flex;
	align-items: center;
	gap: 3px;
	height: 32px;
	opacity: 0;
	transition: opacity 0.3s;
}
.waveform.visible {
	opacity: 1;
}
.wave-bar {
	width: 3px;
	background: var(--danger);
	border-radius: 2px;
	animation: waveAnim 0.6s ease-in-out infinite alternate;
	min-height: 4px;
}
.wave-bar:nth-child(1) {
	animation-delay: 0s;
}
.wave-bar:nth-child(2) {
	animation-delay: 0.1s;
}
.wave-bar:nth-child(3) {
	animation-delay: 0.2s;
}
.wave-bar:nth-child(4) {
	animation-delay: 0.3s;
}
.wave-bar:nth-child(5) {
	animation-delay: 0.4s;
}
.wave-bar:nth-child(6) {
	animation-delay: 0.3s;
}
.wave-bar:nth-child(7) {
	animation-delay: 0.2s;
}
.wave-bar:nth-child(8) {
	animation-delay: 0.1s;
}
.wave-bar:nth-child(9) {
	animation-delay: 0s;
}

@keyframes waveAnim {
	from {
		height: 4px;
	}
	to {
		height: 28px;
	}
}

.error-msg {
	background: rgba(248, 113, 113, 0.1);
	border: 1px solid rgba(248, 113, 113, 0.3);
	border-radius: 12px;
	padding: 12px 16px;
	font-size: 0.8rem;
	color: var(--danger);
	margin-bottom: 14px;
	display: none;
	line-height: 1.5;
}
.error-msg.show {
	display: block;
}

.toast {
	position: fixed;
	bottom: 30px;
	left: 50%;
	transform: translateX(-50%) translateY(20px);
	background: var(--surface2);
	border: 1px solid var(--border);
	border-radius: 12px;
	padding: 10px 20px;
	font-size: 0.8rem;
	color: var(--text);
	opacity: 0;
	transition: all 0.3s;
	pointer-events: none;
	white-space: nowrap;
	z-index: 100;
}
.toast.show {
	opacity: 1;
	transform: translateX(-50%) translateY(0);
}

::-webkit-scrollbar {
	width: 4px;
}
::-webkit-scrollbar-track {
	background: transparent;
}
::-webkit-scrollbar-thumb {
	background: var(--border);
	border-radius: 2px;
}
