:root {
    color-scheme: dark;
    --surface: #1c1c1e;
    --surface-active: #2c2c2e;
    --line: rgba(255,255,255,.1);
    --text: #fff;
    --muted: #a5a5ac;
    --quiet: #6e6e76;
    --blue: #0a84ff;
    --green: #30d19b;
    --reading-size: 12px;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
    font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: #000; -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    min-width: 138px;
    min-height: 100%;
    color: var(--text);
    background: #000;
    -webkit-font-smoothing: antialiased;
    overscroll-behavior-y: contain;
    touch-action: pan-y;
}
button, a { font: inherit; -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
::-webkit-scrollbar { width: 0; height: 0; }

.watch-view { display: none; min-height: 100vh; min-height: 100dvh; padding-bottom: max(20px, env(safe-area-inset-bottom)); }
.watch-view.is-active { display: block; }
.watch-header {
    position: sticky;
    z-index: 10;
    top: 0;
    min-height: 45px;
    padding: max(6px, env(safe-area-inset-top)) clamp(8px, 5vw, 12px) 5px;
    display: grid;
    grid-template-columns: 29px minmax(0,1fr) 29px;
    align-items: center;
    gap: 3px;
    border-bottom: 1px solid var(--line);
    background: #000;
}
.watch-header > div { min-width: 0; }
.watch-header h1 { margin: 0; overflow: hidden; font-size: 14px; line-height: 1.1; letter-spacing: -.01em; text-overflow: ellipsis; white-space: nowrap; }
.start-header h1 { font-size: 15px; }
.kicker { display: none; }
.back-control {
    width: 29px;
    height: 30px;
    padding: 0 5px 2px 0;
    display: grid;
    place-items: center;
    border: 0;
    color: var(--blue);
    text-decoration: none;
    background: transparent;
    font-size: 28px;
    line-height: 1;
    font-weight: 300;
}
.back-control:active { opacity: .55; }
.back-control svg { width: 19px; height: 19px; stroke-width: 2.2; }
.live-dot { justify-self: end; width: 6px; height: 6px; border-radius: 50%; background: #555; }
body.is-online .live-dot { background: var(--green); box-shadow: 0 0 7px rgba(48,209,155,.7); }
body.is-offline .live-dot { background: #ff453a; }
.watch-list { padding: 7px clamp(7px, 4.5vw, 10px) 0; }

/* Sloty */
.slot-list { display: grid; gap: 6px; }
.slot-button {
    width: 100%;
    min-height: 46px;
    padding: 7px 10px;
    display: flex;
    align-items: center;
    gap: 9px;
    border: 0;
    border-radius: 12px;
    text-align: left;
    background: var(--surface);
}
.slot-button:active { background: var(--surface-active); }
.slot-number { width: 27px; height: 27px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 9px; color: #78adff; background: rgba(10,132,255,.13); font-size: 11px; font-weight: 700; }
.slot-button strong { min-width: 0; flex: 1; font-size: 12px; }
.slot-button > span:last-child { color: #68686f; font-size: 20px; font-weight: 300; }
.watch-status { margin: 10px 0 0; display: flex; justify-content: center; align-items: center; gap: 5px; color: var(--quiet); font-size: 8px; }

/* Proste menu */
.feature-list { padding: 7px clamp(7px, 4.5vw, 10px) 0; display: grid; gap: 6px; }
.feature-card {
    width: 100%;
    min-height: 51px;
    padding: 8px 10px;
    display: grid;
    grid-template-columns: 20px minmax(0,1fr) auto;
    align-items: center;
    gap: 7px;
    border: 0;
    border-radius: 12px;
    text-align: left;
    background: var(--surface);
}
.feature-card:active { background: var(--surface-active); }
.feature-icon { width: 20px; height: 20px; display: grid; place-items: center; color: #8e8e93; }
.feature-icon svg { width: 17px; height: 17px; }
.messages-feature .feature-icon { color: #6da8ff; }
.images-feature .feature-icon { color: #55d6ac; }
.feature-copy { min-width: 0; }
.feature-copy strong { display: block; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.feature-copy small { display: block; margin-top: 2px; overflow: hidden; color: var(--quiet); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.feature-count, .header-count { min-width: 21px; padding: 3px 5px; border-radius: 7px; color: #aaaab1; background: rgba(255,255,255,.07); text-align: center; font-size: 8px; font-weight: 700; }

/* Lista wiadomości */
.compact-header { min-height: 42px; padding-bottom: 4px; text-align: center; }
.compact-header h1 { font-size: 13px; }
.header-count { justify-self: end; }
.messages-list { display: grid; gap: 6px; }
.message-button {
    width: 100%;
    min-height: 51px;
    padding: 8px 9px;
    border: 0;
    border-radius: 11px;
    text-align: left;
    background: var(--surface);
}
.message-button:active { background: var(--surface-active); }
.message-button strong { display: block; overflow: hidden; font-size: 12px; line-height: 1.18; text-overflow: ellipsis; white-space: nowrap; }
.message-button span { margin-top: 4px; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; color: var(--muted); font-size: 9px; line-height: 1.3; overflow-wrap: anywhere; }
.empty-state { padding: 25px 7px; color: var(--quiet); text-align: center; font-size: 9px; }
.empty-state i { width: 27px; height: 27px; margin: 0 auto 7px; display: grid; place-items: center; border-radius: 9px; background: var(--surface); font-style: normal; }

/* Czytanie: ma mieścić dużo tekstu, Aa pozwala go powiększyć */
.reading-header {
    position: relative;
    min-height: 36px;
    padding-top: max(3px, env(safe-area-inset-top));
    padding-bottom: 2px;
    border-bottom-color: rgba(255,255,255,.06);
}
.reading-label { color: #77777f; font-size: 7px; font-weight: 700; letter-spacing: .09em; }
.reading-header .back-control { height: 26px; }
.font-button { justify-self: end; width: 27px; height: 25px; padding: 0; border: 1px solid var(--line); border-radius: 8px; color: #9bc2ff; background: var(--surface); font-size: 8px; font-weight: 700; }
.font-button:active { background: var(--surface-active); }
.reading-view { padding: 9px clamp(8px, 5vw, 12px) 28px; }
.reading-view h1 { margin: 0; color: white; font-size: calc(var(--reading-size) + 2px); line-height: 1.18; letter-spacing: -.01em; overflow-wrap: anywhere; }
.title-rule { width: 26px; height: 2px; margin: 8px 0; border-radius: 3px; background: var(--blue); }
.reading-view #read-body { margin: 0; color: #e0e0e3; font-size: var(--reading-size); line-height: 1.4; overflow-wrap: anywhere; white-space: pre-wrap; user-select: text; -webkit-user-select: text; }
.reading-end { margin: 21px 0 0; color: #55555c; text-align: center; font-size: 7px; font-weight: 700; letter-spacing: .15em; }

/* Zdjęcia */
.images-grid { padding: 5px clamp(5px, 3vw, 7px) 0; display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 4px; }
.image-tile { aspect-ratio: 1; padding: 0; overflow: hidden; border: 0; border-radius: 9px; background: var(--surface); }
.image-tile:active { opacity: .7; }
.image-tile img { width: 100%; height: 100%; display: block; object-fit: cover; }
.images-grid .empty-state { grid-column: 1 / -1; }
.image-detail { padding: 6px clamp(6px, 4vw, 9px) 24px; }
.detail-image-button { position: relative; width: 100%; min-height: 90px; padding: 0; overflow: hidden; display: block; border: 0; border-radius: 11px; background: #0c0c0e; }
.detail-image-button img { width: 100%; max-height: 62vh; display: block; object-fit: contain; }
.image-nav { margin-top: 6px; display: grid; grid-template-columns: 35px 1fr 1fr 35px; gap: 5px; }
.image-nav button { min-height: 35px; border: 0; border-radius: 9px; color: var(--blue); background: var(--surface); font-size: 9px; font-weight: 700; }
.image-nav button:first-child, .image-nav button:last-child { padding-bottom: 3px; font-size: 23px; font-weight: 300; }
.image-nav .zoom-step { font-size: 18px; font-weight: 400; }
.image-nav button:active { background: var(--surface-active); }
.image-nav button:disabled { color: #44444a; }

/* Zoom zdjęcia — koronka zmienia skalę */
.zoom-overlay { position: fixed; z-index: 100; inset: 0; display: none; background: #000; touch-action: none; }
.zoom-overlay.is-active { display: block; }
.zoom-stage { width: 100%; height: 100%; display: grid; place-items: center; overflow: auto; }
.zoom-stage img { width: 100vw; max-width: none; height: auto; display: block; object-fit: contain; }
.zoom-close { position: fixed; z-index: 102; top: max(6px, env(safe-area-inset-top)); left: max(6px, env(safe-area-inset-left)); width: 29px; height: 29px; padding: 0 0 2px; border: 1px solid rgba(255,255,255,.2); border-radius: 50%; color: white; background: rgba(0,0,0,.72); font-size: 20px; }
.zoom-output { position: fixed; z-index: 102; top: max(9px, env(safe-area-inset-top)); right: max(7px, env(safe-area-inset-right)); padding: 4px 6px; border-radius: 7px; color: white; background: rgba(0,0,0,.72); font-size: 8px; }
.zoom-buttons { position: fixed; z-index: 102; left: 50%; bottom: max(25px, calc(env(safe-area-inset-bottom) + 21px)); transform: translateX(-50%); display: flex; gap: 5px; }
.zoom-buttons button { width: 38px; height: 31px; border: 1px solid rgba(255,255,255,.12); border-radius: 9px; color: white; background: rgba(28,28,30,.9); font-size: 17px; }
.zoom-buttons button:active { background: #3a3a3c; }
.crown-hint { position: fixed; z-index: 102; left: 50%; bottom: max(5px, env(safe-area-inset-bottom)); transform: translateX(-50%); color: #777; font-size: 7px; white-space: nowrap; }
.watch-toast { position: fixed; z-index: 200; left: 7px; right: 7px; bottom: max(7px, env(safe-area-inset-bottom)); padding: 7px; border: 1px solid var(--line); border-radius: 9px; color: white; background: rgba(35,35,38,.97); text-align: center; opacity: 0; transform: translateY(6px); pointer-events: none; font-size: 8px; transition: .12s; }
.watch-toast.is-visible { opacity: 1; transform: none; }

/* Mniejsze koperty */
@media (max-width: 175px) {
    .watch-header { min-height: 40px; grid-template-columns: 27px minmax(0,1fr) 27px; padding-left: 6px; padding-right: 6px; }
    .watch-header h1, .start-header h1 { font-size: 13px; }
    .back-control { width: 27px; font-size: 26px; }
    .slot-list, .watch-list { padding-left: 6px; padding-right: 6px; }
    .slot-button { min-height: 42px; padding: 6px 8px; }
    .slot-number { width: 25px; height: 25px; }
    .feature-list { padding: 6px 6px 0; }
    .feature-card { min-height: 46px; padding: 7px 8px; grid-template-columns: 19px minmax(0,1fr) auto; }
    .feature-icon, .feature-icon svg { width: 16px; height: 16px; }
    .reading-view { padding-left: 8px; padding-right: 8px; }
}

/* 46 mm: więcej szerokości przeznaczamy na treść */
@media (min-width: 195px) {
    :root { --reading-size: 13px; }
    .watch-header { min-height: 47px; padding-left: 11px; padding-right: 11px; }
    .watch-header h1 { font-size: 15px; }
    .start-header h1 { font-size: 16px; }
    .watch-list, .feature-list { padding-left: 9px; padding-right: 9px; gap: 7px; }
    .slot-button { min-height: 48px; }
    .slot-button strong, .feature-copy strong { font-size: 13px; }
    .feature-card { min-height: 53px; }
    .message-button span { -webkit-line-clamp: 3; font-size: 10px; }
    .reading-view { padding-left: 11px; padding-right: 11px; }
}

/* Pasek czytania jest niski i przewija się razem z treścią. */
.reading-header { min-height: 34px; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition-duration: .01ms !important; }
}
