
   :root {
  --primary: #059669;              
  --primary-dark: #047857;         
  --accent: #0EA5E9;               
  --success: #059669;              
  --bg-main: #F9FAFB;              
  --bg-elevated: #FFFFFF;          
  --bg-card: #FFFFFF;              
  --text-primary: #111827;         
  --text-secondary: #6B7280;       
  --border: #E5E7EB;               
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
body {
  /* font-family: 'DM Sans', 'Inter', system-ui, -apple-system, sans-serif; */
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
#header,
#footer,
#backtotop,
#moretools {
  display: block;
}
#header {
  position: relative;
  z-index: 50;
}
main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.5rem;
}
@media (min-width: 768px) {
  main {
    padding: 2.5rem;
  }
}
.hero {
  text-align: center;
  margin-bottom: 2rem;
  background: linear-gradient(135deg, var(--bg-elevated) 0%, var(--bg-card) 100%);
  border-radius: 1.5rem;
  border: 1px solid var(--border);
}
.hero h1 {
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}
.hero p {
  color: var(--text-secondary);
  font-size: 1rem;
  max-width: 600px;
  margin: 0 auto;
}
.tool-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}
@media (min-width: 1024px) {
  .tool-container {
    grid-template-columns: 1.2fr 1fr;
    gap: 2rem;
  }
}
@media (max-width: 1023px) {
  .seo-info-box {
    order: 999; 
  }
  .tool-container {
    display: flex;
    flex-direction: column;
  }
  .right-column {
    order: 2; 
  }
  .left-column {
    order: 1; 
    display: flex;
    flex-direction: column;
  }
}
.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}
@media (min-width: 768px) {
  .card {
    padding: 2rem;
  }
}
.input-wrapper {
  position: relative;
  margin-bottom: 1rem;
}
.btn-clear {
  padding: 0.75rem;
  /* background: #EF4444; */
  background : #bb4545;
  color: white;
  border: none;
  border-radius: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
}
.btn-clear .material-icons {
  font-size: 1.25rem;
}
.btn-clear:hover {
  background: #DC2626;
}
.btn-clear:active {
  transform: scale(0.98);
}

/* Toggle Button */
.btn-toggle {
  width: 100%;
  padding: 0.875rem 1.5rem;
  background: white;
  color: var(--primary);
  border: 2px solid var(--primary);
  border-radius: 0.75rem;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}
.btn-toggle:hover {
  background: var(--primary);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.25);
}
.btn-toggle:active {
  transform: translateY(0) scale(0.98);
}
.btn-toggle .material-icons {
  font-size: 1.25rem;
}

/* Search Results Container */
.search-results {
  max-height: 500px;
  overflow-y: auto;
  margin-top: 1rem;
}
.search-results::-webkit-scrollbar {
  width: 8px;
}
.search-results::-webkit-scrollbar-track {
  background: var(--bg-main);
  border-radius: 4px;
}
.search-results::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
.search-results::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* Search Result Item */
.search-result-item {
  display: flex;
  gap: 1rem;
  padding: 0.875rem;
  background: var(--bg-main);
  border: 2px solid var(--border);
  border-radius: 0.75rem;
  margin-bottom: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
}
.search-result-item:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.15);
  transform: translateY(-2px);
}
.search-result-item:active {
  transform: translateY(0) scale(0.98);
}

.search-result-thumbnail {
  position: relative;
  flex-shrink: 0;
  width: 160px;
  height: 90px;
  border-radius: 0.5rem;
  overflow: hidden;
  background: #000;
}
.search-result-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.play-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.search-result-item:hover .play-overlay {
  opacity: 1;
}
.play-overlay .material-icons {
  font-size: 3rem;
  color: white;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.search-result-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.search-result-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 0.5rem 0;
  line-height: 1.4;
  display: -webkit-box;
  /* -webkit-line-clamp: 2; */
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.search-result-channel {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 0;
}

/* Search States */
.search-loading,
.search-error,
.search-empty {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-secondary);
}
.search-loading .spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.search-loading p,
.search-error p,
.search-empty p {
  font-size: 0.95rem;
  margin: 0;
}
.search-error .material-icons,
.search-empty .material-icons {
  font-size: 3rem;
  opacity: 0.3;
  margin-bottom: 1rem;
}
.search-error {
  color: #EF4444;
}

