:root {
  /* Color Palette */
  --terracotta: #894335;
  --terracotta-light: #AB776B;
  --warm-beige: #AC968E;
  --greige: #897A74;
  --slate: #4B5556;
  --deep-charcoal: #0C2023;

  /* Semantic assignments */
  --surface: #0C2023;
  --surface-elevated: #13282b;
  --card: rgba(19, 40, 43, 0.85);
  --ink: #f5f2f0;
  --muted: #AC968E;
  --muted-light: #897A74;
  --border: rgba(172, 150, 142, 0.15);
  --border-strong: rgba(172, 150, 142, 0.25);
  --primary: #894335;
  --primary-light: #AB776B;
  --primary-dark: #6d3429;
  --accent: #AC968E;
  --success: #4a7c59;
  --error: #c45b4a;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  
  /* Animation curves */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out-sine: cubic-bezier(0.37, 0, 0.63, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

[data-theme="light"] {
  --surface: #f5f2f0;
  --surface-elevated: #ffffff;
  --card: rgba(255, 255, 255, 0.92);
  --ink: #0C2023;
  --muted: #897A74;
  --muted-light: #AC968E;
  --border: rgba(137, 90, 52, 0.12);
  --border-strong: rgba(137, 90, 52, 0.2);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  height: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--surface);
  color: var(--ink);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
  transition: background 0.5s var(--ease-out-expo), color 0.5s var(--ease-out-expo);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Enhanced Background Effects */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(ellipse at 15% 15%, rgba(137, 67, 53, 0.1) 0%, transparent 45%),
    radial-gradient(ellipse at 85% 85%, rgba(171, 119, 107, 0.08) 0%, transparent 45%),
    radial-gradient(ellipse at 50% 50%, rgba(172, 150, 142, 0.05) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

.orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
  will-change: transform;
}

.orb-1 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(137, 67, 53, 0.2) 0%, transparent 70%);
  top: -200px;
  right: -200px;
  animation: orbFloat1 25s var(--ease-in-out-sine) infinite;
}

.orb-2 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(171, 119, 107, 0.15) 0%, transparent 70%);
  bottom: -150px;
  left: -150px;
  animation: orbFloat2 30s var(--ease-in-out-sine) infinite;
}

.orb-3 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(172, 150, 142, 0.12) 0%, transparent 70%);
  top: 45%;
  left: 15%;
  animation: orbFloat3 22s var(--ease-in-out-sine) infinite;
}

@keyframes orbFloat1 {
  0%, 100% { transform: translate(0, 0) scale(1) rotate(0deg); }
  25% { transform: translate(30px, -25px) scale(1.05) rotate(5deg); }
  50% { transform: translate(-20px, 20px) scale(0.98) rotate(-3deg); }
  75% { transform: translate(-25px, -20px) scale(1.02) rotate(2deg); }
}

@keyframes orbFloat2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(-30px, 15px) scale(1.03); }
  66% { transform: translate(20px, -25px) scale(0.97); }
}

@keyframes orbFloat3 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(25px, -15px) scale(1.04); }
}

/* Particle dust effect */
.particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.particle {
  position: absolute;
  width: 2px;
  height: 2px;
  background: rgba(137, 67, 53, 0.3);
  border-radius: 50%;
  animation: particleFloat 20s linear infinite;
}

