:root {
    --theme-primary: #f28cab;
    --theme-primary-rgb: 242, 140, 171;
    --theme-font: "Manrope", sans-serif;
    --theme-display-font: "Fredoka", sans-serif;
}

body {
    font-family: var(--theme-font);
}

h1,
h2,
h3,
h4,
h5,
h6,
.font-display {
    font-family: var(--theme-display-font);
}

body.theme-transition,
body.theme-transition *,
body.theme-transition *::before,
body.theme-transition *::after {
    transition: background-color 180ms ease, color 180ms ease, border-color 180ms ease, box-shadow 180ms ease, font-family 180ms ease, transform 180ms ease;
}

.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

.fill-1 { 
    font-variation-settings: 'FILL' 1; 
}

.text-primary,
.hover\:text-primary:hover,
.group:hover .group-hover\:text-primary,
.focus\:text-primary:focus {
    color: var(--theme-primary) !important;
}

.bg-primary,
.hover\:bg-primary:hover,
.focus\:bg-primary:focus {
    background-color: var(--theme-primary) !important;
}

.border-primary,
.hover\:border-primary:hover,
.focus\:border-primary:focus {
    border-color: var(--theme-primary) !important;
}

.ring-primary,
.focus\:ring-primary:focus {
    --tw-ring-color: rgba(var(--theme-primary-rgb), 1) !important;
}

.accent-primary {
    accent-color: var(--theme-primary) !important;
}

[class*="bg-primary/10"] {
    background-color: rgba(var(--theme-primary-rgb), 0.1) !important;
}

[class*="bg-primary/20"] {
    background-color: rgba(var(--theme-primary-rgb), 0.2) !important;
}

[class*="bg-primary/30"] {
    background-color: rgba(var(--theme-primary-rgb), 0.3) !important;
}

[class*="bg-primary/90"] {
    background-color: rgba(var(--theme-primary-rgb), 0.9) !important;
}

[class*="text-primary/"] {
    color: rgba(var(--theme-primary-rgb), 1) !important;
}

[class*="border-primary/10"] {
    border-color: rgba(var(--theme-primary-rgb), 0.1) !important;
}

[class*="border-primary/20"] {
    border-color: rgba(var(--theme-primary-rgb), 0.2) !important;
}

[class*="shadow-primary/"] {
    --tw-shadow-color: rgba(var(--theme-primary-rgb), 0.28) !important;
}

.template-palette {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 70;
    width: min(360px, calc(100vw - 40px));
    height: 100vh;
    background: rgba(255, 255, 255, 0.96);
    border-left: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: -24px 0 60px rgba(15, 23, 42, 0.14);
    backdrop-filter: blur(18px);
    transform: translateX(100%);
    transition: transform 220ms ease;
    overflow: visible;
}

.dark .template-palette {
    background: rgba(15, 23, 42, 0.96);
    border-left-color: rgba(148, 163, 184, 0.2);
    box-shadow: -24px 0 60px rgba(2, 6, 23, 0.45);
}

.template-palette.is-open {
    transform: translateX(0);
}

.template-palette__inner {
    height: 100%;
    overflow-y: auto;
    padding: 24px 22px 24px;
}

.template-palette__title {
    font-size: 1.125rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.template-palette__text {
    color: #64748b;
    font-size: 0.92rem;
    line-height: 1.5;
}

.dark .template-palette__text {
    color: #94a3b8;
}

.template-palette__section {
    margin-top: 22px;
}

.template-palette__label {
    display: block;
    margin-bottom: 10px;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #475569;
}

.dark .template-palette__label {
    color: #cbd5e1;
}

.template-palette__swatches {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.template-palette__fonts {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.template-palette__swatch {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 16px;
    background: rgba(248, 250, 252, 0.92);
    padding: 10px 12px;
    cursor: pointer;
}

.dark .template-palette__swatch {
    background: rgba(30, 41, 59, 0.7);
    border-color: rgba(148, 163, 184, 0.18);
}

.template-palette__swatch.is-active,
.template-palette__font.is-active {
    border-color: var(--theme-primary);
    box-shadow: 0 0 0 2px rgba(var(--theme-primary-rgb), 0.15);
}

.template-palette__dot {
    width: 18px;
    height: 18px;
    border-radius: 999px;
    flex: 0 0 auto;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4);
}

.template-palette__swatch-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
}

.template-palette__swatch-name {
    font-size: 0.92rem;
    font-weight: 700;
}

.template-palette__swatch-meta {
    font-size: 0.75rem;
    color: #64748b;
}

.dark .template-palette__swatch-meta {
    color: #94a3b8;
}

.template-palette__font {
    width: 100%;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 16px;
    background: rgba(248, 250, 252, 0.92);
    padding: 12px 14px;
    text-align: left;
    color: inherit;
    cursor: pointer;
}

.dark .template-palette__font {
    background: rgba(30, 41, 59, 0.7);
    border-color: rgba(148, 163, 184, 0.18);
}

.template-palette__font-name {
    display: block;
    font-size: 0.95rem;
    font-weight: 700;
}

.template-palette__font-preview {
    display: block;
    margin-top: 4px;
    font-size: 0.82rem;
    color: #64748b;
}

.dark .template-palette__font-preview {
    color: #94a3b8;
}

.template-palette__select {
    width: 100%;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 14px;
    background: rgba(248, 250, 252, 0.92);
    color: inherit;
    padding: 12px 14px;
    font: inherit;
}

.dark .template-palette__select {
    background: rgba(30, 41, 59, 0.7);
    border-color: rgba(148, 163, 184, 0.18);
}

.template-palette__actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 24px;
}

.template-palette__button {
    border: 0;
    border-radius: 14px;
    padding: 12px 14px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.template-palette__button--primary {
    background: var(--theme-primary);
    color: #fff;
}

.template-palette__button--secondary {
    background: rgba(148, 163, 184, 0.14);
    color: inherit;
}

.template-palette__rail {
    position: absolute;
    left: 0;
    top: 50%;
    z-index: 2;
    transform: translate(-100%, -50%);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    pointer-events: auto;
}

.template-palette__tab,
.template-palette__buy {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    border: 0;
    border-radius: 16px 0 0 16px;
    padding: 16px 10px;
    min-height: 156px;
    width: 54px;
    text-align: center;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.18);
    white-space: nowrap;
}

.template-palette__tab-text,
.template-palette__buy-text {
    display: inline-block;
    transform: rotate(180deg);
}

.template-palette__tab {
    background: #0f172a;
    color: #fff;
    cursor: pointer;
}

.template-palette__buy {
    background: var(--theme-primary);
    color: #fff;
    text-decoration: none;
}

.template-palette__hint {
    margin-top: 16px;
    padding: 14px 16px;
    border-radius: 16px;
    background: rgba(var(--theme-primary-rgb), 0.08);
    color: #475569;
    font-size: 0.85rem;
    line-height: 1.55;
}

.dark .template-palette__hint {
    color: #cbd5e1;
}

@media (max-width: 767px) {
    .template-palette {
        width: min(100vw - 20px, 340px);
        transform: translateX(100%);
    }

    .template-palette__tab,
    .template-palette__buy {
        min-height: 138px;
        width: 46px;
        padding: 12px 8px;
        font-size: 0.78rem;
    }
}
