/* ==========================================================================
   Audio knjiga gostiju — virtual phone (guest page, template preview, landing)
   Every rule is scoped to .agb so guest-page templates cannot restyle it.
   ========================================================================== */

.agb {
    --agb-accept: #34c759;
    --agb-accept-dark: #248a3d;
    --agb-decline: #ff3b30;
    --agb-decline-dark: #c9271e;
    --agb-ink: #ffffff;
    --agb-ink-soft: rgba(255, 255, 255, 0.78);
    --agb-ink-faint: rgba(255, 255, 255, 0.55);
    --agb-glass: rgba(255, 255, 255, 0.16);
    --agb-glass-strong: rgba(255, 255, 255, 0.26);
    --agb-radius-screen: 46px;
    /* Round button = icon + padding on each side; the recording ring is sized from the large one. */
    --agb-round-icon: 30px;
    --agb-round-pad: 21px;
    --agb-xl-icon: 34px;
    --agb-xl-pad: 23px;
    --agb-font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-family: var(--agb-font);
    color: var(--agb-ink);
    letter-spacing: normal;
    text-transform: none;
    -webkit-tap-highlight-color: transparent;
}

.agb *,
.agb *::before,
.agb *::after {
    box-sizing: border-box;
}

.agb[hidden],
.agb [hidden] {
    display: none !important;
}

.agb svg {
    fill: currentColor;
    stroke: currentColor;
    stroke-width: 0;
}

/* ---------- overlay shell ---------- */

.agb--overlay {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: grid;
    place-items: center;
    padding: 24px 16px;
    animation: agb-fade-in 0.28s ease both;
}

.agb-backdrop {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 50% 30%, rgba(52, 199, 89, 0.18), transparent 55%),
        rgba(8, 8, 14, 0.72);
    -webkit-backdrop-filter: blur(14px) saturate(1.2);
    backdrop-filter: blur(14px) saturate(1.2);
}

.agb-stage {
    position: relative;
    display: grid;
    /* A definite column, so percentage widths on the device resolve against the stage. */
    grid-template-columns: minmax(0, 1fr);
    place-items: center;
    width: 100%;
    height: 100%;
}

.agb--overlay .agb-stage {
    animation: agb-rise 0.45s cubic-bezier(0.2, 0.9, 0.25, 1.15) both;
}

.agb-dismiss {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 3;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.agb-dismiss:hover {
    background: rgba(255, 255, 255, 0.24);
    transform: rotate(90deg);
}

.agb-dismiss svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke-width: 2.4;
    stroke-linecap: round;
}

/* ---------- the device ---------- */

.agb-device {
    position: relative;
    height: min(740px, calc(100dvh - 48px));
    aspect-ratio: 9 / 19.5;
    max-width: 100%;
    filter: drop-shadow(0 40px 60px rgba(0, 0, 0, 0.45));
}

/* Fill the column even inside centring grids, so a width-based device size has something to resolve against. */
.agb--inline {
    width: 100%;
}

.agb--inline .agb-device {
    height: min(680px, 86vh);
}