/* Mobile Responsive */
@media (max-width: 640px) {
  .search-result-item {
    flex-direction: column;
  }
  .search-result-thumbnail {
    width: 100%;
    height: 180px;
  }
}
input[type="text"] {
  width: 100%;
  padding: 1rem 1rem 1rem 3rem;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 0.75rem;
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: all 0.2s ease;
  font-family: 'JetBrains Mono', monospace;
}
input[type="text"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}
input[type="text"]::placeholder {
  color: var(--text-secondary);
  opacity: 0.6;
}
.input-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  pointer-events: none;
}
.btn {
  padding: 1rem 1rem;
  border-radius: 0.75rem;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.btn:active {
  transform: scale(0.98);
}
.btn-primary {
  background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.25);
}
.btn-primary:hover {
  box-shadow: 0 6px 16px rgba(5, 150, 105, 0.35);
  transform: translateY(-2px);
}
.btn-success {
  background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.25);
  padding: 0.875rem 1rem;
}
.btn-success:hover {
  box-shadow: 0 6px 16px rgba(5, 150, 105, 0.35);
  transform: translateY(-2px);
}
#videoCard {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 2px solid var(--border);
  transition: opacity 0.3s ease;
}
#videoCard.hidden {
  display: none;
}
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: #ECFDF5;
  border: 1px solid #059669;
  border-radius: 2rem;
  font-size: 0.875rem;
  color: #065F46;
  font-weight: 500;
  margin-bottom: 1rem;
}
.status-dot {
  width: 8px;
  height: 8px;
  background: #059669;
  border-radius: 50%;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
#playerWrap {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: 0.75rem;
  margin-bottom: 1.5rem;
  background: #000;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  /* Critical for mobile touch events */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  /* Override any Tailwind resets */
  max-width: 100% !important;
  isolation: isolate;
}
#player,
#player iframe {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  border-radius: 0.75rem;
  /* Ensure touch events reach the iframe on mobile */
  pointer-events: auto !important;
  touch-action: auto !important;
  /* Override Tailwind video/iframe resets */
  border: none !important;
  max-width: none !important;
  max-height: none !important;
  display: block !important;
}
.controls-grid {
  display: grid;
  gap: 1rem;
  margin-bottom: 1rem;
}
@media (min-width: 640px) {
  .controls-grid {
    grid-template-columns: 1fr auto;
  }
}
.shortcut-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: #F3F4F6;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  justify-content: center;
}
@media (max-width: 1023px) {
  .shortcut-badge {
    display: none;
  }
}
.key {
  background: white;
  border: 1px solid var(--border);
  border-radius: 0.25rem;
  padding: 0.125rem 0.5rem;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  color: var(--text-primary);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}