@keyframes particleFloat {
  0% { transform: translateY(100vh) rotate(0deg); opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { transform: translateY(-100vh) rotate(720deg); opacity: 0; }
}

.app-container {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
  padding: 28px 24px 48px;
  min-height: 100vh;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 48px;
  opacity: 0;
  transform: translateY(-20px);
  animation: fadeInDown 0.7s var(--ease-out-expo) forwards;
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

.icon-btn {
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.3s var(--ease-out-expo);
  position: relative;
  overflow: hidden;
}

.icon-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(137, 67, 53, 0.15), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.icon-btn:hover {
  color: var(--terracotta);
  border-color: var(--terracotta-light);
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 24px rgba(137, 67, 53, 0.2);
}

.icon-btn:hover::before {
  opacity: 1;
}

.icon-btn:active {
  transform: translateY(0) scale(0.98);
  transition: all 0.1s ease;
}

.icon-btn svg {
  width: 20px;
  height: 20px;
  position: relative;
  z-index: 1;
  transition: transform 0.3s var(--ease-spring);
}

.icon-btn:hover svg {
  transform: scale(1.1);
}

.logo-section {
  text-align: center;
  position: relative;
}

.logo {
  font-family: 'Cormorant Garamond', 'Playfair Display', serif;
  font-size: 52px;
  font-weight: 600;
  color: var(--terracotta);
  margin-bottom: 4px;
  letter-spacing: -0.02em;
  line-height: 1;
  position: relative;
  display: inline-block;
  background: linear-gradient(135deg, var(--terracotta) 0%, var(--terracotta-light) 50%, var(--terracotta) 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: logoShimmer 4s ease-in-out infinite;
}

@keyframes logoShimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.logo::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 70%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--terracotta-light), transparent);
  opacity: 0.7;
  animation: underlineExpand 0.8s var(--ease-out-expo) 0.5s forwards;
}

@keyframes underlineExpand {
  to { transform: translateX(-50%) scaleX(1); }
}

.tagline {
  font-size: 10px;
  letter-spacing: 0.4em;
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 500;
  margin-top: 10px;
  opacity: 0;
  animation: fadeIn 0.6s var(--ease-out-expo) 0.7s forwards;
}

@keyframes fadeIn {
  to { opacity: 1; }
}

.tabs-container {
  background: var(--card);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 6px;
  display: flex;
  gap: 4px;
  margin-bottom: 32px;
  box-shadow: 
    0 8px 32px rgba(12, 32, 35, 0.35),
    0 2px 8px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 0.7s var(--ease-out-expo) 0.15s forwards;
  position: relative;
}

