/* ============================================
   Palace Card Game - Main Styles
   ============================================ */

/* CSS Variables */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --secondary-color: #10b981;
    --secondary-dark: #059669;
    --accent-color: #f59e0b;
    --danger-color: #ef4444;

    --bg-color: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #334155;
    --bg-light: #475569;

    --text-color: #f1f5f9;
    --text-muted: #94a3b8;
    --text-dark: #64748b;

    --border-color: #475569;
    --border-light: #64748b;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.4);

    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;

    --max-width: 1200px;
    --header-height: 70px;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--primary-light);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-color);
}

img {
    max-width: 100%;
    height: auto;
}

ul, ol {
    padding-left: 1.5rem;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    line-height: 1.2;
    margin-bottom: 0.5em;
    font-weight: 700;
}

h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 4vw, 2.5rem); }
h3 { font-size: clamp(1.25rem, 3vw, 1.75rem); }

p {
    margin-bottom: 1rem;
}

/* Container */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ============================================
   Header & Navigation
   ============================================ */

.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
}

.main-nav {
    height: 100%;
}

.nav-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
    text-decoration: none;
}

.logo:hover {
    color: var(--text-color);
}

.logo-icon {
    font-size: 1.25rem;
    background: linear-gradient(135deg, #ef4444, #f59e0b, #10b981, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 0.5rem;
    padding: 0;
    margin: 0;
}

.nav-links a {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--text-muted);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--text-color);
    background: var(--bg-secondary);
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 30px;
    height: 30px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.mobile-menu-btn span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--text-color);
    border-radius: 2px;
    transition: all var(--transition-fast);
}

/* ============================================
   Buttons
   ============================================ */

.play-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, var(--secondary-color), var(--secondary-dark));
    color: white;
    font-weight: 600;
    font-size: 1rem;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-md);
    text-decoration: none;
}

.play-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    color: white;
}

.play-btn:active {
    transform: translateY(0);
}

.play-btn.large {
    padding: 1rem 2.5rem;
    font-size: 1.25rem;
    border-radius: var(--radius-lg);
}

.nav-play-btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.secondary-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    background: transparent;
    color: var(--text-color);
    font-weight: 600;
    font-size: 1rem;
    border: 2px solid var(--border-light);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.secondary-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--text-color);
    color: var(--text-color);
}

/* ============================================
   Hero Section
   ============================================ */

.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: calc(var(--header-height) + 2rem) 1.5rem 4rem;
    position: relative;
    overflow: hidden;
    background: linear-gradient(180deg, var(--bg-color) 0%, var(--bg-secondary) 100%);
}

.hero-content {
    text-align: center;
    max-width: 700px;
    z-index: 1;
}

