:root {
    --primary-color: #0d9488;
    /* Teal 600 */
    --primary-dark: #0f766e;
    /* Teal 700 */
    --primary-light: #f0fdfa;
    /* Teal 50 */
    --accent-color: #f59e0b;
    /* Amber 500 */
    --text-main: #0f172a;
    /* Slate 900 */
    --text-secondary: #475569;
    /* Slate 600 */
    --bg-page: #f8fafc;
    /* Slate 50 */
    --bg-card: #ffffff;
    --border-color: #e2e8f0;
    /* Slate 200 */
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --font-family: 'Outfit', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-page);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.app-container {
    max-width: 600px;
    margin: 0 auto;
    background-color: var(--bg-card);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    box-shadow: var(--shadow-lg);
    position: relative;
}

/* Header Styles */
.app-header {
    background: linear-gradient(135deg, #042f2e 0%, #0d9488 100%);
    color: white;
    padding: 0.75rem 1.25rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.4rem;
}

.meta-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.copyright {
    font-size: 0.65rem;
    font-weight: 500;
    opacity: 0.9;
}

.version {
    font-size: 0.55rem;
    opacity: 0.7;
}

.header-center {
    flex: 1;
    display: flex;
    justify-content: center;
}

.setup-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: white;
    padding: 6px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
    backdrop-filter: blur(4px);
}

.setup-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.language-toggle {
    display: flex;
    gap: 0.4rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 3px;
    border-radius: var(--radius-sm);
    backdrop-filter: blur(4px);
}

.lang-btn {
    background: transparent;
    border: none;
    color: white;
    padding: 0.3rem 0.6rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.7rem;
    font-weight: 600;
    transition: all 0.2s;
}

.lang-btn.active {
    background: white;
    color: var(--primary-dark);
    box-shadow: var(--shadow-sm);
}

h1 {
    font-size: 1.15rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.5rem;
    letter-spacing: -0.01em;
}

/* Main Section */
.timer-section {
    flex: 1;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    background-color: #ffffff;
}

.timer-controls {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.large-btn {
    width: 100%;
    padding: 1.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s;
}

.main-btn {
    background-color: var(--bg-card);
    color: var(--primary-dark);
    border: 2px solid var(--primary-color);
    box-shadow: var(--shadow-md);
}

.main-btn:hover {
    background-color: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.secondary-btn {
    background-color: #ef4444;
    /* Red for Stop */
    color: white;
    box-shadow: var(--shadow-sm);
}

.secondary-btn:hover:not(:disabled) {
    background-color: #dc2626;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.secondary-btn:disabled {
    background-color: #fee2e2;
    color: #fca5a5;
    cursor: not-allowed;
}

/* Elapsed Time Display */
.display-container {
    width: 100%;
}

.display-box {
    background: var(--bg-page);
    border: 2px solid var(--border-color);
    padding: 2rem;
    border-radius: var(--radius-lg);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: all 0.3s;
}

.display-box.clickable {
    cursor: pointer;
}

.display-box.clickable:hover {
    border-color: var(--primary-color);
    background-color: var(--primary-light);
}

.display-label {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.display-value {
    font-size: 4rem;
    font-weight: 800;
    color: var(--primary-dark);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.display-unit {
    font-size: 1.2rem;
    color: var(--text-secondary);
    font-weight: 600;
}

/* Footer Styles */
.app-footer {
    padding: 1.5rem;
    background-color: white;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.primary-btn {
    width: 100%;
    padding: 1.1rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.3);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(13, 148, 136, 0.4);
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(15, 23, 42, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(8px);
    padding: 1.5rem;
}

.modal-content {
    background-color: white;
    padding: 2.5rem 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 450px;
    position: relative;
    text-align: center;
}

.close-btn {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 2rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s;
    line-height: 1;
}

.modal-header h2 {
    font-size: 1.25rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1.5rem;
}

.modal-result-box {
    margin: 1.5rem 0;
}

.result-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.modal-result-value {
    font-size: 3.5rem;
    font-weight: 800;
    color: var(--primary-color);
}

.modal-result-unit {
    font-size: 1.2rem;
    color: var(--text-secondary);
    font-weight: 600;
}

/* Speed Scale Styles */
.speed-scale-container {
    margin: 1.5rem 0 2.5rem 0;
    position: relative;
    padding: 0 10px;
    direction: ltr !important;
    text-align: left !important;
}

.speed-scale-bar {
    height: 12px;
    width: 100%;
    border-radius: 6px;
    background: linear-gradient(to right,
            #ef4444 0%, #ef4444 25%,
            #f59e0b 25%, #f59e0b 50%,
            #10b981 50%, #10b981 75%,
            #059669 75%, #059669 100%);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.speed-scale-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.speed-indicator {
    position: absolute;
    top: -8px;
    left: calc(var(--speed-percent, 0) * 1%);
    transform: translateX(-50%);
    transition: left 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 5;
}

.indicator-arrow {
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 12px solid var(--text-main);
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.2));
}

.modal-body {
    text-align: left;
}

html[dir="rtl"] .modal-body {
    text-align: right;
}

.modal-body h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 4px;
}

.interpretation-level {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 1.5rem;
}

.interpretation-details {
    font-size: 1rem;
    color: var(--text-main);
    line-height: 1.5;
}

.setup-modal-body {
    text-align: left;
    max-height: 60vh;
    overflow-y: auto;
}

html[dir="rtl"] .setup-modal-body {
    text-align: right;
}

/* RTL Adjustments */
html[dir="rtl"] {
    --font-family: 'Outfit', sans-serif;
}