/* =========================================================
   TACHIREAD — GUIDA VISUALE APP ONLINE V1
   Solo interfaccia locale: nessun tracciamento e nessun IP.
   ========================================================= */

:root {
    --tr-guide-blue: #0753d6;
    --tr-guide-blue-dark: #08245f;
    --tr-guide-pink: #f50057;
    --tr-guide-yellow: #ffd84a;
    --tr-guide-ink: #102047;
    --tr-guide-muted: #59657a;
    --tr-guide-border: #dbe7ff;
    --tr-guide-surface: #ffffff;
}

body.tr-guide-open {
    overflow: hidden !important;
}

.tr-guide-launcher {
    position: fixed;
    top: 18px;
    right: max(18px, env(safe-area-inset-right));
    z-index: 8500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    padding: 10px 17px;
    border: 1px solid #cbdcff;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.96);
    color: var(--tr-guide-blue);
    font: inherit;
    font-size: 15px;
    font-weight: 900;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 12px 28px rgba(7, 83, 214, 0.16);
    backdrop-filter: blur(12px);
    transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
}

.tr-guide-launcher:hover {
    transform: translateY(-2px);
    border-color: #8bb4ff;
    box-shadow: 0 16px 34px rgba(7, 83, 214, 0.22);
}

.tr-guide-launcher:focus-visible,
.tr-guide-dialog button:focus-visible,
.tr-quick-dialog button:focus-visible {
    outline: 4px solid rgba(7, 83, 214, 0.24);
    outline-offset: 3px;
}

.tr-guide-launcher-icon {
    display: grid;
    place-items: center;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    background: linear-gradient(145deg, #2484ff, #0753d6);
    color: #ffffff;
    font-size: 15px;
    font-weight: 950;
}

.tr-guide-overlay,
.tr-quick-overlay {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: grid;
    place-items: center;
    padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
    background: rgba(4, 15, 45, 0.72);
    backdrop-filter: blur(10px);
}

.tr-guide-overlay[hidden],
.tr-quick-overlay[hidden] {
    display: none !important;
}

.tr-guide-dialog,
.tr-quick-dialog {
    position: relative;
    width: min(920px, 100%);
    max-height: min(760px, calc(100vh - 36px));
    overflow: auto;
    border: 1px solid rgba(255, 255, 255, 0.76);
    border-radius: 32px;
    background:
        radial-gradient(circle at 8% 0%, rgba(37, 132, 255, 0.10), transparent 34%),
        radial-gradient(circle at 100% 100%, rgba(245, 0, 87, 0.08), transparent 34%),
        var(--tr-guide-surface);
    color: var(--tr-guide-ink);
    box-shadow: 0 34px 90px rgba(3, 15, 48, 0.34);
}

.tr-guide-dialog {
    padding: 30px;
}

.tr-quick-dialog {
    width: min(660px, 100%);
    padding: 30px;
}

.tr-guide-close,
.tr-quick-close {
    position: absolute;
    top: 18px;
    right: 18px;
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #edf3ff;
    color: var(--tr-guide-blue-dark);
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
}

.tr-guide-topline {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-right: 54px;
}

.tr-guide-kicker,
.tr-quick-kicker {
    margin: 0;
    color: var(--tr-guide-pink);
    font-size: 13px;
    font-weight: 950;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.tr-guide-counter {
    margin-left: auto;
    color: #6c7890;
    font-size: 13px;
    font-weight: 800;
}

.tr-guide-progress {
    height: 7px;
    margin: 16px 54px 26px 0;
    overflow: hidden;
    border-radius: 999px;
    background: #edf2ff;
}

.tr-guide-progress > span {
    display: block;
    height: 100%;
    width: 25%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--tr-guide-blue), var(--tr-guide-pink));
    transition: width 240ms ease;
}

.tr-guide-slide {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 0.92fr);
    gap: 34px;
    align-items: center;
    min-height: 410px;
    animation: trGuideEnter 220ms ease both;
}

