/* Custom styles that tailwind doesn't handle natively via CDN easily */

.pb-safe {
    padding-bottom: calc(0.5rem + env(safe-area-inset-bottom));
}

/* Hanzi Writer Container styling */
.hanzi-character {
    width: 150px;
    height: 150px;
    border: 1px solid #e5e7eb;
    border-radius: 1rem;
    background-color: white;
    box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);
    position: relative;
}

/* Grid lines for character */
.hanzi-character::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background-color: #f3f4f6;
    border-top: 1px dashed #d1d5db;
}

.hanzi-character::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 1px;
    background-color: #f3f4f6;
    border-left: 1px dashed #d1d5db;
}

/* Hide scrollbars for cleaner look */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Animations */
@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.animate-slide-in {
    animation: slideInRight 0.3s ease-out forwards;
}

@keyframes vibrate {
    0% { transform: translate(0); }
    20% { transform: translate(-3px, 0); }
    40% { transform: translate(3px, 0); }
    60% { transform: translate(-3px, 0); }
    80% { transform: translate(3px, 0); }
    100% { transform: translate(0); }
}

.animate-vibrate {
    animation: vibrate 0.3s ease-in-out;
}

@keyframes glow-gray {
    0% { box-shadow: 0 0 0 rgba(0, 0, 0, 0); transform: scale(1); }
    50% { box-shadow: 0 0 25px rgba(0, 0, 0, 0.5); transform: scale(1.05); }
    100% { box-shadow: 0 0 0 rgba(0, 0, 0, 0); transform: scale(1); }
}

.animate-glow {
    animation: glow-gray 0.5s ease-out;
}

body {
    background-color: #fafafa;
}

.zen-panel {
    background: #ffffff;
    border: 1px solid #e5e5e5;
}

.zen-card {
    background: #ffffff;
    border: 1px solid #e5e5e5;
    transition: all 0.2s ease;
}

.zen-card:hover {
    border-color: #000000;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.zen-header {
    background: #ffffff;
    border-bottom: 1px solid #e5e5e5;
}

.zen-btn-primary {
    background-color: #000000;
    color: #ffffff;
    border: 1px solid #000000;
    transition: all 0.2s ease;
}

.zen-btn-primary:hover {
    background-color: #ffffff;
    color: #000000;
}

.zen-btn-secondary {
    background-color: #ffffff;
    color: #000000;
    border: 1px solid #e5e5e5;
    transition: all 0.2s ease;
}

.zen-btn-secondary:hover {
    border-color: #000000;
}

/* Hanzi Writer Canvas */
.hanzi-character {
    border: 1px solid #e5e5e5 !important;
    background-color: #fafafa !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

.hanzi-character::before, .hanzi-character::after {
    border-color: #e5e5e5 !important;
}

/* Dark Mode Custom Styles */
html.dark body {
    background-color: #09090b;
    color: #f4f4f5;
}

.correct-answer {
    background-color: #dcfce7 !important; /* verde chiaro sfumato */
    border-color: #86efac !important;
    color: #166534 !important;
}

.wrong-answer {
    background-color: #fef2f2 !important; /* rosso chiaro sfumato */
    border-color: #fca5a5 !important;
    color: #991b1b !important;
}

html.dark .correct-answer {
    background-color: rgba(34, 197, 94, 0.15) !important;
    border-color: #4ade80 !important;
    color: #4ade80 !important;
}

html.dark .wrong-answer {
    background-color: rgba(239, 68, 68, 0.15) !important;
    border-color: #f87171 !important;
    color: #f87171 !important;
}
html.dark .text-black, html.dark .text-heisig-accent {
    color: #ffffff !important;
}
html.dark .bg-white {
    background-color: #09090b !important;
}
html.dark .zen-panel, html.dark .zen-card, html.dark .zen-header, html.dark .hanzi-character {
    background-color: #09090b !important;
    border-color: #27272a !important;
}
html.dark .zen-card:hover {
    border-color: #ffffff !important;
}
html.dark .zen-btn-primary {
    background-color: #ffffff;
    color: #000000;
    border-color: #ffffff;
}
html.dark .zen-btn-primary:hover {
    background-color: #09090b;
    color: #ffffff;
}
html.dark .zen-btn-secondary {
    background-color: #09090b;
    color: #ffffff;
    border-color: #27272a;
}
html.dark .zen-btn-secondary:hover {
    border-color: #ffffff;
}
html.dark .text-stone-800, html.dark .text-heisig-dark {
    color: #e4e4e7 !important;
}
html.dark .text-stone-600 {
    color: #a1a1aa !important;
}
html.dark .text-stone-500, html.dark .text-stone-400 {
    color: #71717a !important;
}
html.dark .bg-stone-50, html.dark .bg-stone-100 {
    background-color: #18181b !important;
    border-color: #27272a !important;
}
html.dark .border-e5e5e5, html.dark .border-stone-100, html.dark .border-stone-200 {
    border-color: #27272a !important;
}
html.dark .hanzi-character::before, html.dark .hanzi-character::after {
    border-color: #27272a !important;
}
html.dark #loadingView {
    background-color: #09090b;
}
html.dark .animate-spin {
    border-bottom-color: #ffffff;
}
html.dark .bg-black {
    background-color: #ffffff !important;
    color: #000000 !important;
}
html.dark .text-white {
    color: #000000 !important;
}
html.dark .bg-white\/70, html.dark .bg-white\/80 {
    background-color: rgba(9, 9, 11, 0.8) !important;
}
html.dark .bg-black\/10 {
    background-color: rgba(0, 0, 0, 0.7) !important;
}