[data-theme="light"] .tabs-container {
  box-shadow: 
    0 8px 32px rgba(137, 90, 52, 0.12),
    0 2px 8px rgba(0, 0, 0, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.35s var(--ease-out-expo);
  border: none;
  background: transparent;
  font-family: inherit;
  position: relative;
  overflow: hidden;
}

.tab::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(137, 67, 53, 0.1), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.tab:hover {
  color: var(--ink);
  transform: translateY(-1px);
}

.tab:hover::before {
  opacity: 1;
}

.tab.active {
  color: white;
  background: linear-gradient(135deg, var(--terracotta) 0%, var(--terracotta-light) 100%);
  box-shadow: 
    0 4px 20px rgba(137, 67, 53, 0.4),
    0 2px 8px rgba(137, 67, 53, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.tab.active::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
  transform: translateX(-100%);
  animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  50%, 100% { transform: translateX(100%); }
}

.tab svg {
  width: 16px;
  height: 16px;
  transition: transform 0.3s var(--ease-spring);
}

.tab:hover svg {
  transform: scale(1.15);
}

.glass-card {
  background: var(--card);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: 
    0 8px 32px rgba(12, 32, 35, 0.25),
    0 2px 8px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  margin-bottom: 24px;
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 0.7s var(--ease-out-expo) 0.25s forwards;
  position: relative;
  overflow: hidden;
  transition: all 0.4s var(--ease-out-expo);
}

[data-theme="light"] .glass-card {
  box-shadow: 
    0 8px 32px rgba(137, 90, 52, 0.1),
    0 2px 8px rgba(0, 0, 0, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.glass-card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: calc(var(--radius-xl) + 1px);
  padding: 1px;
  background: linear-gradient(135deg, rgba(137, 67, 53, 0.4), rgba(171, 119, 107, 0.3));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.glass-card:focus-within::before,
.glass-card:hover::before {
  opacity: 1;
}

.glass-card:focus-within {
  transform: translateY(-2px);
  box-shadow: 
    0 12px 40px rgba(12, 32, 35, 0.35),
    0 4px 12px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.input-wrapper {
  padding: 4px;
}

textarea {
  width: 100%;
  min-height: 180px;
  padding: 24px;
  font-size: 16px;
  line-height: 1.75;
  color: var(--ink);
  background: transparent;
  border: none;
  resize: vertical;
  outline: none;
  font-family: inherit;
  transition: all 0.3s ease;
}

textarea::placeholder {
  color: var(--muted-light);
  transition: all 0.3s ease;
}

textarea:focus::placeholder {
  opacity: 0.6;
  transform: translateX(4px);
}

.input-meta {
  padding: 0 24px 20px;
}

.input-hint {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-style: italic;
  opacity: 0.9;
  transition: all 0.3s ease;
}

.input-hint svg {
  width: 14px;
  height: 14px;
  color: var(--terracotta-light);
  flex-shrink: 0;
}

.input-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.char-count {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  transition: all 0.3s var(--ease-out-expo);
  font-variant-numeric: tabular-nums;
}

.char-count.warning {
  color: var(--terracotta);
  animation: pulseWarning 1.5s ease-in-out infinite;
}

@keyframes pulseWarning {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.clear-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: all 0.25s var(--ease-out-expo);
  font-family: inherit;
  position: relative;
  overflow: hidden;
}

.clear-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(137, 67, 53, 0.1);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.clear-btn:hover {
  color: var(--ink);
  transform: translateX(2px);
}

.clear-btn:hover::before {
  opacity: 1;
}

.clear-btn svg {
  width: 14px;
  height: 14px;
  transition: transform 0.3s var(--ease-spring);
}

.clear-btn:hover svg {
  transform: rotate(-90deg);
}

/* Language Selector - Premium Mode */
.language-selector {
  padding: 0 24px 20px;
  display: none;
  animation: fadeInUp 0.4s var(--ease-out-expo);
}

.language-selector.active {
  display: block;
}

.translation-direction {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(137, 67, 53, 0.08), rgba(171, 119, 107, 0.04));
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  font-size: 13px;
  transition: all 0.3s ease;
}

.translation-direction:hover {
  border-color: var(--terracotta-light);
}

.direction-arrow {
  color: var(--terracotta-light);
  font-size: 16px;
  animation: arrowPulse 2s ease-in-out infinite;
}

@keyframes arrowPulse {
  0%, 100% { transform: translateX(0); opacity: 1; }
  50% { transform: translateX(3px); opacity: 0.7; }
}

.source-label {
  color: var(--muted);
  font-weight: 500;
}

.target-label {
  color: var(--ink);
  font-weight: 600;
}

.language-selector-label {
  font-size: 12px;
  color: var(--terracotta-light);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.language-selector-label svg {
  width: 14px;
  height: 14px;
}

.language-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

@media (min-width: 480px) {
  .language-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 640px) {
  .language-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.language-option {
  padding: 12px 10px;
  border-radius: var(--radius-md);
  background: rgba(137, 67, 53, 0.06);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s var(--ease-out-expo);
  text-align: center;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  position: relative;
  overflow: hidden;
}

.language-option::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(137, 67, 53, 0.15), transparent);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.language-option:hover {
  background: rgba(137, 67, 53, 0.12);
  border-color: var(--terracotta-light);
  color: var(--ink);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(137, 67, 53, 0.15);
}

.language-option:hover::before {
  opacity: 1;
}

.language-option.selected {
  background: linear-gradient(135deg, var(--terracotta) 0%, var(--terracotta-light) 100%);
  border-color: var(--terracotta);
  color: white;
  box-shadow: 
    0 6px 20px rgba(137, 67, 53, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.language-option .lang-flag {
  font-size: 18px;
  line-height: 1;
}

.language-option .lang-name {
  font-size: 11px;
  font-weight: 600;
  position: relative;
  z-index: 1;
}

.language-option .lang-native {
  font-size: 10px;
  opacity: 0.8;
  position: relative;
  z-index: 1;
}

.transform-btn {
  width: 100%;
  padding: 20px 36px;
  border-radius: var(--radius-lg);
  border: none;
  background: linear-gradient(135deg, var(--terracotta) 0%, var(--terracotta-light) 100%);
  color: white;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  transition: all 0.35s var(--ease-out-expo);
  box-shadow: 
    0 6px 24px rgba(137, 67, 53, 0.35),
    0 2px 8px rgba(137, 67, 53, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  margin-bottom: 24px;
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 0.7s var(--ease-out-expo) 0.35s forwards;
  font-family: inherit;
  position: relative;
  overflow: hidden;
  letter-spacing: 0.02em;
  -webkit-appearance: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.transform-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, transparent 50%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.transform-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  transform: translateX(-100%);
  transition: none;
}

.transform-btn:hover:not(:disabled) {
  transform: translateY(-3px) scale(1.01);
  box-shadow: 
    0 12px 36px rgba(137, 67, 53, 0.5),
    0 4px 12px rgba(137, 67, 53, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.transform-btn:hover:not(:disabled)::before {
  opacity: 1;
}

.transform-btn:hover:not(:disabled)::after {
  animation: btnShimmer 1.5s ease-in-out;
}

@keyframes btnShimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.transform-btn:active:not(:disabled) {
  transform: translateY(-1px) scale(0.99);
  transition: all 0.1s ease;
}

.transform-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.transform-btn svg {
  width: 20px;
  height: 20px;
  transition: transform 0.3s var(--ease-spring);
}

.transform-btn:hover:not(:disabled) svg {
  transform: scale(1.15) rotate(5deg);
}

.transform-btn.loading svg {
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.error-card {
  background: linear-gradient(135deg, rgba(196, 91, 74, 0.1), rgba(196, 91, 74, 0.05));
  border-color: rgba(196, 91, 74, 0.4);
  animation: shake 0.5s var(--ease-out-expo);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

.error-content {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 24px;
}

.error-content svg {
  width: 22px;
  height: 22px;
  color: var(--error);
  flex-shrink: 0;
  margin-top: 2px;
  animation: errorPulse 2s ease-in-out infinite;
}

@keyframes errorPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.05); }
}

.error-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--error);
  margin-bottom: 6px;
}

.error-message {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}

.output-card {
  background: linear-gradient(135deg, rgba(137, 67, 53, 0.08) 0%, rgba(171, 119, 107, 0.04) 100%);
  border-color: rgba(137, 67, 53, 0.25);
}

.output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}

.output-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--terracotta-light);
  font-family: 'Cormorant Garamond', serif;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--terracotta);
  position: relative;
}

.pulse-dot::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: var(--terracotta);
  opacity: 0.4;
  animation: pulseRing 2s ease-out infinite;
}

@keyframes pulseRing {
  0% { transform: scale(0.8); opacity: 0.4; }
  100% { transform: scale(2); opacity: 0; }
}

.output-actions {
  display: flex;
  gap: 10px;
}

.action-btn {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: rgba(137, 67, 53, 0.1);
  border: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.25s var(--ease-out-expo);
  position: relative;
  overflow: hidden;
}

.action-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(137, 67, 53, 0.2), transparent);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.action-btn:hover {
  background: rgba(137, 67, 53, 0.18);
  border-color: var(--terracotta);
  color: var(--terracotta);
  transform: scale(1.08) translateY(-1px);
  box-shadow: 0 4px 12px rgba(137, 67, 53, 0.2);
}

.action-btn:hover::before {
  opacity: 1;
}

.action-btn:active {
  transform: scale(1.02);
}

.action-btn svg {
  width: 16px;
  height: 16px;
  position: relative;
  z-index: 1;
  transition: transform 0.3s var(--ease-spring);
}

.action-btn:hover svg {
  transform: scale(1.15);
}

.action-btn.copied {
  background: rgba(74, 124, 89, 0.2);
  border-color: var(--success);
  color: var(--success);
}

.output-content {
  padding: 24px;
  font-size: 18px;
  line-height: 1.8;
  color: var(--ink);
  white-space: pre-wrap;
  font-family: 'Cormorant Garamond', serif;
  animation: contentFadeIn 0.5s var(--ease-out-expo);
}

@keyframes contentFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.notes-card .notes-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}

