/* ========================================
   RESET E BASE
======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

/* ── Fundo: Cosmos / Nebulosa Sombria ── */
body {
    background-color: var(--cosmos-void);
    background-attachment: fixed;
    font-family: 'Crimson Text', serif;
    color: var(--cosmos-text);
    min-height: 100vh;
    padding: 20px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    touch-action: pan-y;
    position: relative;
}
/* ========================================
   ANIMAÇÕES GLOBAIS
======================================== */
@keyframes shimmer {
    0%   { transform: translateX(-50%) translateY(-50%) rotate(0deg); }
    100% { transform: translateX(-50%) translateY(-50%) rotate(360deg); }
}

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

@keyframes syncEnter {
    0%   { transform: scale(0.2) rotate(-180deg); opacity: 0; }
    60%  { transform: scale(1.2) rotate(20deg); }
    100% { transform: scale(1)   rotate(0deg);   opacity: 1; }
}

@keyframes syncGlow {
    0%, 100% { box-shadow: 0 0 4px var(--cosmos-ornament); }
    50%       { box-shadow: 0 0 12px var(--cosmos-ornament), 0 0 22px var(--cosmos-ornament); }
}

@keyframes ornamentsGlow {
    0%, 100% { opacity: 0.45; }
    50%       { opacity: 0.80; }
}

/* ========================================
   LAYOUT PRINCIPAL
======================================== */
.app-container {
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* ── Header / Banner da ficha ── */
.header {
    text-align: center;
    margin-bottom: 30px;
    padding: 32px 40px;
    background:
        linear-gradient(180deg,
            rgba(30, 20, 70, 0.85) 0%,
            rgba(10, 13, 40, 0.95) 60%,
            rgba(5,   8, 22, 0.98) 100%);
    border: 1px solid rgba(144, 128, 200, 0.40);
    border-top: 3px solid rgba(200, 188, 232, 0.70);
    border-bottom: 3px solid rgba(200, 188, 232, 0.70);
    box-shadow:
        0 0 40px rgba(80, 60, 180, 0.25),
        inset 0 0 60px rgba(80, 60, 160, 0.08),
        0 8px 30px rgba(0, 0, 0, 0.70);
    position: relative;
    overflow: hidden;
    clip-path: polygon(
        0 0,
        100% 0,
        100% calc(100% - 14px),
        calc(100% - 14px) 100%,
        0 100%
    );
}

/* Brilho de bordas ornamentais no header */
.header::before {
    content: '✦';
    position: absolute;
    top: 8px;
    left: 18px;
    font-size: 14px;
    color: rgba(200, 188, 232, 0.55);
    pointer-events: none;
    animation: ornamentsGlow 4s ease-in-out infinite;
}

.header::after {
    content: '✦';
    position: absolute;
    top: 8px;
    right: 18px;
    font-size: 14px;
    color: rgba(200, 188, 232, 0.55);
    pointer-events: none;
    animation: ornamentsGlow 4s ease-in-out infinite 2s;
}

.header h1 {
    font-family: 'Pirata One', cursive;
    font-size: 3.5rem;
    color: var(--cosmos-silver-bright);
    text-shadow:
        2px 2px 8px rgba(0, 0, 0, 0.90),
        0 0 30px rgba(100, 80, 200, 0.60),
        0 0 60px rgba(80, 60, 180, 0.30);
    margin-bottom: 8px;
    position: relative;
    z-index: 1;
    letter-spacing: 4px;
}

.header p {
    color: var(--cosmos-text-dim);
    font-size: 1.1rem;
    font-style: italic;
    position: relative;
    z-index: 1;
    letter-spacing: 2px;
    text-shadow: 1px 1px 4px rgba(0,0,0,0.8);
}

/* ========================================
   CONTAINER DA FICHA
======================================== */
.sheet-container {
    background: linear-gradient(160deg,
        rgba(14, 18, 55, 0.96) 0%,
        rgba(9, 13, 36, 0.98)  100%);
    padding: 36px;
    border: 1px solid rgba(100, 80, 200, 0.28);
    border-top: 2px solid rgba(144, 128, 200, 0.45);
    position: relative;
    box-shadow:
        0 0 30px rgba(60, 40, 160, 0.15),
        inset 0 0 50px rgba(80, 60, 160, 0.04);
}

/* Linha de grade sutil */
.sheet-container::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 60px,
            rgba(100, 80, 200, 0.02) 60px,
            rgba(100, 80, 200, 0.02) 61px
        ),
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 60px,
            rgba(100, 80, 200, 0.02) 60px,
            rgba(100, 80, 200, 0.02) 61px
        );
    pointer-events: none;
    border-radius: inherit;
}

.sheet-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.sheet-grid-details {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 20px;
}

/* ========================================
   INDICADOR DE SALVAMENTO
======================================== */
.save-indicator {
    animation: slideInUp 0.3s ease-out;
}

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

.save-indicator.show {
    display: block;
    animation: slideInUp 0.3s ease-out;
}