/* =============================================================================
   Interactive Cardsets — app.css
   digitaletik.se
   ============================================================================= */

/* =============================================================================
   1. DESIGN SYSTEM / CUSTOM PROPERTIES
   ============================================================================= */

:root {
  /* Colors */
  --color-bg:           #f8f7f4;
  --color-surface:      #ffffff;
  --color-text:         #1a1a1a;
  --color-text-muted:   #666666;
  --color-border:       #1a1a1a;
  --color-accent:       var(--deck-primary, #2c5f8a);
  --color-accent-light: color-mix(in srgb, var(--color-accent) 15%, transparent);

  /* Card Dimensions */
  --card-width:  280px;
  --card-height: 420px;
  --card-radius: 12px;

  /* Typography */
  --font-display: 'Fraunces', Georgia, serif;
  --font-body:    'DM Sans', system-ui, sans-serif;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 40px;

  /* Border Radii */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.10);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.12);

  /* Transitions */
  --transition: 0.2s ease;
}

/* Dark Mode Overrides */
[data-theme="dark"] {
  --color-bg:         #141414;
  --color-surface:    #1e1e1e;
  --color-text:       #f0ede8;
  --color-text-muted: #999999;
  --color-border:     #3a3a3a;
}

/* =============================================================================
   2. RESET & BASE
   ============================================================================= */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  line-height: 1.2;
}

h4,
h5,
h6 {
  line-height: 1.3;
}

a {
  color: inherit;
}

img,
svg {
  display: block;
  max-width: 100%;
}

ul,
ol {
  padding: 0;
}

button,
input,
textarea,
select {
  font-family: inherit;
  font-size: inherit;
}

/* =============================================================================
   3. LAYOUT — HEADER
   ============================================================================= */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  z-index: 100;
  padding: 12px 24px;
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1280px;
  margin: 0 auto;
}

.site-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: inherit;
}

.site-logo img {
  height: 36px;
  width: auto;
}

.logo-dark {
  display: none;
}

[data-theme="dark"] .logo-dark {
  display: block;
}

[data-theme="dark"] .logo-light {
  display: none;
}

/* Theme toggle: show sun in light mode, moon in dark mode */
.icon-moon { display: none; }
.icon-sun  { display: block; }

[data-theme="dark"] .icon-moon { display: block; }
[data-theme="dark"] .icon-sun  { display: none; }

.header-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

#main-content {
  padding-top: 72px;
}

/* =============================================================================
   4. LAYOUT — FOOTER
   ============================================================================= */

.site-footer {
  padding: 24px;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--color-border);
  margin-top: var(--space-xl);
}

.site-footer a {
  color: var(--color-text-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.site-footer a:hover {
  color: var(--color-text);
}

/* =============================================================================
   5. BUTTONS
   ============================================================================= */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition), color var(--transition),
              border-color var(--transition), opacity var(--transition),
              box-shadow var(--transition);
  white-space: nowrap;
  user-select: none;
  -webkit-user-select: none;
}

.btn:hover {
  background: var(--color-text);
  color: var(--color-bg);
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--color-accent);
}

.btn-primary {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #ffffff;
  opacity: 0.85;
}

.btn-small {
  padding: 5px 10px;
  font-size: 0.8rem;
}

.btn-tiny {
  padding: 3px 7px;
  font-size: 0.75rem;
}

.btn-full {
  width: 100%;
  justify-content: center;
}

.btn-danger {
  border-color: #c0392b;
  color: #c0392b;
}

.btn-danger:hover {
  background: #c0392b;
  color: #ffffff;
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text);
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
  line-height: 1;
}

.btn-icon:hover {
  background: rgba(44, 95, 138, 0.15);
  background: var(--color-accent-light);
}

.btn-icon:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--color-accent);
}
/* =============================================================================
   6. CARD FLIP (3D)
   ============================================================================= */