.agb-frame {
    position: relative;
    width: 100%;
    height: 100%;
    padding: 11px;
    border-radius: 58px;
    background:
        linear-gradient(145deg, #3a3a40 0%, #141417 38%, #2a2a2f 62%, #0b0b0d 100%);
    box-shadow:
        inset 0 0 0 1.5px rgba(255, 255, 255, 0.16),
        inset 0 0 0 6px #050506,
        0 0 0 1px rgba(0, 0, 0, 0.6);
}

.agb-hw {
    position: absolute;
    width: 4px;
    border-radius: 2px;
    background: linear-gradient(90deg, #1a1a1d, #46464d);
}

.agb-hw--action { left: -3px; top: 17%; height: 4.5%; }
.agb-hw--vol-up { left: -3px; top: 25%; height: 8%; }
.agb-hw--vol-down { left: -3px; top: 35%; height: 8%; }
.agb-hw--power { right: -3px; top: 28%; height: 12%; }

.agb-screen {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: var(--agb-radius-screen);
    background: #101014;
    isolation: isolate;
    container: agb-screen / inline-size;
}

.agb-wallpaper {
    position: absolute;
    inset: -40px;
    z-index: -1;
    background:
        linear-gradient(180deg, rgba(0, 0, 0, 0.35) 0%, rgba(0, 0, 0, 0.15) 35%, rgba(0, 0, 0, 0.55) 75%, rgba(0, 0, 0, 0.8) 100%),
        var(--agb-wallpaper, linear-gradient(160deg, #6f52b5 0%, #c96b9b 55%, #f2a65a 100%));
    background-size: cover;
    background-position: center;
    filter: blur(26px) saturate(1.35);
    transform: scale(1.08);
    transition: filter 0.6s ease;
}

.agb-screen[data-agb-state="recording"] .agb-wallpaper,
.agb-screen[data-agb-state="paused"] .agb-wallpaper {
    filter: blur(34px) saturate(1.1) brightness(0.8);
}

/* ---------- status bar & dynamic island ---------- */

.agb-statusbar {
    position: relative;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    flex: 0 0 auto;
    height: 54px;
    padding: 6px 26px 0;
    font-size: 15px;
    font-weight: 600;
}

.agb-clock {
    justify-self: start;
    font-variant-numeric: tabular-nums;
}

.agb-island {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 112px;
    height: 32px;
    padding: 0 13px;
    border-radius: 20px;
    background: #000;
    transition: width 0.45s cubic-bezier(0.3, 1.4, 0.4, 1);
}

.agb-island-dot,
.agb-island-wave {
    opacity: 0;
    transition: opacity 0.25s ease;
}

.agb-island-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--agb-accept);
}

.agb-island-wave {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 14px;
}

.agb-island-wave i {
    display: block;
    width: 2.5px;
    height: 100%;
    border-radius: 2px;
    background: var(--agb-accept);
    animation: agb-island-wave 0.9s ease-in-out infinite;
}

.agb-island-wave i:nth-child(2) { animation-delay: -0.2s; }
.agb-island-wave i:nth-child(3) { animation-delay: -0.45s; }
.agb-island-wave i:nth-child(4) { animation-delay: -0.1s; }
.agb-island-wave i:nth-child(5) { animation-delay: -0.6s; }

.agb-screen:is([data-agb-state="ringing"], [data-agb-state="greeting"], [data-agb-state="recording"], [data-agb-state="paused"]) .agb-island {
    width: 132px;
}

.agb-screen:is([data-agb-state="ringing"], [data-agb-state="greeting"], [data-agb-state="recording"], [data-agb-state="paused"]) :is(.agb-island-dot, .agb-island-wave) {
    opacity: 1;
}

.agb-screen[data-agb-state="recording"] .agb-island-dot {
    background: var(--agb-decline);
    animation: agb-blink 1s steps(2, start) infinite;
}

.agb-screen[data-agb-state="recording"] .agb-island-wave i {
    background: var(--agb-decline);
}

.agb-screen[data-agb-state="paused"] .agb-island-wave i {
    animation-play-state: paused;
    background: #ffcc00;
}

.agb-status-icons {
    display: flex;
    align-items: center;
    justify-self: end;
    gap: 6px;
}

.agb-signal { width: 17px; height: 11px; }
.agb-wifi { width: 16px; height: 12.5px; }

.agb-battery {
    position: relative;
    width: 25px;
    height: 12px;
    padding: 1.5px;
    border: 1.2px solid rgba(255, 255, 255, 0.55);
    border-radius: 4px;
}

.agb-battery::after {
    content: "";
    position: absolute;
    top: 3px;
    right: -3.5px;
    width: 2px;
    height: 4px;
    border-radius: 0 2px 2px 0;
    background: rgba(255, 255, 255, 0.55);
}

.agb-battery i {
    display: block;
    width: 82%;
    height: 100%;
    border-radius: 2px;
    background: #fff;
}

/* ---------- caller area ---------- */

.agb-call {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 0;
    padding: 6% 24px 0;
    overflow: hidden;
    text-align: center;
}

/* Never let the caller name or status collapse when the bottom panel is tall. */
.agb-call > * {
    flex-shrink: 0;
}

/* Busy screens need the room for their controls: shrink the caller block. */
.agb-screen:is([data-agb-state="recording"], [data-agb-state="paused"], [data-agb-state="beeping"], [data-agb-state="review"], [data-agb-state="sending"], [data-agb-state="sent"], [data-agb-state="error"]) .agb-call {
    padding-top: 3%;
}

.agb-screen:is([data-agb-state="recording"], [data-agb-state="paused"], [data-agb-state="beeping"], [data-agb-state="review"], [data-agb-state="sending"], [data-agb-state="sent"], [data-agb-state="error"]) .agb-avatar {
    width: 76px;
    height: 76px;
    margin-bottom: 10px;
}

.agb-screen:is([data-agb-state="recording"], [data-agb-state="paused"], [data-agb-state="review"], [data-agb-state="sending"], [data-agb-state="sent"], [data-agb-state="error"]) .agb-name {
    font-size: clamp(20px, 3.4vh, 26px);
}

.agb-avatar {
    position: relative;
    display: grid;
    place-items: center;
    width: 112px;
    height: 112px;
    margin: 0 0 18px;
    flex: 0 0 auto;
}

/* The inline phone (landing page) is shorter than the guest page's: there the avatar gives up height when the
   greeting caption would not fit, and the aspect ratio keeps it round while it shrinks. */
.agb.agb--inline .agb-call > .agb-avatar {
    flex-shrink: 1;
    width: auto;
    min-height: 56px;
    aspect-ratio: 1;
}

.agb-avatar img,
.agb-avatar-initials {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.85), 0 12px 30px rgba(0, 0, 0, 0.35);
}

.agb-avatar-initials {
    display: grid;
    place-items: center;
    background: linear-gradient(160deg, #b9a7e6, #6f52b5);
    font-size: 40px;
    font-weight: 600;
}

.agb-avatar-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.55);
    opacity: 0;
}

