:root {
  --translator-primary: #0284c7;
  --translator-primary-dark: #0369a1;
  --translator-primary-light: #f0f9ff;
  --translator-primary-glow: rgba(2, 132, 199, 0.22);
  --translator-cyan: #38bdf8;
  --translator-emerald: #10b981;
  --translator-amber: #f59e0b;
  --translator-danger: #ef4444;
  --translator-bg: #f8fafc;
  --translator-card: #ffffff;
  --translator-text-main: #0f172a;
  --translator-text-muted: #64748b;
  --translator-text-subtle: #94a3b8;
  --translator-border: #e2e8f0;
  --translator-radius-sm: 10px;
  --translator-radius-md: 14px;
  --translator-radius-lg: 18px;
  --translator-radius-xl: 24px;
  --translator-radius-full: 9999px;
  --translator-shadow-sm: 0 2px 8px -2px rgba(15, 23, 42, 0.05);
  --translator-shadow-md: 0 12px 32px -4px rgba(15, 23, 42, 0.08), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
  --translator-shadow-lg: 0 20px 48px -8px rgba(15, 23, 42, 0.12), 0 4px 12px rgba(15, 23, 42, 0.03);
  --font-display: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100vh;
  padding-bottom: 110px;
  color: var(--translator-text-main);
  background: radial-gradient(1200px 800px at 15% -10%, rgba(2, 132, 199, 0.09) 0%, transparent 60%),
              radial-gradient(1000px 700px at 85% 110%, rgba(56, 189, 248, 0.08) 0%, transparent 60%),
              var(--translator-bg);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.translator-main {
  width: min(100% - 40px, 1260px);
  margin: 28px auto 60px;
  animation: translatorFadeIn 0.35s ease-out;
}
@keyframes translatorFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.translator-hero {
  position: relative;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.96) 0%, rgba(240, 249, 255, 0.98) 100%);
  border: 1px solid var(--translator-border);
  border-radius: var(--translator-radius-lg);
  padding: 24px 28px;
  margin-bottom: 24px;
  box-shadow: var(--translator-shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.translator-hero h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  color: var(--translator-text-main);
  letter-spacing: -0.5px;
  line-height: 1.25;
}
.translator-hero h1 .highlight-text {
  background: linear-gradient(135deg, #0284c7 0%, #0ea5e9 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.translator-hero p {
  margin: 0;
  color: var(--translator-text-muted);
  font-size: 14.5px;
  line-height: 1.5;
  max-width: 720px;
}
.translator-two-way-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1.25fr);
  gap: 28px;
  align-items: stretch;
}
.translator-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--translator-border);
  border-radius: var(--translator-radius-xl);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--translator-shadow-md);
  transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}
.translator-panel:hover {
  box-shadow: var(--translator-shadow-lg);
  border-color: rgba(2, 132, 199, 0.28);
}
.panel-header-mini {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  background: #f8fafc;
  border-bottom: 1px solid var(--translator-border);
}
.panel-header-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}
.panel-icon-capsule {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: #e0f2fe;
  color: #0284c7;
  display: grid;
  place-items: center;
  font-size: 16px;
}
.panel-icon-capsule.tts {
  background: #f0fdf4;
  color: #10b981;
}
.panel-header-mini h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
  color: var(--translator-text-main);
  letter-spacing: -0.2px;
}
.panel-subtitle-mini {
  font-size: 12px;
  font-weight: 600;
  color: var(--translator-text-muted);
}
.panel-header-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--translator-radius-full);
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid var(--translator-border);
}
.panel-header-badge.live {
  background: #ecfdf5;
  color: #059669;
  border-color: #a7f3d0;
}
.panel-header-badge.tts-badge {
  background: #f0f9ff;
  color: #0284c7;
  border-color: #bae6fd;
}
.live-indicator-dot {
  width: 7.5px;
  height: 7.5px;
  border-radius: 50%;
  background: #94a3b8;
}
.panel-header-badge.live .live-indicator-dot {
  background: #10b981;
  box-shadow: 0 0 0 2.5px rgba(16, 185, 129, 0.3);
  animation: liveDotPulse 1.8s infinite ease-in-out;
}
@keyframes liveDotPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.85); }
}
.camera-stage {
  position: relative;
  width: 100%;
  min-height: 380px;
  background: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
#cameraPreview {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 380px;
  object-fit: cover;
  transform: scaleX(-1);
}
#handCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 380px;
  object-fit: cover;
  transform: scaleX(-1);
  pointer-events: none;
}
.camera-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 32px 24px;
  background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
  color: #94a3b8;
  text-align: center;
}
.placeholder-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.placeholder-icon-wrap {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.25);
  color: #38bdf8;
  display: grid;
  place-items: center;
  font-size: 26px;
  margin-bottom: 6px;
  box-shadow: 0 4px 16px rgba(56, 189, 248, 0.15);
}
.camera-placeholder p {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #f1f5f9;
}
.camera-placeholder span {
  font-size: 13px;
  color: #94a3b8;
}
.camera-placeholder[hidden] {
  display: none !important;
}
.camera-loading-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #ffffff;
  text-align: center;
  z-index: 10;
  transition: opacity 0.25s ease;
}
.camera-loading-overlay[hidden] {
  display: none !important;
}
.camera-spinner-wrap {
  position: relative;
  width: 54px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}
