/* ============================================
   NO CAP TRANSLATOR
   iMessage-inspired with light/dark mode
   ============================================ */

:root {
  --bg-deep: #0b0b0f;
  --bg-base: #0f0f14;
  --bg-surface: #1a1a22;
  --bg-elevated: #22222e;

  --boring-bubble: #2a2a35;
  --boring-border: #35353f;
  --boring-text: #c0c0cc;
  --boring-label: #6e6e80;

  --imsg-green: #34d058;
  --imsg-green-dark: #2bba4b;
  --imsg-blue: #0b93f6;
  --imsg-blue-dark: #0a7dd6;

  --accent-pink: #ff2d78;

  --text-primary: #eeeef6;
  --text-secondary: #8888a0;
  --text-muted: #55556a;

  --glass-bg: rgba(20, 20, 30, 0.65);
  --glass-border: rgba(255, 255, 255, 0.06);

  --action-btn-bg: rgba(255, 255, 255, 0.06);
  --action-btn-border: rgba(255, 255, 255, 0.08);
  --action-btn-hover: rgba(255, 255, 255, 0.1);

  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-pill: 100px;

  --font-display: 'Outfit', sans-serif;
  --font-mono: 'Space Mono', monospace;
}

/* ---- Light mode ---- */

body.light {
  --bg-deep: #f2f2f7;
  --bg-base: #ffffff;
  --bg-surface: #f0f0f5;
  --bg-elevated: #e8e8ef;

  --boring-bubble: #e5e5ea;
  --boring-border: #d1d1d6;
  --boring-text: #3a3a3c;
  --boring-label: #8e8e93;

  --text-primary: #1c1c1e;
  --text-secondary: #636366;
  --text-muted: #aeaeb2;

  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(0, 0, 0, 0.06);

  --action-btn-bg: rgba(0, 0, 0, 0.04);
  --action-btn-border: rgba(0, 0, 0, 0.08);
  --action-btn-hover: rgba(0, 0, 0, 0.08);
}

body.light .noise-overlay {
  opacity: 0;
}

body.light .gradient-orb {
  opacity: 0.4;
}

body.light .orb-1 {
  background: radial-gradient(circle, rgba(52, 208, 88, 0.06), transparent 70%);
}

body.light .orb-2 {
  background: radial-gradient(circle, rgba(11, 147, 246, 0.05), transparent 70%);
}

body.light .orb-3 {
  background: radial-gradient(circle, rgba(168, 85, 247, 0.04), transparent 70%);
}

body.light .input-card {
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.06);
}

body.light .history-drawer {
  border-bottom-color: rgba(0, 0, 0, 0.06);
}

body.light .history-header {
  border-bottom-color: rgba(0, 0, 0, 0.04);
}

body.light .history-item:hover {
  background: rgba(0, 0, 0, 0.03);
}

body.light .toast {
  background: #1c1c1e;
  color: #fff;
  border-color: transparent;
}

body.light .slang-pill {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.08);
}

body.light .slang-pill:hover {
  background: rgba(0, 0, 0, 0.06);
  border-color: rgba(0, 0, 0, 0.12);
}

body.light .typing-bubble {
  background: rgba(52, 208, 88, 0.08);
  border-color: rgba(52, 208, 88, 0.12);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font-display);
  background: var(--bg-deep);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s, color 0.3s;
}

/* ---- Atmospheric background ---- */

.noise-overlay {
  position: fixed;
  inset: 0;
  z-index: 0;
  opacity: 0.03;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 200px;
  transition: opacity 0.3s;
}

.gradient-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
  animation: orbFloat 20s ease-in-out infinite;
  transition: opacity 0.3s;
}

.orb-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(52, 208, 88, 0.08), transparent 70%);
  top: -100px;
  right: -100px;
  animation-delay: 0s;
}

.orb-2 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(11, 147, 246, 0.06), transparent 70%);
  bottom: 10%;
  left: -80px;
  animation-delay: -7s;
}

.orb-3 {
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.06), transparent 70%);
  top: 40%;
  right: 20%;
  animation-delay: -13s;
}

@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(30px, -40px) scale(1.05); }
  50% { transform: translate(-20px, 20px) scale(0.95); }
  75% { transform: translate(15px, 35px) scale(1.02); }
}

/* ---- App layout ---- */

.app {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 800px;
  margin: 0 auto;
}

/* ---- Header ---- */

.header {
  flex-shrink: 0;
  padding: 24px 20px 16px;
  text-align: center;
}

.header-inner {
  position: relative;
}

.title {
  font-family: var(--font-display);
  font-size: clamp(28px, 6vw, 42px);
  font-weight: 900;
  letter-spacing: -1.5px;
  line-height: 1.1;
  color: var(--text-primary);
  text-transform: lowercase;
}

.title-accent {
  color: var(--text-primary);
}

.tagline {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-muted);
  margin-top: 8px;
  letter-spacing: 0.5px;
  font-family: var(--font-mono);
}

/* Header buttons */

.header-buttons {
  position: absolute;
  top: 4px;
  right: 0;
  display: flex;
  gap: 8px;
}