.card-wrapper {
  perspective: 1000px;
  width: var(--card-width);
  height: var(--card-height);
  position: relative;
  cursor: pointer;
  outline: none;
  flex-shrink: 0;
}

.card-wrapper:focus-visible {
  box-shadow: 0 0 0 3px var(--color-accent);
  border-radius: var(--card-radius);
}

.card-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.55s cubic-bezier(0.645, 0.045, 0.355, 1.0);
  border-radius: var(--card-radius);
}

.card-inner.flipped {
  transform: rotateY(180deg);
}

.card-back,
.card-front {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-md);
}

.card-back {
  overflow: hidden;
}

.card-front {
  transform: rotateY(180deg);
}

.card-back-inner {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 20px;
  color: #ffffff;
  text-align: center;
}

.card-icon {
  font-size: 3.5rem;
  text-align: center;
  line-height: 1;
}

.card-emoji {
  font-size: 3.5rem;
  line-height: 1;
}

.card-category-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.85;
  font-weight: 500;
}

.card-title-label {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  text-align: center;
  line-height: 1.3;
  padding: 0 8px;
}

.card-front-inner {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--card-radius);
}

.card-front-header {
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #ffffff;
  font-size: 0.85rem;
  flex-shrink: 0;
  border-radius: var(--card-radius) var(--card-radius) 0 0;
}

.card-id-sm {
  font-weight: 600;
}

.card-front-body {
  flex: 1;
  min-height: 0;
  padding: 18px 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.card-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 8px;
  line-height: 1.3;
  color: var(--color-text);
}

.card-description {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}

.card-activity {
  padding: 12px 14px;
  background: rgba(44, 95, 138, 0.08);
  background: color-mix(in srgb, var(--color-accent) 8%, transparent);
  border-top: 1px solid var(--color-border);
  font-size: 0.85rem;
  color: var(--color-text-muted);
  flex-shrink: 0;
  line-height: 1.4;
  border-radius: 0 0 var(--card-radius) var(--card-radius);
}

/* =============================================================================
   7. CARD TOOLBAR (on hover)
   ============================================================================= */

.card-toolbar {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 10;
}

.card-wrapper:hover .card-toolbar,
.card-wrapper:focus-within .card-toolbar {
  opacity: 1;
}

.card-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #333333;
  transition: background 0.15s ease, transform 0.15s ease, color 0.15s ease;
  padding: 0;
  font-size: 0.75rem;
  line-height: 1;
}

.card-btn:hover {
  background: #ffffff;
  transform: scale(1.1);
}

.card-btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.card-btn.active,
.fav-btn[aria-pressed="true"] {
  color: #e74c3c;
}

.fav-btn[aria-pressed="true"] svg path {
  fill: #e74c3c;
  stroke: #e74c3c;
}

[data-theme="dark"] .card-btn {
  background: rgba(30, 30, 30, 0.9);
  border-color: rgba(255, 255, 255, 0.2);
  color: #cccccc;
}

[data-theme="dark"] .card-btn:hover {
  background: rgba(30, 30, 30, 1);
}

/* =============================================================================
   8. CARDS GRID
   ============================================================================= */

.cards-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 16px 40px;
  list-style: none;
}

.cards-grid > li {
  display: flex;
}

.card-wrapper.hidden {
  display: none;
}