.hero h1 {
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--text-color), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: clamp(1.25rem, 3vw, 1.75rem);
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.hero-description {
    font-size: 1.125rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.hero-cta {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Floating Cards Animation */
.hero-cards {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.floating-card {
    position: absolute;
    font-size: 4rem;
    opacity: 0.1;
    animation: float 6s ease-in-out infinite;
}

.card-1 { top: 15%; left: 10%; animation-delay: 0s; color: #1e293b; }
.card-2 { top: 25%; right: 15%; animation-delay: 1.5s; color: #ef4444; }
.card-3 { bottom: 25%; left: 15%; animation-delay: 3s; color: #ef4444; }
.card-4 { bottom: 15%; right: 10%; animation-delay: 4.5s; color: #1e293b; }

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(-5deg); }
    50% { transform: translateY(-20px) rotate(5deg); }
}

/* ============================================
   Features Section
   ============================================ */

.features {
    padding: 5rem 0;
    background: var(--bg-secondary);
}

.features h2 {
    text-align: center;
    margin-bottom: 3rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.feature-card {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: var(--radius-lg);
    text-align: center;
    transition: transform var(--transition-normal);
}

.feature-card:hover {
    transform: translateY(-5px);
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.feature-card h3 {
    margin-bottom: 0.5rem;
}

.feature-card p {
    color: var(--text-muted);
    margin-bottom: 0;
}

/* ============================================
   How to Play Section
   ============================================ */

.how-to-play {
    padding: 5rem 0;
}

.how-to-play h2 {
    text-align: center;
    margin-bottom: 3rem;
}

.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.step {
    text-align: center;
}

.step-number {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
}

.step h3 {
    margin-bottom: 0.5rem;
}

.step p {
    color: var(--text-muted);
    margin-bottom: 0;
}

.section-cta {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* ============================================
   CTA Section
   ============================================ */

.cta-section {
    padding: 5rem 0;
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-card));
    text-align: center;
}

.cta-section h2 {
    margin-bottom: 1rem;
}

.cta-section p {
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-size: 1.125rem;
}

.cta-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* ============================================
   Content Pages
   ============================================ */

.content-page {
    padding-top: calc(var(--header-height) + 2rem);
    padding-bottom: 4rem;
    min-height: 100vh;
}

.page-header {
    text-align: center;
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.page-intro {
    font-size: 1.25rem;
    color: var(--text-muted);
    max-width: 700px;
    margin: 0 auto 1.5rem;
}

/* Table of Contents */
.table-of-contents {
    background: var(--bg-secondary);
    padding: 1.5rem 2rem;
    border-radius: var(--radius-lg);
    margin-bottom: 3rem;
}

.table-of-contents h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.table-of-contents ul {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
    list-style: none;
    padding: 0;
    margin: 0;
}

.table-of-contents a {
    color: var(--text-muted);
}

.table-of-contents a:hover {
    color: var(--primary-light);
}

/* Rule Sections */
.rule-section {
    margin-bottom: 3rem;
    scroll-margin-top: calc(var(--header-height) + 2rem);
}

.rule-section h2 {
    color: var(--primary-light);
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-color);
    margin-bottom: 1.5rem;
}

.rule-section h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.rule-section ul, .rule-section ol {
    margin-bottom: 1rem;
}

.rule-section li {
    margin-bottom: 0.5rem;
}

/* Tip Box */
.tip-box {
    background: rgba(16, 185, 129, 0.1);
    border-left: 4px solid var(--secondary-color);
    padding: 1rem 1.5rem;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    margin: 1.5rem 0;
}

.tip-box.warning {
    background: rgba(245, 158, 11, 0.1);
    border-left-color: var(--accent-color);
}

.tip-box strong {
    color: var(--secondary-color);
}

.tip-box.warning strong {
    color: var(--accent-color);
}

/* Win Box */
.win-box {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.2), rgba(16, 185, 129, 0.2));
    padding: 2rem;
    border-radius: var(--radius-lg);
    text-align: center;
    margin: 2rem 0;
}

.win-box h3 {
    margin-top: 0;
}

/* Card Ranks Display */
.card-ranks {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1rem 0;
}

.rank {
    width: 40px;
    height: 50px;
    background: white;
    color: #1e293b;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 1.25rem;
    box-shadow: var(--shadow-sm);
}

/* Special Cards Grid */
.special-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.special-card {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    text-align: center;
}

.special-card-rank {
    width: 60px;
    height: 80px;
    background: white;
    color: #1e293b;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 1.75rem;
    margin: 0 auto 1rem;
    box-shadow: var(--shadow-md);
}

.special-card h3 {
    margin-bottom: 0.5rem;
}

.special-card p {
    color: var(--text-muted);
    margin-bottom: 0;
}

/* Rules Table */
.rules-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
}

.rules-table th,
.rules-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.rules-table th {
    background: var(--bg-secondary);
    font-weight: 600;
}

.rules-table tr:hover td {
    background: var(--bg-secondary);
}

/* Strategy Grid */
.strategy-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.strategy-card {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
}

.strategy-card h3 {
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.strategy-card p {
    color: var(--text-muted);
    margin-bottom: 0;
}

/* Check List */
.check-list {
    list-style: none;
    padding: 0;
}

.check-list li {
    position: relative;
    padding-left: 1.75rem;
}

.check-list li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--secondary-color);
    font-weight: 700;
}

/* Special Strategy */
.special-strategy {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    margin: 1.5rem 0;
}

.special-strategy h3 {
    margin-top: 0;
    color: var(--primary-light);
}

.strategy-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

/* Phase Box */
.phase-box {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    margin: 1rem 0;
}

.phase-box p:first-child {
    margin-bottom: 0.75rem;
}

.phase-box ul {
    margin-bottom: 0;
}

/* Mistakes Grid */
.mistakes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.mistake-card {
    background: rgba(239, 68, 68, 0.1);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    border-left: 4px solid var(--danger-color);
}

.mistake-card h3 {
    color: var(--danger-color);
    margin-top: 0;
}

.mistake-card p {
    color: var(--text-muted);
    margin-bottom: 0;
}

/* Timeline */
.timeline {
    position: relative;
    padding-left: 2rem;
    margin: 2rem 0;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--primary-color);
}

.timeline-item {
    position: relative;
    padding-bottom: 2rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -2rem;
    top: 0.5rem;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary-color);
    transform: translateX(-5px);
}

.timeline-item h3 {
    margin-top: 0;
}

.timeline-item p {
    color: var(--text-muted);
    margin-bottom: 0;
}

/* Names Grid */
.names-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.name-card {
    background: var(--bg-secondary);
    padding: 1.25rem;
    border-radius: var(--radius-md);
}

.name-card h3 {
    margin-top: 0;
    font-size: 1.125rem;
    color: var(--primary-light);
}

.name-card p {
    color: var(--text-muted);
    margin-bottom: 0;
    font-size: 0.9rem;
}

/* ============================================
   Footer
   ============================================ */

.site-footer {
    background: var(--bg-secondary);
    padding: 3rem 0;
    border-top: 1px solid var(--border-color);
}

.footer-content {
    text-align: center;
}

.footer-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

.footer-nav {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.footer-nav a {
    color: var(--text-muted);
}

.footer-nav a:hover {
    color: var(--text-color);
}

.copyright {
    color: var(--text-dark);
    font-size: 0.875rem;
    margin-bottom: 0;
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 768px) {
    :root {
        --header-height: 60px;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: var(--header-height);
        left: 0;
        right: 0;
        flex-direction: column;
        background: var(--bg-secondary);
        padding: 1rem;
        gap: 0;
        border-bottom: 1px solid var(--border-color);
    }

    .nav-links.active {
        display: flex;
    }

    .nav-links li {
        width: 100%;
    }

    .nav-links a {
        display: block;
        padding: 0.75rem 1rem;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .nav-play-btn {
        display: none;
    }

    .hero {
        padding-top: calc(var(--header-height) + 1rem);
    }

    .hero-cta {
        flex-direction: column;
        align-items: center;
    }

    .features, .how-to-play, .cta-section {
        padding: 3rem 0;
    }

    .table-of-contents ul {
        flex-direction: column;
        gap: 0.5rem;
    }

    .strategy-content {
        grid-template-columns: 1fr;
    }

    .rules-table {
        font-size: 0.9rem;
    }

    .rules-table th,
    .rules-table td {
        padding: 0.75rem 0.5rem;
    }
}

@media (max-width: 480px) {
    .play-btn.large {
        width: 100%;
    }

    .secondary-btn {
        width: 100%;
    }

    .cta-buttons {
        flex-direction: column;
    }

    .section-cta {
        flex-direction: column;
    }

    .special-cards-grid {
        grid-template-columns: 1fr;
    }
}
