:root {
  /* Light theme (default) */
  --bg-primary: #f8f9fa;
  --bg-container: #fff;
  --bg-card: #f3f6fa;
  --bg-thumb: #fff;
  --text-primary: #222;
  --text-secondary: #555;
  --text-tertiary: #777;
  --text-title: #1a2a3a;
  --text-desc: #444;
  --link-color: #1976d2;
  --link-hover: #0d47a1;
  --border-color: #e0e0e0;
  --shadow-light: rgba(0,0,0,0.05);
  --shadow-medium: rgba(0,0,0,0.07);
  --shadow-hover: rgba(0,0,0,0.10);
}

[data-theme="dark"] {
  --bg-primary: #1a1a1a;
  --bg-container: #2d2d2d;
  --bg-card: #3a3a3a;
  --bg-thumb: #4a4a4a;
  --text-primary: #ffffff;
  --text-secondary: #cccccc;
  --text-tertiary: #aaaaaa;
  --text-title: #ffffff;
  --text-desc: #dddddd;
  --link-color: #64b5f6;
  --link-hover: #42a5f5;
  --border-color: #555555;
  --shadow-light: rgba(0,0,0,0.3);
  --shadow-medium: rgba(0,0,0,0.4);
  --shadow-hover: rgba(0,0,0,0.5);
}

[data-theme="contrast"] {
  --bg-primary: #000000;
  --bg-container: #ffffff;
  --bg-card: #ffffff;
  --bg-thumb: #ffffff;
  --text-primary: #000000;
  --text-secondary: #000000;
  --text-tertiary: #000000;
  --text-title: #000000;
  --text-desc: #000000;
  --link-color: #0000ff;
  --link-hover: #000080;
  --border-color: #000000;
  --shadow-light: rgba(0,0,0,0.8);
  --shadow-medium: rgba(0,0,0,0.9);
  --shadow-hover: rgba(0,0,0,1.0);
}

[data-theme="spectrum"] {
  --bg-primary: #000000;
  --bg-container: #0000AA;
  --bg-card: #AA0000;
  --bg-thumb: #00AA00;
  --text-primary: #FFFFFF;
  --text-secondary: #FFFF00;
  --text-tertiary: #00FFFF;
  --text-title: #FFFFFF;
  --text-desc: #AAAAAA;
  --link-color: #00FFFF;
  --link-hover: #FFFF00;
  --border-color: #FFFFFF;
  --shadow-light: rgba(170,170,0,0.3);
  --shadow-medium: rgba(170,170,0,0.5);
  --shadow-hover: rgba(255,255,0,0.7);
}

/* ZX Spectrum theme specific styles */
body[data-theme="spectrum"] {
  font-family: 'Orbitron', 'Courier New', 'Monaco', 'Menlo', monospace;
}

body[data-theme="spectrum"] h2 {
  color: #FF00FF; /* Spectrum magenta */
}

body {
  font-family: 'Segoe UI', Arial, sans-serif;
  background: var(--bg-primary);
  margin: 0;
  padding: 0;
  transition: background-color 0.3s ease;
}

.theme-switcher {
  position: fixed;
  top: 20px;
  right: 20px;
  display: flex;
  gap: 8px;
  z-index: 1000;
}

@media (max-width: 768px) {
  .theme-switcher {
    top: 10px;
    right: 10px;
    gap: 6px;
  }
}

.theme-btn {
  width: 40px;
  height: 40px;
  border: 2px solid var(--border-color);
  border-radius: 50%;
  background: var(--bg-container);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all 0.2s ease;
  user-select: none;
}

@media (max-width: 768px) {
  .theme-btn {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }
}

.theme-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 2px 8px var(--shadow-hover);
}

.theme-btn.active {
  background: var(--link-color);
  color: white;
  border-color: var(--link-color);
}

.theme-btn:focus {
  outline: 2px solid var(--link-color);
  outline-offset: 2px;
}

.container {
  max-width: 900px;
  margin: 40px auto;
  padding: 20px;
  background: var(--bg-container);
  border-radius: 12px;
  box-shadow: 0 2px 12px var(--shadow-medium);
  transition: all 0.3s ease;
}

h1 {
  font-size: 2.8rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
  text-align: center;
}

h2 {
  font-size: 1.3rem;
  font-weight: 400;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 2.5rem;
}

h3 {
  font-size: 1.1rem;
  color: var(--text-tertiary);
  text-align: center;
  margin-bottom: 2rem;
}

.contact-link,
.nav-link,
.app-link {
  text-decoration: none;
  color: var(--link-color);
  font-weight: 500;
  transition: color 0.2s;
}

.contact-link:hover,
.nav-link:hover,
.app-link:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

.contact-link:focus,
.nav-link:focus,
.app-link:focus {
  outline: 2px solid var(--link-color);
  outline-offset: 2px;
}

@media (max-width: 768px) {
  .container {
    margin: 20px auto;
    padding: 15px;
  }

  h1 {
    font-size: 2.2rem;
  }

  h2 {
    font-size: 1.1rem;
  }
}