/* LingoEcho Premium UI Stylesheet */

:root {
  /* Color Palette - Premium HSL System */
  --bg-app: hsl(222, 47%, 6%);
  --bg-sidebar: hsl(222, 45%, 4%);
  --bg-card: rgba(20, 26, 40, 0.6);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-focus: hsl(265, 89%, 65%);
  
  --color-primary: hsl(265, 89%, 65%);
  --color-primary-glow: hsla(265, 89%, 65%, 0.35);
  --color-accent: hsl(320, 85%, 58%);
  --color-accent-glow: hsla(320, 85%, 58%, 0.35);
  
  --text-main: hsl(210, 40%, 98%);
  --text-muted: hsl(215, 20%, 65%);
  --text-dimmed: hsl(215, 15%, 45%);
  
  --shadow-premium: 0 16px 40px rgba(0, 0, 0, 0.4);
  --shadow-neon: 0 0 20px var(--color-primary-glow);
  
  --font-display: 'Outfit', 'Inter', -apple-system, sans-serif;
  --font-body: 'Inter', -apple-system, sans-serif;
  
  --sidebar-width: 280px;
  --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent; /* Remove touch highlight box on mobile */
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-app);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 10% 20%, hsla(265, 80%, 20%, 0.15) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, hsla(320, 80%, 15%, 0.12) 0%, transparent 50%);
  
  /* WebView optimization: disable long-press text selection and callouts */
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

/* Allow text selection in form elements for normal typing/searching */
input, select, textarea, [contenteditable="true"] {
  user-select: text !important;
  -webkit-user-select: text !important;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* App Container Layout */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar Styling */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-glass);
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 10;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 2.5rem;
}

.logo-icon {
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 4px 15px rgba(142, 68, 173, 0.4);
}

.logo-icon i {
  width: 22px;
  height: 22px;
}

.logo-area h1 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.logo-area h1 span {
  background: linear-gradient(to right, var(--color-primary), var(--color-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sidebar-section {
  margin-bottom: 2rem;
}

.sidebar-section h3 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-dimmed);
  margin-bottom: 1rem;
  font-weight: 600;
}

.language-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.language-item {
  width: 100%;
}

.lang-btn {
  width: 100%;
  padding: 0.8rem 1rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--text-muted);
  text-align: left;
  font-family: var(--font-display);
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: var(--transition-smooth);
}

.lang-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
}

.lang-btn.active {
  background: rgba(142, 68, 173, 0.12);
  border-color: rgba(142, 68, 173, 0.25);
  color: var(--color-primary);
}

.lang-btn .badge {
  font-size: 0.7rem;
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text-muted);
}

.lang-btn.active .badge {
  background: var(--color-primary);
  color: white;
}

.nav-btn {
  width: 100%;
  padding: 0.85rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  color: var(--text-main);
  font-family: var(--font-display);
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: var(--transition-smooth);
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--color-accent);
  box-shadow: 0 0 10px rgba(243, 156, 18, 0.1);
}

.nav-btn.active {
  border-color: var(--color-accent);
  background: rgba(243, 156, 18, 0.08);
}

.credits {
  margin-top: auto;
  font-size: 0.68rem;
  color: var(--text-dimmed);
  line-height: 1.5;
}

/* Main Content Area */
.main-content {
  flex-grow: 1;
  padding: 2rem 3rem;
  display: flex;
  flex-direction: column;
  max-width: 1200px;
  margin: 0 auto;
  width: calc(100% - var(--sidebar-width));
}

/* Top Navigation */
.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.current-info h2 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.current-info p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Tooltip & Buttons */
.icon-btn-text {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  padding: 0.6rem 1.2rem;
  border-radius: 10px;
  font-family: var(--font-display);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.icon-btn-text:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--color-primary);
}

.icon-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.icon-btn.active {
  color: var(--color-accent);
  border-color: rgba(243, 156, 18, 0.3);
  background: rgba(243, 156, 18, 0.08);
}

/* Category Filters */
.category-filters {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.chip {
  padding: 0.5rem 1.2rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-glass);
  border-radius: 30px;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-family: var(--font-display);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.chip:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.chip.active {
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  border-color: transparent;
  color: white;
  box-shadow: 0 4px 15px rgba(142, 68, 173, 0.35);
}

/* Player Stage (Glass Card) */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: 20px;
  box-shadow: var(--shadow-premium);
}