.notes-header .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--terracotta-light);
  position: relative;
}

.notes-header .dot::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1px solid var(--terracotta-light);
  opacity: 0.5;
  animation: dotPulse 2s ease-out infinite;
}

@keyframes dotPulse {
  0% { transform: scale(1); opacity: 0.5; }
  100% { transform: scale(1.5); opacity: 0; }
}

.notes-header span {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  font-family: 'Cormorant Garamond', serif;
}

.notes-content {
  padding: 24px;
  font-size: 14px;
  line-height: 1.8;
  color: var(--muted);
  animation: contentFadeIn 0.5s var(--ease-out-expo) 0.1s both;
}

.notes-content strong {
  color: var(--ink);
  font-weight: 600;
}

.notes-content em {
  color: var(--terracotta-light);
  font-style: normal;
  background: rgba(137, 67, 53, 0.1);
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 13px;
  transition: all 0.2s ease;
}

.notes-content em:hover {
  background: rgba(137, 67, 53, 0.15);
}

.notes-content ul, .notes-content ol {
  margin: 14px 0;
  padding-left: 24px;
}

.notes-content li {
  margin: 8px 0;
  position: relative;
}

.notes-content li::marker {
  color: var(--terracotta-light);
}

.footer {
  text-align: center;
  padding-top: 28px;
  opacity: 0;
  animation: fadeIn 0.6s var(--ease-out-expo) 0.6s forwards;
}

