/* assets/css/stopwatch.css v45 */

/* ── Page ── */
.sw-body {
    background-color: var(--bg-body, #f8f4ee);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px 16px 0;
    font-family: var(--font-main, 'Quicksand', system-ui, sans-serif);
    overflow-x: hidden;
}

.sw-inner {
    width: 100%;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ── Header ── */
.sw-header {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
}
.sw-header-row {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 150;
    margin-bottom: 6px;
}
.pp-logo { display: block; }
.pp-logo img { height: 44px; width: auto; display: block; }
.pp-creator {
    font-size: .82rem;
    color: #999;
    margin: 0;
    text-align: center;
}

/* ── Language selector ── */
.sw-lang-dropdown {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
}
.sw-lang-btn {
    background: none;
    border: 1.5px solid #e0e0e0;
    border-radius: 8px;
    padding: 4px 10px;
    font-size: .75rem;
    font-weight: 700;
    color: #888;
    cursor: pointer;
    font-family: inherit;
    transition: border-color .15s, color .15s;
}
.sw-lang-btn:hover { border-color: var(--clr-green, #73b7ab); color: var(--clr-green, #73b7ab); }
.sw-lang-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    padding-top: 6px;
    background: transparent;
    z-index: 300;
    min-width: 60px;
}
.sw-lang-menu-inner {
    background: #fff;
    border: 1.5px solid #e8e8e8;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0,0,0,.1);
    overflow: hidden;
}
.sw-lang-dropdown.open .sw-lang-menu { display: block; }
@media (hover: hover) {
    .sw-lang-dropdown:hover .sw-lang-menu { display: block; }
}
.sw-lang-menu-inner a {
    display: block;
    padding: 8px 16px;
    font-size: .78rem;
    font-weight: 700;
    color: #636e72;
    text-decoration: none;
    transition: background .12s;
}
.sw-lang-menu-inner a:hover { background: #f5f5f5; }
.sw-lang-menu-inner a.active { color: var(--clr-green, #73b7ab); }
.sw-page-title {
    font-size: .82rem;
    font-weight: 600;
    color: #bbb;
    margin: 0;
    text-align: center;
    line-height: 1.3;
}

/* ── Sticky header (canvas + action buttons) ── */
.sw-sticky {
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-bottom: 6px;
}
/* Full-viewport-width background so card shadows don't bleed through on desktop */
.sw-sticky::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: calc(-50vw + 50%);
    right: calc(-50vw + 50%);
    background: var(--bg-body, #f8f4ee);
    z-index: -1;
    pointer-events: none;
}

/* ── Canvas wrap — transitions between preview and timer size ── */
.sw-canvas-wrap {
    position: relative;
    width: min(56vw, 260px);
    margin: 0 auto 16px;
    transition: width .45s cubic-bezier(.4,0,.2,1),
                margin-bottom .45s ease,
                opacity .28s ease,
                transform .28s ease;
    will-change: width, opacity, transform;
}
.sw-canvas-wrap.sw-canvas-loading .sw-canvas-loader,
.sw-canvas-loader.visible { display: flex; }

/* ── Canvas loading spinner ── */
.sw-canvas-loader {
    display: none;
    position: absolute;
    inset: 0;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    background: rgba(248,244,238,.55);
    z-index: 5;
    pointer-events: none;
}
.sw-canvas-loader::after {
    content: '';
    width: 28%;
    aspect-ratio: 1;
    border: 3px solid rgba(115,183,171,.25);
    border-top-color: var(--clr-green, #73b7ab);
    border-radius: 50%;
    animation: sw-spin .75s linear infinite;
}
@keyframes sw-spin { to { transform: rotate(360deg); } }
.sw-canvas-wrap.sw-preview-exit {
    opacity: 0;
    transform: translateX(-32px);
}

/* Swap between preview-square and fullscreen sizing while invisible, so the
   resize itself never appears as a slide/grow — only a plain centred fade. */
.sw-canvas-wrap.sw-fade-swap {
    opacity: 0;
    transform: none;
}

#stopwatch-canvas {
    display: block;
    width: 100%;
    aspect-ratio: 1;
}

.sw-countdown {
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--clr-green, #73b7ab);
    color: #fff;
    font-size: 1.55rem;
    font-weight: 700;
    padding: 6px 26px;
    border-radius: 50px;
    letter-spacing: .06em;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    box-shadow: 0 3px 12px rgba(115,183,171,.4);
    font-family: inherit;
}

/* ── CTA row: Spustit + Zamíchat ── */
.sw-cta-row {
    display: flex;
    gap: 10px;
    width: 100%;
    margin-bottom: 20px;
    transition: opacity .25s ease, transform .3s ease;
    will-change: opacity, transform;
}
.sw-cta-row.sw-fade-out {
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
}
.sw-btn-start   { flex: 1; justify-content: center; gap: 7px; }
.sw-btn-shuffle  { flex: 1; justify-content: center; gap: 7px; }
.sw-btn-cancel {
    flex: 1;
    justify-content: center;
    background: var(--clr-strawberry-pink, #e0848f);
    color: #fff;
    border-color: var(--clr-strawberry-pink, #e0848f);
}
.sw-btn-cancel:hover {
    background: #d0767f;
    border-color: #d0767f;
}

/* ── Timer controls ── */
.sw-timer-controls {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
    transition: opacity .25s ease;
}
.sw-timer-controls.sw-fade-in { opacity: 1; }

.sw-btn-row {
    display: flex;
    gap: 10px;
}
.sw-btn-row .btn {
    flex: 1;
    min-width: 0;
    padding: .75rem 1rem;
    gap: 6px;
    justify-content: center;
}

/* ── Config cards — slide out / in ── */
.sw-config-cards {
    width: 100%;
    transition: opacity .3s ease, transform .35s ease;
    will-change: opacity, transform;
}
.sw-config-cards.sw-slide-out {
    opacity: 0;
    transform: translateY(60px);
    pointer-events: none;
}

/* ── Card ── */
.sw-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 2px 20px rgba(0,0,0,.07);
    padding: 20px 20px;
    margin-bottom: 12px;
}
.sw-card-label {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #bbb;
    margin-bottom: 14px;
}
/* Collapsible card (Naposledy použité) */
.sw-card-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #bbb;
    margin-bottom: 0;
}
.sw-chevron {
    flex-shrink: 0;
    transition: transform .2s ease;
    opacity: .6;
}
.sw-card-collapsible.sw-card-open .sw-chevron { transform: rotate(180deg); }
.sw-collapsible-body {
    overflow: hidden;
    max-height: 0;
    transition: max-height .3s ease, margin-top .2s ease;
    margin-top: 0;
}
.sw-card-collapsible.sw-card-open .sw-collapsible-body {
    max-height: 400px;
    margin-top: 14px;
}

/* ── Recent configs ── */
.sw-recents {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
.sw-recent-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    padding: 10px 8px;
    border-radius: 12px;
    border: 2px solid transparent;
    background: #fafafa;
    transition: border-color .15s, background .15s;
    width: 100%;
}
.sw-recent-item:hover { background: #f0f0f0; }
.sw-recent-item.active {
    border-color: var(--clr-green, #73b7ab);
    background: #f0f9f7;
}
.sw-recent-thumb { display: flex; align-items: center; }
.sw-rc {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    overflow: hidden;
    background: #fff;
    border: 2px solid #fff;
    box-shadow: 0 1px 5px rgba(0,0,0,.13);
    flex-shrink: 0;
    position: relative;
}
.sw-rc img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sw-rp {
    width: 14px;
    height: 14px;
    background: #fff;
    border-radius: 50%;
    font-size: .7rem;
    font-weight: 700;
    color: var(--clr-green);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
    left: -10px;
    margin: 0 -7px;
}
.sw-rp + .sw-rc { margin-left: -10px; }
.sw-recent-time {
    font-size: .7rem;
    font-weight: 700;
    color: #636e72;
    white-space: nowrap;
}

/* ── Pickers ── */
.sw-picker-grid,
.sw-face-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}

.sw-pick-btn {
    aspect-ratio: 1;
    padding: 0;
    border: 3px solid transparent;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    overflow: hidden;
    transition: border-color .15s, transform .15s, box-shadow .15s;
}
.sw-pick-btn img,
.sw-pick-btn svg {
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: none;
}
.sw-pick-btn img { object-fit: cover; border-radius: 50%; }
.sw-pick-btn:hover { border-color: #ddd; transform: scale(1.06); }
.sw-pick-btn.selected {
    border-color: var(--clr-green, #73b7ab);
    box-shadow: 0 0 0 3px rgba(115,183,171,.25);
}

/* ── Time picker ── */
.sw-time-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}
.sw-time-btn {
    padding: 7px 6px;
    border: 1.5px solid #e8e8e8;
    border-radius: 50px;
    background: #fff;
    color: #2d3436;
    font-size: .78rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color .15s, background .15s, color .15s;
    font-family: inherit;
    line-height: 1.3;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sw-time-btn:hover { border-color: var(--clr-green, #73b7ab); color: var(--clr-green, #73b7ab); }
.sw-time-btn.selected {
    border-color: var(--clr-green, #73b7ab);
    background: var(--clr-green, #73b7ab);
    color: #fff;
}
.sw-custom-row {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    margin-top: 14px;
    flex-wrap: wrap;
}
.sw-custom-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #bbb;
}
.sw-custom-input {
    width: 68px;
    padding: 8px 10px;
    border: 1.5px solid #e8e8e8;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 700;
    text-align: center;
    background: #fff;
    color: #2d3436;
    font-family: inherit;
    transition: border-color .15s;
}
.sw-custom-input:focus { outline: none; border-color: var(--clr-green, #73b7ab); }
.sw-custom-sep {
    font-size: 1.4rem;
    font-weight: 700;
    color: #bbb;
    line-height: 1;
    padding-bottom: 7px;
}
.sw-btn-ok {
    padding: 9px 20px;
    background: var(--clr-green, #73b7ab);
    color: #fff;
    border: none;
    border-radius: 50px;
    font-size: .9rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: background .15s;
}
.sw-btn-ok:hover { background: #5fa095; }

/* ── Ghost button ── */
.sw-btn-ghost {
    background: none;
    border: none;
    font-family: inherit;
    font-size: .83rem;
    color: #bbb;
    cursor: pointer;
    padding: 6px;
    text-align: center;
    text-decoration: underline;
    transition: color .15s;
    width: 100%;
}
.sw-btn-ghost:hover { color: #999; }
.sw-links-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
}
.sw-btn-website,
.sw-btn-instagram {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    text-align: center;
}

/* ── Recording ── */
.sw-rec-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: .85rem;
    font-weight: 700;
    color: #c0392b;
    margin-top: 4px;
}
.sw-rec-dot {
    width: 10px;
    height: 10px;
    background: #c0392b;
    border-radius: 50%;
    animation: sw-blink 1s ease-in-out infinite;
    flex-shrink: 0;
}
@keyframes sw-blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: .15; }
}

/* ── Footer ── */
.sw-footer {
    margin-top: 20px;
    padding-bottom: 32px;
    text-align: center;
    font-size: .72rem;
    color: #bbb;
    width: 100%;
}

/* ── Utility ── */
.hidden { display: none !important; }
.sw-placeholder {
    font-size: .85rem;
    color: #bbb;
    text-align: center;
    padding: 12px 0;
    margin: 0;
}
.sw-placeholder code {
    background: #f5f5f5;
    border-radius: 4px;
    padding: 1px 5px;
    font-size: .82em;
}

/* ── Responsive ── */
@media (max-width: 599px) {
    .sw-recents {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 8px;
        scrollbar-width: none;
        padding-bottom: 2px;
        -webkit-overflow-scrolling: touch;
    }
    .sw-recents::-webkit-scrollbar { display: none; }
    .sw-recent-item { flex-shrink: 0; width: auto; }
}

@media (max-width: 480px) {
    .sw-body   { padding: 20px 12px 0; }
    .pp-logo img { height: 38px; }
    .sw-card   { padding: 16px 14px; }
    .sw-picker-grid,
    .sw-face-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
    .sw-time-grid { gap: 5px; }
    .sw-time-btn { font-size: .72rem; padding: 6px 4px; }
    .sw-countdown { font-size: 1.3rem; }
}

/* ── Fullscreen running mode ── */
body.sw-running {
    overflow: hidden;
}
/* Make the sticky wrapper cover the whole viewport as a background layer */
body.sw-running .sw-sticky {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    justify-content: center;
    background: var(--bg-body, #f8f4ee);
    z-index: 100;
}
/* Canvas fills the entire screen on both axes — the clock itself is drawn as a
   smaller region inside it (see getClockArea() in stopwatch.js), so confetti
   can fly across the whole display instead of being clipped at the clock edge. */
/* No explicit width/height here on purpose: 100vw/100vh ignore the scrollbar
   gutter and can disagree with window.innerWidth/innerHeight (which the canvas
   backing store is sized from in JS) whenever a scrollbar shows/hides — that
   mismatch is what stretched the canvas on production. inset:0 alone sizes a
   fixed element to the true viewport, matching window.innerWidth/innerHeight. */
body.sw-running .sw-canvas-wrap {
    position: fixed;
    inset: 0;
    width: auto;
    height: auto;
    margin: 0;
}
body.sw-running #stopwatch-canvas {
    width: 100%;
    height: 100%;
    aspect-ratio: auto;
}
body.sw-running .sw-sticky::before {
    display: none;
}

/* Countdown pill anchored just below the drawn clock area — landscape: clock is
   50% of viewport height; portrait: clock is 90% of viewport width. Formulas
   mirror getClockArea() in stopwatch.js so the pill tracks the clock exactly. */
body.sw-running #sw-countdown {
    position: fixed;
    bottom: auto;
    left: 50%;
    transform: translateX(-50%);
    z-index: 210;
}
@media (orientation: landscape) {
    body.sw-running #sw-countdown { top: calc(75vh + 14px); }
}
@media (orientation: portrait) {
    body.sw-running #sw-countdown { top: calc((100vh + 90vw) / 2 + 14px); }
}

/* Logo/header float above the fullscreen canvas instead of being hidden behind it */
body.sw-running .sw-header {
    position: fixed;
    top: 14px;
    left: 0;
    right: 0;
    max-width: 480px;
    margin: 0 auto;
    z-index: 220;
    pointer-events: none;
}
body.sw-running .sw-header a,
body.sw-running .sw-header button {
    pointer-events: auto;
}
body.sw-running .sw-page-title {
    display: none;
}
body.sw-running .sw-lang-dropdown {
    display: none;
}

/* Fixed during entire timer lifecycle (running + paused) */
body.sw-timer-on .sw-timer-controls {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: min(100%, 480px);
    padding: 10px 16px 22px;
    background: var(--bg-body, #f8f4ee);
    z-index: 200;
    margin-bottom: 0;
}