.camera-spinner-wrap i {
  font-size: 28px;
  color: #38bdf8;
}
.camera-pulse-ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid rgba(56, 189, 248, 0.5);
  animation: cameraPulse 1.6s cubic-bezier(0.24, 0, 0.38, 1) infinite;
}
@keyframes cameraPulse {
  0% { transform: scale(0.85); opacity: 0.8; }
  50% { transform: scale(1.18); opacity: 0.2; }
  100% { transform: scale(0.85); opacity: 0.8; }
}
.camera-loading-overlay p {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 700;
  color: #f8fafc;
}
.camera-loading-overlay span {
  font-size: 12.5px;
  color: #94a3b8;
  max-width: 280px;
  line-height: 1.4;
}
.translation-result-card {
  padding: 12px 18px;
  background: #ffffff;
  border-top: 1px solid var(--translator-border);
  border-bottom: 1px solid var(--translator-border);
  display: flex;
  flex-direction: column;
  gap: 6px;
  animation: slideInResult 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
.translation-result-card[hidden] {
  display: none !important;
}
@keyframes slideInResult {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.translation-result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.result-label {
  font-size: 11.5px;
  font-weight: 800;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.result-label i {
  color: var(--translator-primary);
}
.translation-result-tools {
  display: flex;
  align-items: center;
  gap: 6px;
}
.result-tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--translator-border);
  background: #f8fafc;
  color: #475569;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.18s ease;
}
.result-tool-btn:hover {
  background: #f1f5f9;
  color: var(--translator-primary);
  border-color: rgba(2, 132, 199, 0.3);
  transform: translateY(-1px);
}
.result-tool-btn.transfer {
  width: auto;
  padding: 0 10px;
  gap: 6px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  background: #f0f9ff;
  color: #0284c7;
  border-color: #bae6fd;
}
.result-tool-btn.transfer:hover {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
}
.translation-result-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.translation-output-text {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  color: #0284c7;
  letter-spacing: -0.3px;
  min-height: 28px;
  display: flex;
  align-items: center;
}
.translation-confidence-text {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  min-height: 16px;
}
.camera-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  background: #f8fafc;
  flex-wrap: wrap;
}
.camera-status-bar {
  display: inline-flex;
  align-items: center;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--translator-text-main);
}
.camera-btn-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.translator-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 18px;
  border: 0;
  border-radius: 12px;
  color: #ffffff;
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.25);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.translator-button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(2, 132, 199, 0.35);
}
.translator-button.secondary {
  color: #334155;
  background: #ffffff;
  box-shadow: var(--translator-shadow-sm);
  border: 1px solid var(--translator-border);
}
.translator-button.secondary:hover:not(:disabled) {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #cbd5e1;
}
.translator-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.status-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 8px;
  border-radius: 50%;
  background: #94a3b8;
  transition: all 0.2s ease;
}
.status-dot.live {
  background: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25);
}
.status-dot.loading {
  background: #38bdf8;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25);
  animation: dotBlink 1.2s ease-in-out infinite;
}
@keyframes dotBlink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}
.loading-shimmer-text {
  font-size: 14px;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  font-weight: 600;
}
.text-to-sign-card {
  display: flex;
  flex-direction: column;
}
.tts-card-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 20px 22px;
}
.tts-input-wrap {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  margin-bottom: 12px;
}
.tts-input-icon {
  position: absolute;
  left: 16px;
  color: #94a3b8;
  font-size: 16px;
  pointer-events: none;
}
.tts-input-wrap input {
  width: 100%;
  height: 50px;
  padding: 0 82px 0 46px;
  border: 1.5px solid var(--translator-border);
  border-radius: 14px;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--translator-text-main);
  background: #ffffff;
  outline: none;
  box-shadow: var(--translator-shadow-sm);
  transition: all 0.22s ease;
}
.tts-input-wrap input:focus {
  border-color: var(--translator-primary);
  box-shadow: 0 0 0 3.5px var(--translator-primary-glow), var(--translator-shadow-sm);
}
.tts-voice-btn {
  position: absolute;
  right: 44px;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--translator-border);
  background: #f8fafc;
  color: #64748b;
  font-size: 13px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.18s ease;
}
.tts-voice-btn:hover {
  background: #f0f9ff;
  color: #0284c7;
  border-color: #bae6fd;
}
.tts-voice-btn.listening {
  background: #ef4444;
  color: #ffffff;
  border-color: #ef4444;
  animation: micPulse 1.2s infinite ease-in-out;
}
@keyframes micPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50% { transform: scale(1.08); box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}
.tts-clear-btn {
  position: absolute;
  right: 12px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 0;
  background: #f1f5f9;
  color: #64748b;
  font-size: 12px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.18s ease;
}
.tts-clear-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}
.tts-clear-btn[hidden] {
  display: none !important;
}
.tts-sample-chips {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 16px;
}
.tts-chips-label {
  font-size: 11.5px;
  font-weight: 800;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-right: 2px;
}
.tts-chip {
  padding: 5px 12px;
  border-radius: var(--translator-radius-full);
  border: 1px solid var(--translator-border);
  background: #ffffff;
  color: #334155;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
  transition: all 0.18s ease;
}
.tts-chip:hover {
  background: #f0f9ff;
  border-color: #7dd3fc;
  color: #0284c7;
  transform: translateY(-1px);
}
.tts-results-wrap {
  display: flex;
  flex-direction: column;
  flex: 1;
}
.tts-grammar-summary {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 16px;
  margin-bottom: 14px;
  border-radius: 14px;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border: 1px solid #bae6fd;
}
.tts-grammar-flow {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 700;
  color: #0369a1;
}
.tts-grammar-tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  background: #ffffff;
  border: 1px solid #38bdf8;
  border-radius: 8px;
  color: #0284c7;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  box-shadow: 0 1px 3px rgba(2, 132, 199, 0.1);
}
.tts-omitted-note {
  font-size: 11.5px;
  color: #64748b;
  font-weight: 500;
}
.tts-omitted-badge {
  color: #94a3b8;
  text-decoration: line-through;
  font-weight: 600;
  margin: 0 2px;
}
.tts-horizontal-scroll-container {
  width: 100%;
  flex: 1;
  overflow-x: auto;
  padding: 8px 4px 14px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  display: flex;
  align-items: center;
}
.tts-horizontal-scroll-container::-webkit-scrollbar {
  height: 6px;
}
.tts-horizontal-scroll-container::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 9999px;
}
.tts-horizontal-scroll-container::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 9999px;
}
.tts-horizontal-scroll-container::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}
.tts-sign-cards-track {
  display: inline-flex;
  align-items: stretch;
  gap: 14px;
  min-width: 100%;
}
.tts-sign-card {
  position: relative;
  flex: 0 0 190px;
  width: 190px;
  display: flex;
  flex-direction: column;
  padding: 12px;
  background: #ffffff;
  border-radius: 16px;
  border: 1.5px solid var(--translator-border);
  box-shadow: var(--translator-shadow-sm);
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  scroll-snap-align: start;
}
.tts-sign-card:hover {
  transform: translateY(-3px);
  border-color: #38bdf8;
  box-shadow: 0 10px 24px -4px rgba(2, 132, 199, 0.16);
}
.tts-sign-step-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(6px);
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  border-radius: 6px;
  z-index: 2;
  letter-spacing: 0.4px;
}
.tts-sign-media-wrap {
  position: relative;
  width: 100%;
  height: 140px;
  border-radius: 10px;
  overflow: hidden;
  background: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}
