@charset "UTF-8";

/* =========================================================================
   RUOTE DEL DESTINO
   Stili della modale ruote, del disegno SVG e delle liste modificabili.
   Usa le variabili definite in style.css.
   ========================================================================= */

/* --- Anteprima nella sidebar ------------------------------------------ */

.wheel-box {
    margin-top: 16px;
}

.wheel-preview-container {
    padding: 12px;
    display: flex;
    justify-content: center;
}

.wheel-preview {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    cursor: pointer;
    display: block;
    transition: transform 0.25s ease, filter 0.25s ease;
    filter: drop-shadow(0 6px 18px rgba(162, 28, 175, 0.35));
}

.wheel-preview:hover {
    transform: scale(1.06);
    filter: drop-shadow(0 8px 24px rgba(236, 72, 153, 0.5));
}

.wheel-preview svg {
    width: 100%;
    height: 100%;
    display: block;
}

.preview-spin {
    transform-origin: 0 0;
    animation: preview-rotate 14s linear infinite;
}

@keyframes preview-rotate {
    to { transform: rotate(360deg); }
}

/* --- Modale ------------------------------------------------------------ */

#wheel-overlay {
    background-color: rgba(8, 8, 18, 0.82);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 200;
    align-items: flex-start;
    padding: 3vh 0;
}

.wheel-modal-container {
    width: 96%;
    max-width: 1240px;
    max-height: 94vh;
    background-color: var(--card);
    border-radius: 18px;
    padding: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transform: scale(0.94);
    opacity: 0;
    transition: all 0.35s cubic-bezier(0.34, 1.4, 0.64, 1);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#wheel-overlay.show .wheel-modal-container {
    transform: scale(1);
    opacity: 1;
}

.wheel-modal-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-right: 48px;
    border-bottom: 1px solid #3d3d52;
    padding-bottom: 12px;
    flex-shrink: 0;
}

.wheel-modal-head h2 {
    font-size: 20px;
    margin: 0;
    color: var(--text);
}

.wheel-modal-head .hint {
    font-size: 12px;
    color: var(--muted);
    margin-left: auto;
}

.btn-sound {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 16px;
    line-height: 1;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    padding: 0;
}

.btn-sound:hover {
    background: rgba(255, 255, 255, 0.16);
}

.close-wheel-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    background: var(--bg);
    color: var(--text);
    border: 2px solid var(--card);
    border-radius: 50%;
    font-size: 24px;
    display: grid;
    place-items: center;
    cursor: pointer;
    z-index: 10;
    padding: 0;
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.close-wheel-btn:hover {
    transform: scale(1.1);
    background-color: var(--danger);
}

.wheel-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
    overflow-y: auto;
    padding: 4px;
    flex: 1 1 auto;
    min-height: 0;
}

@media (min-width: 1000px) {
    .wheel-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .wheel-modal-container {
        padding: 24px;
    }
}

/* --- Card di una ruota -------------------------------------------------- */

.wheel-card {
    background: linear-gradient(180deg, #3a3a53, #32324a);
    border-radius: 16px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.wheel-card-head {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    width: 100%;
}

.wheel-card-head h2 {
    font-size: 18px;
    margin: 0;
    color: var(--text);
}

.wheel-count {
    font-size: 11px;
    color: var(--muted);
    letter-spacing: 0.4px;
    text-transform: uppercase;
}

/* --- Il disco ----------------------------------------------------------- */

.wheel-stage {
    position: relative;
    width: min(300px, 74vw);
    aspect-ratio: 1 / 1;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.wheel-stage .wheel-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    overflow: visible;
}

/* Ombreggiatura che dà profondità al disco. */
.wheel-stage::after {
    content: '';
    position: absolute;
    inset: 3.5%;
    border-radius: 50%;
    pointer-events: none;
    z-index: 2;
    background: radial-gradient(circle at 32% 26%,
        rgba(255, 255, 255, 0.16) 0%,
        rgba(255, 255, 255, 0) 42%),
        radial-gradient(circle at 50% 50%,
        rgba(0, 0, 0, 0) 58%,
        rgba(0, 0, 0, 0.32) 100%);
}

.wheel-slice {
    stroke: none;
}

.wheel-divider {
    stroke: rgba(0, 0, 0, 0.3);
    stroke-width: 0.9;
}

.wheel-label {
    fill: #ffffff;
    font-weight: 800;
    font-family: inherit;
    letter-spacing: 0.2px;
    paint-order: stroke fill;
    stroke: rgba(0, 0, 0, 0.5);
    stroke-width: 1.6;
    stroke-linejoin: round;
    pointer-events: none;
}

.wheel-empty-disc {
    fill: #2f2f47;
    stroke: #4a4a68;
    stroke-width: 1.5;
}

.wheel-empty-label {
    fill: var(--muted);
    font-family: inherit;
    font-weight: 600;
}

.wheel-rim {
    fill: none;
    stroke: #d8b25a;
    stroke-width: 5;
    filter: drop-shadow(0 0 10px rgba(162, 28, 175, 0.55));
}

.wheel-bulb {
    fill: rgba(255, 246, 214, 0.55);
}

.wheel-bulb.alt {
    fill: rgba(236, 72, 153, 0.6);
}

.wheel-card.is-spinning .wheel-bulb {
    animation: bulb-glow 0.32s linear infinite alternate;
}

.wheel-card.is-spinning .wheel-bulb.alt {
    animation-delay: 0.16s;
}

@keyframes bulb-glow {
    from { fill: rgba(255, 246, 214, 0.3); }
    to   { fill: rgba(255, 246, 214, 1); }
}

/* Lancetta */
.wheel-pointer {
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    transform-origin: 50% 14%;
    width: 0;
    height: 0;
    border-left: 14px solid transparent;
    border-right: 14px solid transparent;
    border-top: 30px solid var(--accent-2);
    filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.55));
    z-index: 4;
    pointer-events: none;
}

