:root {
    /* Soothing Palette */
    --bg-color: #f4f7f6;
    --text-color: #2c3e50;
    --card-bg: #ffffff;
    --primary-color: #7f9c96; /* Sage Green */
    --primary-dark: #5f7a74;
    --accent-color: #e0e5e4;
    --progress-bg: #dce3e2;
    --font-main: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    width: 100%;
    height: 100vh; /* Fallback */
    height: 100dvh; /* Dynamic viewport height for mobile browsers */
    overflow: hidden;
    position: fixed;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1.5vh 3vw;
    padding-bottom: max(1.5vh, env(safe-area-inset-bottom));
    line-height: 1.6;
}

.container {
    width: 100%;
    max-width: 500px;
    height: 100%;
    max-height: 100%;
    background: transparent;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Views */
.view {
    display: none;
    flex-direction: column;
    gap: 1.5vh;
    animation: fadeIn 0.5s ease;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.view.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Typography */
h1 {
    font-size: clamp(1.5rem, 5vw, 2rem);
    font-weight: 300;
    text-align: center;
    color: var(--primary-dark);
    margin-bottom: 0.5rem;
}

.subtitle {
    text-align: center;
    color: #7f8c8d;
    margin-bottom: 1rem;
}

.guidance {
    text-align: center;
    font-style: italic;
    color: var(--primary-dark);
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.source {
    text-align: center;
    font-size: 0.85rem;
    color: #7f8c8d;
    margin-top: -10px;
    margin-bottom: 1rem;
}

.source a {
    color: var(--primary-color);
    text-decoration: none;
    border-bottom: 1px solid var(--accent-color);
    transition: border-color 0.3s;
}

.source a:hover {
    border-bottom-color: var(--primary-color);
}

h2 {
    font-size: 1.2rem;
    margin-bottom: 10px;
    color: var(--primary-dark);
}

/* Cards */
.card {
    background: var(--card-bg);
    padding: 2vh 4vw;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.checklist {
    list-style-position: inside;
    padding-left: 10px;
}

/* Controls */
.controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
}

label {
    font-size: 0.9rem;
    color: #7f8c8d;
}

input[type="number"] {
    padding: 15px;
    border: 2px solid var(--accent-color);
    border-radius: 8px;
    font-size: 1.2rem;
    text-align: center;
    width: 100%;
    outline: none;
    transition: border-color 0.3s;
}

input[type="number"]:focus {
    border-color: var(--primary-color);
}

/* Buttons */
.btn-primary {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 16px;
    border-radius: 8px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background-color 0.3s;
    font-weight: 600;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
}

.btn-text {
    background: none;
    border: none;
    color: #95a5a6;
    cursor: pointer;
    margin-top: 20px;
    align-self: center;
}

/* Workout View Specifics */
.header-info {
    text-align: center;
    font-size: 0.9rem;
    color: #95a5a6;
    margin-bottom: 10px;
}

.timer-display {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 15vh;
    min-height: 100px;
}

.time-text {
    font-size: clamp(3rem, 10vh, 5rem);
    font-weight: 300;
    color: var(--primary-dark);
    font-variant-numeric: tabular-nums;
}

.exercise-content {
    text-align: center;
    background: var(--card-bg);
    padding: 3vh 4vw;
    border-radius: 12px;
    box-shadow: 0 8px 15px rgba(0,0,0,0.05);
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
}

#exercise-name {
    font-size: 1.5rem;
    margin-bottom: 15px;
}

#exercise-description {
    font-size: 1.1rem;
    color: #555;
}

.progress-container {
    height: 6px;
    background-color: var(--progress-bg);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 20px;
}

.progress-bar {
    height: 100%;
    background-color: var(--primary-color);
    width: 100%;
    transform-origin: left;
    transition: width 1s linear;
}

.next-exercise-preview {
    text-align: center;
    margin-top: 20px;
    padding: 12px 20px;
    background-color: var(--accent-color);
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--text-color);
}

.next-exercise-preview.hidden {
    display: none;
}

.preview-label {
    color: #7f8c8d;
    margin-right: 8px;
}

#next-exercise-name {
    font-weight: 600;
    color: var(--primary-dark);
}

/* Completion View */
#completion-view {
    text-align: center;
    justify-content: center;
    height: 100%;
}

.quote {
    font-style: italic;
    color: #7f8c8d;
    margin: 20px 0 40px 0;
}