.section-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.section-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}
.count-badge {
  background: var(--primary);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 2rem;
  font-size: 0.875rem;
  font-weight: 600;
  min-width: 32px;
  text-align: center;
}
#output {
  margin-bottom: 1.5rem;
}
@media (min-width: 1024px) {
  #output {
    max-height: 600px;
    overflow-y: auto;
    padding-right: 0.5rem;
  }
  #output::-webkit-scrollbar {
    width: 8px;
  }
  #output::-webkit-scrollbar-track {
    background: var(--bg-main);
    border-radius: 4px;
  }
  #output::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
    transition: background 0.2s ease;
  }
  #output::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
  }
}
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-secondary);
}
.empty-state .material-icons {
  font-size: 4rem;
  opacity: 0.3;
  margin-bottom: 1rem;
}
.empty-state p {
  font-size: 0.95rem;
  line-height: 1.6;
}
.timestamp-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  margin-bottom: 0.75rem;
  transition: all 0.2s ease;
}
.timestamp-item:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.1);
  transform: translateY(-2px);
}
.timestamp-info {
  flex: 1;
  min-width: 0;
}
.timestamp-time {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  color: var(--primary);
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}
.timestamp-label {
  color: var(--text-primary);
  font-size: 0.9rem;
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
  white-space: normal;
  line-height: 1.4;
}
.timestamp-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}
.icon-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: white;
  border-radius: 0.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.icon-btn:hover {
  background: var(--bg-main);
  color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
.icon-btn.play:hover {
  color: var(--success);
}
.icon-btn.loop:hover {
  color: var(--accent);
}
.icon-btn.delete:hover {
  color: #EF4444;
}
.icon-btn .material-icons {
  font-size: 1.25rem;
}
#exportSection {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 2px solid var(--border);
}
.export-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
@media (min-width: 640px) {
  .export-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
.export-btn {
  padding: 0.875rem 1rem;
  background: white;
  border: 2px solid var(--border);
  border-radius: 0.75rem;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-primary);
}
.export-btn:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
.export-btn .material-icons {
  font-size: 1.5rem;
}
.info-box {
  display: flex;
  gap: 1rem;
  padding: 1rem;
  background: #EEF2FF;
  border-left: 4px solid var(--primary);
  border-radius: 0.5rem;
  font-size: 0.9rem;
  line-height: 1.6;
}
.info-box .material-icons {
  color: var(--primary);
  flex-shrink: 0;
}
.info-box p {
  margin: 0;
  color: var(--text-secondary);
}
.seo-info-box {
  display: flex;
  gap: 1rem;
  padding: 1.25rem;
  background: linear-gradient(135deg, #FEF3C7 0%, #FDE68A 100%);
  border-left: 4px solid #F59E0B;
  border-radius: 0.75rem;
  font-size: 0.9rem;
  line-height: 1.7;
  margin-top: 1.5rem;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.15);
}
.seo-info-box .material-icons {
  color: #D97706;
  flex-shrink: 0;
  font-size: 1.75rem;
}
.seo-info-box p {
  margin: 0;
  color: #78350F;
}
.seo-info-box strong {
  color: #92400E;
  display: block;
  margin-bottom: 0.5rem;
  font-size: 1rem;
}
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #1F2937;
  color: white;
  padding: 1rem 1.5rem;
  border-radius: 0.75rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.95rem;
  font-weight: 500;
  z-index: 9999;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  max-width: 90%;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast .material-icons {
  font-size: 1.25rem;
  flex-shrink: 0;
}
.content-section {
  background: white;
  padding: 2rem 1.5rem;
  margin-top: 3rem;
  border-radius: 1rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.content-section h2 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
}
.content-section h3 {
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 2rem;
  margin-bottom: 1rem;
}
.content-section h4 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--primary);
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}
.content-section p {
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 1rem;
  font-size: 1rem;
}
.content-section ul,
.content-section ol {
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}
.content-section li {
  margin-bottom: 0.5rem;
}
.content-section code {
  background: #F3F4F6;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  color: var(--primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9em;
}
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}
.feature-card {
  padding: 1.5rem;
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  transition: all 0.2s ease;
}
.feature-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.1);
  transform: translateY(-2px);
}
.feature-card h4 {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  margin-top: 0;
}
.feature-card h4 .material-icons {
  color: var(--primary);
  font-size: 1.5rem;
}
.feature-card p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
}
main .hidden {
  display: none !important;
}


@media (max-width: 640px) {
  .timestamp-actions {
    flex-wrap: wrap;
  }
  .icon-btn {
    width: 32px;
    height: 32px;
  }
  .feature-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 768px) {
  * {
    -webkit-text-size-adjust: 100%;
  }
}

/* Mobile-specific YouTube player fixes */
@media (max-width: 1023px) {
  #playerWrap {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
  }
  
  #player iframe {
    -webkit-transform: translateZ(0) !important;
    transform: translateZ(0) !important;
  }
}

/* Force proper stacking context for mobile */
#videoCard {
  position: relative;
  z-index: 1;
}
