:root {
  color-scheme: light;
  --bg: #0d1224;
  --bg-soft: rgba(22, 30, 58, 0.8);
  --accent: #5ef1d5;
  --accent-strong: #42cfae;
  --accent-soft: rgba(94, 241, 213, 0.2);
  --primary-text: #f3f6ff;
  --secondary-text: #a9b4d9;
  --danger: #ff6b6b;
  --warning: #ffbf69;
  --good: #87f575;
  --transition: 0.25s ease;
  font-family: 'Space Grotesk', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(circle at 20% 20%, rgba(94, 241, 213, 0.15) 0, rgba(13, 18, 36, 0) 45%),
              radial-gradient(circle at 80% 30%, rgba(66, 207, 174, 0.25) 0, rgba(13, 18, 36, 0) 55%),
              #050813;
  color: var(--primary-text);
}

.app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.title-block h1 {
  margin: 0;
  font-size: clamp(2rem, 3vw, 2.8rem);
  letter-spacing: 0.05em;
}

.subtitle {
  display: block;
  margin-top: 0.25rem;
  color: var(--secondary-text);
  font-size: 0.95rem;
}

.info-btn {
  background: rgba(94, 241, 213, 0.12);
  border: 1px solid rgba(94, 241, 213, 0.35);
  color: var(--accent);
  padding: 0.65rem 1.2rem;
  border-radius: 999px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.info-btn:hover,
.info-btn[aria-expanded="true"] {
  background: rgba(94, 241, 213, 0.28);
  border-color: rgba(94, 241, 213, 0.65);
}

.content {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: 1.75rem;
}

.trainer {
  background: var(--bg-soft);
  border: 1px solid rgba(94, 241, 213, 0.15);
  border-radius: 24px;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  box-shadow: 0 18px 40px rgba(8, 11, 26, 0.5);
  position: relative;
  overflow: hidden;
}

.trainer::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(94, 241, 213, 0.05) 0%, rgba(66, 207, 174, 0) 50%, rgba(94, 241, 213, 0.08) 100%);
  pointer-events: none;
}

.ring-wrapper {
  width: clamp(260px, 35vw, 320px);
  height: clamp(260px, 35vw, 320px);
  margin: 0 auto;
  position: relative;
}

.progress-ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.04);
  stroke-width: 14;
}

.ring-track {
  fill: none;
  stroke: rgba(94, 241, 213, 0.16);
  stroke-width: 14;
  stroke-linecap: round;
  stroke-dasharray: 597;
}

.ring-progress {
  fill: none;
  stroke: url(#ringGradient);
  stroke-width: 14;
  stroke-linecap: round;
  stroke-dasharray: 597;
  stroke-dashoffset: 597;
  transition: stroke var(--transition);
}

.ring-wrapper.phase-contract .ring-progress {
  stroke: url(#ringGradient);
}

.ring-wrapper.phase-release .ring-progress {
  stroke: #62c7ff;
}

.ring-wrapper.phase-rest .ring-progress {
  stroke: #ffbf69;
}

.ring-wrapper.phase-complete .ring-progress {
  stroke: #87f575;
}

.ring-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  text-align: center;
  padding: 1rem;
  pointer-events: none;
}

.phase-label {
  margin: 0;
  font-size: 1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--secondary-text);
}