@keyframes card-shuffle {
  0% {
    transform: scale(0.95) rotate(-2deg);
    opacity: 0.7;
  }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

.card-wrapper.shuffling {
  animation: card-shuffle 0.3s ease-out;
}

@keyframes card-reveal {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card-wrapper.revealed {
  animation: card-reveal 0.25s ease-out;
}
/* =============================================================================
   9. CARDSET PAGE
   ============================================================================= */

.cardset-page {
  padding-bottom: 40px;
}

.cardset-header {
  padding: 32px 24px 24px;
  max-width: 1280px;
  margin: 0 auto;
}

.cardset-header-inner {
  max-width: 700px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  margin-bottom: 12px;
  transition: color var(--transition);
}

.back-link:hover {
  color: var(--color-text);
}

.cardset-title {
  font-family: var(--font-display);
  font-size: 2rem;
  margin-bottom: 8px;
  color: var(--color-text);
}

.cardset-description {
  color: var(--color-text-muted);
  max-width: 600px;
  line-height: 1.6;
}

/* =============================================================================
   10. TOOLBAR (Search, Filter Controls)
   ============================================================================= */

.cards-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 24px;
  max-width: 1280px;
  margin: 0 auto;
  border-bottom: 1px solid var(--color-border);
}

.toolbar-left,
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

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

.search-wrapper svg,
.search-wrapper .search-icon {
  position: absolute;
  left: 8px;
  color: var(--color-text-muted);
  pointer-events: none;
  width: 16px;
  height: 16px;
}

.search-wrapper input {
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-family: var(--font-body);
  font-size: 0.875rem;
  background: var(--color-surface);
  color: var(--color-text);
  width: 200px;
  transition: border-color var(--transition), width 0.3s ease;
  appearance: none;
  -webkit-appearance: none;
}

.search-wrapper input:focus {
  outline: none;
  border-color: var(--color-accent);
  width: 280px;
}

.search-wrapper input::placeholder {
  color: var(--color-text-muted);
}

/* =============================================================================
   11. FILTER PANEL
   ============================================================================= */

.filter-panel {
  padding: 16px 24px;
  max-width: 1280px;
  margin: 0 auto;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
}

.filter-panel-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-start;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

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

.category-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border: 1.5px solid var(--color-border);
  border-radius: 100px;
  background: transparent;
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 0.8rem;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition),
              color var(--transition);
  white-space: nowrap;
}

.category-filter-btn:hover {
  background: rgba(44, 95, 138, 0.12);
  background: var(--color-accent-light);
  border-color: var(--color-accent);
}

.category-filter-btn[aria-pressed="true"] {
  background: var(--cat-color, var(--color-accent));
  border-color: var(--cat-color, var(--color-accent));
  color: #ffffff;
}

.category-filter-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--color-accent);
}

.cat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.filter-status {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* =============================================================================
   12. CARDS SECTION
   ============================================================================= */

.cards-section {
  padding-top: 24px;
}

.cards-section .empty-state {
  padding: 60px 24px;
}

/* =============================================================================
   13. SHARED BANNER
   ============================================================================= */

.shared-banner {
  background: rgba(44, 95, 138, 0.10);
  background: color-mix(in srgb, var(--color-accent) 10%, transparent);
  border-left: 4px solid var(--color-accent);
  padding: 12px 24px;
  max-width: 1280px;
  margin: 0 auto 16px;
  font-size: 0.875rem;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.shared-banner strong {
  font-weight: 600;
}
/* =============================================================================
   14. HOME PAGE
   ============================================================================= */

.home-hero {
  padding: 48px 24px 24px;
  max-width: 1280px;
  margin: 0 auto;
}

.home-hero h1 {
  font-family: var(--font-display);
  font-size: 2.5rem;
  color: var(--color-text);
  line-height: 1.15;
}

.hero-tagline {
  font-size: 1.1rem;
  color: var(--color-text-muted);
  margin-top: 8px;
  max-width: 560px;
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.decks-section {
  padding: 0 24px 48px;
  max-width: 1280px;
  margin: 0 auto;
}

.decks-section h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  margin-bottom: 20px;
  color: var(--color-text);
}

.decks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

.deck-card {
  display: block;
  text-decoration: none;
  color: inherit;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
  background: var(--color-surface);
}

.deck-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.deck-card:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--color-accent), var(--shadow-md);
}

.deck-card-top {
  height: 80px;
  display: flex;
  align-items: flex-end;
  padding: 12px;
  position: relative;
}

