body, html {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, sans-serif;
    line-height: 1.6;
}

body {
    background: white;
    position: relative;
}

body.form-page {
    background: url('../images/flag.jpg') no-repeat center center fixed;
    background-size: cover;
}

html { overflow-y: scroll; }

header, .survey-form, .image-grid img, .muscle-images img, .muscle-thumbnail, .survey-form input[type="text"], .survey-form textarea {
    border-radius: 8px;
}

header {
    background: #2c3e50;
    color: #fff;
    padding: 1rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 2rem;
}

nav {
    width: 100%;
    background: #1a232e;
    border-radius: 8px;
    margin: 1rem 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}

nav ul {
    list-style: none;
    padding: 0.5rem 1rem;
    margin: 0;
    display: flex;
    gap: 2rem;
}

nav a {
    color: #ecf0f1;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
    padding: 0.5rem 1rem;
    border-radius: 4px;
}

nav a:hover {
    color: #3498db;
    background: #223047;
}

nav a.active {
    background: #fff;
    color: #2c3e50 !important;
    font-weight: bold;
    border: 2px solid #3498db;
}

main {
    margin: 0 auto;
    padding: 0 2rem;
    max-width: 1200px;
}

main article > h2, .progression-section h2, .muscle-groups h3 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-size: 2rem;
}

main article > p, .progression-section p, .muscle-groups p {
    margin-bottom: 1.5rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

th, td {
    border: 1px solid #ddd;
    padding: 1rem;
    text-align: left;
}

th {
    background: #2c3e50;
    color: #fff;
}

.image-grid, .muscle-images {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin: 2rem 0;
    justify-content: center;
    align-items: flex-start;
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
}

.image-grid figure, .muscle-images figure {
    text-align: center;
    width: 100%;
    max-width: 350px;
    flex: 1 1 250px;
}

.image-grid img, .muscle-images img {
    width: 100%;
    height: auto;
    max-width: 350px;
    min-width: 200px;
    border: 2px solid #3498db;
    display: block;
    margin: 0 auto;
    object-fit: contain;
}

.muscle-thumbnail {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border: 2px solid #3498db;
}

.survey-form {
    flex: 1;
    max-width: 600px;
    background: #fff;
    padding: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.survey-form fieldset { border: none; padding: 0; }
.survey-form legend { font-size: 1.5rem; margin-bottom: 1rem; }
.survey-form .form-group { margin-bottom: 1.5rem; }
.survey-form label { display: block; margin-bottom: 0.5rem; font-weight: bold; }
.survey-form input[type="text"], .survey-form textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ccc;
    font-size: 1rem;
}
.survey-form textarea { resize: none; }
.survey-form input[type="radio"], .survey-form input[type="checkbox"] { margin-right: 0.5rem; }
.survey-form .form-buttons {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}
.survey-form button {
    padding: 0.5rem 1rem;
    font-size: 1rem;
    color: #fff;
    background: #3498db;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.3s;
}
.survey-form button:hover { background: #2980b9; }

.form-container {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 2rem;
    margin-top: 2rem;
}

.form-image {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.progression-section, .muscle-groups {
    margin-bottom: 4rem;
    text-align: center;
}

.video-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 2rem;
}

.muscle-groups ul {
    list-style: disc;
    padding-left: 2rem;
    text-align: left;
    margin: 0 auto;
    max-width: 800px;
}

.muscle-groups ul li {
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

body.dark-theme {
    background: #121212;
    color: #fff;
}
body.dark-theme header, body.dark-theme .survey-form {
    background: #1e1e1e;
    color: #fff;
}
body.dark-theme nav a { color: #fff; }
body.dark-theme nav a:hover { color: #76c7c0; }
body.dark-theme .survey-form input, body.dark-theme .survey-form textarea {
    background: #2c2c2c;
    color: #fff;
    border: 1px solid #444;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.high-contrast, .high-contrast header, .high-contrast nav, .high-contrast main, .high-contrast article, .high-contrast section, .high-contrast footer {
  background: #000 !important;
  color: #fff !important;
  border: none !important;
  box-shadow: none !important;
}
.high-contrast a, .high-contrast a:link, .high-contrast a:visited {
  color: #ff0 !important;
  text-decoration: underline !important;
  font-weight: bold !important;
}
.high-contrast th, .high-contrast td {
  background: #000 !important;
  color: #fff !important;
  border: 2px solid #fff !important;
}
.high-contrast h1, .high-contrast h2, .high-contrast h3, .high-contrast h4, .high-contrast h5, .high-contrast h6, .high-contrast label {
  color: #ff0 !important;
  font-size: 2em !important;
  letter-spacing: 1px !important;
}
.high-contrast input, .high-contrast textarea, .high-contrast select, .high-contrast button {
  background: #000 !important;
  color: #fff !important;
  border: 2px solid #fff !important;
  font-size: 1.3em !important;
}
.high-contrast img, .high-contrast figure img {
  filter: grayscale(100%) contrast(200%);
  border: 3px solid #ff0 !important;
}

@media (max-width: 768px) {
    header { align-items: stretch; }
    nav ul { flex-direction: column; gap: 0.5rem; }
    .image-grid { grid-template-columns: 1fr; }
    .image-grid img, .muscle-images img {
        min-width: 120px;
        max-width: 100%;
    }
}

@media (max-width: 900px) {
    .image-grid {
        grid-template-columns: 1fr 1fr;
    }
    .image-grid img, .muscle-images img {
        max-width: 220px;
        min-width: 120px;
    }
}

@media (max-width: 600px) {
    .image-grid {
        grid-template-columns: 1fr;
    }
    .image-grid img, .muscle-images img {
        max-width: 100%;
        min-width: 80px;
    }
}

@media (min-width: 1200px) {
    main { display: block; }
}