.theme-toggle,
.history-toggle {
  background: var(--action-btn-bg);
  border: 1px solid var(--action-btn-border);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.theme-toggle:hover,
.history-toggle:hover {
  background: var(--action-btn-hover);
  color: var(--text-primary);
}

.history-toggle.active {
  background: var(--imsg-green);
  border-color: var(--imsg-green);
  color: #fff;
}

/* Sun/moon icon toggle */
.icon-moon { display: none; }
.icon-sun { display: block; }

body.light .icon-moon { display: block; }
body.light .icon-sun { display: none; }

/* ---- History drawer ---- */

.history-drawer {
  display: none;
  flex-direction: column;
  background: var(--bg-surface);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  max-height: 280px;
  overflow: hidden;
  animation: slideDown 0.3s ease-out;
}

.history-drawer.open {
  display: flex;
}

@keyframes slideDown {
  from { opacity: 0; max-height: 0; }
  to { opacity: 1; max-height: 280px; }
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.history-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: lowercase;
  letter-spacing: 0.5px;
}

.history-clear {
  background: none;
  border: none;
  color: var(--accent-pink);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.2s;
}

.history-clear:hover {
  background: rgba(255, 45, 120, 0.1);
}

.history-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--bg-elevated) transparent;
}

.history-item {
  display: flex;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s;
  margin-bottom: 4px;
}

.history-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.history-item-original {
  flex: 1;
  font-size: 12px;
  color: var(--boring-text);
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-item-arrow {
  color: var(--text-muted);
  font-size: 12px;
  flex-shrink: 0;
}

.history-item-translated {
  flex: 1;
  font-size: 12px;
  color: var(--imsg-green);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-item-slang {
  font-size: 10px;
  color: var(--text-muted);
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.history-empty {
  display: none;
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* ---- Chat area ---- */

.chat-area {
  flex: 1;
  overflow-y: auto;
  padding: 12px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--bg-elevated) transparent;
}

.chat-area::-webkit-scrollbar {
  width: 5px;
}

.chat-area::-webkit-scrollbar-track {
  background: transparent;
}

.chat-area::-webkit-scrollbar-thumb {
  background: var(--bg-elevated);
  border-radius: 10px;
}

/* ---- Empty state ---- */

.empty-state {
  margin: auto;
  text-align: center;
  animation: fadeInUp 0.8s ease-out;
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  animation: floatBounce 3s ease-in-out infinite;
}

.empty-text {
  font-size: 16px;
  color: var(--text-secondary);
  font-weight: 400;
  max-width: 280px;
  line-height: 1.6;
}

.empty-arrows {
  margin-top: 20px;
  display: flex;
  gap: 12px;
  justify-content: center;
  color: var(--text-muted);
  font-size: 18px;
}

.empty-arrows span {
  animation: arrowBounce 1.5s ease-in-out infinite;
}

.empty-arrows span:nth-child(2) {
  animation-delay: 0.15s;
}

.empty-arrows span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes floatBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes arrowBounce {
  0%, 100% { transform: translateY(0); opacity: 0.4; }
  50% { transform: translateY(6px); opacity: 1; }
}

/* ---- Chat bubbles ---- */

.bubble-wrapper {
  display: flex;
  flex-direction: column;
  max-width: 85%;
}

.bubble-wrapper.left {
  align-self: flex-start;
  align-items: flex-start;
  animation: slideInLeft 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.bubble-wrapper.right {
  align-self: flex-end;
  align-items: flex-end;
  animation: slideInRight 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.bubble-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.bubble-wrapper.left .bubble-label {
  color: var(--boring-label);
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 10px;
}

.bubble-wrapper.right .bubble-label {
  color: var(--imsg-green);
  font-family: var(--font-display);
}

.bubble {
  padding: 14px 18px;
  border-radius: 20px;
  font-size: 15px;
  line-height: 1.55;
  position: relative;
  word-wrap: break-word;
  white-space: pre-wrap;
}

/* Boring bubble (left) - iMessage gray */
.bubble.boring {
  background: var(--boring-bubble);
  color: var(--boring-text);
  border-bottom-left-radius: 6px;
  font-family: var(--font-display);
  font-size: 15px;
}

/* Gen Z bubble (right) - iMessage green */
.bubble.genz {
  background: var(--imsg-green);
  color: #fff;
  border-bottom-right-radius: 6px;
  font-weight: 500;
  box-shadow: 0 2px 12px rgba(52, 208, 88, 0.2);
}

/* Bubble actions (copy + share) */
.bubble-actions {
  display: flex;
  gap: 4px;
  margin-top: 6px;
  padding: 0 4px;
  opacity: 0;
  transition: opacity 0.2s;
}

.bubble-wrapper:hover .bubble-actions {
  opacity: 1;
}

.bubble-action-btn {
  background: var(--action-btn-bg);
  border: 1px solid var(--action-btn-border);
  border-radius: 8px;
  padding: 5px 8px;
  cursor: pointer;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s;
}

.bubble-action-btn:hover {
  background: var(--action-btn-hover);
  color: var(--text-primary);
}

.bubble-action-btn svg {
  width: 12px;
  height: 12px;
}

/* ---- Typing indicator ---- */

.typing-indicator {
  align-self: flex-end;
  animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
  max-width: 85%;
}

.typing-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
  padding: 0 12px;
  color: var(--imsg-green);
  text-align: right;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
}

.typing-bubble {
  background: rgba(52, 208, 88, 0.12);
  border: 1px solid rgba(52, 208, 88, 0.15);
  border-radius: 20px;
  border-bottom-right-radius: 6px;
  padding: 16px 22px;
  display: flex;
  gap: 6px;
  align-items: center;
}

.typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--imsg-green);
  animation: typingBounce 1.4s ease-in-out infinite;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.15s;
  opacity: 0.7;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.3s;
  opacity: 0.5;
}

@keyframes typingBounce {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-8px);
    opacity: 1;
  }
}

