:root {
  --bg-color: #0d1117;
  --card-bg: #161b22;
  --card-border: #30363d;
  --input-bg: #0d1117;
  --text-primary: #f0f6fc;
  --text-secondary: #8b949e;
  --yt-red: #ff0033;
  --yt-red-hover: #cc0029;
  --accent-blue: #58a6ff;
  --accent-green: #238636;
  --accent-green-hover: #2ea043;
  --badge-hd: #ff7b72;
  --radius: 12px;
  --transition: all 0.2s ease-in-out;
}

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

html,
body {
  overscroll-behavior: none;
  overscroll-behavior-y: none;
  -webkit-overflow-scrolling: auto;
}

img {
  max-width: 100%;
  height: auto;
}

body {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px;
}

.canvas-container,
#gameCanvas {
  touch-action: none !important;
  user-select: none !important;
  -webkit-user-select: none !important;
  -webkit-touch-callout: none !important;
  overscroll-behavior: none !important;
}

.container {
  width: 100%;
  max-width: 960px;
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 32px;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin-bottom: 8px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}

.brand-logo,
.brand-logo-img {
  width: 48px !important;
  height: 48px !important;
  max-width: 48px !important;
  max-height: 48px !important;
  object-fit: contain !important;
  flex-shrink: 0 !important;
  display: block !important;
  filter: drop-shadow(0 4px 10px rgba(88, 166, 255, 0.3));
  transition: var(--transition);
}

.brand-logo:hover,
.brand-logo-img:hover {
  transform: scale(1.08) rotate(8deg);
}

.brand-text {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.brand-text h1 {
  font-size: 2.1rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #ffffff 0%, #93c5fd 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-sub {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-secondary);
}

/* 3-line Hamburger Menu Button */
.menu-toggle-btn {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 42px;
  padding: 11px 9px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.menu-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-50%) scale(1.05);
}

.hamburger-line {
  display: block;
  height: 2px;
  width: 20px;
  background: #c9d1d9;
  border-radius: 2px;
  transition: all 0.25s ease-in-out;
}

.menu-toggle-btn:hover .hamburger-line {
  background: #ffffff;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* Search Card */
.search-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  margin-bottom: 32px;
}

.search-form {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

@media (max-width: 680px) {
  .search-form {
    flex-direction: column;
  }
}

.input-wrapper {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 14px;
  width: 20px;
  height: 20px;
  color: var(--text-secondary);
  pointer-events: none;
}

.input-wrapper input {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 14px 80px 14px 44px;
  color: var(--text-primary);
  font-size: 1rem;
  outline: none;
  transition: var(--transition);
}

.input-wrapper input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.2);
}

.paste-btn {
  position: absolute;
  right: 10px;
  background: #21262d;
  border: 1px solid var(--card-border);
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 0.8rem;
  padding: 6px 10px;
  cursor: pointer;
  transition: var(--transition);
}

.paste-btn:hover {
  background: #30363d;
  color: var(--text-primary);
}

.submit-btn {
  background: var(--yt-red);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 14px 28px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition);
  min-width: 130px;
}

.submit-btn:hover {
  background: var(--yt-red-hover);
  transform: translateY(-1px);
}

.submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Spinner */
.spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Error Box */
.error-box {
  background: rgba(248, 81, 73, 0.15);
  border: 1px solid rgba(248, 81, 73, 0.4);
  color: #ff7b72;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 0.9rem;
  margin-bottom: 16px;
}

/* Examples */
.examples {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.examples code {
  background: #21262d;
  padding: 3px 8px;
  border-radius: 4px;
  color: #c9d1d9;
}

/* Video Info Card */
.video-info-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 28px;
}

.video-channel {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-blue);
  margin-bottom: 6px;
}

.video-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 10px;
  line-height: 1.4;
}

.video-link {
  color: var(--text-secondary);
  font-size: 0.85rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: var(--transition);
}

.video-link:hover {
  color: var(--accent-blue);
  text-decoration: underline;
}

/* Section Title */
.section-title-wrapper {
  margin-bottom: 20px;
}

.section-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.section-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Thumbnails Grid */
.thumbnails-grid {
  display: flex;
  justify-content: center;
  margin-bottom: 40px;
}

.thumb-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-width: 860px;
  width: 100%;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.thumb-img-wrapper {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 Aspect Ratio */
  background: #000;
  overflow: hidden;
  cursor: zoom-in;
  -webkit-tap-highlight-color: transparent;
}

.thumb-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.25s ease;
}

.thumb-img-wrapper:hover .thumb-img {
  transform: scale(1.02);
}

