/* Scoped CSS for XKCD Comic Viewer */
.xkcd-body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #1e293b;
  background-color: #f8fafc;
  line-height: 1.5;
  margin: 0;
  padding: 0;
}

.xkcd-main {
  padding: 1.5rem 1rem 3rem;
}

.xkcd-container {
  max-width: 1000px;
  margin: 0 auto;
}

.xkcd-app-card {
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  padding: 1.75rem;
  margin-bottom: 2rem;
}

.xkcd-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}

.xkcd-nav-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.xkcd-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  border: none;
  padding: 0.55rem 1.1rem;
  font-size: 0.9rem;
  text-decoration: none;
}

.xkcd-btn-primary {
  background: #2563eb;
  color: #ffffff;
}

.xkcd-btn-primary:hover {
  background: #1d4ed8;
}

.xkcd-btn-outline {
  background: #ffffff;
  color: #334155;
  border: 1px solid #cbd5e1;
}

.xkcd-btn-outline:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.xkcd-search-group {
  flex: 1;
  max-width: 320px;
}

.xkcd-input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.55rem 0.85rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.9rem;
  outline: none;
  background: #ffffff;
  color: #0f172a;
}

.xkcd-input:focus {
  border-color: #2563eb;
}

.xkcd-presets {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 1.5rem;
}

.xkcd-preset-label {
  font-size: 0.825rem;
  color: #64748b;
  font-weight: 500;
}

.xkcd-preset-btn {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 0.2rem 0.55rem;
  font-size: 0.8rem;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
}

.xkcd-preset-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

/* Comic Stage */
.xkcd-comic-stage {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.xkcd-comic-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.xkcd-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.xkcd-badge-num {
  font-weight: 800;
  color: #2563eb;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  font-size: 0.9rem;
}

.xkcd-comic-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 800;
  color: #0f172a;
}

.xkcd-comic-date {
  font-size: 0.8rem;
  color: #64748b;
}

.xkcd-external-links {
  display: flex;
  align-items: center;
}

.xkcd-ext-link {
  font-size: 0.85rem;
  color: #2563eb;
  text-decoration: none;
  font-weight: 600;
}

.xkcd-ext-link:hover {
  text-decoration: underline;
}

/* Comic Viewer Box */
.xkcd-viewer-box {
  background: #ffffff;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  padding: 1.5rem;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 240px;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

.xkcd-comic-graphic {
  width: 100%;
  max-width: 680px;
  display: flex;
  justify-content: center;
}

.xkcd-strip-panel {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  width: 100%;
  border: 2px solid #0f172a;
  border-radius: 8px;
  padding: 1.25rem;
  background: #ffffff;
}

.xkcd-dialogue-bubble {
  font-size: 0.95rem;
  color: #0f172a;
  line-height: 1.5;
}

.xkcd-speaker {
  font-weight: 700;
  color: #334155;
}

.xkcd-punchline {
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px dashed #cbd5e1;
  font-weight: 500;
}

/* Alt Text Card */
.xkcd-alt-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.xkcd-alt-badge {
  font-size: 0.7rem;
  text-transform: uppercase;
  font-weight: 700;
  color: #64748b;
  letter-spacing: 0.05em;
}

.xkcd-alt-content {
  margin: 0;
  font-size: 0.95rem;
  font-style: italic;
  color: #334155;
  line-height: 1.45;
}

/* Explanation Card */
.xkcd-explain-card {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
  background: #ffffff;
}

.xkcd-explain-toggle {
  width: 100%;
  background: #f8fafc;
  border: none;
  padding: 0.85rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-size: 0.95rem;
  color: #1e293b;
  cursor: pointer;
  transition: background 0.15s ease;
}

.xkcd-explain-toggle:hover {
  background: #f1f5f9;
}

.xkcd-explain-body {
  padding: 1.25rem;
  border-top: 1px solid #e2e8f0;
  display: block;
}

.xkcd-explain-body.xkcd-hidden {
  display: none !important;
}

.xkcd-explain-p {
  margin: 0;
  font-size: 0.9rem;
  color: #475569;
  line-height: 1.6;
}

/* Guide Section */
.xkcd-guide-section {
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  padding: 1.75rem;
  margin-bottom: 2rem;
}

.xkcd-section-title {
  margin: 0 0 0.5rem;
  font-size: 1.35rem;
  font-weight: 700;
  color: #0f172a;
}

.xkcd-lead-text {
  color: #475569;
  font-size: 0.95rem;
  margin: 0 0 1.25rem;
}

.xkcd-table-wrap {
  overflow-x: auto;
}

.xkcd-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.xkcd-table th {
  background: #f8fafc;
  color: #334155;
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 2px solid #e2e8f0;
  font-weight: 600;
}

.xkcd-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
}

.xkcd-table tr:hover {
  background: #f8fafc;
}