.countdown {
  font-size: 3rem;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.rep-label,
.set-label {
  margin: 0;
  font-size: 0.95rem;
  color: var(--secondary-text);
}

.controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.control-btn {
  min-width: 110px;
  padding: 0.8rem 1.5rem;
  border-radius: 999px;
  border: 1px solid rgba(143, 168, 216, 0.25);
  background: rgba(11, 16, 38, 0.9);
  color: var(--primary-text);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.control-btn.primary {
  background: linear-gradient(135deg, var(--accent) 0%, #52e7c5 40%, #30c6a0 100%);
  border: none;
  color: #05221a;
}

.control-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(66, 207, 174, 0.25);
}

.control-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.gamification {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.streak {
  background: rgba(94, 241, 213, 0.08);
  border-radius: 16px;
  padding: 1rem;
  border: 1px solid rgba(94, 241, 213, 0.18);
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1rem;
  align-items: center;
}

.streak .label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--secondary-text);
}

.streak-bar {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 999px;
  height: 10px;
  overflow: hidden;
}

.streak-fill {
  background: linear-gradient(90deg, #52e7c5 0%, #87f575 100%);
  height: 100%;
  width: 0%;
  transition: width 0.4s ease-out;
}

.streak-count {
  font-weight: 600;
  font-size: 1.25rem;
}

.scoreboard {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.scoreboard div {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 16px;
  padding: 1rem;
  text-align: center;
}

.score-label {
  display: block;
  font-size: 0.85rem;
  color: var(--secondary-text);
  margin-bottom: 0.35rem;
}

.score-value {
  font-size: 1.3rem;
  font-weight: 600;
}

.config-panel {
  background: rgba(12, 18, 40, 0.78);
  border: 1px solid rgba(94, 241, 213, 0.12);
  border-radius: 20px;
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  backdrop-filter: blur(12px);
}

.config-panel h2 {
  margin: 0;
  font-size: 1.3rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1.15rem;
}

.form-row label {
  font-size: 0.95rem;
  color: var(--secondary-text);
}

.form-row input[type="range"] {
  grid-column: 1 / -1;
  appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(94, 241, 213, 0.15);
  outline: none;
}

.form-row input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
  box-shadow: 0 0 0 4px rgba(94, 241, 213, 0.18);
}

.form-row .value {
  font-size: 0.9rem;
  color: var(--accent);
  font-weight: 500;
}

.form-row select {
  grid-column: 1 / -1;
  background: rgba(255, 255, 255, 0.05);
  color: var(--primary-text);
  border: 1px solid rgba(94, 241, 213, 0.25);
  border-radius: 12px;
  padding: 0.75rem 1rem;
}

.form-row.toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.form-row.toggle input[type="checkbox"] {
  width: 46px;
  height: 26px;
  border-radius: 999px;
  appearance: none;
  background: rgba(255, 255, 255, 0.15);
  position: relative;
  cursor: pointer;
  transition: background var(--transition);
}

.form-row.toggle input[type="checkbox"]::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #f3f6ff;
  transition: transform var(--transition), background var(--transition);
}

.form-row.toggle input[type="checkbox"]:checked {
  background: linear-gradient(135deg, var(--accent) 0%, #87f575 100%);
}

.form-row.toggle input[type="checkbox"]:checked::after {
  transform: translateX(20px);
  background: #05221a;
}

.tips {
  background: rgba(94, 241, 213, 0.08);
  border-radius: 16px;
  padding: 1.2rem;
  border: 1px solid rgba(94, 241, 213, 0.15);
}

.tips h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

.tips ul {
  list-style: none;
  margin: 0;
  padding-left: 1.1rem;
}

.tips li {
  position: relative;
  margin-bottom: 0.55rem;
  font-size: 0.9rem;
  color: var(--secondary-text);
}

.tips li::before {
  content: '•';
  position: absolute;
  left: -1.1rem;
  color: var(--accent);
}

.log-panel {
  background: rgba(11, 18, 40, 0.8);
  border: 1px solid rgba(94, 241, 213, 0.12);
  border-radius: 20px;
  padding: 1.75rem;
  backdrop-filter: blur(15px);
}

.log-panel h2 {
  margin-top: 0;
  font-size: 1.25rem;
}

.session-log {
  display: grid;
  gap: 1rem;
  max-height: 260px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.session-log::-webkit-scrollbar {
  width: 6px;
}

.session-log::-webkit-scrollbar-thumb {
  background: rgba(94, 241, 213, 0.18);
  border-radius: 999px;
}

.log-entry {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 14px;
  padding: 1rem 1.25rem;
  border: 1px solid rgba(94, 241, 213, 0.14);
}

.log-entry header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.log-title {
  font-weight: 600;
}

.log-time {
  font-size: 0.8rem;
  color: var(--secondary-text);
}

.log-summary {
  margin: 0;
  font-size: 0.9rem;
  color: var(--secondary-text);
  line-height: 1.4;
}

.info-panel {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 20px;
  padding: 1.75rem;
  border: 1px solid rgba(94, 241, 213, 0.18);
  line-height: 1.65;
}

.info-panel ul {
  padding-left: 1.1rem;
}

.info-panel li {
  margin-bottom: 0.35rem;
}

@media (max-width: 960px) {
  .content {
    grid-template-columns: 1fr;
  }

  .config-panel {
    order: -1;
  }

  .trainer {
    padding: 1.5rem;
  }
}

@media (max-width: 560px) {
  .app {
    padding: 1.75rem 1rem 2.5rem;
  }

  .app-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .ring-wrapper {
    width: min(240px, 80vw);
    height: min(240px, 80vw);
  }

  .controls {
    flex-direction: column;
  }

  .scoreboard {
    grid-template-columns: 1fr;
  }

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