.agb-screen[data-agb-state="ringing"] .agb-avatar-ring {
    animation: agb-ring-out 1.6s ease-out infinite;
}

.agb-screen[data-agb-state="ringing"] .agb-avatar-ring--late {
    animation-delay: 0.8s;
}

.agb-screen[data-agb-state="recording"] .agb-avatar-ring {
    border-color: rgba(255, 59, 48, 0.75);
    animation: agb-ring-out 2.2s ease-out infinite;
}

.agb-name {
    margin: 0;
    max-width: 100%;
    overflow: hidden;
    color: #fff;
    font-family: var(--agb-font);
    font-size: clamp(24px, 4.2vh, 32px);
    font-weight: 500;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-shadow: 0 2px 16px rgba(0, 0, 0, 0.35);
}

.agb-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin: 8px 0 0;
    color: var(--agb-ink-soft);
    font-size: 16px;
    font-weight: 400;
    font-variant-numeric: tabular-nums;
}

.agb-status .agb-rec-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--agb-decline);
    box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.6);
    animation: agb-rec-pulse 1.4s ease-out infinite;
}

.agb-status.is-warning {
    color: #ffd60a;
    font-weight: 600;
}

.agb-caption {
    margin: 22px 6px 0;
    padding: 12px 16px;
    border-radius: 18px;
    background: rgba(0, 0, 0, 0.32);
    color: #fff;
    font-size: 15px;
    line-height: 1.4;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    animation: agb-pop 0.35s ease both;
}

.agb-wave {
    width: 100%;
    height: 60px;
    margin-top: 16px;
}

/* ---------- panels (bottom area) ---------- */

.agb-panel {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 0 22px 46px;
    animation: agb-panel-in 0.32s ease both;
}

.agb-field {
    display: block;
    width: 100%;
    margin: 0;
    text-align: left;
}

.agb-field-label {
    display: block;
    margin: 0 0 6px 14px;
    color: var(--agb-ink-soft);
    font-size: 13px;
    font-weight: 500;
}

.agb-field-label em {
    color: var(--agb-ink-faint);
    font-style: normal;
    font-weight: 400;
}

.agb .agb-input {
    display: block;
    width: 100%;
    height: 48px;
    margin: 0;
    padding: 0 18px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 24px;
    outline: none;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    font-family: var(--agb-font);
    font-size: 16px;
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.agb .agb-input::placeholder {
    color: rgba(255, 255, 255, 0.55);
}

.agb .agb-input:focus {
    border-color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.12);
}

.agb .agb-input.is-invalid {
    border-color: #ff6961;
    animation: agb-shake 0.4s ease;
}

.agb-hint {
    margin: 0;
    color: var(--agb-ink-faint);
    font-size: 12.5px;
    line-height: 1.45;
    text-align: center;
}

