/* ==========================================================================
   Eulen-Lerntimer – 100 % lokal, Mobile-First & Touch-optimiert (>= 44px)
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    min-height: 100%;
    font-family: var(--le-font-sans);
    background: var(--le-bg);
    color: var(--le-ink);
    -webkit-tap-highlight-color: transparent;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
    color: inherit;
    transition: transform 0.12s ease, background-color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

button:active:not(:disabled) {
    transform: scale(0.97);
}

button:disabled {
    opacity: 0.42;
    cursor: not-allowed;
}

.mono {
    font-family: var(--le-font-mono);
    font-variant-numeric: tabular-nums;
}

.app-shell {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    transition: background-color 0.35s ease;
}

body.phase-break {
    background: #f0fdfa;
}

body.phase-done {
    background: #f0fdf4;
}

/* ==========================================================================
   KOPFLEISTE
   ========================================================================== */
.top-bar {
    position: sticky;
    top: 0;
    z-index: 30;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--le-border);
    padding: 8px 14px;
}

.top-bar-inner {
    max-width: 1120px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.brand-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 3px 10px rgba(79, 70, 229, 0.22);
}

.brand-title {
    font-size: 1.05rem;
    font-weight: 900;
    letter-spacing: -0.02em;
    color: var(--le-ink);
}

.mode-chip {
    font-size: 0.75rem;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--le-indigo-soft);
    color: #3730a3;
}

body.phase-break .mode-chip {
    background: var(--le-teal-soft);
    color: #115e59;
}

body.phase-done .mode-chip {
    background: var(--le-green-soft);
    color: #166534;
}

.top-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.action-btn {
    min-height: 44px;
    padding: 0 12px;
    border-radius: 12px;
    border: 1px solid var(--le-border-strong);
    background: var(--le-surface);
    font-size: 0.85rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.action-btn:hover {
    background: var(--le-surface-alt);
}

.action-btn[aria-pressed="true"] {
    background: var(--le-indigo);
    color: #ffffff;
    border-color: var(--le-indigo);
}

/* ==========================================================================
   HAUPTBEREICH
   ========================================================================== */
.timer-workspace {
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    padding: 16px 14px 28px;
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.9fr);
    gap: 16px;
    align-items: start;
}

.card {
    background: var(--le-surface);
    border: 1px solid var(--le-border);
    border-radius: var(--le-radius-lg);
    box-shadow: var(--le-shadow-sm);
}

.timer-stage {
    padding: 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

/* Presets */
.presets-row {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.preset-btn {
    min-height: 52px;
    padding: 8px 6px;
    border-radius: 14px;
    border: 1.5px solid var(--le-border);
    background: var(--le-surface-alt);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    text-align: center;
}

.preset-btn strong {
    font-size: 0.95rem;
    font-weight: 900;
    color: var(--le-ink);
}

.preset-btn span {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--le-ink-muted);
}

.preset-btn:hover {
    border-color: var(--le-indigo);
}

.preset-btn.active {
    background: var(--le-indigo-soft);
    border-color: var(--le-indigo);
}

.preset-btn.active strong {
    color: #312e81;
}

/* Fach & Ziel */
.subject-bar {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.subject-chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
}

.subject-chip {
    min-height: 44px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid var(--le-border);
    background: var(--le-surface);
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--le-ink-muted);
}

.subject-chip.active {
    background: var(--le-amber-soft);
    border-color: var(--le-amber);
    color: #78350f;
}

.task-input {
    width: 100%;
    min-height: 44px;
    padding: 8px 14px;
    border-radius: 12px;
    border: 1.5px solid var(--le-border);
    background: var(--le-bg);
    color: var(--le-ink);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
}

.task-input:focus {
    outline: none;
    border-color: var(--le-indigo);
    background: #ffffff;
}

.active-task-pill {
    display: none;
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--le-amber-soft);
    color: #78350f;
    font-weight: 800;
    font-size: 0.95rem;
}

