/* Fairy Tail Theme Styles */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;700&family=Lato:wght@400;700&display=swap');

:root {
    --ft-primary: #ff9100;
    /* Fire Dragon Slayer Magic Orange */
    --ft-secondary: #800080;
    /* Dark Magic Purple */
    --ft-accent: #ffd700;
    /* Gold */
    --ft-bg-dark: #1a0524;
    /* Deep dark purple/black */
    --ft-text-light: #f8e7d0;
    --ft-panel-bg: rgba(26, 5, 36, 0.85);
    --ft-border-color: rgba(255, 215, 0, 0.3);
}

html,
body {
    height: 100%;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    font-family: 'Lato', 'Segoe UI', sans-serif;
    color: var(--ft-text-light);
    background-color: #08010a;
    background-image: url('images/background.jpg');
    background-size: cover;
    background-attachment: fixed;
    background-position: center top;
    overflow-y: auto;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, rgba(15, 3, 27, 0.92), rgba(91, 23, 23, 0.88));
    backdrop-filter: blur(2px);
    z-index: -1;
}

object:focus {
    outline: none;
}

#flashContent {
    display: none;
}

.page-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: rgba(10, 3, 18, 0.65);
}

/* Header & Brand */
.site-header {
    padding: 2.5rem 5vw 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    gap: 1rem;
    background: linear-gradient(180deg, rgba(80, 0, 0, 0.9) 0%, rgba(40, 6, 41, 0.0) 100%);
    border-bottom: 2px solid var(--ft-accent);
    box-shadow: 0 0 20px rgba(255, 145, 0, 0.2);
}

.brand h1 {
    margin: 0;
    font-family: 'Cinzel', serif;
    font-size: 3.5rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--ft-accent);
    text-shadow: 0 0 10px rgba(255, 69, 0, 0.8), 2px 2px 0px #8b0000;
    text-align: center;
}

.brand-top {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    text-align: center;
}

/* Navigation */
.main-nav {
    display: flex;
    gap: 2rem;
    padding: 1rem 5vw 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 0.6rem;
}

.main-nav a {
    color: var(--ft-text-light);
    text-decoration: none;
    font-family: 'Cinzel', serif;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-size: 1.1rem;
    position: relative;
    transition: all 0.3s ease;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.main-nav a::before {
    content: "✦";
    margin-right: 5px;
    color: var(--ft-primary);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.main-nav a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -5px;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--ft-accent), transparent);
    opacity: 0;
    transform: scaleX(0);
    transition: all 0.3s ease;
}

.main-nav a:hover,
.main-nav a:focus {
    color: var(--ft-accent);
    text-shadow: 0 0 8px var(--ft-primary);
}

.main-nav a:hover::before {
    opacity: 1;
}

.main-nav a:hover::after,
.main-nav a:focus::after {
    opacity: 1;
    transform: scaleX(1);
}

/* Main Content */
main {
    flex: 1;
    padding: 1.5rem 5vw 3rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2.5rem;
}

.game-panel {
    background: var(--ft-panel-bg);
    border: 2px solid var(--ft-border-color);
    border-radius: 4px;
    /* Slightly sharper corners for a scroll/parchment feel */
    padding: 2rem;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.6), inset 0 0 50px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    width: 100%;
    max-width: calc(1250px + 3.5rem);
    margin: 0 auto;
    position: relative;
}

/* Decorative corners */
.game-panel::before,
.game-panel::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid var(--ft-accent);
    transition: all 0.3s ease;
}

.game-panel::before {
    top: -2px;
    left: -2px;
    border-right: none;
    border-bottom: none;
}

.game-panel::after {
    bottom: -2px;
    right: -2px;
    border-left: none;
    border-top: none;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 215, 0, 0.1);
    padding-bottom: 1rem;
}

.panel-title {
    font-family: 'Cinzel', serif;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--ft-accent);
    font-size: 1.5rem;
    text-shadow: 0 0 5px rgba(255, 145, 0, 0.5);
}