.zoom-badge {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  transition: background 0.2s, transform 0.2s;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.thumb-img-wrapper:hover .zoom-badge {
  background: rgba(0, 0, 0, 0.9);
  transform: translateY(-2px);
}

.badge {
  position: absolute;
  top: 14px;
  left: 14px;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(6px);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.badge.recommended {
  background: var(--yt-red);
  box-shadow: 0 2px 8px rgba(255, 0, 51, 0.4);
}

.thumb-body {
  padding: 14px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--card-bg);
}

.thumb-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.thumb-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.thumb-res {
  font-size: 0.85rem;
  color: var(--accent-blue);
  background: rgba(88, 166, 255, 0.1);
  border: 1px solid rgba(88, 166, 255, 0.25);
  padding: 3px 10px;
  border-radius: 6px;
  font-weight: 600;
}

.thumb-actions {
  display: flex;
  flex-shrink: 0;
}

.download-btn {
  min-width: 360px;
  background: var(--accent-green);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 12px 48px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  white-space: nowrap;
  transition: var(--transition);
}

.download-btn:hover {
  background: var(--accent-green-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(46, 160, 67, 0.35);
}

@media (max-width: 640px) {
  .thumb-body {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 14px 16px;
  }

  .thumb-header {
    justify-content: space-between;
  }

  .download-btn {
    min-width: unset;
    width: 100%;
    padding: 12px 20px;
  }
}

.mobile-tip {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-align: center;
  margin-top: 8px;
  width: 100%;
}

/* SEO Info Section */
.seo-info-section {
  margin-top: 40px;
  margin-bottom: 40px;
  border-top: 1px solid var(--card-border);
  padding-top: 32px;
}

.seo-heading {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--text-primary);
}

.seo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.seo-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.seo-card h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--accent-blue);
}

.seo-card p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Footer */
.footer {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.85rem;
  border-top: 1px solid var(--card-border);
  padding-top: 24px;
}

/* Fullscreen Lightbox Modal (Pure Thumbnail Only) */
.lightbox-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000000;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  animation: lightboxFadeIn 0.15s ease-out;
}

@keyframes lightboxFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.lightbox-img {
  max-width: 100vw;
  max-height: 100vh;
  width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
}

.lightbox-close-btn {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 100000;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.lightbox-close-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

/* Toast Notification */
.toast-notification {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(22, 27, 34, 0.95);
  border: 1px solid var(--accent-blue);
  color: #fff;
  padding: 12px 24px;
  border-radius: 30px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s ease-out;
  z-index: 1000000;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

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

/* Slide-over Side Menu Drawer */
.side-menu-drawer {
  position: fixed;
  inset: 0;
  z-index: 999999;
  visibility: hidden;
  transition: visibility 0.3s ease;
}

.side-menu-drawer.open {
  visibility: visible;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.3s ease;
  cursor: pointer;
}

.side-menu-drawer.open .drawer-backdrop {
  opacity: 1;
}

.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 320px;
  max-width: 85vw;
  background: #111418;
  border-left: 1px solid var(--card-border);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 24px 20px;
  z-index: 2;
}

.side-menu-drawer.open .drawer-panel {
  transform: translateX(0);
}

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

.drawer-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.drawer-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
}

.drawer-badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  background: rgba(88, 166, 255, 0.15);
  color: var(--accent-blue);
  border: 1px solid rgba(88, 166, 255, 0.3);
  padding: 2px 6px;
  border-radius: 4px;
}

.drawer-close-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #c9d1d9;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.drawer-close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.drawer-nav {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  overflow-y: auto;
}

.drawer-category {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.category-heading {
  font-size: 0.75rem;
  font-weight: 700;
  color: #8b949e;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 4px 10px;
  margin-bottom: 2px;
}

.drawer-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid transparent;
  transition: var(--transition);
}

.drawer-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
}

.drawer-item.active {
  background: rgba(88, 166, 255, 0.12);
  border-color: rgba(88, 166, 255, 0.35);
}

.drawer-item-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #c9d1d9;
  flex-shrink: 0;
}

.drawer-item.active .drawer-item-icon {
  background: rgba(88, 166, 255, 0.2);
  color: var(--accent-blue);
}

.drawer-item-content {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.drawer-item-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 2px;
}

.drawer-item-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.drawer-item-badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.1);
  color: #8b949e;
  padding: 3px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}

.drawer-active-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-blue);
  box-shadow: 0 0 8px var(--accent-blue);
  flex-shrink: 0;
}

.drawer-footer {
  padding-top: 16px;
  border-top: 1px solid var(--card-border);
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-align: center;
}
