.exercise-content.active {
  background: #e6fbe6;
  border: 2px solid #4bb543;
  box-shadow: 0 0 0 2px #b6e6b6;
}
.exercise-content.active .rest-progress-bar {
  background: #d2f5d2;
}
.exercise-content.active .rest-progress {
  background: #4bb543;
}
.rest-progress-bar {
  width: 100%;
  height: 12px;
  background: #e0e7ef;
  border-radius: 6px;
  margin: 0.5em 0;
  overflow: hidden;
}
.rest-progress {
  height: 100%;
  background: #7db7ff;
  border-radius: 6px 0 0 6px;
  transition: width 0.3s;
}
.rest-ready-btn {
  display: inline-block;
  padding: 0.5em 1.2em;
  font-size: 1em;
  font-weight: 600;
  color: #fff;
  background: #2a3a4a;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  margin-top: 0.5em;
}
.rest-ready-btn:hover {
  background: #1a2533;
}
html {
  font-size: 16px;
}
body {
  font-family: Arial, Helvetica, sans-serif;
  background: #f6f8fa;
  color: #222;
  margin: 0;
  padding: 0;
}

/**
 * Exercise sections structure
 */
.exercise-section {
  display: flex;
  min-height: 200px;
  border: 1px solid #ccc;
  border-radius: 8px;
  overflow: hidden;
  background: #fafafa;
  margin-bottom: 1em;
  flex-direction: row;
}

/* Recursive child section styling */
.exercise-section > .exercise-section-content > .exercise-section {
  background: #fff;
  border: 1px solid #e0e7ef;
  border-radius: 6px;
  margin: 0 0 0.1em 0;
}
.exercise-section
  > .exercise-section-content
  > .exercise-section
  .exercise-section-title {
  background: #eef2f7;
  border-right: 1px solid #cbd5e1;
}

/* Third level and deeper: stack title on top to avoid deep indentation */
.exercise-section .exercise-section .exercise-section {
  flex-direction: column;
}
.exercise-section .exercise-section .exercise-section .exercise-section-title {
  border-right: none;
  border-bottom: 1px solid #cbd5e1;
  width: 100%;
}
.exercise-section
  .exercise-section
  .exercise-section
  .exercise-section-title
  p {
  writing-mode: horizontal-tb;
  transform: none;
}

/* Styling */
.exercise-section-title {
  background: #e0e7ef;
  border-right: 2px solid #b0b8c1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-width: 20px;
  padding: 0.5em 0.5em;
}
.exercise-section-title p {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  margin: 0;
  font-weight: bold;
  font-size: 1.1em;
  color: #2a3a4a;
}
.exercise-section-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0;
}
.exercise-content:not(:last-child) {
  border-bottom: 1px solid #e0e7ef;
}
.exercise-content:not(.exercise-section-content .exercise-content) {
  margin-bottom: 1em;
  border: 1px solid #e0e7ef;
  border-radius: 6px;
  background: #fff;
}
.exercise-content {
  padding: 1em;
  display: flex;
  flex-direction: column;
}
.exercise-header {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  border-bottom: 2px solid #b0b8c1;
  padding-bottom: 0.5em;
  margin-bottom: 0.5em;
}
.exercise-name {
  flex: 2;
  text-align: left;
  font-size: 1.1em;
  font-weight: 600;
}
.exercise-duration {
  flex: 1;
  text-align: right;
  font-size: 1em;
  color: #555;
}
.exercise-description {
  flex: 1;
  text-align: left;
  font-size: 1em;
  color: #333;
  word-break: break-word;
  overflow-wrap: break-word;
}

@media (max-width: 600px) {
  html {
    font-size: 16px;
  }
  .exercise-section {
    flex-direction: column;
    min-height: 0;
  }
  .exercise-section-title {
    border-right: none;
    border-bottom: 2px solid #b0b8c1;
    min-width: 0;
    width: 100%;
    justify-content: flex-start;
    align-items: flex-start;
    padding: 0.5em 0.5em;
  }
  .exercise-section-title p {
    writing-mode: horizontal-tb;
    transform: none;
  }
  .exercise-content {
    padding: 0.7em;
  }
}