.player-stage {
  margin-bottom: 2.5rem;
}

.player-card {
  padding: 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  position: relative;
  overflow: hidden;
}

.player-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(to right, var(--color-primary), var(--color-accent));
}

.card-header-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-badge {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  padding: 4px 12px;
  border-radius: 20px;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 500;
}

.card-buttons {
  display: flex;
  gap: 0.5rem;
}

/* Text Display Zone */
.card-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  text-align: center;
  gap: 1.5rem;
}

.text-display-wrapper {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  cursor: pointer;
}

.text-foreign {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #fff 0%, hsl(210, 45%, 85%) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.25;
  transition: opacity 0.2s ease;
}

.text-korean {
  font-size: 1.35rem;
  color: var(--text-muted);
  font-weight: 400;
  line-height: 1.5;
  min-height: 30px;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s ease;
}

.text-korean.hidden {
  opacity: 0 !important;
  transform: translateY(10px);
}

/* Sound Visualizer */
.visualizer-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 36px;
  opacity: 0;
  transform: scaleY(0.5);
  transition: all 0.3s ease;
}

.visualizer-wrapper.active {
  opacity: 1;
  transform: scaleY(1);
}

.visualizer-wrapper .bar {
  width: 3px;
  height: 8px;
  background: linear-gradient(to top, var(--color-primary), var(--color-accent));
  border-radius: 20px;
}

/* Web animation keyframes for visualizer */
@keyframes dance-1 {
  0%, 100% { height: 6px; }
  50% { height: 28px; }
}
@keyframes dance-2 {
  0%, 100% { height: 12px; }
  50% { height: 36px; }
}
@keyframes dance-3 {
  0%, 100% { height: 8px; }
  50% { height: 22px; }
}

.visualizer-wrapper.active .bar:nth-child(3n+1) {
  animation: dance-1 0.7s ease-in-out infinite alternate;
}
.visualizer-wrapper.active .bar:nth-child(3n+2) {
  animation: dance-2 0.5s ease-in-out infinite alternate;
}
.visualizer-wrapper.active .bar:nth-child(3n+3) {
  animation: dance-3 0.6s ease-in-out infinite alternate;
}

/* Player Controls Group */
.player-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  margin-top: 1rem;
}

.primary-controls {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.control-btn-play {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  border: none;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 25px var(--color-primary-glow);
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s ease;
}

.control-btn-play:hover {
  transform: scale(1.08);
  box-shadow: 0 10px 30px hsla(265, 89%, 65%, 0.5);
}

.control-btn-play:active {
  transform: scale(0.95);
}

.control-btn-play i {
  width: 28px;
  height: 28px;
  fill: currentColor;
}

.control-btn-main {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.control-btn-main:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--color-primary);
}

.control-btn-main i {
  width: 20px;
  height: 20px;
}

.control-btn-sub {
  background: transparent;
  border: none;
  color: var(--text-dimmed);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.control-btn-sub:hover {
  color: var(--text-main);
}

.control-btn-sub.active {
  color: var(--color-accent);
  background: rgba(243, 156, 18, 0.08);
  box-shadow: 0 0 10px rgba(243, 156, 18, 0.05);
}

/* Autoplay Bar Option */
.autoplay-setting-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.2rem 1.5rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.toggle-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.toggle-label {
  font-size: 0.9rem;
  font-weight: 500;
}

/* Switch Toggle Styling */
.switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.15);
  transition: .3s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
}

input:checked + .slider {
  background-image: linear-gradient(135deg, var(--color-primary), var(--color-accent));
}

input:checked + .slider:before {
  transform: translateX(22px);
}

.slider.round {
  border-radius: 34px;
}

.slider.round:before {
  border-radius: 50%;
}

.autoplay-info-badge {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(142, 68, 173, 0.1);
  color: var(--color-primary);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid rgba(142, 68, 173, 0.15);
}

.autoplay-info-badge.playing {
  background: rgba(243, 156, 18, 0.1);
  color: var(--color-accent);
  border-color: rgba(243, 156, 18, 0.15);
}

/* Panels Grid Layout */
.panels-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 1.5rem;
}

.panel-card {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  height: 380px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.2rem;
  border-bottom: 1px solid var(--border-glass);
  padding-bottom: 0.75rem;
}

.panel-header h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
}

