/* General Styles */
body {
    margin: 0;
    padding: 0;
    background: radial-gradient(circle at 20% 20%, #1b1b1f, #050507 55%);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
    font-family: 'Georgia', serif;
    color: white;
}

/* Card Container */
.card-container {
    perspective: 1000px;
    animation: float 4.5s ease-in-out infinite;
    position: relative;
}

.card-container.opened {
    animation-play-state: running;
}

/* Card */
.card {
    width: 640px;
    height: 440px;
    position: relative;
    transform-style: preserve-3d;
    transform: translate(160px, 30px) rotateX(6deg) rotateY(-18deg);
    transition: transform 1.1s cubic-bezier(0.18, 0.8, 0.2, 1);
    cursor: pointer;
}

/* Cover (front + its inside) */
.card-cover {
    position: absolute;
    width: 320px;
    height: 100%;
    left: 0;
    top: 0;
    z-index: 2;
    background: #fdfdfb;
    border-radius: 10px;
    overflow: hidden;
    transform-style: preserve-3d;
    transform-origin: left center;
    transform: rotateY(-12deg) translateZ(2px);
    box-shadow: 0 20px 45px rgba(255, 122, 122, 0.25), 0 18px 28px rgba(0, 0, 0, 0.35);
    transition: transform 1.1s cubic-bezier(0.18, 0.8, 0.2, 1), box-shadow 0.6s ease;
    backface-visibility: hidden;
}

.cover-content {
    width: 100%;
    height: 100%;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 14px;
    align-items: center;
    justify-content: center;
    padding: 26px 20px;
    box-sizing: border-box;
    backface-visibility: hidden;
}

.cover-title {
    font-family: "Segoe UI", Tahoma, sans-serif;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 700;
    font-size: 0.9rem;
    line-height: 1.4;
}

.title-line {
    color: #1a1a1a;
}

.title-accent {
    color: #e94c4c;
    font-weight: 700;
}

.cover-visual {
    position: relative;
    width: 100%;
    max-width: 240px;
    margin: 10px 0;
}

.mountain-sketch {
    width: 100%;
    height: auto;
}

.mountain-line {
    fill: none;
    stroke: #2e64c6;
    stroke-width: 3;
    stroke-linejoin: round;
    stroke-linecap: round;
}

.pin .pin-shape {
    fill: none;
    stroke: #2e64c6;
    stroke-width: 2;
}

.pin .pin-hole {
    fill: #2e64c6;
}

.math-label {
    position: absolute;
    font-family: "Segoe UI", Tahoma, sans-serif;
    font-weight: 700;
    color: #e94c4c;
    font-size: 1rem;
}

.math-label.left { top: 4%; left: 26%; }
.math-label.center { top: 34%; left: 56%; transform: translateX(-50%); }
.math-label.right { top: 2%; left: 78%; }

.cover-bottom {
    margin-top: 4px;
    font-family: "Segoe UI", Tahoma, sans-serif;
    font-size: 1rem;
    color: #c23c3c;
}

.card-page {
    position: absolute;
    width: 320px;
    height: 100%;
    top: 0;
    z-index: 1;
    padding: 20px;
    box-sizing: border-box;
    border-radius: 10px;
    background: #ffffff;
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.28);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.card-inner-left {
    left: 0;
}

.notebook {
    width: 100%;
    height: 100%;
    padding: 10px 12px 12px 12px;
    box-sizing: border-box;
    background: #ffffff;
    border: 1px solid #e0e6f0;
    border-radius: 8px;
    box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.02);
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-family: "Segoe UI", Tahoma, sans-serif;
    font-size: 0.82rem;
    line-height: 1.3;
}

.note-title {
    font-family: "Segoe UI", Tahoma, sans-serif;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-align: left;
    color: #2a2a2a;
    font-size: 0.95rem;
}

.note-heading {
    font-family: "Segoe UI", Tahoma, sans-serif;
    font-weight: 700;
    color: #c23c3c;
    letter-spacing: 0.5px;
    margin-top: 4px;
    font-size: 0.85rem;
}

.note-step {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.step-label {
    font-weight: 700;
    color: #2a2a2a;
}

.step-body {
    color: #1f3d7a;
}

.step-note {
    color: #2a2a2a;
}

.math-bold {
    font-weight: 700;
    color: #c23c3c;
}

.note-list {
    margin: 4px 0 0 14px;
    padding: 0;
    color: #1f3d7a;
    list-style: square;
}

.note-list li {
    margin-bottom: 2px;
}

.note-conclusion {
    margin-top: auto;
    padding: 8px 10px;
    border: 2px solid #c23c3c;
    border-radius: 6px;
    color: #c23c3c;
    font-weight: 700;
    text-align: center;
    background: rgba(255, 235, 235, 0.5);
    cursor: pointer;
}

.note-conclusion:hover {
    background: rgba(255, 235, 235, 0.8);
}

/* Right inside page */
.card-inner-right {
    right: 0;
    transform: translateZ(-2px);
}

.image-frame {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
    background: #f1f1f1;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
    cursor: pointer;
}

.inner-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.card-inner-right .closing-message {
    font-size: 1.2rem;
    color: #ff6f61;
}

/* Animations */
@keyframes float {
    0%, 100% {
        transform: translateY(20px);
    }
    50% {
        transform: translateY(0px);
    }
}

.card.opened {
    transform: translate(0px, -6px) rotateX(0deg) rotateY(0deg);
}

.card.opened .card-cover {
    transform: rotateY(-180deg) translateZ(2px);
    box-shadow: 0 12px 26px rgba(0, 0, 0, 0.32);
}

.card.opened .card-page {
    opacity: 1;
    visibility: visible;
}

.final-proof {
    position: absolute;
    inset: -20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 10, 12, 0.35);
    opacity: 0;
    pointer-events: none;
    transform: scale(0.2);
    transform-origin: var(--proof-origin-x, 50%) var(--proof-origin-y, 50%);
    transition: transform 0.6s cubic-bezier(0.18, 0.8, 0.2, 1), opacity 0.4s ease;
}

.final-proof.show {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1);
}

.final-proof-panel {
    width: min(560px, 90vw);
    max-height: 80vh;
    background: #fffdfa;
    border-radius: 14px;
    padding: 28px 26px;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.35);
    overflow: auto;
    color: #2a2a2a;
    font-family: "Georgia", serif;
    line-height: 1.55;
}

.final-proof-panel h2 {
    margin: 0 0 14px 0;
    font-size: 1.2rem;
    color: #c23c3c;
    letter-spacing: 0.5px;
}

.final-proof-panel p {
    margin: 0 0 12px 0;
}