.footer p {
  font-size: 11px;
  letter-spacing: 0.25em;
  color: var(--muted);
  text-transform: uppercase;
  font-family: 'Cormorant Garamond', serif;
  position: relative;
  display: inline-block;
}

.footer p::before,
.footer p::after {
  content: '•';
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: var(--terracotta-light);
  opacity: 0.5;
  font-size: 8px;
}

.footer p::before {
  left: -20px;
}

.footer p::after {
  right: -20px;
}

.toast-container {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  padding: 14px 24px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  font-weight: 500;
  animation: toastIn 0.4s var(--ease-out-expo);
  pointer-events: auto;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.toast.success {
  background: rgba(74, 124, 89, 0.95);
  color: white;
}

.toast.error {
  background: rgba(196, 91, 74, 0.95);
  color: white;
}

.toast.info {
  background: rgba(137, 67, 53, 0.95);
  color: white;
}

.toast svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.offline-indicator {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  padding: 14px 28px;
  border-radius: 999px;
  background: var(--error);
  color: white;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 1000;
  animation: slideUp 0.4s var(--ease-out-expo);
  box-shadow: 0 6px 24px rgba(196, 91, 74, 0.4);
  backdrop-filter: blur(8px);
}

@keyframes slideUp {
  from { opacity: 0; transform: translate(-50%, 20px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.offline-indicator svg {
  width: 18px;
  height: 18px;
  animation: wifiPulse 1.5s ease-in-out infinite;
}

@keyframes wifiPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(12, 32, 35, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: all 0.4s var(--ease-out-expo);
}

.drawer-overlay.active {
  opacity: 1;
  visibility: visible;
}

.history-drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  max-width: 420px;
  height: 100%;
  background: var(--surface-elevated);
  z-index: 101;
  transform: translateX(-105%);
  transition: transform 0.5s var(--ease-out-expo);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  box-shadow: 20px 0 60px rgba(0, 0, 0, 0.3);
}

.history-drawer.active {
  transform: translateX(0);
}

.drawer-header {
  padding: 28px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, rgba(137, 67, 53, 0.12) 0%, rgba(171, 119, 107, 0.06) 100%);
}

.drawer-title {
  display: flex;
  align-items: center;
  gap: 14px;
}

.drawer-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--terracotta) 0%, var(--terracotta-light) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(137, 67, 53, 0.3);
}

.drawer-icon svg {
  width: 22px;
  height: 22px;
  color: white;
}

.drawer-title h2 {
  font-size: 19px;
  font-weight: 600;
}

.drawer-title p {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
}

.drawer-close {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.25s var(--ease-out-expo);
}

.drawer-close:hover {
  background: rgba(137, 67, 53, 0.1);
  color: var(--ink);
  transform: rotate(90deg);
}