.panel-body {
  overflow-y: auto;
  flex-grow: 1;
}

/* Playlist Panel items */
.playlist-items {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.playlist-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.playlist-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.05);
}

.playlist-item.active {
  background: rgba(142, 68, 173, 0.06);
  border-color: rgba(142, 68, 173, 0.2);
}

.item-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  overflow: hidden;
}

.play-state-indicator {
  display: flex;
  align-items: center;
  color: var(--text-dimmed);
}

.playlist-item.active .play-state-indicator {
  color: var(--color-primary);
}

.item-texts {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  overflow: hidden;
}

.playlist-foreign {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.playlist-item.active .playlist-foreign {
  color: var(--color-primary);
}

.playlist-korean {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.item-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-item-action {
  background: transparent;
  border: none;
  color: var(--text-dimmed);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: var(--transition-smooth);
}

.btn-item-action:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.06);
}

.btn-item-action.starred {
  color: var(--color-accent) !important;
}

/* Custom Add Form */
.custom-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.form-control {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  padding: 0.75rem 1rem;
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  transition: var(--transition-smooth);
}

.form-control:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(142, 68, 173, 0.2);
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg fill='white' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/><path d='M0 0h24v24H0z' fill='none'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px top 50%;
  padding-right: 30px;
}

.custom-badge {
  background: rgba(243, 156, 18, 0.1);
  color: var(--color-accent);
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 600;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 1px solid transparent;
  border-radius: 10px;
  font-family: var(--font-display);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
  border-radius: 6px;
}

.btn-primary {
  background: rgba(142, 68, 173, 0.15);
  border-color: rgba(142, 68, 173, 0.3);
  color: hsl(265, 95%, 75%);
}

.btn-primary:hover {
  background: var(--color-primary);
  color: white;
}

.btn-accent {
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  color: white;
  padding: 0.8rem 1.5rem;
  box-shadow: 0 4px 15px rgba(243, 156, 18, 0.2);
}

.btn-accent:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(243, 156, 18, 0.35);
}

.btn-outline {
  background: transparent;
  border-color: var(--border-glass);
  color: var(--text-main);
  padding: 0.75rem 1.5rem;
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--color-primary);
}

/* Drawer / Settings overlay */
.settings-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.settings-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.drawer-drag-handle {
  display: none;
}

.settings-drawer {
  position: fixed;
  top: 0;
  right: -420px;
  width: 400px;
  height: 100vh;
  background: hsl(222, 45%, 5%);
  border-left: 1px solid var(--border-glass);
  z-index: 101;
  box-shadow: -10px 0 30px rgba(0,0,0,0.5);
  padding: 2.5rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.settings-drawer.open {
  right: 0;
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-glass);
  padding-bottom: 1rem;
}

.drawer-header h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
}

.drawer-body {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  overflow-y: auto;
  flex-grow: 1;
}

.setting-item {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.setting-item label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.slider-val {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-accent);
}

.help-text {
  font-size: 0.75rem;
  color: var(--text-dimmed);
  line-height: 1.4;
}

.settings-divider {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dimmed);
  margin-top: 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  padding-bottom: 0.5rem;
}

/* Range Input Styling */
.range-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 5px;
  background: rgba(255,255,255,0.1);
  outline: none;
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  cursor: pointer;
  box-shadow: 0 0 10px var(--color-primary-glow);
  transition: transform 0.1s ease;
}

