/* PiTools Clock Generator Stylesheet */

.cg-app {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px 16px 64px;
    color: #1e293b;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Header */
.cg-header {
    margin-bottom: 28px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(241, 245, 249, 0.9));
    backdrop-filter: blur(12px);
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 20px;
    padding: 28px 32px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.03);
}

.cg-header-main {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 18px;
}

.cg-brand-icon {
    font-size: 44px;
    width: 72px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #e0f2fe, #bae6fd);
    border-radius: 18px;
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.8), 0 6px 12px rgba(14, 165, 233, 0.15);
    flex-shrink: 0;
}

.cg-title {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #0f172a;
    margin-bottom: 6px;
    line-height: 1.25;
}

.cg-sub {
    font-size: 15px;
    color: #64748b;
    line-height: 1.5;
    max-width: 900px;
}

.cg-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.cg-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

/* Palco Principale / Showcase Stage */
.cg-stage-section {
    margin-bottom: 36px;
}

.cg-stage-card {
    display: grid;
    grid-template-columns: 480px 1fr;
    gap: 32px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 24px;
    padding: 32px;
    box-shadow: 0 12px 30px -8px rgba(15, 23, 42, 0.08);
}

@media (max-width: 980px) {
    .cg-stage-card {
        grid-template-columns: 1fr;
    }
}

.cg-stage-display-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 24px 16px;
    min-height: 440px;
    position: relative;
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.02);
}

.cg-clock-viewport {
    width: 100%;
    max-width: 360px;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.cg-active-clock {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cg-active-clock svg {
    width: 100%;
    height: 100%;
    display: block;
    filter: drop-shadow(0 10px 20px rgba(0,0,0,0.12));
}

.cg-time-badge-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 18px;
    flex-wrap: wrap;
    justify-content: center;
}

.cg-digital-time {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 22px;
    font-weight: 700;
    color: #0f172a;
    background: #ffffff;
    padding: 6px 14px;
    border-radius: 10px;
    border: 1px solid #cbd5e1;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    letter-spacing: 0.05em;
}

.cg-date-display, .cg-tz-badge {
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    background: #e2e8f0;
    padding: 6px 12px;
    border-radius: 8px;
}

/* Controlli Palco */
.cg-stage-controls {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 20px;
}

.cg-control-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 16px;
}

.cg-active-title {
    font-size: 24px;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 4px;
}

.cg-active-category {
    display: inline-block;
    font-size: 13px;
    font-weight: 600;
    color: #0284c7;
    background: #e0f2fe;
    padding: 3px 10px;
    border-radius: 999px;
}

.cg-mode-toggles {
    display: flex;
    gap: 8px;
}

.cg-btn-toggle, .cg-btn-icon {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s ease;
}

.cg-btn-toggle:hover, .cg-btn-icon:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.cg-btn-toggle.active {
    background: #0284c7;
    color: #ffffff;
    border-color: #0284c7;
    box-shadow: 0 2px 6px rgba(2, 132, 199, 0.3);
}

.cg-dot-live {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444;
    display: inline-block;
    box-shadow: 0 0 6px #ef4444;
}

.cg-btn-toggle.active .cg-dot-live {
    background: #4ade80;
    box-shadow: 0 0 8px #4ade80;
    animation: cgPulse 1.5s infinite;
}

@keyframes cgPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

/* Time Override Controls */
.cg-time-override-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 16px 20px;
}

.cg-time-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 14px;
}

.cg-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.cg-field input, .cg-field select {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
    outline: none;
    transition: border-color 0.15s ease;
}

.cg-field input {
    width: 72px;
    text-align: center;
}

.cg-field select {
    min-width: 180px;
}

.cg-field-grow {
    flex-grow: 1;
}

.cg-field input:focus, .cg-field select:focus {
    border-color: #0284c7;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.cg-quick-times {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.cg-quick-label {
    font-size: 12px;
    font-weight: 700;
    color: #64748b;
}

.cg-pill-btn {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
    transition: all 0.12s ease;
}

.cg-pill-btn:hover {
    background: #e2e8f0;
    color: #0f172a;
}

/* Pulsanti Azione */
.cg-action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding-top: 10px;
}

.cg-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
    border: none;
    text-decoration: none;
}