.agb-hint strong {
    color: var(--agb-ink-soft);
}

.agb-notice,
.agb-error,
.agb-done {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 16px 18px;
    border-radius: 22px;
    background: rgba(0, 0, 0, 0.34);
    text-align: center;
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

.agb-notice strong,
.agb-error strong,
.agb-done strong {
    font-size: 17px;
    font-weight: 600;
}

.agb-notice span,
.agb-error span,
.agb-done span {
    color: var(--agb-ink-soft);
    font-size: 14px;
    line-height: 1.45;
}

.agb-error svg {
    width: 34px;
    height: 34px;
    color: #ffd60a;
}

/* ---------- round buttons ---------- */

.agb-round {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    width: 72px;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    color: #fff;
    font-family: var(--agb-font);
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
}

.agb-round svg {
    box-sizing: content-box;
    width: var(--agb-round-icon);
    height: var(--agb-round-icon);
    padding: var(--agb-round-pad);
    border-radius: 50%;
    background: var(--agb-glass);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    transition: transform 0.18s ease, background 0.2s ease, color 0.2s ease;
}

.agb-round:not(:disabled):active svg {
    transform: scale(0.92);
}

.agb-round:disabled {
    cursor: default;
    opacity: 0.38;
}

.agb-round--glass:not(:disabled):hover svg {
    background: var(--agb-glass-strong);
}

.agb-round--glass.is-active svg,
.agb-round--speaker[aria-pressed="true"] svg {
    background: #fff;
    color: #1c1c1e;
}

.agb-round--speaker[aria-pressed="true"] svg path:last-child {
    stroke: #1c1c1e;
}

.agb-round--speaker svg path:last-child {
    stroke: #fff;
}

.agb-round--xl svg {
    width: var(--agb-xl-icon);
    height: var(--agb-xl-icon);
    padding: var(--agb-xl-pad);
}

.agb-round--accept svg {
    background: var(--agb-accept);
    box-shadow: 0 10px 28px rgba(52, 199, 89, 0.45);
}

.agb-round--accept:not(:disabled):hover svg {
    background: var(--agb-accept-dark);
}

.agb-round--accept:not(:disabled) svg {
    animation: agb-wiggle 3.2s ease-in-out infinite;
}

.agb-round--decline svg {
    background: var(--agb-decline);
    box-shadow: 0 10px 28px rgba(255, 59, 48, 0.4);
}

.agb-round--decline:not(:disabled):hover svg {
    background: var(--agb-decline-dark);
}

.agb-round .agb-icon-resume {
    display: none;
}

.agb-round.is-active .agb-icon-pause {
    display: none;
}

.agb-round.is-active .agb-icon-resume {
    display: block;
    color: var(--agb-decline);
}

.agb-controls {
    display: flex;
    justify-content: center;
    gap: 22px;
    width: 100%;
}

.agb-skip {
    margin: 0 0 4px;
    padding: 6px 12px;
    border: 0;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.25);
    color: var(--agb-ink-soft);
    font-family: var(--agb-font);
    font-size: 13px;
    cursor: pointer;
}

.agb-skip:hover {
    color: #fff;
}

.agb-end-wrap {
    position: relative;
    display: grid;
    place-items: center;
    margin-top: 8px;
}

.agb-progress {
    --agb-ring: calc(var(--agb-xl-icon) + 2 * var(--agb-xl-pad) + 12px);
    position: absolute;
    top: -6px;
    left: 50%;
    width: var(--agb-ring);
    height: var(--agb-ring);
    transform: translateX(-50%) rotate(-90deg);
    pointer-events: none;
}

.agb-progress circle {
    fill: none;
    stroke-width: 4;
}

.agb-progress-track {
    stroke: rgba(255, 255, 255, 0.14);
}

.agb-progress-value {
    stroke: #fff;
    stroke-linecap: round;
    stroke-dasharray: 289;
    stroke-dashoffset: 289;
    transition: stroke-dashoffset 0.25s linear, stroke 0.3s ease;
}

.agb-progress-value.is-warning {
    stroke: #ffd60a;
}

/* ---------- review player ---------- */

.agb-player {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 14px 16px;
    border-radius: 24px;
    background: rgba(0, 0, 0, 0.34);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
}

.agb-play {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: 52px;
    height: 52px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #fff;
    color: #1c1c1e;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.agb-play:active {
    transform: scale(0.94);
}