.deck-count {
  color: #ffffff;
  font-size: 0.8rem;
  opacity: 0.9;
  font-weight: 500;
}

.deck-card-body {
  padding: 16px;
  background: var(--color-surface);
}

.deck-name {
  font-family: var(--font-display);
  font-size: 1.2rem;
  margin-bottom: 6px;
  color: var(--color-text);
  line-height: 1.25;
}

.deck-description {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.deck-card-footer {
  padding: 12px 16px;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.deck-cta {
  font-size: 0.8rem;
  color: var(--color-accent);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* =============================================================================
   15. MODAL (General)
   ============================================================================= */

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  cursor: pointer;
}

.modal-box {
  position: relative;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  overscroll-behavior: contain;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text);
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
  line-height: 1;
}

.modal-close:hover {
  background: rgba(44, 95, 138, 0.12);
  background: var(--color-accent-light);
}

.modal-close:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--color-accent);
}

.about-content {
  font-size: 0.95rem;
  line-height: 1.7;
}

.about-content h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  margin-bottom: 12px;
  color: var(--color-text);
}

.about-content p {
  margin-bottom: 12px;
  color: var(--color-text);
}

.about-content p:last-child {
  margin-bottom: 0;
}

.about-content a {
  color: var(--color-accent);
  text-underline-offset: 2px;
}

.about-content a:hover {
  opacity: 0.8;
}

.about-content ul,
.about-content ol {
  padding-left: 20px;
  margin-bottom: 12px;
}

.about-content li {
  margin-bottom: 4px;
}

/* =============================================================================
   16. SLIDESHOW MODAL
   ============================================================================= */

.slideshow-modal .modal-backdrop {
  background: rgba(0, 0, 0, 0.85);
}

.slideshow-modal .modal-box {
  background: transparent;
  box-shadow: none;
  padding: 24px;
  max-width: none;
  width: auto;
  overflow: visible;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.slideshow-content {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.slideshow-card-container {
  width: 300px;
  height: 450px;
  position: relative;
}

.slideshow-card-container .card-wrapper {
  width: 100%;
  height: 100%;
}

.slideshow-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.slideshow-counter {
  font-size: 0.9rem;
  color: #ffffff;
  min-width: 60px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.slideshow-controls .btn {
  border-color: rgba(255, 255, 255, 0.5);
  color: #ffffff;
}

.slideshow-controls .btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.9);
}

.slideshow-modal .modal-close {
  position: fixed;
  top: 20px;
  right: 20px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  width: 36px;
  height: 36px;
}

.slideshow-modal .modal-close:hover {
  background: rgba(255, 255, 255, 0.25);
}

.slideshow-progress {
  width: 300px;
  height: 3px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 100px;
  overflow: hidden;
}

.slideshow-progress-bar {
  height: 100%;
  background: #ffffff;
  border-radius: 100px;
  transition: width 0.3s ease;
}
/* =============================================================================
   17. NOTIFICATION BANNER
   ============================================================================= */

.notification {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-text);
  color: var(--color-bg);
  padding: 10px 20px;
  border-radius: 100px;
  font-size: 0.875rem;
  z-index: 2000;
  animation: slide-up 0.2s ease;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: var(--shadow-md);
}

.notification[hidden] {
  display: none;
}

@keyframes slide-up {
  from {
    transform: translateX(-50%) translateY(10px);
    opacity: 0;
  }
  to {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
  }
}

/* =============================================================================
   18. KEYBOARD SHORTCUTS HINT
   ============================================================================= */

.shortcuts-hint {
  max-width: 1280px;
  margin: 16px auto 0;
  padding: 0 24px 32px;
}

.shortcuts-toggle {
  background: none;
  border: none;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  padding: 0;
  transition: color var(--transition);
}

.shortcuts-toggle:hover {
  color: var(--color-text);
}

.shortcuts-toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--color-accent);
  border-radius: 2px;
}

