/* ---- Custom Properties ---- */
:root {
    --color-charcoal: #1a1a2e;
    --color-accent-teal: #4ECDC4;
    --color-accent-teal-glow: rgba(78, 205, 196, 0.4);
    --color-accent-amber: #FFB347;
    --color-accent-amber-glow: rgba(255, 179, 71, 0.4);
    --color-accent-purple: #a78bfa;
    --color-accent-purple-glow: rgba(167, 139, 250, 0.4);
    --color-accent-coral: #FF6B6B;
    --color-accent-coral-glow: rgba(255, 107, 107, 0.4);
    --font-display: 'Fraunces', Georgia, serif;
    --font-body: 'Source Sans 3', -apple-system, sans-serif;
    --bento-bg: rgba(255, 255, 255, 0.05);
    --bento-bg-hover: rgba(255, 255, 255, 0.09);
    --bento-border: rgba(255, 255, 255, 0.08);
    --bento-radius: 20px;
    --bento-gap: 1rem;
    --bento-padding: 2rem;
}

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

html {
    font-size: 16px;
    overflow-x: hidden;
}

body {
    font-family: var(--font-body);
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    color: #ffffff;
    min-height: 100vh;
    padding: 1.5rem;
    line-height: 1.6;
    position: relative;
}

body.view-inner {
    padding-top: 2rem;
}

/* ---- Background Orbs (simplified) ---- */
.bg-orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.25;
    pointer-events: none;
    z-index: 0;
}

.bg-orb-1 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(78, 205, 196, 0.5) 0%, transparent 70%);
    top: -200px;
    left: -200px;
    animation: float1 30s ease-in-out infinite;
}

.bg-orb-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(167, 139, 250, 0.4) 0%, transparent 70%);
    bottom: -150px;
    right: -150px;
    animation: float2 35s ease-in-out infinite;
}

@keyframes float1 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(80px, 60px) scale(1.1); }
}

@keyframes float2 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-60px, -50px) scale(1.1); }
}

/* ---- View Management ---- */
.view { display: none; }
.view.active { display: block; }

/* ---- Bento Grid ---- */
.bento-grid {
    display: grid;
    gap: var(--bento-gap);
    max-width: 960px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
    grid-template-columns: 1fr;
    grid-template-areas:
        "hero"
        "meeple"
        "micro"
        "plays"
        "books"
        "games"
        "loc";
}

@media (min-width: 540px) {
    .bento-grid {
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "hero    hero"
            "meeple  micro"
            "plays   books"
            "games   games"
            "loc     loc";
    }
}

@media (min-width: 900px) {
    .bento-grid {
        grid-template-columns: 1fr 1fr 1fr;
        grid-template-areas:
            "hero    hero    meeple"
            "micro   plays   books"
            "games   loc     loc";
    }
}

/* ---- Bento Cell Base ---- */
.bento-cell {
    background: var(--bento-bg);
    border: 1px solid var(--bento-border);
    border-radius: var(--bento-radius);
    padding: var(--bento-padding);
    position: relative;
    overflow: hidden;
    animation: bentoIn 0.5s ease-out both;
}

a.bento-cell {
    text-decoration: none;
    color: inherit;
    display: block;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease, background 0.3s ease;
}

@media (hover: hover) {
    a.bento-cell:hover {
        transform: translateY(-3px);
        background: var(--bento-bg-hover);
    }
}

a.bento-cell:active {
    transform: scale(0.98);
}

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

/* Staggered delays */
.cell-hero     { animation-delay: 0s; }
.cell-meeple   { animation-delay: 0.08s; }
.cell-micro    { animation-delay: 0.16s; }
.cell-plays    { animation-delay: 0.24s; }
.cell-books    { animation-delay: 0.32s; }
.cell-location { animation-delay: 0.40s; }
.cell-games    { animation-delay: 0.48s; }

/* ---- Hero Cell ---- */
.cell-hero {
    grid-area: hero;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 2.5rem var(--bento-padding);
}

.cell-hero h1 {
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #fff;
}

.cell-hero .tagline {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.45);
    margin-top: 0.5rem;
}

.cell-hero::after {
    content: '';
    position: absolute;
    bottom: -60px;
    left: -60px;
    width: 220px;
    height: 220px;
    background: radial-gradient(circle, rgba(167, 139, 250, 0.12) 0%, transparent 70%);
    pointer-events: none;
}

@media (min-width: 540px) {
    .cell-hero h1 {
        font-size: 3rem;
    }
    .cell-hero {
        padding: 3rem var(--bento-padding);
    }
}