.agb-play svg {
    width: 24px;
    height: 24px;
}

.agb-play .agb-icon-stop,
.agb-play.is-playing .agb-icon-play {
    display: none;
}

.agb-play.is-playing .agb-icon-stop {
    display: block;
}

.agb-player-body {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
}

/* The script picks the bar count from the width; overflow stays clipped if a resize races it. */
.agb-bars {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 34px;
    overflow: hidden;
}

.agb-bars i {
    flex: 1 1 0;
    min-width: 1px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.35);
    transition: background 0.15s ease;
}

.agb-bars i.is-played {
    background: #fff;
}

.agb .agb-seek {
    position: absolute;
    inset: 0 0 18px;
    width: 100%;
    height: 34px;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.agb-times {
    display: flex;
    justify-content: space-between;
    margin-top: 4px;
    color: var(--agb-ink-faint);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.agb-review-text {
    margin: 2px 0 0;
    color: var(--agb-ink-soft);
    font-size: 13.5px;
    text-align: center;
}

/* ---------- pill buttons ---------- */

.agb-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 50px;
    margin: 0;
    padding: 0 18px;
    border: 0;
    border-radius: 25px;
    background: var(--agb-glass);
    color: #fff;
    font-family: var(--agb-font);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    transition: background 0.2s ease, transform 0.15s ease;
}

.agb-pill:hover {
    background: var(--agb-glass-strong);
}

.agb-pill:active {
    transform: scale(0.98);
}

.agb-pill svg {
    width: 19px;
    height: 19px;
}

.agb-pill--primary {
    background: var(--agb-accept);
    box-shadow: 0 10px 24px rgba(52, 199, 89, 0.35);
}

.agb-pill--primary:hover {
    background: var(--agb-accept-dark);
}

.agb-pill--ghost {
    min-height: 40px;
    background: transparent;
    color: var(--agb-ink-soft);
    font-weight: 500;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}

.agb-pill--ghost:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.agb-pill-row {
    display: flex;
    gap: 10px;
    width: 100%;
}

.agb-pill-row .agb-pill {
    min-height: 44px;
    padding: 0 10px;
    font-size: 14.5px;
    white-space: nowrap;
}

/* ---------- the guest's own messages ---------- */

.agb-mine-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin: 6px 0 0;
    padding: 4px 12px 4px 9px;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    font-family: var(--agb-font);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.25;
    cursor: pointer;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    transition: background 0.2s ease;
}

.agb-mine-chip:hover {
    background: rgba(255, 255, 255, 0.28);
}

.agb-mine-chip svg {
    width: 18px;
    height: 18px;
}

/* Only on the start and "sent" screens, where it stands in for the status line. */
.agb-screen:not([data-agb-state="idle"]):not([data-agb-state="sent"]) .agb-mine-chip {
    display: none;
}

.agb-screen.agb-has-mine:is([data-agb-state="idle"], [data-agb-state="sent"]) .agb-status {
    display: none;
}

/* The list takes the room the caller block gives up. */
.agb-screen[data-agb-state="mine"] .agb-call {
    flex: 0 0 auto;
    padding-top: 3%;
}

.agb-screen[data-agb-state="mine"] .agb-avatar {
    width: 64px;
    height: 64px;
    margin-bottom: 8px;
}

.agb-screen[data-agb-state="mine"] .agb-name {
    font-size: clamp(19px, 3.2vh, 24px);
}

.agb-panel--mine {
    flex: 1 1 auto;
    min-height: 0;
}

.agb-mine {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    min-height: 0;
}

.agb-mine-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    list-style: none;
}