.cg-btn-primary {
    background: linear-gradient(135deg, #0284c7, #0369a1);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.25);
}

.cg-btn-primary:hover {
    background: linear-gradient(135deg, #0369a1, #075985);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(2, 132, 199, 0.35);
}

.cg-btn-secondary {
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #cbd5e1;
}

.cg-btn-secondary:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.cg-btn-accent {
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.25);
}

.cg-btn-accent:hover {
    background: linear-gradient(135deg, #7c3aed, #5b21b6);
    transform: translateY(-1px);
}

.cg-btn-ghost {
    background: transparent;
    border: 1px solid #cbd5e1;
    color: #475569;
}

.cg-btn-ghost:hover {
    background: #f8fafc;
    color: #0f172a;
    border-color: #94a3b8;
}

.cg-dropdown-group {
    display: flex;
    gap: 6px;
}

/* Area Catalogo 100 Orologi */
.cg-catalog-section {
    margin-bottom: 48px;
}

.cg-catalog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
}

.cg-catalog-title-group {
    display: flex;
    align-items: center;
    gap: 14px;
}

.cg-catalog-title-group h2 {
    font-size: 22px;
    font-weight: 800;
    color: #0f172a;
}

.cg-catalog-counter {
    background: #0284c7;
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 999px;
}

.cg-search-wrap {
    position: relative;
    width: 380px;
    max-width: 100%;
}

.cg-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 15px;
    color: #94a3b8;
    pointer-events: none;
}

.cg-search-wrap input {
    width: 100%;
    padding: 10px 14px 10px 40px;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    font-size: 14px;
    background: #ffffff;
    outline: none;
    transition: all 0.15s ease;
}

.cg-search-wrap input:focus {
    border-color: #0284c7;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

/* Category Filter Bar */
.cg-category-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
}

.cg-cat-pill {
    padding: 8px 16px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s ease;
}

.cg-cat-pill:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.cg-cat-pill.active {
    background: #0f172a;
    color: #ffffff;
    border-color: #0f172a;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.2);
}

/* 100 Clocks Grid */
.cg-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

.cg-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    box-shadow: 0 2px 6px rgba(0,0,0,0.03);
}

.cg-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px -6px rgba(15, 23, 42, 0.1);
    border-color: #94a3b8;
}

.cg-card.is-active {
    border-color: #0284c7;
    box-shadow: 0 0 0 2px #0284c7, 0 12px 24px -6px rgba(2, 132, 199, 0.2);
    background: linear-gradient(to bottom, #ffffff, #f0f9ff);
}

.cg-card-preview {
    width: 150px;
    height: 150px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.cg-card-name {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    text-align: center;
    margin-bottom: 4px;
    line-height: 1.3;
}

.cg-card-tag {
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 6px;
    margin-bottom: 12px;
}

.cg-card-actions {
    display: flex;
    gap: 6px;
    width: 100%;
}

.cg-card-btn {
    flex: 1;
    padding: 6px 0;
    font-size: 11px;
    font-weight: 700;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #334155;
    cursor: pointer;
    text-align: center;
    transition: all 0.12s ease;
}

.cg-card-btn:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.cg-card-btn-primary {
    background: #0284c7;
    color: #ffffff;
    border-color: #0284c7;
}

.cg-card-btn-primary:hover {
    background: #0369a1;
}

/* Modali (Embed & Worksheet) */
.cg-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(6px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.cg-modal-backdrop[hidden] {
    display: none !important;
}

.cg-modal-card {
    background: #ffffff;
    border-radius: 24px;
    width: 100%;
    max-width: 760px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
}

.cg-modal-wide {
    max-width: 1040px;
}

.cg-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 28px;
    border-bottom: 1px solid #e2e8f0;
}

.cg-modal-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 800;
    color: #0f172a;
}

.cg-modal-close {
    background: #f1f5f9;
    border: none;
    font-size: 18px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.cg-modal-close:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.cg-modal-body {
    padding: 24px 28px;
}

.cg-modal-desc {
    font-size: 14px;
    color: #475569;
    line-height: 1.5;
    margin-bottom: 20px;
}

/* Tabs Embed */
.cg-embed-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 12px;
}

.cg-embed-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    color: #64748b;
    cursor: pointer;
    transition: all 0.15s ease;
}

.cg-embed-tab:hover {
    color: #0f172a;
    background: #f8fafc;
}

.cg-embed-tab.active {
    background: #f0fdf4;
    color: #166534;
    border-color: #bbf7d0;
}

.cg-embed-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 24px;
    margin-bottom: 20px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 20px;
}

@media (max-width: 700px) {
    .cg-embed-layout {
        grid-template-columns: 1fr;
    }
}