.range-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* Tooltip standard utility */
.tooltip {
  position: relative;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 120%;
  left: 50%;
  transform: translateX(-50%) translateY(5px);
  background: #111;
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s ease;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.tooltip:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Responsive adjustments */
@media (max-width: 1024px) {
  .app-container {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border-glass);
    padding: 1.5rem;
  }
  .main-content {
    width: 100%;
    padding: 1.5rem;
  }
  .panels-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .text-foreign {
    font-size: 2.2rem;
  }
  .control-btn-play {
    width: 60px;
    height: 60px;
  }
  .settings-overlay {
    height: 45vh;
    bottom: auto;
    top: 0;
    background: rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(1px);
  }
  .settings-drawer {
    top: auto;
    bottom: -55vh;
    right: 0;
    left: 0;
    width: 100%;
    height: 55vh;
    border-left: none;
    border-top: 1px solid var(--border-glass);
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -10px 30px rgba(0,0,0,0.5);
    padding: 0.5rem 1.5rem 2rem 1.5rem; /* 줄어든 상단 패딩 */
    gap: 1.25rem;
    transition: bottom 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .settings-drawer.open {
    bottom: 0;
    right: 0;
  }
  /* 모바일용 드래그 핸들 노출 */
  .drawer-drag-handle {
    display: block;
    width: 40px;
    height: 5px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    margin: 0.75rem auto 0 auto;
    cursor: grab;
    transition: background 0.3s ease;
  }
  .drawer-drag-handle:active {
    background: rgba(255, 255, 255, 0.4);
    cursor: grabbing;
  }
  /* 모바일에서 설정창 제목 가리기 */
  .drawer-header h3 {
    display: none;
  }
  .drawer-header {
    border-bottom: none;
    padding-bottom: 0;
    justify-content: flex-end; /* 닫기 X 버튼만 우측 정렬 */
    margin-bottom: -1rem; /* 설정 항목과의 간격 축소 */
  }
}


/* --- Pro Upgrade Sidebar Button & Icon --- */
.pro-btn {
  border: 1px solid rgba(243, 156, 18, 0.45) !important;
  background: rgba(243, 156, 18, 0.05) !important;
  position: relative;
  overflow: hidden;
}

.pro-btn:hover {
  background: rgba(243, 156, 18, 0.1) !important;
  border-color: var(--color-accent) !important;
  box-shadow: 0 0 15px rgba(243, 156, 18, 0.25) !important;
}

.pro-btn::after {
  content: '';
  position: absolute;
  top: 0;
  left: -50%;
  width: 200%;
  height: 100%;
  background: linear-gradient(
    to right,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.1) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: skewX(-25deg);
  animation: shine 4s infinite linear;
}

@keyframes shine {
  0% { left: -150%; }
  50% { left: 150%; }
  100% { left: 150%; }
}

.icon-glow {
  filter: drop-shadow(0 0 4px var(--color-accent));
  animation: float 2s ease-in-out infinite alternate;
}

@keyframes float {
  0% { transform: translateY(0); }
  100% { transform: translateY(-2px); }
}

/* --- Paywall Modal Styles --- */
.paywall-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  width: 500px;
  max-width: 90%;
  max-height: 90vh;
  z-index: 102;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  padding: 2.5rem 2rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.paywall-modal.open {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.paywall-close-btn {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  background: transparent;
  border: none;
  color: var(--text-dimmed);
  cursor: pointer;
  padding: 4px;
  transition: var(--transition-smooth);
}

.paywall-close-btn:hover {
  color: var(--text-main);
  transform: rotate(90deg);
}

.paywall-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.pro-crown-icon {
  background: linear-gradient(135deg, var(--color-accent), var(--color-primary));
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  margin-bottom: 0.25rem;
  box-shadow: 0 4px 15px var(--color-accent-glow);
}

.pro-crown-icon i {
  width: 24px;
  height: 24px;
}

.paywall-header h2 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 800;
}

.paywall-header h2 span {
  background: linear-gradient(to right, var(--color-primary), var(--color-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.paywall-tagline {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Benefits list */
.paywall-benefits {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 14px;
  padding: 1.2rem;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.benefit-item {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.benefit-item i {
  color: var(--color-accent);
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 2px;
}

.benefit-item h4 {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.15rem;
}

.benefit-item p {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.35;
}

/* Hybrid Options Grid */
.paywall-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.paywall-option-card {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-glass);
  border-radius: 14px;
  padding: 1.2rem;
  cursor: pointer;
  transition: var(--transition-smooth);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  justify-content: space-between;
}

.paywall-option-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.02);
}

.paywall-option-card.active {
  border-color: var(--color-primary);
  background: rgba(142, 68, 173, 0.06);
  box-shadow: 0 0 15px rgba(142, 68, 173, 0.1);
}

.paywall-option-card.active#option-lifetime {
  border-color: var(--color-accent);
  background: rgba(243, 156, 18, 0.06);
  box-shadow: 0 0 15px rgba(243, 156, 18, 0.1);
}

.popular-badge {
  position: absolute;
  top: -10px;
  right: 10px;
  background: linear-gradient(135deg, var(--color-accent), #e67e22);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  box-shadow: 0 2px 8px rgba(243, 156, 18, 0.3);
}

.option-title {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}

.paywall-option-card.active .option-title {
  color: var(--text-main);
}

.option-price {
  display: flex;
  align-items: baseline;
  gap: 2px;
  flex-wrap: wrap;
}

.option-price .price {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
}

.option-price .original-price {
  font-family: var(--font-display);
  font-size: 0.95rem;
  text-decoration: line-through;
  color: var(--text-dimmed);
  margin-right: 4px;
}

.option-price .period {
  font-size: 0.75rem;
  color: var(--text-dimmed);
}

.option-desc {
  font-size: 0.7rem;
  color: var(--text-dimmed);
  line-height: 1.3;
}

.paywall-option-card.active .option-desc {
  color: var(--text-muted);
}

.checkout-btn {
  margin-top: 0.5rem;
  padding: 0.9rem !important;
}

.paywall-footer {
  text-align: center;
  font-size: 0.7rem;
  color: var(--text-dimmed);
}

/* --- AI Pronunciation Coach Styles --- */
.speaking-practice-wrapper {
  width: 100%;
  max-width: 460px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 1.5rem;
  margin: 1rem auto 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
}

.speaking-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  justify-content: center;
  width: 100%;
}

.control-btn-mic {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.control-btn-mic:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--color-primary);
  color: var(--text-main);
  box-shadow: 0 0 10px var(--color-primary-glow);
}

.control-btn-mic.recording {
  background: rgba(231, 76, 60, 0.15) !important;
  border-color: rgb(231, 76, 60) !important;
  color: rgb(231, 76, 60) !important;
  animation: pulse-red 1.5s infinite;
}

@keyframes pulse-red {
  0% {
    box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.5);
  }
  70% {
    box-shadow: 0 0 0 12px rgba(231, 76, 60, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(231, 76, 60, 0);
  }
}

.speaking-status {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
  transition: color 0.3s ease;
}

.speaking-status.listening {
  color: rgb(231, 76, 60);
  font-weight: 600;
}

/* Feedback panel */
.pronunciation-feedback {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 1rem 1.2rem;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  animation: fadeIn 0.3s ease-out;
}

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

.pronunciation-feedback.hidden {
  display: none !important;
}

.feedback-top-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  padding-bottom: 0.5rem;
}

.score-badge {
  font-size: 0.85rem;
  color: var(--text-main);
  font-weight: 600;
}

.score-badge span {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--color-accent);
  text-shadow: 0 0 10px var(--color-accent-glow);
}