.drawer-close svg {
  width: 22px;
  height: 22px;
  transition: transform 0.3s ease;
}

.drawer-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 24px;
  text-align: center;
  animation: fadeIn 0.5s ease-out;
}

.empty-icon {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(137, 67, 53, 0.1), rgba(171, 119, 107, 0.05));
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  animation: emptyFloat 3s ease-in-out infinite;
}

@keyframes emptyFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.empty-icon svg {
  width: 36px;
  height: 36px;
  color: var(--muted);
}

.empty-state p {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.7;
}

.history-item {
  padding: 18px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(137, 67, 53, 0.05), rgba(171, 119, 107, 0.02));
  border: 1px solid var(--border);
  margin-bottom: 14px;
  cursor: pointer;
  transition: all 0.3s var(--ease-out-expo);
  animation: itemSlideIn 0.4s var(--ease-out-expo);
}

@keyframes itemSlideIn {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

.history-item:hover {
  border-color: var(--terracotta);
  background: linear-gradient(135deg, rgba(137, 67, 53, 0.1), rgba(171, 119, 107, 0.05));
  transform: translateX(4px);
  box-shadow: 0 4px 16px rgba(137, 67, 53, 0.15);
}

.history-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.history-mode {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.history-mode.refine {
  background: rgba(137, 67, 53, 0.2);
  color: var(--terracotta-light);
}

.history-mode.translate {
  background: rgba(171, 119, 107, 0.25);
  color: var(--terracotta-light);
}

.history-mode.polish {
  background: rgba(172, 150, 142, 0.25);
  color: var(--warm-beige);
}

.history-date {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.history-text {
  font-size: 14px;
  color: var(--ink);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-family: 'Cormorant Garamond', serif;
}

.history-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.history-btn {
  flex: 1;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s var(--ease-out-expo);
  border: none;
  font-family: inherit;
  position: relative;
  overflow: hidden;
}

.history-btn.load {
  background: rgba(137, 67, 53, 0.15);
  color: var(--terracotta-light);
}

.history-btn.load:hover {
  background: rgba(137, 67, 53, 0.25);
  transform: translateY(-1px);
}

.history-btn.delete {
  background: rgba(196, 91, 74, 0.15);
  color: var(--error);
  width: auto;
  flex: 0 0 auto;
  padding: 10px;
}

.history-btn.delete:hover {
  background: rgba(196, 91, 74, 0.25);
  transform: translateY(-1px);
}

.history-btn svg {
  width: 16px;
  height: 16px;
}

.clear-all-btn {
  width: calc(100% - 40px);
  margin: 20px;
  padding: 16px;
  border-radius: var(--radius-lg);
  background: rgba(196, 91, 74, 0.15);
  color: var(--error);
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.25s var(--ease-out-expo);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: inherit;
}

.clear-all-btn:hover {
  background: rgba(196, 91, 74, 0.25);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(196, 91, 74, 0.2);
}

.clear-all-btn svg {
  width: 18px;
  height: 18px;
}

::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

::selection {
  background: rgba(137, 67, 53, 0.3);
  color: var(--ink);
}

:focus-visible {
  outline: 2px solid var(--terracotta);
  outline-offset: 2px;
}

@media (max-width: 640px) {
  .app-container {
    padding: 20px 16px 36px;
  }

  .logo {
    font-size: 42px;
  }

  .header {
    margin-bottom: 36px;
  }

  .tab {
    padding: 12px 10px;
    font-size: 11px;
  }

  .tab span {
    display: none;
  }

  .tab svg {
    width: 18px;
    height: 18px;
  }

  .orb {
    opacity: 0.25;
    filter: blur(100px);
  }

  .orb-1 { width: 280px; height: 280px; top: -100px; right: -100px; }
  .orb-2 { width: 220px; height: 220px; bottom: -80px; left: -80px; }
  .orb-3 { width: 180px; height: 180px; }

  .history-drawer {
    max-width: 100%;
  }
  
  .language-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  textarea {
    min-height: 140px;
    padding: 18px;
  }

  .transform-btn {
    padding: 16px 28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}