.cg-embed-preview-col {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.cg-preview-label {
    font-size: 12px;
    font-weight: 700;
    color: #64748b;
    margin-bottom: 10px;
}

.cg-embed-box-preview {
    width: 220px;
    height: 220px;
    border: 1px dashed #cbd5e1;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    overflow: hidden;
}

.cg-embed-box-preview svg {
    width: 90%;
    height: 90%;
}

.cg-embed-config-col {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.cg-config-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    font-weight: 700;
    color: #475569;
}

.cg-config-row select {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 14px;
    outline: none;
}

.cg-checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
    margin-top: 4px;
}

/* Code Wrap */
.cg-code-wrap {
    margin-top: 10px;
}

.cg-code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 700;
    color: #334155;
}

.cg-btn-copy {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: #0284c7;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}

.cg-btn-copy:hover {
    background: #0369a1;
}

.cg-code-wrap textarea {
    width: 100%;
    height: 100px;
    background: #0f172a;
    color: #38bdf8;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 13px;
    border-radius: 12px;
    padding: 14px;
    border: none;
    outline: none;
    resize: none;
    line-height: 1.4;
}

/* Worksheet Toolbar & Sheet */
.cg-worksheet-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 14px;
    margin-bottom: 24px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 16px 20px;
}

.cg-ws-opt {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    font-weight: 700;
    color: #64748b;
}

.cg-ws-opt select {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
}

.cg-worksheet-preview-sheet {
    background: #ffffff;
    border: 2px solid #cbd5e1;
    border-radius: 12px;
    padding: 36px 32px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.cg-ws-page-header {
    border-bottom: 2px solid #0f172a;
    padding-bottom: 14px;
    margin-bottom: 24px;
}

.cg-ws-title {
    font-size: 20px;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 8px;
}

.cg-ws-meta {
    display: flex;
    gap: 24px;
    font-size: 13px;
    font-weight: 700;
    color: #334155;
}

.cg-ws-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-bottom: 28px;
}

@media (max-width: 768px) {
    .cg-ws-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.cg-ws-card {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #fafafa;
}

.cg-ws-clock-svg {
    width: 140px;
    height: 140px;
    margin-bottom: 12px;
}

.cg-ws-clock-svg svg {
    width: 100%;
    height: 100%;
}

.cg-ws-prompt {
    font-size: 13px;
    font-weight: 700;
    color: #334155;
    margin-bottom: 6px;
    text-align: center;
}

.cg-ws-answer-box {
    width: 100px;
    height: 34px;
    border: 2px dashed #94a3b8;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: monospace;
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
    background: #ffffff;
}

.cg-ws-footer {
    text-align: center;
    font-size: 11px;
    color: #94a3b8;
    border-top: 1px solid #f1f5f9;
    padding-top: 12px;
}

/* SEO Section */
.cg-seo-section {
    margin-top: 48px;
}

.cg-seo-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 36px 40px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.02);
}

.cg-seo-card h2 {
    font-size: 22px;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 14px;
}

.cg-seo-card > p {
    font-size: 15px;
    color: #475569;
    line-height: 1.7;
    margin-bottom: 28px;
}

.cg-seo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}

.cg-seo-item h3 {
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 8px;
}

.cg-seo-item p {
    font-size: 14px;
    color: #64748b;
    line-height: 1.6;
}

/* Tab Navigazione Principale: Galleria vs Your Clock */
.cg-main-tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    background: #f1f5f9;
    padding: 6px;
    border-radius: 16px;
    width: fit-content;
    max-width: 100%;
}

.cg-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    color: #64748b;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
}

.cg-tab-btn:hover {
    color: #0f172a;
}

.cg-tab-btn.active {
    background: #ffffff;
    color: #0284c7;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.cg-tab-pill-badge {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #ffffff;
    font-size: 10px;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 999px;
    letter-spacing: 0.5px;
}

.cg-tab-view[hidden] {
    display: none !important;
}

/* Studio Customizer "Your Clock" */
.cg-custom-studio-grid {
    display: grid;
    grid-template-columns: 460px 1fr;
    gap: 32px;
    align-items: start;
}

@media (max-width: 1020px) {
    .cg-custom-studio-grid {
        grid-template-columns: 1fr;
    }
}

.cg-custom-preview-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 24px;
    padding: 24px;
    box-shadow: 0 12px 30px -8px rgba(15, 23, 42, 0.08);
    position: sticky;
    top: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.cg-custom-preview-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 16px;
}