@media (min-width: 900px) {
    .cell-hero h1 {
        font-size: 3.5rem;
    }
}

/* ---- Business Card Cells ---- */
.cell-meeple { grid-area: meeple; }
.cell-micro  { grid-area: micro; }

.card-header {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    margin-bottom: 0.75rem;
}

.card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.card-icon svg {
    width: 24px;
    height: 24px;
}

@media (hover: hover) {
    a.bento-cell:hover .card-icon {
        transform: scale(1.1) rotate(3deg);
    }
}

.card-title {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: #ffffff;
}

.card-description {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.95rem;
    line-height: 1.7;
    margin-bottom: 1rem;
}

.card-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    transition: gap 0.3s ease;
}

.card-link svg {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
}

@media (hover: hover) {
    a.bento-cell:hover .card-link {
        gap: 0.75rem;
    }
    a.bento-cell:hover .card-link svg {
        transform: translateX(3px);
    }
}

/* Meeple theming */
.cell-meeple .card-icon {
    background: rgba(78, 205, 196, 0.12);
    border: 1px solid rgba(78, 205, 196, 0.25);
    color: var(--color-accent-teal);
}

.cell-meeple .card-link {
    color: var(--color-accent-teal);
}

@media (hover: hover) {
    .cell-meeple:hover {
        border-color: rgba(78, 205, 196, 0.3);
        box-shadow: 0 8px 30px rgba(78, 205, 196, 0.08);
    }
}

/* Microsolve theming */
.cell-micro .card-icon {
    background: rgba(255, 179, 71, 0.12);
    border: 1px solid rgba(255, 179, 71, 0.25);
    color: var(--color-accent-amber);
}

.cell-micro .card-link {
    color: var(--color-accent-amber);
}

@media (hover: hover) {
    .cell-micro:hover {
        border-color: rgba(255, 179, 71, 0.3);
        box-shadow: 0 8px 30px rgba(255, 179, 71, 0.08);
    }
}

/* ---- Compact Cells (Plays, Books) ---- */
.cell-plays { grid-area: plays; }
.cell-books { grid-area: books; }

.cell-compact {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.625rem;
}

.cell-compact .cell-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.25rem;
    transition: transform 0.3s ease;
}

.cell-compact .cell-icon svg {
    width: 20px;
    height: 20px;
}

@media (hover: hover) {
    a.cell-compact:hover .cell-icon {
        transform: scale(1.1) rotate(3deg);
    }
}

.cell-label {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 600;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cell-label svg {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
}

@media (hover: hover) {
    a.cell-compact:hover .cell-label svg {
        transform: translateX(3px);
    }
}

.cell-sublabel {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.45);
    line-height: 1.5;
}

/* Plays theming */
.cell-plays .cell-icon {
    background: rgba(167, 139, 250, 0.12);
    border: 1px solid rgba(167, 139, 250, 0.25);
    color: var(--color-accent-purple);
}

@media (hover: hover) {
    .cell-plays:hover {
        border-color: rgba(167, 139, 250, 0.3);
        box-shadow: 0 8px 30px rgba(167, 139, 250, 0.08);
    }
}

/* Books theming */
.cell-books .cell-icon {
    background: rgba(255, 179, 71, 0.12);
    border: 1px solid rgba(255, 179, 71, 0.25);
    color: var(--color-accent-amber);
}

@media (hover: hover) {
    .cell-books:hover {
        border-color: rgba(255, 179, 71, 0.3);
        box-shadow: 0 8px 30px rgba(255, 179, 71, 0.08);
    }
}

/* Games theming */
.cell-games { grid-area: games; }

.cell-games .cell-icon {
    background: rgba(255, 107, 107, 0.12);
    border: 1px solid rgba(255, 107, 107, 0.25);
    color: var(--color-accent-coral);
}

@media (hover: hover) {
    .cell-games:hover {
        border-color: rgba(255, 107, 107, 0.3);
        box-shadow: 0 8px 30px rgba(255, 107, 107, 0.08);
    }
}

/* ---- Location Cell ---- */
.cell-location {
    grid-area: loc;
    text-align: center;
    padding: 1.25rem;
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(255, 255, 255, 0.04);
}

.cell-location .footer-text {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.4);
}

