:root {
    --black: #0d0d0d;
    --gold: #d4af37;
    --bronze: #8b6914;
    --red: #b8312f;
    --blue: #0e68ab;
    --white: #f0e6d2;
    --purple: #7b4397;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Spectral', serif;
    background: #1a1a1a;
    color: var(--white);
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
}

/* Prevent horizontal scroll on mobile */
html {
    overflow-x: hidden;
}

body {
    overflow-x: hidden;
    width: 100%;
}

/* Animated background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(ellipse at 20% 20%, rgba(212, 175, 55, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(123, 67, 151, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(14, 104, 171, 0.05) 0%, transparent 50%);
    z-index: 0;
    animation: pulse 8s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* Mystical particles */
.particle {
    position: fixed;
    width: 2px;
    height: 2px;
    background: var(--gold);
    border-radius: 50%;
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    animation: float 6s ease-in-out infinite;
    box-shadow: 0 0 10px var(--gold);
}

@keyframes float {
    0%, 100% { 
        opacity: 0;
        transform: translateY(0) translateX(0);
    }
    10% { opacity: 0.6; }
    50% { 
        opacity: 1;
        transform: translateY(-100vh) translateX(20px);
    }
    90% { opacity: 0.3; }
}

.title-font {
    font-family: 'Cinzel', serif;
}

/* Header animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes glow {
    0%, 100% {
        text-shadow: 0 0 20px rgba(212, 175, 55, 0.5),
                     0 0 40px rgba(212, 175, 55, 0.3);
    }
    50% {
        text-shadow: 0 0 30px rgba(212, 175, 55, 0.8),
                     0 0 60px rgba(212, 175, 55, 0.4);
    }
}

.animate-fade-in-down {
    animation: fadeInDown 1s ease-out;
}

.animate-fade-in-up {
    animation: fadeInUp 1s ease-out;
}

.text-glow {
    animation: glow 3s ease-in-out infinite;
}

/* MTG Card styling */
.mtg-card {
    position: relative;
    background: linear-gradient(145deg, #2a2a2a 0%, #1a1a1a 100%);
    border-radius: 14px;
    overflow: hidden;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid rgba(212, 175, 55, 0.3);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 0 20px rgba(212, 175, 55, 0.2);
    animation: fadeInUp 0.8s ease-out both;
}

@media (min-width: 640px) {
    .mtg-card {
        border-radius: 16px;
    }
}

@media (min-width: 1024px) {
    .mtg-card {
        border-radius: 18px;
    }
}

.mtg-card:nth-child(1) { animation-delay: 0.1s; }
.mtg-card:nth-child(2) { animation-delay: 0.2s; }
.mtg-card:nth-child(3) { animation-delay: 0.3s; }
.mtg-card:nth-child(4) { animation-delay: 0.4s; }
.mtg-card:nth-child(5) { animation-delay: 0.5s; }
.mtg-card:nth-child(6) { animation-delay: 0.6s; }

/* Card border glow effect */
.mtg-card::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, 
        var(--gold), 
        var(--bronze), 
        var(--purple), 
        var(--blue),
        var(--gold)
    );
    border-radius: 18px;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.5s ease;
    background-size: 300% 300%;
    animation: gradient-shift 6s ease infinite;
}

@keyframes gradient-shift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.mtg-card:hover::before {
    opacity: 1;
}

.mtg-card:hover {
    transform: translateY(-12px) scale(1.03);
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.8),
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        0 0 40px rgba(212, 175, 55, 0.5);
    border-color: var(--gold);
}

/* Reduce hover effects on touch devices */
@media (hover: none) {
    .mtg-card:hover {
        transform: none;
    }
    
    .mtg-card:active {
        transform: scale(0.98);
    }
}

/* Card image frame */
.card-image-frame {
    position: relative;
    overflow: hidden;
    border: 3px solid var(--bronze);
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
}

.card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    transition: transform 0.6s ease;
    filter: contrast(1.1) saturate(1.2);
}

/* Responsive card image heights */
@media (min-width: 640px) {
    .card-image {
        height: 240px;
    }
}

@media (min-width: 1024px) {
    .card-image {
        height: 280px;
    }
}

.mtg-card:hover .card-image {
    transform: scale(1.1);
}

/* Card title bar */
.card-title-bar {
    background: linear-gradient(90deg, 
        rgba(212, 175, 55, 0.2) 0%,
        rgba(212, 175, 55, 0.4) 50%,
        rgba(212, 175, 55, 0.2) 100%
    );
    border-top: 1px solid rgba(212, 175, 55, 0.5);
    border-bottom: 1px solid rgba(139, 105, 20, 0.5);
    padding: 8px 12px;
    position: relative;
}