/* ==========================================================================
   KREIS-UHR (SVG)
   ========================================================================== */
.clock-wrap {
    position: relative;
    width: min(296px, 74vw);
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    margin: 4px 0;
}

.clock-wrap.ring-pulse {
    animation: gentlePulse 0.9s ease 3;
}

@keyframes gentlePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.03); }
}

.clock-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
    overflow: visible;
}

.clock-ticks line {
    stroke: var(--le-border-strong);
    stroke-linecap: round;
}

.clock-track {
    fill: none;
    stroke: #e2e8f0;
    stroke-width: 14;
}

.clock-progress {
    fill: none;
    stroke: var(--le-indigo);
    stroke-width: 14;
    stroke-linecap: round;
    transition: stroke 0.3s ease;
}

body.phase-break .clock-progress {
    stroke: var(--le-teal);
}

body.phase-done .clock-progress {
    stroke: var(--le-green);
}

.clock-center {
    position: absolute;
    inset: 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-align: center;
    pointer-events: none;
}

.phase-pill {
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 4px 11px;
    border-radius: 999px;
    background: var(--le-indigo-soft);
    color: #3730a3;
}

body.phase-break .phase-pill {
    background: var(--le-teal-soft);
    color: #0f766e;
}

body.phase-done .phase-pill {
    background: var(--le-green-soft);
    color: #15803d;
}

.time-display {
    font-size: clamp(2.8rem, 8vw, 3.8rem);
    font-weight: 900;
    letter-spacing: -0.04em;
    line-height: 1;
    color: var(--le-ink);
}

.clock-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--le-ink-muted);
}

/* Minuten-Feinanpassung */
.quick-adjust-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.adj-btn {
    min-width: 48px;
    min-height: 44px;
    padding: 0 10px;
    border-radius: 12px;
    border: 1px solid var(--le-border-strong);
    background: var(--le-surface-alt);
    font-size: 0.86rem;
    font-weight: 800;
}

.adj-btn:hover:not(:disabled) {
    border-color: var(--le-indigo);
    background: var(--le-indigo-soft);
}

.adj-label {
    font-size: 0.84rem;
    font-weight: 800;
    color: var(--le-ink-muted);
    padding: 0 6px;
}

/* Haupt-Buttons */
.primary-controls {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.ctrl-btn {
    min-height: 50px;
    padding: 0 22px;
    border-radius: 16px;
    font-size: 1rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.ctrl-btn.primary {
    min-width: 170px;
    background: var(--le-indigo);
    color: #ffffff;
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.25);
}

.ctrl-btn.primary.running {
    background: #d97706;
    box-shadow: 0 8px 20px rgba(217, 119, 6, 0.24);
}

body.phase-break .ctrl-btn.primary {
    background: var(--le-teal);
    box-shadow: 0 8px 20px rgba(13, 148, 136, 0.24);
}

.ctrl-btn.secondary {
    background: var(--le-surface-alt);
    border: 1.5px solid var(--le-border-strong);
    color: var(--le-ink);
}

.completion-banner {
    width: 100%;
    padding: 12px 14px;
    border-radius: 14px;
    background: var(--le-green-soft);
    border: 1px solid #86efac;
    color: #14532d;
    font-size: 0.9rem;
    font-weight: 800;
    text-align: center;
}

/* ==========================================================================
   SEITENLEISTE
   ========================================================================== */
.timer-side {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.side-card {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.side-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.side-title {
    font-size: 1rem;
    font-weight: 900;
    color: var(--le-ink);
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--le-border);
}

.setting-row:first-of-type {
    padding-top: 2px;
    border-top: none;
}

.setting-row.stack-sm {
    flex-direction: column;
    align-items: flex-start;
}

.setting-label {
    font-size: 0.88rem;
    font-weight: 800;
    color: var(--le-ink);
}

.setting-sub {
    font-size: 0.75rem;
    color: var(--le-ink-muted);
}

.stepper {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.step-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid var(--le-border-strong);
    background: var(--le-surface-alt);
    font-size: 1.1rem;
    font-weight: 900;
}

.step-val {
    min-width: 50px;
    text-align: center;
    font-size: 0.92rem;
    font-weight: 800;
}

.pill-choice {
    display: inline-flex;
    gap: 4px;
}

.pill-choice.wrap {
    flex-wrap: wrap;
    width: 100%;
}

.choice-btn {
    min-height: 44px;
    padding: 0 11px;
    border-radius: 11px;
    border: 1px solid var(--le-border);
    background: var(--le-surface-alt);
    font-size: 0.82rem;
    font-weight: 800;
    color: var(--le-ink-muted);
}

.choice-btn.active {
    background: var(--le-indigo);
    border-color: var(--le-indigo);
    color: #ffffff;
}

.toggle-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--le-border);
}