.location {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.location svg {
    width: 14px;
    height: 14px;
    opacity: 0.7;
}

/* ---- Content Container (for plays/reader views) ---- */
.content-container {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* ---- Plays Catalogue ---- */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
    font-size: 0.875rem;
    padding: 0.4rem 0.75rem;
    border-radius: 8px;
    transition: color 0.2s ease, background 0.2s ease;
    margin-bottom: 1.5rem;
}

.back-link:hover {
    color: var(--color-accent-purple);
    background: rgba(167, 139, 250, 0.08);
}

.plays-title {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.plays-contact {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
    margin-bottom: 2rem;
}

.plays-contact a {
    color: var(--color-accent-purple);
    text-decoration: none;
    border-bottom: 1px solid rgba(167, 139, 250, 0.3);
    transition: border-color 0.2s ease;
}

.plays-contact a:hover {
    border-color: var(--color-accent-purple);
}

.plays-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr;
}

@media (min-width: 700px) {
    .plays-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.play-card {
    background: var(--bento-bg);
    border-radius: var(--bento-radius);
    padding: 1.75rem 2rem;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--bento-border);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease, background 0.3s ease;
    cursor: pointer;
}

@media (hover: hover) {
    .play-card:hover {
        transform: translateY(-3px);
        background: var(--bento-bg-hover);
        border-color: rgba(167, 139, 250, 0.3);
        box-shadow: 0 8px 30px rgba(167, 139, 250, 0.08);
    }
}

.play-card:active {
    transform: scale(0.98);
}

.play-card-title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.play-card-blurb {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
    line-height: 1.7;
    margin-bottom: 0.875rem;
    flex: 1;
}

.play-card-meta {
    display: flex;
    gap: 1rem;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.8rem;
    margin-bottom: 0.875rem;
}

.play-card-meta span {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.play-card-meta svg {
    width: 14px;
    height: 14px;
    opacity: 0.6;
}

.play-card-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--color-accent-purple);
    font-weight: 600;
    font-size: 0.875rem;
    transition: gap 0.3s ease;
}

.play-card-link svg {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
}

@media (hover: hover) {
    .play-card:hover .play-card-link {
        gap: 0.75rem;
    }
    .play-card:hover .play-card-link svg {
        transform: translateX(3px);
    }
}

.copyright-notice {
    margin-top: 1.5rem;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.35);
    text-align: center;
    line-height: 1.6;
}

.reader-copyright {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #ddd;
    font-size: 0.75rem;
    color: #888;
    line-height: 1.5;
}

/* ---- Play Reader ---- */
.reader-title {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

.reader-content {
    background: rgba(255, 255, 255, 0.95);
    color: var(--color-charcoal);
    border-radius: var(--bento-radius);
    padding: 2.5rem;
    min-height: 300px;
    line-height: 1.85;
    font-size: 1.025rem;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.12);
}

.reader-content h1 {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: #1a1a2e;
}

.reader-content h2 {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: #1a1a2e;
}

.reader-content h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #444;
}

.reader-content p { margin-bottom: 0.875rem; }
.reader-content em { color: #555; }
.reader-content strong { font-weight: 600; }

.reader-content blockquote {
    border-left: 3px solid var(--color-accent-purple);
    padding-left: 1rem;
    margin: 1rem 0;
    color: #555;
    font-style: italic;
}

.reader-content hr {
    border: none;
    border-top: 1px solid #ddd;
    margin: 1.5rem 0;
}

.reader-content ul, .reader-content ol {
    margin-bottom: 0.875rem;
    padding-left: 1.5rem;
}

.reader-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1.5rem;
    gap: 1rem;
}

.reader-btn {
    background: var(--bento-bg);
    border: 1px solid var(--bento-border);
    color: #fff;
    padding: 0.6rem 1.25rem;
    border-radius: 10px;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.reader-btn:hover:not(:disabled) {
    background: rgba(167, 139, 250, 0.15);
    border-color: rgba(167, 139, 250, 0.3);
}

.reader-btn:disabled {
    opacity: 0.25;
    cursor: default;
}

.reader-page-info {
    color: rgba(255, 255, 255, 0.45);
    font-size: 0.85rem;
}

.reader-loading {
    text-align: center;
    padding: 3rem;
    color: rgba(255, 255, 255, 0.5);
}

/* ---- Games catalogue card theming ---- */
.game-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 107, 107, 0.12);
    border: 1px solid rgba(255, 107, 107, 0.25);
    color: var(--color-accent-coral);
    margin-bottom: 1rem;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.game-card-icon svg { width: 24px; height: 24px; }

.game-card .play-card-link { color: var(--color-accent-coral); }

