/* =========================================================
   Stopwatch Lab & Sport Pro
   Semua class memakai prefix "swp-" dan variabel CSS dibatasi
   di dalam .swp-page, jadi aman dari bentrok dengan CSS lain.
   ========================================================= */

.swp-page {
    --swp-ink: #0c1626;
    --swp-ink-2: #14233b;
    --swp-line: rgba(148, 176, 214, .16);
    --swp-text: #e8eef8;
    --swp-muted: #8fa3c0;
    --swp-cyan: #38bdf8;
    --swp-indigo: #6366f1;
    --swp-coral: #ff6b57;
    --swp-green: #34d399;
    --swp-amber: #fbbf24;
    --swp-paper: #f4f7fb;
    --swp-radius: 22px;

    box-sizing: border-box;
    min-height: 100vh;
    background: var(--swp-paper);
    color: #1e293b;
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.swp-page *,
.swp-page *::before,
.swp-page *::after {
    box-sizing: border-box;
}

.swp-wrap {
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    padding: 32px 16px 64px;
}

/* ---------- Kartu alat ---------- */
.swp-app {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    padding: 28px 20px 24px;
    border-radius: 28px;
    color: var(--swp-text);
    background:
        radial-gradient(900px 420px at 50% -10%, rgba(56, 189, 248, .14), transparent 60%),
        linear-gradient(160deg, var(--swp-ink-2), var(--swp-ink) 60%);
    box-shadow: 0 30px 60px -28px rgba(12, 22, 38, .65), 0 0 0 1px rgba(255, 255, 255, .04) inset;
}

.swp-app::before {
    /* cahaya yang bergerak pelan saat stopwatch berjalan */
    content: "";
    position: absolute;
    z-index: -1;
    width: 520px;
    height: 520px;
    left: 50%;
    top: 90px;
    margin-left: -260px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(99, 102, 241, .28), transparent 65%);
    opacity: 0;
    transition: opacity .6s ease;
}

.swp-app[data-state="running"]::before {
    opacity: 1;
    animation: swp-drift 9s ease-in-out infinite alternate;
}

@keyframes swp-drift {
    from { transform: translate(-60px, -10px) scale(.95); }
    to   { transform: translate(60px, 20px) scale(1.08); }
}

.swp-head {
    text-align: center;
    margin-bottom: 8px;
}

.swp-title {
    margin: 0 0 6px;
    font-size: clamp(1.5rem, 4.2vw, 2.1rem);
    font-weight: 700;
    letter-spacing: -.02em;
    color: #fff;
}

.swp-sub {
    margin: 0 auto;
    max-width: 520px;
    font-size: .95rem;
    color: var(--swp-muted);
}

/* ---------- Dial ---------- */
.swp-dial {
    position: relative;
    width: min(100%, 340px);
    aspect-ratio: 1;
    margin: 18px auto 10px;
}

.swp-svg {
    width: 100%;
    height: 100%;
    display: block;
    overflow: visible;
}

.swp-track {
    fill: none;
    stroke: rgba(148, 176, 214, .10);
    stroke-width: 10;
}