.shortcuts-list {
  list-style: none;
  padding: 8px 0;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin-top: 8px;
}

.shortcuts-list li {
  display: flex;
  align-items: center;
  gap: 6px;
}

kbd {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 3px;
  padding: 1px 5px;
  font-family: monospace;
  font-size: 0.75rem;
  color: var(--color-text);
  line-height: 1.5;
  box-shadow: 0 1px 0 var(--color-border);
}

/* =============================================================================
   19. FORMS — SETUP WIZARD
   ============================================================================= */

.setup-container {
  min-height: calc(100vh - 72px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.setup-wizard {
  width: 100%;
  max-width: 480px;
}

.setup-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 32px;
}

.setup-step {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 500;
  background: var(--color-bg);
  color: var(--color-text);
  flex-shrink: 0;
  transition: background var(--transition), border-color var(--transition),
              color var(--transition);
}

.setup-step.active {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #ffffff;
}

.setup-step.done {
  background: var(--color-text);
  border-color: var(--color-text);
  color: var(--color-bg);
}

.setup-line {
  flex: 1;
  height: 2px;
  background: var(--color-border);
  max-width: 60px;
  transition: background var(--transition);
}

.setup-line.done {
  background: var(--color-text);
}

.setup-card {
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 32px;
}

.setup-card h1 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  margin-bottom: 8px;
  color: var(--color-text);
}

.setup-card p {
  color: var(--color-text-muted);
  margin-bottom: 24px;
  line-height: 1.6;
}

/* =============================================================================
   20. FORM ELEMENTS (GENERAL)
   ============================================================================= */

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 4px;
  color: var(--color-text);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 8px 12px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 0.9rem;
  transition: border-color var(--transition);
  appearance: none;
  -webkit-appearance: none;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--color-accent);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--color-text-muted);
}

.form-group small {
  display: block;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: 4px;
  line-height: 1.4;
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.form-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23666' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
  cursor: pointer;
}

[data-theme="dark"] .form-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23999' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
/* =============================================================================
   21. ALERTS
   ============================================================================= */

.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 0.875rem;
  line-height: 1.5;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.alert-error {
  background: #fef2f2;
  border-left: 3px solid #ef4444;
  color: #b91c1c;
}

.alert-success {
  background: #f0fdf4;
  border-left: 3px solid #22c55e;
  color: #15803d;
}

.alert-info {
  background: #eff6ff;
  border-left: 3px solid #3b82f6;
  color: #1d4ed8;
}

.alert-warning {
  background: #fffbeb;
  border-left: 3px solid #f59e0b;
  color: #92400e;
}

[data-theme="dark"] .alert-error {
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
}

[data-theme="dark"] .alert-success {
  background: rgba(34, 197, 94, 0.1);
  color: #86efac;
}

[data-theme="dark"] .alert-info {
  background: rgba(59, 130, 246, 0.1);
  color: #93c5fd;
}

[data-theme="dark"] .alert-warning {
  background: rgba(245, 158, 11, 0.1);
  color: #fcd34d;
}

/* =============================================================================
   22. BADGE
   ============================================================================= */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--color-border);
  color: var(--color-bg);
  line-height: 1.5;
}

.badge-green {
  background: #22c55e;
  color: #ffffff;
}

.badge-blue {
  background: #3b82f6;
  color: #ffffff;
}

.badge-yellow {
  background: #f59e0b;
  color: #ffffff;
}

.badge-red {
  background: #ef4444;
  color: #ffffff;
}

/* =============================================================================
   23. EMPTY STATE
   ============================================================================= */

.empty-state {
  text-align: center;
  color: var(--color-text-muted);
  padding: 40px;
  font-size: 0.95rem;
  line-height: 1.6;
}

.empty-state p {
  max-width: 360px;
  margin: 0 auto 16px;
}

.empty-state svg,
.empty-state .empty-icon {
  margin: 0 auto 16px;
  opacity: 0.4;
  font-size: 3rem;
}