.cg-custom-badge {
    font-size: 13px;
    font-weight: 700;
    color: #0284c7;
    background: #e0f2fe;
    padding: 4px 12px;
    border-radius: 999px;
}

.cg-btn-icon-text {
    background: transparent;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s ease;
}

.cg-btn-icon-text:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.cg-custom-stage {
    width: 100%;
    min-height: 460px;
    background: radial-gradient(circle at center, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow: hidden;
}

.cg-custom-clock-wrap {
    width: 100%;
    max-width: 340px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cg-custom-clock-wrap svg {
    width: 100%;
    height: auto;
    max-height: 420px;
    display: block;
    filter: drop-shadow(0 12px 24px rgba(0,0,0,0.15));
}

.cg-custom-action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
    width: 100%;
    justify-content: center;
}

/* Sub-Tabs dello Studio Customizer */
.cg-studio-subtabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    background: #f1f5f9;
    padding: 6px;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    margin-bottom: 4px;
}

.cg-subtab-btn {
    flex: 1 1 calc(33.333% - 6px);
    min-width: 110px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 12px;
    border-radius: 12px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    color: #475569;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.cg-subtab-btn:hover {
    background: rgba(255, 255, 255, 0.7);
    color: #0f172a;
}

.cg-subtab-btn.active {
    background: #ffffff;
    color: #0284c7;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.cg-subtab-pane[hidden] {
    display: none !important;
}

.cg-subtab-pane {
    animation: cgSubtabFade 0.2s ease-out;
}

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

/* Gradienti Lancette Pills */
.cg-hand-grad-pill {
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 11.5px;
    font-weight: 700;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #1e293b;
    cursor: pointer;
    transition: all 0.15s ease;
}

.cg-hand-grad-pill:hover {
    border-color: #0284c7;
    background: #e0f2fe;
    color: #0369a1;
}

/* Slider inline raggio centro */
.cg-slider-wrap-inline {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cg-slider-wrap-inline input[type="range"] {
    flex: 1;
    accent-color: #0284c7;
    cursor: pointer;
}

.cg-opt-group {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 22px 24px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
}

.cg-opt-group-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 12px;
}

.cg-opt-icon {
    font-size: 22px;
}

.cg-opt-group-head h3 {
    font-size: 17px;
    font-weight: 800;
    color: #0f172a;
    margin: 0;
}

.cg-bg-type-selector {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.cg-radio-chip {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s ease;
}

.cg-radio-chip input {
    display: none;
}

.cg-radio-chip:has(input:checked) {
    background: #0284c7;
    color: #ffffff;
    border-color: #0284c7;
    box-shadow: 0 2px 6px rgba(2, 132, 199, 0.25);
}

.cg-field-inline {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 700;
    color: #334155;
}

.cg-field-inline input[type="color"] {
    width: 44px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    cursor: pointer;
    padding: 2px;
}

.cg-palette-presets {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 12px;
}

.cg-color-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    transition: transform 0.12s ease;
}

.cg-color-dot:hover {
    transform: scale(1.25);
}

.cg-grad-inputs {
    display: flex;
    gap: 20px;
    margin-bottom: 12px;
}

.cg-quick-grad-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.cg-grad-pill {
    padding: 4px 12px;
    border-radius: 999px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.12s ease;
}

.cg-grad-pill:hover {
    background: #e2e8f0;
}

/* File Dropzone per Caricamento Foto */
.cg-file-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px dashed #94a3b8;
    border-radius: 16px;
    padding: 24px;
    cursor: pointer;
    background: #f8fafc;
    transition: all 0.15s ease;
    text-align: center;
}

.cg-file-dropzone:hover {
    border-color: #0284c7;
    background: #f0f9ff;
}

.cg-drop-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.cg-drop-text {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 4px;
}

.cg-drop-hint {
    font-size: 12px;
    color: #64748b;
}

.cg-photo-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    padding: 8px 14px;
    background: #e0f2fe;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    color: #0369a1;
}

.cg-btn-remove-photo {
    background: #ef4444;
    color: #ffffff;
    border: none;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
}

/* Controlli Posizionamento e Zoom Foto */
.cg-photo-controls {
    margin-top: 14px;
    padding: 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
}

.cg-photo-controls-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 12px;
}

.cg-photo-controls-head small {
    font-size: 11px;
    color: #64748b;
}

.cg-photo-controls-body {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}

/* D-Pad a Croce per Spostamento */
.cg-dpad-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
}