.btn-clear-feedback {
  background: transparent;
  border: none;
  color: var(--text-dimmed);
  cursor: pointer;
  font-size: 0.75rem;
  text-decoration: underline;
  transition: var(--transition-smooth);
}

.btn-clear-feedback:hover {
  color: var(--text-main);
}

/* Colored text diff output */
.diff-output {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem 0.2rem;
  font-size: 1.05rem;
  line-height: 1.6;
  padding: 0.25rem 0;
  text-align: center;
}

.word-correct {
  color: #2ecc71;
  font-weight: 600;
  text-shadow: 0 0 8px rgba(46, 204, 113, 0.15);
}

.word-incorrect {
  color: #e74c3c;
  font-weight: 500;
  text-decoration: line-through;
  opacity: 0.85;
}

.word-extra {
  color: #f39c12;
  font-style: italic;
  font-weight: 500;
}

/* --- Recording Visualizer Animations --- */
.visualizer-wrapper.recording .bar {
  background: linear-gradient(to top, #e74c3c, #f39c12) !important;
}

.visualizer-wrapper.recording.active .bar:nth-child(3n+1) {
  animation: dance-1 0.4s ease-in-out infinite alternate !important;
}

.visualizer-wrapper.recording.active .bar:nth-child(3n+2) {
  animation: dance-2 0.3s ease-in-out infinite alternate !important;
}

.visualizer-wrapper.recording.active .bar:nth-child(3n+3) {
  animation: dance-3 0.35s ease-in-out infinite alternate !important;
}

/* --- Toast Notification System --- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1000;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 300px;
  max-width: 450px;
  background: rgba(20, 26, 40, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 1rem 1.25rem;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 0.88rem;
  line-height: 1.4;
  transform: translateY(20px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.25);
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.toast-content {
  flex-grow: 1;
}

.toast-success {
  border-left: 4px solid #2ecc71;
}
.toast-success .toast-icon {
  color: #2ecc71;
}

.toast-info {
  border-left: 4px solid var(--color-primary);
}
.toast-info .toast-icon {
  color: var(--color-primary);
}

.toast-warning {
  border-left: 4px solid #f39c12;
}
.toast-warning .toast-icon {
  color: #f39c12;
}

.toast-error {
  border-left: 4px solid #e74c3c;
}
.toast-error .toast-icon {
  color: #e74c3c;
}

/* --- Pro Activated Styling --- */
.pro-activated-btn {
  border: 1px solid rgba(243, 156, 18, 0.6) !important;
  background: linear-gradient(135deg, rgba(243, 156, 18, 0.15), rgba(142, 68, 173, 0.15)) !important;
  box-shadow: 0 0 20px rgba(243, 156, 18, 0.2) !important;
  cursor: default !important;
  pointer-events: none;
}

.pro-activated-btn i {
  color: #f39c12 !important;
  filter: drop-shadow(0 0 6px #f39c12);
}

.pro-activated-badge {
  background: linear-gradient(135deg, #f39c12, var(--color-accent));
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-left: auto;
}

/* --- Add Language Sidebar & Modal Styles --- */
.nav-btn-add-lang {
  width: 100%;
  padding: 0.75rem 1rem;
  background: transparent;
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.75rem;
  transition: var(--transition-smooth);
}

.nav-btn-add-lang:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--color-primary);
  color: var(--text-main);
  box-shadow: 0 0 10px rgba(142, 68, 173, 0.1);
}

.add-lang-grid {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin: 0.5rem 0;
  max-height: 260px;
  overflow-y: auto;
  padding-right: 6px;
}

.add-lang-grid::-webkit-scrollbar {
  width: 4px;
}

.add-lang-grid::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

.add-lang-card-btn {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 0.8rem 1rem;
  color: var(--text-main);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: var(--transition-smooth);
  width: 100%;
}

.add-lang-card-btn:hover {
  background: rgba(142, 68, 173, 0.06);
  border-color: var(--color-primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(142, 68, 173, 0.15);
}

.lang-flag {
  font-size: 1.25rem;
  line-height: 1;
}

.lang-name-text {
  text-align: left;
}

.custom-lang-input-section {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 1rem;
  margin-top: 0.5rem;
}

/* --- Panel Tabs Styles --- */
.panel-tabs-header {
  display: flex;
  border-bottom: 1px solid var(--border-glass);
  margin-bottom: 0.5rem;
  width: 100%;
}

.tab-btn {
  flex: 1;
  padding: 0.75rem 0.5rem;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-dimmed);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: var(--transition-smooth);
}

.tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.02);
}