/* =============================================================================
   24. ERROR PAGE
   ============================================================================= */

.error-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  text-align: center;
  padding: 24px;
}

.error-page h1 {
  font-family: var(--font-display);
  font-size: 5rem;
  font-weight: 700;
  color: var(--color-accent);
  line-height: 1;
}

.error-page h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--color-text);
}

.error-page p {
  color: var(--color-text-muted);
  max-width: 400px;
  line-height: 1.6;
}

/* =============================================================================
   25. UTILITY CLASSES
   ============================================================================= */

.text-muted  { color: var(--color-text-muted); }
.text-accent { color: var(--color-accent); }
.text-sm     { font-size: 0.875rem; }
.text-xs     { font-size: 0.75rem; }
.text-center { text-align: center; }

.mt-xs { margin-top: var(--space-xs); }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mb-xs { margin-bottom: var(--space-xs); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

.hidden { display: none !important; }
.flex   { display: flex; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }

.divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: var(--space-lg) 0;
}

/* =============================================================================
   26. RESPONSIVE — MOBILE
   ============================================================================= */

@media (max-width: 480px) {
  :root {
    --card-width:  calc(100vw - 48px);
    --card-height: calc((100vw - 48px) * 1.5);
  }

  .cards-grid {
    gap: 12px;
    padding: 0 12px 32px;
  }

  .cardset-title {
    font-size: 1.6rem;
  }

  .home-hero h1 {
    font-size: 2rem;
  }

  .cards-toolbar {
    padding: 10px 16px;
  }

  .search-wrapper input {
    width: 160px;
  }

  .search-wrapper input:focus {
    width: 200px;
  }

  .filter-panel {
    padding: 12px 16px;
  }

  .modal-box {
    padding: 24px 20px;
    width: 95%;
  }

  .setup-card {
    padding: 24px 20px;
  }

  .slideshow-card-container {
    width: calc(100vw - 80px);
    height: calc((100vw - 80px) * 1.5);
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .decks-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .error-page h1 {
    font-size: 4rem;
  }
}

@media (max-width: 640px) {
  .site-header {
    padding: 10px 16px;
  }

  .header-inner {
    gap: 8px;
  }

  .cardset-header {
    padding: 24px 16px 16px;
  }

  .home-hero {
    padding: 32px 16px 16px;
  }

  .decks-section {
    padding: 0 16px 32px;
  }

  .shortcuts-hint {
    padding: 0 16px 24px;
  }

  .toolbar-left,
  .toolbar-right {
    flex-wrap: wrap;
  }
}

@media (min-width: 481px) and (max-width: 768px) {
  :root {
    --card-width:  240px;
    --card-height: 360px;
  }

  .slideshow-card-container {
    width: 260px;
    height: 390px;
  }
}

/* =============================================================================
   27. PRINT STYLES
   ============================================================================= */

@media print {
  .site-header,
  .site-footer,
  .cards-toolbar,
  .filter-panel,
  .card-toolbar,
  .shortcuts-hint,
  .notification,
  .modal,
  .btn {
    display: none !important;
  }

  #main-content {
    padding-top: 0;
  }

  .cards-grid {
    gap: 8px;
  }

  .card-wrapper {
    break-inside: avoid;
  }

  .card-inner {
    transform: none !important;
  }

  .card-front {
    transform: none !important;
    position: relative !important;
    backface-visibility: visible !important;
    -webkit-backface-visibility: visible !important;
  }

  .card-back {
    display: none;
  }
}

/* =============================================================================
   28. ACCESSIBILITY
   ============================================================================= */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .card-inner {
    transition-duration: 0.1s !important;
  }
}

@media (forced-colors: active) {
  .btn {
    border: 2px solid ButtonText;
  }

  .card-front-inner {
    border: 2px solid ButtonText;
  }

  .deck-card {
    border: 2px solid ButtonText;
  }
}