.tr-guide-copy h2,
.tr-quick-copy h2 {
    margin: 0 0 14px;
    color: var(--tr-guide-blue-dark);
    font-size: clamp(29px, 4.3vw, 45px);
    line-height: 1.06;
    letter-spacing: -0.035em;
}

.tr-guide-copy p,
.tr-quick-copy p {
    margin: 0;
    color: var(--tr-guide-muted);
    font-size: 18px;
    line-height: 1.55;
}

.tr-guide-copy strong,
.tr-quick-copy strong {
    color: var(--tr-guide-ink);
}

.tr-guide-points {
    display: grid;
    gap: 10px;
    margin: 22px 0 0;
    padding: 0;
    list-style: none;
}

.tr-guide-points li {
    position: relative;
    padding-left: 31px;
    color: #34435d;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.42;
}

.tr-guide-points li::before {
    content: "✓";
    position: absolute;
    left: 0;
    top: 0;
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #e8f8ef;
    color: #087a42;
    font-size: 13px;
    font-weight: 950;
}

.tr-guide-visual,
.tr-quick-visual {
    min-height: 320px;
    display: grid;
    place-items: center;
    padding: 24px;
    border: 1px solid var(--tr-guide-border);
    border-radius: 28px;
    background: linear-gradient(145deg, #f7faff, #ffffff);
    box-shadow: inset 0 1px 0 #ffffff, 0 20px 48px rgba(7, 83, 214, 0.10);
}

.tr-guide-footer {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 16px;
    align-items: center;
    margin-top: 22px;
    padding-top: 22px;
    border-top: 1px solid #e7edfa;
}

.tr-guide-footer-left,
.tr-guide-footer-right,
.tr-quick-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tr-guide-footer-right {
    justify-content: flex-end;
}

.tr-guide-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.tr-guide-dot {
    width: 9px;
    height: 9px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: #cbd6ec;
    cursor: pointer;
    transition: width 180ms ease, background 180ms ease;
}

.tr-guide-dot.is-active {
    width: 26px;
    background: var(--tr-guide-blue);
}

.tr-guide-btn,
.tr-quick-btn {
    min-height: 48px;
    padding: 12px 20px;
    border: 0;
    border-radius: 15px;
    font: inherit;
    font-size: 15px;
    font-weight: 900;
    cursor: pointer;
}

.tr-guide-btn-primary,
.tr-quick-btn-primary {
    background: linear-gradient(180deg, #ff2d78, #f50057);
    color: #ffffff;
    box-shadow: 0 12px 24px rgba(245, 0, 87, 0.22);
}

.tr-guide-btn-secondary,
.tr-quick-btn-secondary {
    border: 1px solid #cbdcff;
    background: #ffffff;
    color: var(--tr-guide-blue);
}

.tr-guide-btn-ghost {
    background: transparent;
    color: #66728a;
}

.tr-guide-btn[disabled] {
    opacity: 0.42;
    cursor: default;
}

/* Illustrazione 1: parole manuali e generatore */
.tr-visual-choice {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.tr-mini-card {
    min-height: 190px;
    padding: 18px;
    border: 1px solid #d7e4ff;
    border-radius: 22px;
    background: #ffffff;
    box-shadow: 0 12px 28px rgba(16, 32, 71, 0.08);
}

.tr-mini-card.pink {
    border-color: #ffd2e2;
    background: #fff8fb;
}

.tr-mini-icon {
    display: grid;
    place-items: center;
    width: 43px;
    height: 43px;
    margin-bottom: 14px;
    border-radius: 14px;
    background: #eaf2ff;
    color: var(--tr-guide-blue);
    font-size: 22px;
}

.tr-mini-card.pink .tr-mini-icon {
    background: #ffe7f0;
    color: var(--tr-guide-pink);
}

.tr-mini-title {
    margin: 0 0 10px;
    color: var(--tr-guide-ink);
    font-size: 16px;
    font-weight: 950;
}

.tr-mini-input {
    min-height: 38px;
    padding: 9px 11px;
    border: 1px solid #d7e1f3;
    border-radius: 11px;
    background: #ffffff;
    color: #60708c;
    font-size: 13px;
}

.tr-mini-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.tr-mini-tags span {
    padding: 6px 9px;
    border-radius: 999px;
    background: #edf3ff;
    color: #31598e;
    font-size: 11px;
    font-weight: 800;
}

/* Illustrazione 2: parametri */
.tr-visual-params {
    width: 100%;
    display: grid;
    gap: 13px;
}

.tr-param-demo {
    display: grid;
    grid-template-columns: 46px 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 14px;
    border: 1px solid #dbe5f7;
    border-radius: 17px;
    background: #ffffff;
}

.tr-param-demo .symbol {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 13px;
    background: #fff6cc;
    color: #906900;
    font-size: 19px;
    font-weight: 950;
}

.tr-param-demo b {
    display: block;
    color: #17284c;
    font-size: 14px;
}

.tr-param-demo small {
    color: #748097;
}

.tr-param-value {
    min-width: 74px;
    padding: 9px 10px;
    border-radius: 11px;
    background: #edf3ff;
    color: var(--tr-guide-blue);
    text-align: center;
    font-weight: 950;
}

/* Illustrazione 3: gesto errore */
.tr-error-demo {
    width: 100%;
    min-height: 270px;
    display: grid;
    place-items: center;
    position: relative;
    overflow: hidden;
    border-radius: 23px;
    background: #071b4d;
    color: #ffffff;
}

.tr-error-word {
    font-size: clamp(54px, 9vw, 92px);
    font-weight: 900;
    letter-spacing: 0.02em;
}

.tr-error-pointer {
    position: absolute;
    right: 23%;
    bottom: 22%;
    font-size: 48px;
    filter: drop-shadow(0 7px 9px rgba(0, 0, 0, 0.32));
    animation: trGuideTap 1.35s ease-in-out infinite;
}

.tr-error-badge {
    position: absolute;
    left: 50%;
    bottom: 14px;
    transform: translateX(-50%);
    width: max-content;
    max-width: calc(100% - 28px);
    padding: 9px 14px;
    border-radius: 999px;
    background: rgba(245, 0, 87, 0.94);
    color: #ffffff;
    font-size: 13px;
    font-weight: 950;
    text-align: center;
}

/* Illustrazione 4: brano e risultati */
.tr-visual-results {
    width: 100%;
    display: grid;
    gap: 16px;
}

.tr-mode-demo {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 7px;
}

.tr-mode-demo span {
    padding: 10px 7px;
    border-radius: 12px;
    background: #edf3ff;
    color: #31598e;
    font-size: 12px;
    font-weight: 900;
    text-align: center;
}

.tr-mode-demo span:first-child {
    background: var(--tr-guide-blue);
    color: #ffffff;
}

.tr-result-demo {
    display: grid;
    grid-template-columns: 118px 1fr;
    gap: 18px;
    align-items: center;
    padding: 17px;
    border: 1px solid #dce6f7;
    border-radius: 20px;
    background: #ffffff;
}

.tr-score-ring {
    display: grid;
    place-items: center;
    width: 104px;
    height: 104px;
    border-radius: 50%;
    background: conic-gradient(#0aaa68 0 92%, #e8eef8 92% 100%);
    position: relative;
    color: #087a42;
    font-size: 24px;
    font-weight: 950;
}

.tr-score-ring::before {
    content: "";
    position: absolute;
    inset: 10px;
    border-radius: 50%;
    background: #ffffff;
}

.tr-score-ring span {
    position: relative;
}

.tr-result-lines {
    display: grid;
    gap: 9px;
}

.tr-result-line {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding-bottom: 7px;
    border-bottom: 1px solid #edf1f8;
    color: #627089;
    font-size: 13px;
}

.tr-result-line b {
    color: var(--tr-guide-ink);
}

/* Avviso contestuale */
.tr-quick-content {
    display: grid;
    grid-template-columns: minmax(220px, 0.8fr) minmax(0, 1fr);
    gap: 27px;
    align-items: center;
}

.tr-quick-visual {
    min-height: 255px;
    padding: 18px;
}

.tr-quick-copy {
    padding-right: 14px;
}

.tr-quick-copy h2 {
    font-size: clamp(27px, 4vw, 38px);
}

.tr-quick-copy p {
    font-size: 17px;
}

.tr-quick-tip {
    margin-top: 16px;
    padding: 13px 15px;
    border-radius: 14px;
    background: #fff7d6;
    color: #6f5400;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.42;
}

.tr-quick-actions {
    justify-content: flex-end;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #e7edfa;
}

.tr-brano-demo {
    width: 100%;
    min-height: 205px;
    padding: 18px;
    border-radius: 20px;
    background: #ffffff;
    border: 1px solid #dbe5f6;
    color: #60708b;
    font-size: 16px;
    line-height: 1.7;
}

.tr-brano-demo strong {
    padding: 3px 6px;
    border-radius: 7px;
    background: #ffe3ed;
    color: var(--tr-guide-pink);
}

.tr-brano-demo-note {
    margin-top: 14px;
    padding: 8px 10px;
    border-radius: 10px;
    background: #edf3ff;
    color: var(--tr-guide-blue);
    font-size: 12px;
    font-weight: 900;
    text-align: center;
}

@keyframes trGuideEnter {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes trGuideTap {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-7px, -9px) scale(0.92); }
}

@media (max-width: 760px) {
    .tr-guide-launcher {
        top: 12px;
        right: max(12px, env(safe-area-inset-right));
        min-height: 42px;
        padding: 8px 12px;
    }

    .tr-guide-dialog,
    .tr-quick-dialog {
        max-height: calc(100vh - 20px);
        padding: 22px 17px 18px;
        border-radius: 24px;
    }

    .tr-guide-close,
    .tr-quick-close {
        top: 12px;
        right: 12px;
        width: 39px;
        height: 39px;
    }

    .tr-guide-progress {
        margin-right: 48px;
        margin-bottom: 18px;
    }

    .tr-guide-slide,
    .tr-quick-content {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .tr-guide-slide {
        min-height: 0;
    }

    .tr-guide-copy h2,
    .tr-quick-copy h2 {
        padding-right: 18px;
    }

    .tr-guide-copy p,
    .tr-quick-copy p {
        font-size: 16px;
    }

    .tr-guide-points {
        margin-top: 15px;
    }

    .tr-guide-visual,
    .tr-quick-visual {
        min-height: 235px;
        padding: 15px;
    }

    .tr-error-demo {
        min-height: 205px;
    }

    .tr-error-pointer {
        right: 21%;
        bottom: 23%;
        font-size: 39px;
    }

    .tr-guide-footer {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .tr-guide-dots {
        grid-row: 1;
    }

    .tr-guide-footer-left,
    .tr-guide-footer-right {
        justify-content: center;
    }

    .tr-guide-footer-right {
        flex-wrap: wrap;
    }

    .tr-guide-btn,
    .tr-quick-btn {
        flex: 1 1 auto;
    }

    .tr-visual-choice {
        gap: 9px;
    }

    .tr-mini-card {
        min-height: 160px;
        padding: 13px;
    }

    .tr-mini-title {
        font-size: 14px;
    }

    .tr-result-demo {
        grid-template-columns: 90px 1fr;
        gap: 11px;
        padding: 12px;
    }

    .tr-score-ring {
        width: 82px;
        height: 82px;
        font-size: 20px;
    }

    .tr-quick-copy {
        padding-right: 0;
    }

    .tr-quick-actions {
        justify-content: stretch;
    }
}

@media (max-width: 420px) {
    .tr-guide-launcher-label {
        display: none;
    }

    .tr-guide-launcher {
        width: 43px;
        padding: 8px;
    }

    .tr-mini-card {
        min-height: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tr-guide-slide,
    .tr-error-pointer,
    .tr-guide-progress > span,
    .tr-guide-dot,
    .tr-guide-launcher {
        animation: none !important;
        transition: none !important;
    }
}