.swp-progress {
    fill: none;
    stroke: url(#swpGrad);
    stroke-width: 10;
    stroke-linecap: round;
    transform: rotate(-90deg);
    transform-origin: 150px 150px;
    stroke-dasharray: 816.81;
    stroke-dashoffset: 816.81;
    filter: drop-shadow(0 0 6px rgba(56, 189, 248, .55));
}

.swp-tick {
    stroke: rgba(148, 176, 214, .28);
    stroke-width: 2;
    stroke-linecap: round;
    transition: stroke .25s ease, stroke-width .25s ease;
}

.swp-tick.swp-tick-major {
    stroke: rgba(148, 176, 214, .5);
    stroke-width: 3;
}

.swp-tick.swp-lit {
    stroke: var(--swp-cyan);
}

.swp-tick.swp-lit.swp-tick-major {
    stroke: #fff;
}

.swp-hand {
    transform-origin: 150px 150px;
    transform: rotate(0deg);
}

.swp-hand-dot {
    fill: var(--swp-coral);
    filter: drop-shadow(0 0 8px rgba(255, 107, 87, .9));
}

.swp-app[data-state="running"] .swp-hand-dot {
    animation: swp-pulse 1s ease-in-out infinite;
}

@keyframes swp-pulse {
    0%, 100% { r: 7; }
    50%      { r: 9.5; }
}

.swp-readout {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.swp-time {
    display: flex;
    align-items: baseline;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
    font-weight: 700;
    letter-spacing: -.02em;
    color: #fff;
    font-size: clamp(2.1rem, 9vw, 3rem);
    line-height: 1;
}

.swp-time-ms {
    font-size: .52em;
    font-weight: 600;
    margin-left: 4px;
    color: var(--swp-cyan);
}

.swp-app[data-state="running"] .swp-time-ms {
    color: var(--swp-coral);
}

.swp-status {
    margin-top: 10px;
    padding: 3px 12px;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 500;
    color: var(--swp-muted);
    background: rgba(148, 176, 214, .1);
    transition: color .3s, background .3s;
}

.swp-app[data-state="running"] .swp-status {
    color: #052e22;
    background: var(--swp-green);
}

.swp-app[data-state="paused"] .swp-status {
    color: #3b2a00;
    background: var(--swp-amber);
}

/* Denyut halus pada dial saat jalan */
.swp-app[data-state="running"] .swp-dial::after {
    content: "";
    position: absolute;
    inset: 8%;
    border-radius: 50%;
    border: 1px solid rgba(56, 189, 248, .35);
    animation: swp-ripple 2s ease-out infinite;
    pointer-events: none;
}

@keyframes swp-ripple {
    from { transform: scale(.92); opacity: .8; }
    to   { transform: scale(1.12); opacity: 0; }
}

/* ---------- Tombol ---------- */
.swp-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    max-width: 440px;
    margin: 18px auto 0;
}

.swp-btn {
    appearance: none;
    border: 0;
    cursor: pointer;
    font: inherit;
    font-weight: 600;
    font-size: .98rem;
    padding: 14px 18px;
    border-radius: 16px;
    color: #fff;
    transition: transform .12s ease, filter .2s ease, opacity .2s ease, box-shadow .2s ease;
    -webkit-tap-highlight-color: transparent;
}

.swp-btn:hover:not(:disabled) { filter: brightness(1.1); }
.swp-btn:active:not(:disabled) { transform: scale(.96); }
.swp-btn:disabled { opacity: .35; cursor: not-allowed; }

.swp-btn:focus-visible,
.swp-chip:focus-visible,
.swp-select:focus-visible,
.swp-range:focus-visible {
    outline: 3px solid rgba(56, 189, 248, .8);
    outline-offset: 2px;
}

.swp-btn-main {
    grid-column: 1 / -1;
    font-size: 1.1rem;
    padding: 17px 18px;
    background: linear-gradient(135deg, #10b981, #059669);
    box-shadow: 0 12px 26px -12px rgba(16, 185, 129, .8);
}

.swp-app[data-state="running"] .swp-btn-main {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    box-shadow: 0 12px 26px -12px rgba(245, 158, 11, .8);
}

.swp-btn-lap {
    background: linear-gradient(135deg, var(--swp-indigo), #4f46e5);
}

.swp-btn-reset {
    background: rgba(255, 107, 87, .16);
    color: #ffb4a8;
    box-shadow: 0 0 0 1px rgba(255, 107, 87, .35) inset;
}

.swp-hint {
    margin: 12px 0 0;
    text-align: center;
    font-size: .8rem;
    color: var(--swp-muted);
}

.swp-kbd {
    display: inline-block;
    min-width: 22px;
    padding: 0 6px;
    margin: 0 1px;
    border-radius: 6px;
    border: 1px solid var(--swp-line);
    background: rgba(255, 255, 255, .05);
    font-size: .74rem;
    font-weight: 600;
    color: var(--swp-text);
    text-align: center;
}

/* ---------- Pengaturan suara ---------- */
.swp-sound {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px 14px;
    margin: 20px auto 0;
    padding: 12px 14px;
    max-width: 640px;
    border-radius: 16px;
    background: rgba(255, 255, 255, .04);
    border: 1px solid var(--swp-line);
}

.swp-chip {
    appearance: none;
    cursor: pointer;
    font: inherit;
    font-size: .85rem;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 999px;
    color: var(--swp-text);
    background: rgba(255, 255, 255, .06);
    border: 1px solid var(--swp-line);
    transition: background .2s, color .2s, border-color .2s;
}

.swp-chip[aria-pressed="true"] {
    background: rgba(56, 189, 248, .18);
    border-color: rgba(56, 189, 248, .6);
    color: #bfe9ff;
}

.swp-field {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .85rem;
    color: var(--swp-muted);
}

.swp-select {
    font: inherit;
    font-size: .85rem;
    padding: 7px 10px;
    border-radius: 10px;
    color: var(--swp-text);
    background: var(--swp-ink);
    border: 1px solid var(--swp-line);
}

.swp-range {
    width: 96px;
    accent-color: var(--swp-cyan);
}

/* ---------- Statistik & putaran ---------- */
.swp-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 22px 0 14px;
}

.swp-stat {
    padding: 12px 10px;
    text-align: center;
    border-radius: 14px;
    background: rgba(255, 255, 255, .04);
    border: 1px solid var(--swp-line);
}

.swp-stat-label {
    display: block;
    font-size: .76rem;
    color: var(--swp-muted);
}

.swp-stat-value {
    display: block;
    margin-top: 2px;
    font-size: clamp(.9rem, 3.2vw, 1.1rem);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #fff;
}

.swp-laps-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.swp-laps-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
}

.swp-laps-actions {
    display: flex;
    gap: 6px;
}

.swp-mini {
    appearance: none;
    cursor: pointer;
    font: inherit;
    font-size: .8rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 10px;
    color: var(--swp-text);
    background: rgba(255, 255, 255, .06);
    border: 1px solid var(--swp-line);
}

.swp-mini:hover:not(:disabled) { background: rgba(255, 255, 255, .12); }
.swp-mini:disabled { opacity: .35; cursor: not-allowed; }

.swp-laps {
    margin: 0;
    padding: 0;
    list-style: none;
    max-height: 280px;
    overflow-y: auto;
    border-radius: 16px;
    border: 1px solid var(--swp-line);
    background: rgba(0, 0, 0, .18);
}

.swp-laps::-webkit-scrollbar { width: 8px; }
.swp-laps::-webkit-scrollbar-thumb { background: rgba(148, 176, 214, .25); border-radius: 8px; }

.swp-lap {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    border-bottom: 1px solid var(--swp-line);
    font-size: .92rem;
    font-variant-numeric: tabular-nums;
}

.swp-lap:last-child { border-bottom: 0; }

.swp-lap.swp-lap-new {
    animation: swp-slide .35s ease;
}

@keyframes swp-slide {
    from { background: rgba(56, 189, 248, .25); transform: translateY(-8px); }
    to   { background: transparent; transform: none; }
}

.swp-lap-name { color: var(--swp-muted); font-weight: 500; }
.swp-lap-split { font-weight: 700; color: #fff; }
.swp-lap-total { color: var(--swp-muted); min-width: 92px; text-align: right; }

.swp-lap.swp-best .swp-lap-split { color: var(--swp-green); }
.swp-lap.swp-worst .swp-lap-split { color: var(--swp-coral); }

.swp-badge {
    margin-left: 8px;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: .7rem;
    font-weight: 600;
}

.swp-best .swp-badge { color: #052e22; background: var(--swp-green); }
.swp-worst .swp-badge { color: #3a0d06; background: var(--swp-coral); }

.swp-empty {
    padding: 22px 16px;
    text-align: center;
    color: var(--swp-muted);
    font-size: .9rem;
}

.swp-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.swp-toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    z-index: 9999;
    transform: translate(-50%, 20px);
    padding: 10px 18px;
    border-radius: 999px;
    font-size: .88rem;
    font-weight: 600;
    color: #fff;
    background: #0c1626;
    box-shadow: 0 12px 30px -10px rgba(0, 0, 0, .5);
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s, transform .25s;
}

.swp-toast.swp-show {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* ---------- Panduan & artikel ---------- */
.swp-card {
    margin-top: 28px;
    padding: 28px 22px;
    border-radius: var(--swp-radius);
    background: #fff;
    border: 1px solid #e3e9f2;
    box-shadow: 0 18px 40px -26px rgba(15, 27, 51, .25);
}

.swp-card-title {
    margin: 0 0 6px;
    font-size: clamp(1.25rem, 3.4vw, 1.6rem);
    font-weight: 700;
    letter-spacing: -.01em;
    color: #0f1b33;
}

.swp-card-lead {
    margin: 0 0 18px;
    color: #53627a;
    max-width: 62ch;
}

.swp-steps {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 12px;
    counter-reset: swp-step;
}

.swp-steps li {
    position: relative;
    padding: 14px 16px 14px 60px;
    border-radius: 14px;
    background: #f4f7fb;
    counter-increment: swp-step;
    color: #3b4a62;
}

.swp-steps li::before {
    content: counter(swp-step);
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, var(--swp-cyan), var(--swp-indigo));
}

.swp-steps strong { color: #0f1b33; }

.swp-uses {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 12px;
}

.swp-use {
    padding: 16px;
    border-radius: 14px;
    border: 1px solid #e3e9f2;
    background: #fbfcfe;
}

.swp-use h3 {
    margin: 0 0 4px;
    font-size: 1rem;
    color: #0f1b33;
}

.swp-use p {
    margin: 0;
    font-size: .92rem;
    color: #53627a;
}

.swp-table-wrap { overflow-x: auto; }

.swp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .93rem;
}

.swp-table th,
.swp-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #e8edf5;
}

.swp-table th { color: #0f1b33; font-weight: 600; }
.swp-table td { color: #53627a; }

.swp-table .swp-kbd {
    color: #0f1b33;
    background: #f1f5fb;
    border-color: #d6deea;
}

.swp-faq details {
    border-bottom: 1px solid #e8edf5;
    padding: 12px 0;
}

.swp-faq summary {
    cursor: pointer;
    font-weight: 600;
    color: #0f1b33;
    list-style: none;
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.swp-faq summary::-webkit-details-marker { display: none; }

.swp-faq summary::after {
    content: "+";
    font-size: 1.3rem;
    line-height: 1;
    color: var(--swp-indigo);
    transition: transform .2s;
}

.swp-faq details[open] summary::after { transform: rotate(45deg); }

.swp-faq details p {
    margin: 8px 0 0;
    color: #53627a;
}

/* Konten artikel dari database */
.swp-article-body {
    color: #475569;
    font-size: 1.02rem;
    line-height: 1.8;
    max-width: 72ch;
}

.swp-article-body h2,
.swp-article-body h3,
.swp-article-body h4 {
    margin: 1.6em 0 .5em;
    color: #0f1b33;
    line-height: 1.3;
}

.swp-article-body p { margin: 0 0 1em; }
.swp-article-body ul,
.swp-article-body ol { margin: 0 0 1em; padding-left: 1.4em; }
.swp-article-body li { margin-bottom: .35em; }
.swp-article-body a { color: #4f46e5; text-decoration: underline; }
.swp-article-body img { max-width: 100%; height: auto; border-radius: 12px; }
.swp-article-body table { width: 100%; border-collapse: collapse; }
.swp-article-body th,
.swp-article-body td { padding: 8px 10px; border: 1px solid #e3e9f2; }

.swp-divider {
    border: 0;
    height: 1px;
    margin: 0 0 20px;
    background: #e8edf5;
}

/* ---------- Layar lebih lebar ---------- */
@media (min-width: 640px) {
    .swp-wrap { padding: 48px 24px 80px; }
    .swp-app { padding: 36px 36px 30px; }
    .swp-controls { grid-template-columns: 1fr 1fr 1fr; max-width: 560px; }
    .swp-btn-main { grid-column: auto; order: 2; }
    .swp-btn-lap { order: 1; }
    .swp-btn-reset { order: 3; }
    .swp-card { padding: 36px 40px; }
}

/* ---------- Hormati preferensi kurangi gerakan ---------- */
@media (prefers-reduced-motion: reduce) {
    .swp-page *,
    .swp-page *::before,
    .swp-page *::after {
        animation: none !important;
        transition: none !important;
    }
}