.agb-mine-item {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 18px;
    background: rgba(0, 0, 0, 0.34);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

.agb-mine-play,
.agb-mine-download {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: 40px;
    height: 40px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
}

.agb-mine-play {
    background: #fff;
    color: #1c1c1e;
}

.agb-mine-play svg,
.agb-mine-download svg {
    width: 20px;
    height: 20px;
}

.agb-mine-play .agb-icon-stop,
.agb-mine-play.is-playing .agb-icon-play {
    display: none;
}

.agb-mine-play.is-playing .agb-icon-stop {
    display: block;
}

.agb-mine-meta {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-width: 0;
    text-align: left;
}

.agb-mine-meta strong {
    font-size: 15px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.agb-mine-meta small {
    overflow: hidden;
    color: var(--agb-ink-soft);
    font-size: 12.5px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.agb .agb-mine-download {
    background: var(--agb-glass);
    color: #fff;
    text-decoration: none;
}

.agb .agb-mine-download:hover {
    background: var(--agb-glass-strong);
    color: #fff;
}

.agb-mine-empty,
.agb-mine-note {
    margin: 0;
    color: var(--agb-ink-faint);
    font-size: 12.5px;
    text-align: center;
}

.agb-mine-empty {
    padding: 18px 0;
    color: var(--agb-ink-soft);
    font-size: 14px;
}

/* ---------- sending / sent ---------- */

.agb-sending {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 18px 0 24px;
    color: var(--agb-ink-soft);
    font-size: 15px;
}

.agb-spinner {
    width: 46px;
    height: 46px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: agb-spin 0.8s linear infinite;
}

.agb-check {
    width: 64px;
    height: 64px;
    margin-bottom: 4px;
}

.agb-check circle {
    fill: var(--agb-accept);
    stroke: none;
    transform-origin: center;
    animation: agb-pop 0.45s cubic-bezier(0.3, 1.6, 0.4, 1) both;
}

.agb-check path {
    fill: none;
    stroke: #fff;
    stroke-width: 4.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 40;
    stroke-dashoffset: 40;
    animation: agb-draw 0.45s 0.25s ease forwards;
}

.agb-home-indicator {
    position: absolute;
    bottom: 9px;
    left: 50%;
    width: 36%;
    height: 5px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.82);
    transform: translateX(-50%);
}

/* ---------- floating call button ---------- */

.agb-fab {
    position: fixed;
    right: max(18px, env(safe-area-inset-right));
    bottom: max(18px, calc(env(safe-area-inset-bottom) + 12px));
    z-index: 1040;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 6px 18px 6px 6px;
    border: 0;
    border-radius: 999px;
    background: rgba(20, 20, 26, 0.86);
    color: #fff;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: normal;
    text-transform: none;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.3), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
    cursor: pointer;
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    animation: agb-fab-in 0.6s 0.4s cubic-bezier(0.2, 0.9, 0.25, 1.2) both;
    transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s, box-shadow 0.2s ease;
}

.agb-fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35), inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

/* After the entrance the script owns the button; "both" fill would otherwise pin it in place. */
.agb-fab.is-settled {
    animation: none;
}

/* Steps aside while the guest scrolls through the gallery or reaches its pagination. */
.agb-fab.is-away {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(calc(100% + 24px));
}

.agb-fab:focus-visible {
    outline: 3px solid rgba(52, 199, 89, 0.7);
    outline-offset: 3px;
}

.agb-fab-icon {
    position: relative;
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: linear-gradient(160deg, #4cd964, #28a745);
}

.agb-fab-icon::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(52, 199, 89, 0.55);
    animation: agb-fab-ping 2.6s ease-out infinite;
}

.agb-fab-icon svg {
    width: 22px;
    height: 22px;
    fill: #fff;
    animation: agb-wiggle 3.2s ease-in-out infinite;
}

.agb-fab.is-compact {
    padding-right: 6px;
}

.agb-fab.is-compact .agb-fab-label {
    display: none;
}

body.agb-open {
    overflow: hidden;
}