.cg-dpad {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: #0f172a;
    padding: 8px;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.cg-dpad-mid {
    display: flex;
    gap: 4px;
    align-items: center;
}

.cg-dpad-btn {
    width: 32px;
    height: 32px;
    background: #1e293b;
    color: #ffffff;
    border: 1px solid #334155;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.1s ease;
    user-select: none;
}

.cg-dpad-btn:hover {
    background: #0284c7;
    border-color: #38bdf8;
    transform: scale(1.08);
}

.cg-dpad-btn:active {
    transform: scale(0.92);
}

.cg-dpad-center {
    background: #334155;
}

/* Sliders Zoom & Spostamento */
.cg-photo-sliders {
    flex: 1;
    min-width: 220px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cg-photo-slider-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #334155;
}

.cg-slider-lbl {
    width: 95px;
    flex-shrink: 0;
}

.cg-photo-slider-row input[type="range"] {
    flex: 1;
    accent-color: #0284c7;
    cursor: pointer;
}

.cg-mini-btn {
    padding: 2px 8px;
    background: #e2e8f0;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 11px;
    cursor: pointer;
    font-weight: 700;
    transition: background 0.1s ease;
}

.cg-mini-btn:hover {
    background: #cbd5e1;
}

.cg-val-badge {
    width: 44px;
    text-align: right;
    font-family: monospace;
    font-size: 11px;
    font-weight: 700;
    color: #0284c7;
}

.cg-form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 14px;
}

.cg-color-input-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cg-color-input-wrap input[type="color"] {
    width: 44px;
    height: 38px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    padding: 2px;
    cursor: pointer;
}

.cg-color-input-wrap select {
    flex-grow: 1;
}

/* Lancette & Tip Icons */
.cg-hand-colors-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 18px;
    background: #f8fafc;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.cg-tip-icons-section {
    border-top: 1px solid #f1f5f9;
    padding-top: 14px;
}

.cg-subhead {
    font-size: 13px;
    font-weight: 800;
    color: #334155;
    margin-bottom: 12px;
}

.cg-icon-selector-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cg-icon-input {
    width: 80px;
    text-align: center;
    font-size: 18px;
}

.cg-quick-emojis {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.cg-emoji-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.1s ease;
}

.cg-emoji-btn:hover {
    background: #e2e8f0;
    transform: scale(1.1);
}

/* Banner Cinturino */
.cg-checkbox-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    padding: 12px 16px;
    border-radius: 12px;
    cursor: pointer;
    margin-bottom: 16px;
}

.cg-checkbox-banner input {
    width: 20px;
    height: 20px;
    accent-color: #16a34a;
}

.cg-banner-label {
    display: flex;
    flex-direction: column;
    font-size: 13px;
    color: #166534;
}

.cg-banner-label small {
    color: #4b5563;
    font-size: 11px;
}

/* STAMPA A4 */
.cg-print-only {
    display: none;
}

@media print {
    /* Nascondi header del sito, footer, barre di navigazione */
    body * {
        visibility: hidden;
    }
    .cg-print-only, .cg-print-only * {
        visibility: visible;
    }
    .cg-print-only {
        display: block !important;
        position: absolute;
        left: 0;
        top: 0;
        width: 100vw;
        margin: 0;
        padding: 20px;
        background: #ffffff;
    }

    /* Orologio Singolo A4 Parete */
    .cg-print-wall-wrap {
        width: 100%;
        max-width: 680px;
        margin: 0 auto;
        text-align: center;
        page-break-after: avoid;
    }

    .cg-print-wall-wrap svg {
        width: 100%;
        height: auto;
        max-height: 85vh;
    }

    /* Kit Fai-Da-Te Ritaglio */
    .cg-print-craft-wrap {
        width: 100%;
        max-width: 720px;
        margin: 0 auto;
    }

    .cg-print-craft-grid {
        display: grid;
        grid-template-columns: 500px 180px;
        gap: 30px;
        align-items: center;
    }

    .cg-print-craft-hands {
        display: flex;
        flex-direction: column;
        gap: 24px;
        border: 2px dashed #64748b;
        padding: 16px;
        border-radius: 12px;
        text-align: center;
    }

    .cg-craft-scissors {
        font-size: 20px;
        margin-bottom: 6px;
    }

    /* Scheda Didattica Stampabile */
    .cg-print-worksheet-wrap {
        width: 100%;
        max-width: 720px;
        margin: 0 auto;
    }
}

/* ===== Controlli uniformi dello Studio: slider con badge del valore ===== */
.cg-slider-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cg-slider-row input[type="range"] {
    flex: 1;
    min-width: 0;
    accent-color: #0284c7;
    height: 22px;
    cursor: pointer;
}