.launch-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.action-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem;
    border-radius: 4px;
    border: 1px solid var(--ft-accent);
    background: linear-gradient(135deg, #4b0082, #2e0854);
    color: var(--ft-accent);
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    min-width: 48px;
    min-height: 48px;
}

.action-button svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
    filter: drop-shadow(0 0 2px rgba(255, 215, 0, 0.5));
}

.action-button:hover {
    background: linear-gradient(135deg, #6a0dad, #4b0082);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
    transform: translateY(-2px);
}

.action-button:active {
    transform: translateY(0);
}

/* Tooltip */
.action-button::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: var(--ft-accent);
    padding: 0.5rem 0.8rem;
    border: 1px solid var(--ft-accent);
    border-radius: 4px;
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    font-family: 'Lato', sans-serif;
}

.action-button:hover::after {
    opacity: 1;
    transform: translate(-50%, -5px);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.game-player {
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 145, 0, 0.2);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.7);
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    /* Removed padding to let game fill space */
    width: 100%;
    margin: 0 auto;
}

#flashContent,
#flashContent p {
    margin: 0;
    color: var(--ft-text-light);
    text-align: center;
}

#flashContent {
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    max-width: 1250px;
    min-height: 650px;
    /* Ensure height for loading screen */
}

#flashContent p {
    margin: 0;
    color: var(--ft-text-light);
    text-align: center;
    padding: 1rem;
}

#flashContent strong {
    font-weight: 700;
    color: var(--ft-primary);
    border-bottom: 1px dashed var(--ft-accent);
}

#flashContent a:hover {
    color: #fff;
    border-bottom-style: solid;
}

/* Info Panel */
.info-panel {
    display: grid;
    gap: 1.5rem;
    width: 100%;
    max-width: calc(1250px + 3.5rem);
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    margin: 0 auto;
}

.info-card {
    background: var(--ft-panel-bg);
    border-radius: 4px;
    padding: 1.5rem;
    border: 1px solid var(--ft-border-color);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s ease;
}

.info-card:hover {
    transform: translateY(-5px);
    border-color: var(--ft-accent);
}

.info-card h3 {
    margin: 0 0 1rem;
    font-family: 'Cinzel', serif;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 1.25rem;
    color: var(--ft-primary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 0.5rem;
}

.info-card p {
    margin: 0;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.6;
}

.info-card a {
    color: var(--ft-accent);
    text-decoration: none;
    font-weight: bold;
}

.info-card a:hover {
    text-decoration: underline;
    text-shadow: 0 0 5px var(--ft-primary);
}

/* Footer */
.site-footer {
    padding: 2rem 5vw;
    border-top: 2px solid var(--ft-border-color);
    background: linear-gradient(0deg, #0f0214 0%, rgba(17, 3, 27, 0.8) 100%);
    text-align: center;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
}

.footer-links {
    margin-top: 1rem;
    color: rgba(255, 255, 255, 0.8);
}

.footer-label {
    font-weight: 600;
    color: var(--ft-accent);
    margin-right: 0.3rem;
}

.footer-links a {
    color: var(--ft-primary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: #fff;
}

/* Responsive */
@media (max-width: 720px) {
    .site-header {
        flex-direction: column;
        gap: 1.5rem;
    }

    .brand h1 {
        font-size: 2.5rem;
    }

    .main-nav {
        gap: 1rem;
        font-size: 0.9rem;
    }

    .panel-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

#GameWrok,
.game-player ruffle-player,
.game-player ruffle-player>object {
    width: 100%;
    max-width: 1250px;
    aspect-ratio: 1250 / 650;
    height: auto;
    min-height: 650px;
}

/* Shop Panel */
.shop-panel {
    background: var(--ft-panel-bg);
    border: 2px solid var(--ft-border-color);
    border-radius: 4px;
    padding: 2rem;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.6), inset 0 0 50px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    width: 100%;
    max-width: calc(1250px + 3.5rem);
    margin: 0 auto;
    position: relative;
}

.shop-panel::before,
.shop-panel::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid var(--ft-accent);
    transition: all 0.3s ease;
}

.shop-panel::before {
    top: -2px;
    left: -2px;
    border-right: none;
    border-bottom: none;
}

.shop-panel::after {
    bottom: -2px;
    right: -2px;
    border-left: none;
    border-top: none;
}

.shop-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    padding: 1rem 0;
}

.shop-card {
    background: linear-gradient(135deg, rgba(75, 0, 130, 0.4), rgba(46, 8, 84, 0.6));
    border: 1px solid var(--ft-border-color);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
}

.shop-card:hover {
    transform: translateY(-5px);
    border-color: var(--ft-accent);
    box-shadow: 0 8px 25px rgba(255, 215, 0, 0.3);
}

.shop-card-image {
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    padding: 1rem;
}

.shop-card-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.shop-card-info {
    padding: 1rem;
    text-align: center;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    flex: 1;
}

.shop-card-title {
    font-family: 'Cinzel', serif;
    font-size: 1.1rem;
    color: var(--ft-accent);
    margin-bottom: 0.5rem;
    text-shadow: 0 0 5px rgba(255, 145, 0, 0.5);
}

.shop-card-desc {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    flex: 1;
}

.shop-card-price {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--ft-primary);
    margin-top: auto;
    padding-top: 0.5rem;
}