.tab-btn.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
  background: rgba(142, 68, 173, 0.04);
}

/* --- Live Dictionary Results Styles --- */
.dict-results-container {
  scrollbar-width: thin;
}

.dict-entry {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  margin-bottom: 0.75rem;
  animation: fadeIn 0.3s ease-out;
}

.dict-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.06);
  padding-bottom: 0.5rem;
}

.dict-word-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  text-align: left;
}

.dict-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
}

.dict-phonetic {
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--text-dimmed);
}

.dict-actions {
  display: flex;
  gap: 0.4rem;
}

.btn-dict-action {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-dict-action:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.btn-dict-action.btn-speak-foreign:hover {
  color: var(--color-primary);
  border-color: rgba(142, 68, 173, 0.3);
}

.btn-dict-action.btn-speak-meaning:hover {
  color: var(--color-accent);
  border-color: rgba(243, 156, 18, 0.3);
}

.btn-dict-action.btn-save-item:hover {
  color: #2ecc71;
  border-color: rgba(46, 204, 113, 0.3);
}

.dict-meanings {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  text-align: left;
}

.dict-meaning-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.dict-pos {
  align-self: flex-start;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  background: rgba(142, 68, 173, 0.15);
  color: hsl(265, 95%, 75%);
  padding: 2px 8px;
  border-radius: 20px;
}

.dict-def {
  font-size: 0.85rem;
  color: var(--text-main);
  line-height: 1.4;
}

.dict-example {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
  border-left: 2px solid rgba(255, 255, 255, 0.1);
  padding-left: 0.5rem;
  margin-left: 0.25rem;
}

.dict-loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  gap: 0.75rem;
  color: var(--text-dimmed);
}

.dict-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(255, 255, 255, 0.05);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}