@media (hover: hover) {
    .game-card:hover {
        border-color: rgba(255, 107, 107, 0.3);
        box-shadow: 0 8px 30px rgba(255, 107, 107, 0.08);
    }
    .game-card:hover .game-card-icon { transform: scale(1.1) rotate(3deg); }
    .game-card:hover .play-card-link { gap: 0.75rem; }
    .game-card:hover .play-card-link svg { transform: translateX(3px); }
}

/* ---- Game view ---- */
.game-container {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--bento-border);
    border-radius: var(--bento-radius);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.game-ui {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.game-score-bar {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.7);
}

.game-canvas {
    display: block;
    border-radius: 10px;
    max-width: 100%;
}

.game-message {
    text-align: center;
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 8px;
}

.game-dpad {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-top: 0.25rem;
}

.game-dpad-row {
    display: flex;
    gap: 4px;
}

.game-dpad button {
    width: 52px;
    height: 52px;
    background: var(--bento-bg);
    border: 1px solid var(--bento-border);
    color: rgba(255, 255, 255, 0.65);
    border-radius: 10px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.15s ease, color 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.game-dpad button:active {
    background: rgba(255, 107, 107, 0.2);
    color: #fff;
}

@media (hover: hover) {
    .game-dpad button:hover {
        background: rgba(255, 107, 107, 0.1);
        color: #fff;
    }
}

/* ---- Word Guess ---- */
.wordle-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.wordle-row {
    display: flex;
    gap: 6px;
}

.wordle-row.shake {
    animation: wordle-shake 0.3s ease;
}

@keyframes wordle-shake {
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}

.wordle-tile {
    width: 48px;
    height: 48px;
    border: 2px solid var(--bento-border);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 600;
    text-transform: uppercase;
    color: #fff;
    transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.wordle-tile.filled {
    border-color: rgba(255, 255, 255, 0.4);
    transform: scale(1.04);
}

.wordle-tile.correct {
    background: rgba(87, 199, 133, 0.35);
    border-color: rgba(87, 199, 133, 0.7);
}

.wordle-tile.present {
    background: var(--color-accent-amber-glow);
    border-color: rgba(255, 179, 71, 0.7);
}

.wordle-tile.absent {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.3);
}

.wordle-keyboard {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    max-width: 480px;
}

.wordle-kb-row {
    display: flex;
    justify-content: center;
    gap: 5px;
}

.wordle-key {
    flex: 1;
    max-width: 40px;
    height: 46px;
    background: var(--bento-bg);
    border: 1px solid var(--bento-border);
    color: rgba(255, 255, 255, 0.85);
    border-radius: 6px;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    transition: background 0.15s ease, color 0.15s ease;
}

.wordle-key.wide {
    flex: 1.6;
    max-width: 64px;
    font-size: 0.65rem;
}

.wordle-key.correct {
    background: rgba(87, 199, 133, 0.35);
    border-color: rgba(87, 199, 133, 0.7);
    color: #fff;
}

.wordle-key.present {
    background: var(--color-accent-amber-glow);
    border-color: rgba(255, 179, 71, 0.7);
    color: #fff;
}

.wordle-key.absent {
    background: rgba(255, 255, 255, 0.03);
    color: rgba(255, 255, 255, 0.25);
}

@media (hover: hover) {
    .wordle-key:hover {
        background: rgba(255, 107, 107, 0.1);
        border-color: rgba(255, 107, 107, 0.3);
    }
}

@media (max-width: 420px) {
    .wordle-tile { width: 42px; height: 42px; font-size: 1.2rem; }
    .wordle-key { height: 42px; font-size: 0.7rem; }
}

/* ---- Responsive ---- */
@media (max-width: 539px) {
    body {
        padding: 1rem;
    }

    .bento-grid {
        gap: 0.75rem;
    }

    .bento-cell {
        padding: 1.5rem;
    }

    .cell-hero {
        padding: 2rem 1.5rem;
    }

    .card-title {
        font-size: 1.25rem;
    }

    .play-card {
        padding: 1.5rem;
    }

    .play-card-meta {
        flex-direction: column;
        gap: 0.25rem;
    }

    .reader-content {
        padding: 1.5rem 1.25rem;
        font-size: 0.975rem;
    }

    .reader-nav {
        flex-wrap: wrap;
        justify-content: center;
    }

    .reader-page-info {
        order: -1;
        width: 100%;
        text-align: center;
        margin-bottom: 0.5rem;
    }
}

@media (min-width: 540px) {
    body {
        padding: 2rem;
    }
}