@media (min-width: 640px) {
    .card-title-bar {
        padding: 10px 16px;
    }
}

@media (min-width: 1024px) {
    .card-title-bar {
        padding: 12px 20px;
    }
}

.card-title-bar::before,
.card-title-bar::after {
    content: '◆';
    position: absolute;
    color: var(--gold);
    font-size: 12px;
    top: 50%;
    transform: translateY(-50%);
}

.card-title-bar::before {
    left: 8px;
}

.card-title-bar::after {
    right: 8px;
}

/* Card text box */
.card-text-box {
    background: linear-gradient(180deg, 
        rgba(42, 42, 42, 0.9) 0%,
        rgba(26, 26, 26, 0.95) 100%
    );
    border: 1px solid rgba(212, 175, 55, 0.2);
    border-radius: 8px;
    padding: 12px;
    margin: 12px;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.4);
    position: relative;
}

@media (min-width: 640px) {
    .card-text-box {
        padding: 14px;
        margin: 14px;
    }
}

@media (min-width: 1024px) {
    .card-text-box {
        padding: 16px;
        margin: 16px;
    }
}

.card-text-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent 0%,
        rgba(212, 175, 55, 0.3) 50%,
        transparent 100%
    );
}


/* Modal styling */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(12px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.modal.active {
    display: flex;
    animation: fadeIn 0.4s ease forwards;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

.modal-content {
    background: linear-gradient(145deg, #2a2a2a 0%, #1a1a1a 100%);
    max-width: 950px;
    max-height: 90vh;
    width: 95%;
    overflow-y: auto;
    position: relative;
    border-radius: 12px;
    border: 2px solid var(--gold);
    box-shadow: 
        0 0 60px rgba(212, 175, 55, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 30px 90px rgba(0, 0, 0, 0.9);
    animation: modalAppear 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (min-width: 640px) {
    .modal-content {
        width: 90%;
        border-radius: 16px;
        border-width: 3px;
    }
}

@media (min-width: 1024px) {
    .modal-content {
        border-radius: 20px;
    }
}

@keyframes modalAppear {
    from {
        opacity: 0;
        transform: translateY(50px) scale(0.9) rotateX(10deg);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1) rotateX(0);
    }
}

/* Ornate corners */
.ornate-corner {
    position: absolute;
    width: 25px;
    height: 25px;
    border: 2px solid var(--gold);
    z-index: 10;
}

@media (min-width: 640px) {
    .ornate-corner {
        width: 35px;
        height: 35px;
    }
}

@media (min-width: 1024px) {
    .ornate-corner {
        width: 40px;
        height: 40px;
    }
}

.ornate-corner.top-left {
    top: 6px;
    left: 6px;
    border-right: none;
    border-bottom: none;
    border-radius: 8px 0 0 0;
}

@media (min-width: 640px) {
    .ornate-corner.top-left {
        top: 8px;
        left: 8px;
    }
}

@media (min-width: 1024px) {
    .ornate-corner.top-left {
        top: 10px;
        left: 10px;
    }
}

.ornate-corner.top-right {
    top: 6px;
    right: 6px;
    border-left: none;
    border-bottom: none;
    border-radius: 0 8px 0 0;
}

@media (min-width: 640px) {
    .ornate-corner.top-right {
        top: 8px;
        right: 8px;
    }
}

@media (min-width: 1024px) {
    .ornate-corner.top-right {
        top: 10px;
        right: 10px;
    }
}

.ornate-corner.bottom-left {
    bottom: 6px;
    left: 6px;
    border-right: none;
    border-top: none;
    border-radius: 0 0 0 8px;
}

@media (min-width: 640px) {
    .ornate-corner.bottom-left {
        bottom: 8px;
        left: 8px;
    }
}

@media (min-width: 1024px) {
    .ornate-corner.bottom-left {
        bottom: 10px;
        left: 10px;
    }
}

.ornate-corner.bottom-right {
    bottom: 6px;
    right: 6px;
    border-left: none;
    border-top: none;
    border-radius: 0 0 8px 0;
}

@media (min-width: 640px) {
    .ornate-corner.bottom-right {
        bottom: 8px;
        right: 8px;
    }
}

@media (min-width: 1024px) {
    .ornate-corner.bottom-right {
        bottom: 10px;
        right: 10px;
    }
}

.close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    background: linear-gradient(145deg, #3a3a3a, #2a2a2a);
    border: 2px solid var(--gold);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    transition: all 0.3s ease;
    color: var(--gold);
    font-size: 18px;
    font-weight: bold;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
}

@media (min-width: 640px) {
    .close-btn {
        top: 16px;
        right: 16px;
        width: 40px;
        height: 40px;
    }
}

@media (min-width: 1024px) {
    .close-btn {
        top: 20px;
        right: 20px;
        width: 44px;
        height: 44px;
        font-size: 20px;
    }
}

.close-btn:hover {
    transform: rotate(90deg) scale(1.1);
    background: var(--gold);
    color: var(--black);
    box-shadow: 0 0 30px var(--gold);
}

/* Form styling */
.form-label {
    color: var(--gold);
    font-family: 'Cinzel', serif;
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    display: block;
    text-transform: uppercase;
}

@media (min-width: 640px) {
    .form-label {
        font-size: 15px;
        letter-spacing: 0.75px;
        margin-bottom: 8px;
    }
}

@media (min-width: 1024px) {
    .form-label {
        font-size: 16px;
        letter-spacing: 1px;
    }
}

.form-input, .form-textarea {
    width: 100%;
    padding: 12px 14px;
    background: rgba(26, 26, 26, 0.8);
    border: 2px solid rgba(212, 175, 55, 0.3);
    color: var(--white);
    font-family: 'Spectral', serif;
    font-size: 14px;
    transition: all 0.3s ease;
    outline: none;
    border-radius: 8px;
}

@media (min-width: 640px) {
    .form-input, .form-textarea {
        padding: 13px 16px;
        font-size: 15px;
    }
}

@media (min-width: 1024px) {
    .form-input, .form-textarea {
        padding: 14px 18px;
        font-size: 16px;
    }
}

.form-input:focus, .form-textarea:focus {
    border-color: var(--gold);
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.2);
    background: rgba(26, 26, 26, 0.95);
}

.form-input::placeholder, .form-textarea::placeholder {
    color: rgba(240, 230, 210, 0.4);
    font-style: italic;
}

/* Epic button */
.btn-epic {
    padding: 12px 24px;
    background: linear-gradient(145deg, var(--gold), var(--bronze));
    border: none;
    color: var(--black);
    font-family: 'Cinzel', serif;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.4s ease;
    border-radius: 8px;
    box-shadow: 
        0 8px 24px rgba(212, 175, 55, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

@media (min-width: 640px) {
    .btn-epic {
        padding: 14px 32px;
        font-size: 14px;
        letter-spacing: 1.75px;
    }
}

@media (min-width: 1024px) {
    .btn-epic {
        padding: 16px 40px;
        font-size: 16px;
        letter-spacing: 2px;
    }
}

.btn-epic::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-epic:hover::before {
    width: 400px;
    height: 400px;
}

.btn-epic:hover {
    transform: translateY(-4px);
    box-shadow: 
        0 12px 40px rgba(212, 175, 55, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.btn-epic:active {
    transform: translateY(-2px);
}

.btn-epic span {
    position: relative;
    z-index: 1;
}

/* Delete button */
.delete-card-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    background: rgba(184, 49, 47, 0.95);
    border: 2px solid rgba(139, 0, 0, 0.8);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.9;
    transition: all 0.3s ease;
    z-index: 10;
    color: white;
    font-size: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
}

@media (min-width: 640px) {
    .delete-card-btn {
        top: 10px;
        right: 10px;
        width: 34px;
        height: 34px;
        font-size: 17px;
        opacity: 0;
    }
}

@media (min-width: 1024px) {
    .delete-card-btn {
        top: 12px;
        right: 12px;
        width: 36px;
        height: 36px;
        font-size: 18px;
    }
}

@media (hover: hover) {
    .mtg-card:hover .delete-card-btn {
        opacity: 1;
    }
}

.delete-card-btn:hover {
    transform: scale(1.15);
    box-shadow: 0 0 20px rgba(184, 49, 47, 0.8);
}

/* Scrollbar */
.modal-content::-webkit-scrollbar {
    width: 10px;
}

.modal-content::-webkit-scrollbar-track {
    background: rgba(26, 26, 26, 0.5);
}

.modal-content::-webkit-scrollbar-thumb {
    background: var(--gold);
    border-radius: 5px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: var(--bronze);
}

/* Image preview */
.image-preview {
    width: 100%;
    max-height: 300px;
    object-fit: cover;
    margin-top: 12px;
    border: 2px solid var(--gold);
    border-radius: 8px;
}

/* Divider */
.divider {
    height: 2px;
    background: linear-gradient(90deg, 
        transparent 0%,
        var(--gold) 50%,
        transparent 100%
    );
    margin: 24px 0;
    position: relative;
}

.divider::before {
    content: '◆';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #1a1a1a;
    color: var(--gold);
    padding: 0 12px;
    font-size: 14px;
}