/* The entry animation fills "both", which would override opacity; drop it while the phone is open. */
body.agb-open .agb-fab {
    animation: none;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* ---------- small screens: the guest's phone becomes the phone ---------- */

@media (max-width: 520px) {
    .agb--overlay {
        padding: 0;
    }

    .agb--overlay .agb-device {
        width: 100vw;
        height: 100dvh;
        max-width: none;
        aspect-ratio: auto;
        filter: none;
    }

    .agb--overlay .agb-frame {
        padding: 0;
        border-radius: 0;
        background: none;
        box-shadow: none;
    }

    .agb--overlay .agb-hw,
    .agb--overlay .agb-statusbar,
    .agb--overlay .agb-home-indicator {
        display: none;
    }

    .agb--overlay .agb-screen {
        border-radius: 0;
        padding-top: env(safe-area-inset-top);
    }

    .agb--overlay .agb-call {
        padding-top: max(56px, 9vh);
    }

    .agb--overlay .agb-panel {
        padding-bottom: max(28px, calc(env(safe-area-inset-bottom) + 18px));
    }

    .agb--overlay .agb-dismiss {
        top: max(12px, env(safe-area-inset-top));
        right: 12px;
    }

    .agb--overlay .agb-avatar {
        width: 124px;
        height: 124px;
    }

    .agb-fab-label {
        font-size: 14px;
    }
}

@media (max-height: 760px) and (min-width: 521px) {
    .agb {
        --agb-round-pad: 17px;
        --agb-xl-pad: 19px;
    }

    .agb-avatar {
        width: 92px;
        height: 92px;
        margin-bottom: 12px;
    }

    .agb-panel {
        gap: 10px;
        padding-bottom: 34px;
    }

    .agb-caption {
        margin-top: 14px;
    }
}

@media (max-height: 640px) and (min-width: 521px) {
    .agb {
        --agb-round-icon: 26px;
        --agb-round-pad: 14px;
        --agb-xl-icon: 30px;
        --agb-xl-pad: 16px;
    }

    .agb-avatar {
        width: 72px;
        height: 72px;
        margin-bottom: 8px;
    }

    .agb-controls {
        gap: 14px;
    }
}

/* ---------- narrow screens (small phones, previews squeezed into a column) ---------- */

@container agb-screen (max-width: 310px) {
    .agb-statusbar {
        padding: 6px 18px 0;
        font-size: 14px;
    }

    .agb-island {
        width: 88px;
        height: 28px;
        padding: 0 11px;
    }

    .agb-screen:is([data-agb-state="ringing"], [data-agb-state="greeting"], [data-agb-state="recording"], [data-agb-state="paused"]) .agb-island {
        width: 104px;
    }

    .agb-wifi {
        display: none;
    }

    .agb-call {
        padding-inline: 16px;
    }

    .agb-panel {
        --agb-round-icon: 26px;
        --agb-round-pad: 16px;
        --agb-xl-icon: 30px;
        --agb-xl-pad: 18px;
        gap: 10px;
        padding-inline: 14px;
    }

    .agb-controls {
        gap: 8px;
    }

    .agb-round {
        width: 64px;
        font-size: 11.5px;
    }

    .agb-player {
        gap: 10px;
        padding: 12px;
        border-radius: 20px;
    }

    .agb-play {
        width: 44px;
        height: 44px;
    }

    .agb-play svg {
        width: 20px;
        height: 20px;
    }

    .agb-pill {
        min-height: 46px;
        font-size: 15px;
    }

    .agb-pill-row .agb-pill {
        min-height: 42px;
        padding: 0 8px;
        font-size: 13.5px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .agb *,
    .agb-fab,
    .agb-fab * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ---------- keyframes ---------- */

@keyframes agb-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes agb-rise { from { opacity: 0; transform: translateY(40px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes agb-panel-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes agb-pop { from { opacity: 0; transform: scale(0.85); } to { opacity: 1; transform: none; } }
@keyframes agb-draw { to { stroke-dashoffset: 0; } }
@keyframes agb-spin { to { transform: rotate(360deg); } }
@keyframes agb-blink { to { opacity: 0.25; } }
@keyframes agb-shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@keyframes agb-ring-out { 0% { opacity: 0.8; transform: scale(1); } 100% { opacity: 0; transform: scale(1.7); } }
@keyframes agb-rec-pulse { 0% { box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.6); } 100% { box-shadow: 0 0 0 9px rgba(255, 59, 48, 0); } }
@keyframes agb-island-wave { 0%, 100% { transform: scaleY(0.3); } 50% { transform: scaleY(1); } }
@keyframes agb-fab-ping { 0% { box-shadow: 0 0 0 0 rgba(52, 199, 89, 0.55); } 70%, 100% { box-shadow: 0 0 0 16px rgba(52, 199, 89, 0); } }
@keyframes agb-fab-in { from { opacity: 0; transform: translateY(30px) scale(0.8); } to { opacity: 1; transform: none; } }
@keyframes agb-wiggle {
    0%, 82%, 100% { transform: rotate(0deg); }
    85% { transform: rotate(-14deg); }
    88% { transform: rotate(12deg); }
    91% { transform: rotate(-10deg); }
    94% { transform: rotate(8deg); }
    97% { transform: rotate(-4deg); }
}