/* Mozzo cliccabile al centro */
.wheel-hub {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 21%;
    height: 21%;
    border-radius: 50%;
    background: linear-gradient(145deg, #fce594, #e7a63a);
    color: #5c3b00;
    font-weight: 800;
    font-size: clamp(9px, 2.6vw, 12px);
    letter-spacing: 0.5px;
    display: grid;
    place-items: center;
    padding: 0;
    z-index: 3;
    border: 3px solid rgba(0, 0, 0, 0.28);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
    transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.wheel-hub:hover:not(:disabled) {
    transform: translate(-50%, -50%) scale(1.08);
}

.wheel-hub:active:not(:disabled) {
    transform: translate(-50%, -50%) scale(0.95);
}

.wheel-hub:disabled {
    filter: grayscale(0.6);
    opacity: 0.75;
    cursor: not-allowed;
}

/* Ruota senza elementi: il mozzo coprirebbe il messaggio al centro. */
.wheel-card.is-empty .wheel-hub {
    display: none;
}

.wheel-card.is-spinning .wheel-stage {
    cursor: progress;
}

/* --- Risultato e comandi ------------------------------------------------ */

.wheel-result {
    font-size: 16px;
    font-weight: 800;
    color: var(--success);
    min-height: 40px;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.25;
    word-break: break-word;
}

.wheel-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.wheel-actions .btn-spin {
    width: 100%;
    max-width: 300px;
    padding: 11px 12px;
    font-size: 14px;
}

.wheel-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--muted);
    cursor: pointer;
    user-select: none;
}

.wheel-toggle input {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-2);
    cursor: pointer;
}

.wheel-controls {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 300px;
    gap: 8px;
}

.wheel-controls textarea {
    height: 72px;
    resize: vertical;
    font-size: 13px;
    background-color: #232336;
    border-radius: 8px;
    padding: 10px;
    font-family: inherit;
}

/* --- Lista modificabile ------------------------------------------------- */

.wheel-list-wrap {
    width: 100%;
    max-width: 300px;
    background-color: var(--bg);
    border-radius: 12px;
    padding: 8px;
    border: 1px solid #4d4d68;
}

.wheel-list-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 2px 4px 8px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
    border-bottom: 1px solid #3d3d52;
    margin-bottom: 6px;
}

.btn-restore {
    background: transparent;
    border: 1px solid var(--accent-2);
    color: var(--accent-2);
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 999px;
    text-transform: none;
    letter-spacing: 0;
}

.btn-restore:hover {
    background: rgba(236, 72, 153, 0.14);
}

.btn-restore[hidden] {
    display: none;
}

.editable-item-list {
    max-height: 168px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-right: 4px;
}

.list-empty {
    color: var(--muted);
    font-size: 12px;
    font-style: italic;
    margin: 6px 0;
}

.editable-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background-color: var(--card);
    padding: 7px 10px;
    border-radius: 8px;
    font-size: 13px;
    border-left: 3px solid transparent;
    transition: opacity 0.2s ease, border-color 0.2s ease;
}

.editable-item.is-drawn {
    opacity: 0.5;
    border-left-color: var(--accent-2);
}

.editable-item.is-drawn > span {
    text-decoration: line-through;
}

.editable-item > span {
    flex: 1 1 auto;
    min-width: 0;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.editable-item input {
    flex: 1 1 auto;
    min-width: 0;
    background: #3e3e56;
    border: 1px solid var(--accent);
    color: var(--text);
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 13px;
}

.item-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.item-btn {
    background: none;
    border: none;
    padding: 0;
    width: 20px;
    height: 20px;
    line-height: 1;
    font-size: 13px;
    color: var(--muted);
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: transform 0.2s ease, color 0.2s ease;
}

.item-btn:hover {
    transform: scale(1.2);
    color: var(--text);
}

.item-btn img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* --- Modale del risultato ---------------------------------------------- */

#wheel-result-overlay {
    z-index: 300;
}

.wheel-result-modal {
    width: min(420px, 90%);
    background: var(--card);
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transform: scale(0.9);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.34, 1.4, 0.64, 1);
}

#wheel-result-overlay.show .wheel-result-modal {
    transform: scale(1);
    opacity: 1;
}

.wheel-result-modal h3 {
    margin: 0;
    color: var(--muted);
    font-weight: 600;
    font-size: 15px;
}

.wheel-result-modal .kicker {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.4px;
    color: var(--accent-2);
    margin-bottom: 14px;
}

.wheel-result-details {
    padding: 22px 18px;
    background-color: var(--bg);
    border-radius: 12px;
    margin: 12px 0 22px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.wheel-result-details img {
    width: 74px;
    height: 74px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--accent-2);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.wheel-result-details span {
    font-size: 23px;
    font-weight: 800;
    color: var(--success);
    line-height: 1.25;
    word-break: break-word;
}

.wheel-result-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.wheel-result-actions button[hidden] {
    display: none;
}

@media (prefers-reduced-motion: reduce) {
    .preview-spin,
    .wheel-card.is-spinning .wheel-bulb {
        animation: none;
    }
}