/* ---- Input zone ---- */

.input-zone {
  flex-shrink: 0;
  padding: 0 16px 44px;
}

/* Slang selector */

.slang-selector {
  display: flex;
  gap: 8px;
  padding: 0 4px 12px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  justify-content: center;
  flex-wrap: wrap;
}

.slang-selector::-webkit-scrollbar {
  display: none;
}

.slang-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.slang-pill:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
}

.slang-pill.active {
  background: var(--imsg-green);
  border-color: transparent;
  color: #fff;
  font-weight: 600;
  transform: scale(1.05);
  box-shadow: 0 4px 20px rgba(52, 208, 88, 0.25);
}

.pill-emoji {
  font-size: 14px;
  line-height: 1;
}

/* Input card */

.input-card {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 12px 14px;
  background: var(--glass-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.3);
  transition: background 0.3s, border-color 0.3s, box-shadow 0.3s;
}

/* Random example button */

.random-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  background: var(--action-btn-bg);
  border: 1px solid var(--action-btn-border);
  border-radius: 12px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.random-btn:hover {
  background: rgba(52, 208, 88, 0.12);
  border-color: rgba(52, 208, 88, 0.25);
  color: var(--imsg-green);
  transform: rotate(15deg);
}

.random-btn:active {
  transform: rotate(180deg) scale(0.9);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.input-textarea {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  resize: none;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 400;
  color: var(--text-primary);
  padding: 8px 4px;
  max-height: 120px;
  line-height: 1.5;
  scrollbar-width: none;
}

.input-textarea::-webkit-scrollbar {
  display: none;
}

.input-textarea::placeholder {
  color: var(--text-muted);
}

.translate-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: var(--imsg-green);
  border: none;
  border-radius: var(--radius-pill);
  color: #fff;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.translate-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--imsg-blue);
  opacity: 0;
  transition: opacity 0.3s;
}

.translate-btn:hover {
  transform: scale(1.04);
  box-shadow: 0 4px 24px rgba(52, 208, 88, 0.3);
}

.translate-btn:hover::before {
  opacity: 1;
}

.translate-btn:active {
  transform: scale(0.97);
}

.translate-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-text, .btn-fire {
  position: relative;
  z-index: 1;
}

.btn-fire {
  font-size: 16px;
  transition: transform 0.3s;
}

.translate-btn:hover .btn-fire {
  transform: scale(1.2) rotate(-10deg);
}

/* ---- Toast notification ---- */

.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-elevated);
  color: var(--text-primary);
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-family: var(--font-display);
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 100;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---- Animations ---- */

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---- Screenshot capture helper ---- */

.screenshot-wrapper {
  position: fixed;
  left: -9999px;
  top: 0;
  width: 500px;
  padding: 32px;
  background: var(--bg-deep);
  border-radius: 20px;
  z-index: -1;
}

.screenshot-wrapper .bubble-wrapper {
  animation: none;
}

.screenshot-watermark {
  text-align: center;
  margin-top: 16px;
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: 0.5px;
}

/* ---- Responsive ---- */

@media (max-width: 500px) {
  .header {
    padding: 16px 16px 12px;
  }

  .title {
    font-size: 26px;
  }

  .tagline {
    font-size: 11px;
  }

  .chat-area {
    padding: 8px 12px 16px;
  }

  .bubble-wrapper {
    max-width: 90%;
  }

  .bubble-actions {
    opacity: 1;
  }

  .slang-selector {
    justify-content: flex-start;
    flex-wrap: nowrap;
  }

  .slang-pill {
    padding: 7px 12px;
    font-size: 12px;
  }

  .input-card {
    border-radius: var(--radius-md);
  }

  .translate-btn {
    padding: 10px 14px;
    font-size: 13px;
  }

  .translate-btn .btn-text {
    display: none;
  }
}

/* ---- Footer ---- */

.site-footer {
  position: fixed;
  bottom: 6px;
  left: 0;
  right: 0;
  padding: 8px 16px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  pointer-events: none;
  z-index: 5;
}

.site-footer .heart {
  display: inline-block;
  color: var(--accent-pink);
  margin: 0 4px;
  animation: heartbeat 1.5s ease-in-out infinite;
}

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

/* ---- Video bubble ---- */

.video-bubble {
  padding: 8px !important;
  background: var(--bg-elevated) !important;
}

.video-bubble video {
  display: block;
  background: #000;
}
