:root {
  color-scheme: dark;
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-accent: rgba(148, 163, 184, 0.1);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-accent: #cbd5e1;
  --code-bg: #1e293b;
  --code-border: #334155;
  --good-color: #10b981;
  --bad-color: #ef4444;
  --badge-bg: #334155;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(2rem, 4vw, 4rem);
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background:
    radial-gradient(circle at 20% 20%, var(--bg-accent), transparent 60%),
    radial-gradient(circle at 80% 10%, rgba(100, 116, 139, 0.12), transparent 55%),
    linear-gradient(160deg, #0f172a 0%, #020617 100%);
  color: var(--text-main);
  line-height: 1.6;
}

.flash-card-container {
  max-width: min(900px, 92vw);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  opacity: 0;
  transition: opacity 0.6s ease;
  position: relative;
}

.flash-card-container.visible {
  opacity: 1;
}

.card-type-badge {
  position: absolute;
  top: -0.75rem;
  right: 0;
  background: var(--badge-bg);
  color: var(--text-accent);
  padding: 0.35rem 0.85rem;
  border-radius: 0.375rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.card-type-badge.qa {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
}

.card-type-badge.concept {
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  color: white;
}

.card-type-badge.section {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
}

.card-question {
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  line-height: 1.3;
  margin: 0;
  margin-top: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
  text-align: left;
}

.card-answer {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  text-align: left;
}

.answer-text {
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  line-height: 1.7;
  margin: 0;
  color: var(--text-accent);
}

.answer-list {
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  line-height: 1.8;
  margin: 0.5rem 0;
  padding-left: 1.5rem;
  color: var(--text-accent);
}

.answer-list li {
  margin: 0.5rem 0;
  padding-left: 0.25rem;
}

.answer-list li::marker {
  color: var(--good-color);
}

.table-wrapper {
  margin: 1rem 0;
  overflow-x: auto;
  border-radius: 0.5rem;
  border: 1px solid var(--code-border);
}

.answer-table {
  width: 100%;
  border-collapse: collapse;
  font-size: clamp(0.85rem, 2vw, 1rem);
  background: var(--code-bg);
}

.answer-table th,
.answer-table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--code-border);
}

.answer-table th {
  background: rgba(86, 156, 214, 0.1);
  color: #569cd6;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.85em;
  letter-spacing: 0.05em;
}

.answer-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.answer-table tbody tr:last-child td {
  border-bottom: none;
}

.code-wrapper {
  position: relative;
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: 0.5rem;
  overflow: hidden;
  margin: 0.5rem 0;
}

.code-wrapper.good {
  border-left: 4px solid var(--good-color);
}

.code-wrapper.bad {
  border-left: 4px solid var(--bad-color);
}

.code-badge {
  display: inline-block;
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 0 0 0.375rem 0;
  position: absolute;
  top: 0;
  right: 0;
  z-index: 1;
}

.code-badge.good {
  background: var(--good-color);
  color: white;
}

.code-badge.bad {
  background: var(--bad-color);
  color: white;
}

pre {
  margin: 0;
  padding: 3rem 1.25rem 1.25rem 1.25rem;
  overflow-x: auto;
  font-family: 'JetBrains Mono', 'Consolas', 'Monaco', monospace;
  font-size: clamp(0.8rem, 1.8vw, 0.95rem);
  line-height: 1.6;
}

code {
  font-family: inherit;
  color: #dcdcdc;
}

/* Visual Studio Dark Theme Colors for C# */
code[class*="language-"],
pre[class*="language-"] {
  color: #dcdcdc;
  background: none;
  font-family: 'JetBrains Mono', 'Consolas', 'Monaco', monospace;
  text-align: left;
  white-space: pre;
  word-spacing: normal;
  word-break: normal;
  word-wrap: normal;
  line-height: 1.6;
  tab-size: 4;
}

/* Keywords: if, else, return, public, private, class, etc. */
.token.keyword {
  color: #569cd6;
}

/* Class names, types */
.token.class-name {
  color: #4ec9b0;
}

/* Strings */
.token.string {
  color: #d69d85;
}

/* Numbers */
.token.number {
  color: #b5cea8;
}

/* Comments */
.token.comment {
  color: #6a9955;
  font-style: italic;
}

/* Functions, method names */
.token.function {
  color: #dcdcaa;
}

/* Operators: =, +, -, etc. */
.token.operator {
  color: #d4d4d4;
}

/* Punctuation: {}, (), [], etc. */
.token.punctuation {
  color: #d4d4d4;
}

/* Properties */
.token.property {
  color: #9cdcfe;
}

/* Variables, parameters */
.token.parameter,
.token.variable {
  color: #9cdcfe;
}

/* Attributes like [HttpGet] */
.token.annotation,
.token.attr-name {
  color: #4ec9b0;
}

/* Boolean, null, etc. */
.token.boolean,
.token.constant,
.token.null {
  color: #569cd6;
}

/* Namespaces */
.token.namespace {
  color: #4ec9b0;
}

/* Generics <T> */
.token.generic {
  color: #4ec9b0;
}

.card-meta {
  margin: 0;
  margin-top: 0.5rem;
  font-size: clamp(0.75rem, 2vw, 0.9rem);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: center;
  border-top: 1px solid var(--code-border);
  padding-top: 1rem;
}

/* Scrollbar styling for code blocks */
pre::-webkit-scrollbar {
  height: 8px;
}

pre::-webkit-scrollbar-track {
  background: var(--bg-primary);
  border-radius: 4px;
}

pre::-webkit-scrollbar-thumb {
  background: var(--code-border);
  border-radius: 4px;
}

pre::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

@media (max-width: 768px) {
  body {
    padding: 1.5rem 1rem;
  }

  .card-question {
    font-size: 1.5rem;
  }

  .answer-text {
    font-size: 1rem;
  }

  pre {
    padding: 2.5rem 1rem 1rem 1rem;
    font-size: 0.8rem;
  }

  .code-badge {
    font-size: 0.75rem;
    padding: 0.3rem 0.6rem;
  }
}

@media (max-width: 480px) {
  body {
    padding: 1rem 0.75rem;
  }

  .card-type-badge {
    font-size: 0.65rem;
    padding: 0.25rem 0.65rem;
  }

  .card-question {
    font-size: 1.25rem;
    margin-top: 1rem;
  }

  .answer-text {
    font-size: 0.95rem;
  }

  pre {
    font-size: 0.75rem;
  }

  .card-meta {
    letter-spacing: 0.1em;
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  .flash-card-container,
  * {
    transition-duration: 0.01ms !important;
  }
}

/* Print styles */
@media print {
  body {
    background: white;
    color: black;
  }

  .flash-card-container {
    opacity: 1;
  }

  .code-wrapper {
    border: 1px solid #ccc;
    page-break-inside: avoid;
  }

  pre {
    background: #f5f5f5;
  }

  code {
    color: black;
  }
}