.tts-sign-media-wrap img,
.tts-sign-media-wrap video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.tts-sign-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
  text-align: center;
  padding: 2px 0 0;
}
.tts-sign-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  color: #0f172a;
}
.tts-sign-filipino {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  color: #0284c7;
}
.tts-sign-arrow {
  flex: 0 0 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0284c7;
  font-size: 18px;
  animation: arrowPulse 2s ease-in-out infinite;
}
.tts-empty-guide {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 44px 20px;
  text-align: center;
  color: #94a3b8;
  border: 1.5px dashed #cbd5e1;
  border-radius: 18px;
  background: #f8fafc;
}
.tts-empty-guide i {
  font-size: 36px;
  margin-bottom: 12px;
  color: #38bdf8;
}
.tts-empty-guide p {
  margin: 0;
  font-size: 13.5px;
  font-weight: 600;
  color: #64748b;
  max-width: 280px;
  line-height: 1.5;
}
@keyframes arrowPulse {
  0%, 100% { transform: translateX(0); opacity: 0.65; }
  50% { transform: translateX(4px); opacity: 1; }
}
.translator-toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(40px);
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #ffffff;
  padding: 10px 18px;
  border-radius: var(--translator-radius-full);
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 9999;
}
.translator-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
.translator-toast i {
  color: #38bdf8;
  font-size: 14px;
}
@media (max-width: 960px) {
  .translator-two-way-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .camera-stage, #cameraPreview {
    min-height: 340px;
  }
}
@media (max-width: 580px) {
  .translator-main {
    width: min(100% - 24px, 1260px);
    margin: 18px auto 40px;
  }
  .translator-hero {
    padding: 24px 20px;
    border-radius: var(--translator-radius-lg);
  }
  .translator-hero h1 {
    font-size: 24px;
  }
  .panel-header-mini {
    padding: 14px 16px;
  }
  .tts-card-content {
    padding: 16px;
  }
  .camera-stage, #cameraPreview {
    min-height: 240px;
    max-height: 45vh;
  }
  .camera-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .camera-btn-group {
    width: 100%;
  }
  .translator-button {
    flex: 1;
    min-height: 44px;
  }
}
@media (max-width: 360px) {
  .translator-main {
    width: min(100% - 16px, 1260px);
  }
  .translator-hero {
    padding: 16px 12px;
  }
  .camera-stage, #cameraPreview {
    min-height: 200px;
  }
}