.toggle-row {
    width: 100%;
    min-height: 44px;
    padding: 6px 10px;
    border-radius: 12px;
    background: var(--le-surface-alt);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.83rem;
    font-weight: 700;
    text-align: left;
}

.toggle-pill {
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 900;
    background: #e2e8f0;
    color: #475569;
    flex-shrink: 0;
}

.toggle-row[aria-pressed="true"] .toggle-pill {
    background: var(--le-green-soft);
    color: #166534;
}

/* Tagesbilanz */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.stat-box {
    padding: 10px 6px;
    border-radius: 14px;
    background: var(--le-surface-alt);
    border: 1px solid var(--le-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.stat-box.coins {
    background: var(--le-amber-soft);
    border-color: rgba(217, 119, 6, 0.35);
}

.stat-num {
    font-size: 1.1rem;
    font-weight: 900;
    color: var(--le-ink);
}

.stat-cap {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--le-ink-muted);
}

.coin-hint {
    font-size: 0.76rem;
    color: var(--le-ink-muted);
    line-height: 1.35;
}

.text-link-btn {
    min-height: 36px;
    padding: 0 8px;
    font-size: 0.78rem;
    font-weight: 800;
    color: var(--le-rose);
}

.session-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 220px;
    overflow-y: auto;
}

.session-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 12px;
    background: var(--le-bg);
    border: 1px solid var(--le-border);
    font-size: 0.83rem;
}

.session-item-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.session-item-title {
    font-weight: 800;
    color: var(--le-ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.session-item-meta {
    font-size: 0.74rem;
    color: var(--le-ink-muted);
}

.session-empty {
    padding: 12px;
    border-radius: 12px;
    background: var(--le-surface-alt);
    text-align: center;
    font-size: 0.82rem;
    color: var(--le-ink-muted);
}

/* ==========================================================================
   FOKUS-ANSICHT (RUHEMODUS OHNE ABLENKUNG)
   ========================================================================== */
body.focus-mode .calm-hide {
    display: none !important;
}

body.focus-mode .timer-workspace {
    grid-template-columns: minmax(0, 620px);
    justify-content: center;
    padding-top: 24px;
}

body.focus-mode .timer-stage {
    padding: 28px 20px;
}

body.focus-mode .active-task-pill {
    display: inline-flex;
}

body.focus-mode .clock-wrap {
    width: min(350px, 82vw);
}

/* ==========================================================================
   RESPONSIVE (TABLET & SMARTPHONE)
   ========================================================================== */
@media (max-width: 860px) {
    .timer-workspace {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 540px) {
    .top-bar {
        padding: 8px 10px;
    }

    .mode-chip,
    .btn-text-hide-sm {
        display: none;
    }

    .timer-workspace {
        padding: 10px 10px 24px;
        gap: 12px;
    }

    .timer-stage {
        padding: 14px 12px;
    }

    .presets-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ctrl-btn.primary {
        flex: 1 1 180px;
    }
}