.cg-slider-row .cg-val-badge {
    flex: 0 0 auto;
    min-width: 46px;
}

.cg-hint-text {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    color: #475569;
}

/* ===== Selettore Icone Unicode (oltre 2300 simboli) ===== */
.cg-btn-icon-browse {
    margin-top: 6px;
    padding: 6px 10px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    color: #1d4ed8;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.12s ease;
}

.cg-btn-icon-browse:hover {
    background: #dbeafe;
}

.cg-modal-icons {
    max-width: 920px;
    height: min(86vh, 760px);
    overflow: hidden;
}

.cg-icon-picker-toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 16px 24px 10px;
    flex-wrap: wrap;
}

.cg-icon-picker-toolbar input[type="search"] {
    flex: 1;
    min-width: 220px;
    padding: 10px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 14px;
}

.cg-icon-picker-toolbar input[type="search"]:focus {
    outline: none;
    border-color: #0284c7;
}

.cg-icon-cat-bar {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 0 24px 12px;
    border-bottom: 1px solid #e2e8f0;
    scrollbar-width: thin;
}

.cg-icon-cat-pill {
    flex: 0 0 auto;
    padding: 7px 12px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    color: #334155;
    cursor: pointer;
    white-space: nowrap;
}

.cg-icon-cat-pill em {
    font-style: normal;
    opacity: 0.55;
    font-size: 11px;
}

.cg-icon-cat-pill:hover {
    background: #e2e8f0;
}

.cg-icon-cat-pill.active {
    background: #0284c7;
    border-color: #0284c7;
    color: #ffffff;
}

.cg-icon-grid {
    flex: 1;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
    gap: 6px;
    padding: 16px 24px;
    align-content: start;
}

.cg-icon-cell {
    /* Tap target generoso: resta comodo anche su telefono */
    min-width: 48px;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    line-height: 1;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.1s ease, background 0.1s ease;
}

.cg-icon-cell:hover {
    background: #e0f2fe;
    border-color: #0284c7;
    transform: scale(1.12);
}

.cg-icon-picker-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 24px;
    border-top: 1px solid #e2e8f0;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    flex-wrap: wrap;
}

.cg-icon-preview-box b {
    font-size: 22px;
    vertical-align: middle;
}

@media (max-width: 640px) {
    .cg-modal-icons {
        height: 92vh;
    }

    .cg-icon-grid {
        padding: 12px 14px;
    }

    .cg-icon-picker-toolbar,
    .cg-icon-cat-bar {
        padding-left: 14px;
        padding-right: 14px;
    }
}

/* ===== Menu Esporta (PNG, SVG, orologio per macOS / Android, HTML) ===== */
.cg-export-menu {
    position: relative;
    display: inline-flex;
}

.cg-export-caret {
    font-size: 10px;
    opacity: 0.7;
}

.cg-export-menu.is-open .cg-export-caret {
    transform: rotate(180deg);
}

.cg-export-dropdown {
    position: absolute;
    right: 0;
    bottom: calc(100% + 8px);
    z-index: 60;
    min-width: 304px;
    max-width: min(92vw, 380px);
    padding: 8px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 20px 40px -12px rgba(15, 23, 42, 0.35);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cg-export-dropdown[hidden] {
    display: none !important;
}

.cg-export-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    /* Tap target ampio: resta comodo col dito */
    min-height: 52px;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: 10px;
    text-align: left;
    cursor: pointer;
    transition: background 0.1s ease;
}

.cg-export-item:hover {
    background: #f1f5f9;
}

.cg-export-ico {
    flex: 0 0 auto;
    font-size: 22px;
    line-height: 1;
}

.cg-export-item > span:last-child {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.cg-export-item strong {
    font-size: 14px;
    font-weight: 800;
    color: #0f172a;
}

.cg-export-item em {
    font-style: normal;
    font-size: 11.5px;
    line-height: 1.35;
    color: #64748b;
}

.cg-export-sep {
    margin: 6px 4px 2px;
    padding-top: 8px;
    border-top: 1px solid #e2e8f0;
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: #94a3b8;
}

@media (max-width: 560px) {
    .cg-export-menu {
        width: 100%;
    }

    .cg-export-menu .cg-export-toggle {
        width: 100%;
        justify-content: center;
    }

    .cg-export-dropdown {
        left: 0;
        right: 0;
        max-width: none;
    }
}