.shop-loading,
.shop-error,
.shop-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    font-size: 1.1rem;
    color: var(--ft-text-light);
}

.shop-error {
    color: #ff6b6b;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: linear-gradient(135deg, #1a0524, #2e0854);
    border: 2px solid var(--ft-accent);
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 0 40px rgba(255, 215, 0, 0.3);
    animation: modalAppear 0.3s ease;
}

@keyframes modalAppear {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 215, 0, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-family: 'Cinzel', serif;
    font-size: 1.4rem;
    color: var(--ft-accent);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.8rem;
    color: var(--ft-text-light);
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--ft-primary);
}

.modal-body {
    padding: 1.5rem;
}

.modal-body p {
    margin: 0 0 0.8rem;
    color: var(--ft-text-light);
    line-height: 1.6;
}

.modal-body p:last-child {
    margin-bottom: 0;
}

.modal-body strong {
    color: var(--ft-accent);
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid rgba(255, 215, 0, 0.2);
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.modal-btn {
    padding: 0.8rem 1.5rem;
    border-radius: 4px;
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-btn-primary {
    background: linear-gradient(135deg, #ff9100, #ff6600);
    border: 1px solid var(--ft-accent);
    color: #1a0524;
}

.modal-btn-primary:hover {
    background: linear-gradient(135deg, #ffaa33, #ff9100);
    box-shadow: 0 0 15px rgba(255, 145, 0, 0.5);
}

.modal-btn-secondary {
    background: transparent;
    border: 1px solid var(--ft-border-color);
    color: var(--ft-text-light);
}

.modal-btn-secondary:hover {
    border-color: var(--ft-accent);
    color: var(--ft-accent);
}

@media (max-width: 720px) {
    .shop-cards {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 1rem;
    }

    .shop-card-title {
        font-size: 1rem;
    }

    .shop-card-price {
        font-size: 1rem;
    }

    .modal-footer {
        flex-direction: column;
    }

    .modal-btn {
        width: 100%;
        text-align: center;
    }
}

/* Cart Button */
.cart-button {
    position: relative;
    background: transparent;
    border: 1px solid var(--ft-border-color);
    border-radius: 4px;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--ft-text-light);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-button:hover {
    border-color: var(--ft-accent);
    color: var(--ft-accent);
}

.cart-button svg {
    width: 24px;
    height: 24px;
}

.cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--ft-primary);
    color: #1a0524;
    font-size: 0.75rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* Panel Header with Cart */
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 215, 0, 0.2);
}

/* Item Modal */
.item-modal-image {
    width: 120px;
    height: 120px;
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 1rem;
}

.item-modal-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Cart Modal */
.modal-content-wide {
    max-width: 600px;
}

.cart-items {
    max-height: 400px;
    overflow-y: auto;
}

.cart-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 215, 0, 0.1);
}

.cart-item:last-child {
    border-bottom: none;
}

.cart-item-image {
    width: 50px;
    height: 50px;
    object-fit: contain;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    padding: 4px;
}

.cart-item-info {
    flex: 1;
}

.cart-item-name {
    font-family: 'Cinzel', serif;
    color: var(--ft-accent);
    margin-bottom: 0.25rem;
}

.cart-item-price {
    font-size: 0.9rem;
    color: var(--ft-primary);
    font-weight: 700;
}

.cart-item-remove {
    background: transparent;
    border: 1px solid #ff4444;
    color: #ff4444;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-item-remove:hover {
    background: #ff4444;
    color: white;
}

.cart-total {
    padding: 1rem;
    border-top: 1px solid rgba(255, 215, 0, 0.2);
    text-align: right;
    font-size: 1.2rem;
    color: var(--ft-text-light);
}

.cart-total span {
    color: var(--ft-primary);
    font-weight: 700;
}

.cart-empty {
    text-align: center;
    padding: 3rem;
    color: var(--ft-text-light);
    font-size: 1.1rem;
}

/* Danger Button */
.modal-btn-danger {
    background: transparent;
    border: 1px solid #ff4444;
    color: #ff4444;
}

.modal-btn-danger:hover {
    background: #ff4444;
    color: white;
}

/* Notification */
.notification {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: linear-gradient(135deg, #1a0524, #2e0854);
    border: 1px solid var(--ft-accent);
    color: var(--ft-text-light);
    padding: 1rem 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    z-index: 2000;
    opacity: 0;
    transition: all 0.3s ease;
}

.notification-show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

@media (max-width: 720px) {
    .cart-items {
        max-height: 300px;
    }

    .cart-item {
        padding: 0.75rem;
    }

    .cart-item-image {
        width: 40px;
        height: 40px;
    }
}

/* Document Modal Styles */
.modal-content-document {
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-body-scroll {
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 1rem;
}

.modal-body-scroll::-webkit-scrollbar {
    width: 8px;
}

.modal-body-scroll::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.modal-body-scroll::-webkit-scrollbar-thumb {
    background: var(--ft-border-color);
    border-radius: 4px;
}

.modal-body-scroll::-webkit-scrollbar-thumb:hover {
    background: var(--ft-accent);
}

.modal-body-scroll h4 {
    font-family: 'Cinzel', serif;
    font-size: 1.1rem;
    color: var(--ft-primary);
    margin: 1.5rem 0 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid rgba(255, 215, 0, 0.2);
    padding-bottom: 0.5rem;
}

.modal-body-scroll h4:first-child {
    margin-top: 0.5rem;
}

.modal-body-scroll ul {
    margin: 0.5rem 0 1rem;
    padding-left: 1.5rem;
}

.modal-body-scroll li {
    color: var(--ft-text-light);
    line-height: 1.6;
    margin-bottom: 0.3rem;
}

.modal-body-scroll em {
    color: rgba(255, 255, 255, 0.7);
    font-style: italic;
}

/* Footer Links Styling */
.footer-links a {
    margin: 0 0.5rem;
}

.footer-links a:not(:last-child)::after {
    content: "|";
    margin-left: 1rem;
    color: rgba(255, 255, 255, 0.3);
}

@media (max-width: 720px) {
    .modal-content-document {
        max-width: 95%;
        max-height: 95vh;
    }

    .modal-body-scroll {
        max-height: 50vh;
    }

    .modal-body-scroll h4 {
        font-size: 1rem;
    }

    .footer-links {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    .footer-links a:not(:last-child)::after {
        display: none;
    }
}