/* The Way of Becoming - styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

:root {
    --ink: #1a1510;
    --paper: #f5f1e8;
    --accent: #8b4513;
    --muted: #c9b896;
    /* Darker than --muted so small text stays readable on the paper colour. */
    --quiet-text: #7a6a4f;
    --shadow: rgba(26, 21, 16, 0.1);
}

body {
    font-family: 'Zen Kaku Gothic New', sans-serif;
    background: linear-gradient(135deg, #f5f1e8 0%, #e8dfc9 100%);
    color: var(--ink);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(26, 21, 16, 0.02) 2px, rgba(26, 21, 16, 0.02) 4px);
    pointer-events: none;
    z-index: 1;
}

.container {
    max-width: 800px;
    width: 100%;
    position: relative;
    z-index: 2;
}

.header {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeIn 1s ease-out;
}

.title {
    font-family: 'Crimson Pro', serif;
    font-size: 3.5rem;
    font-weight: 300;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
    color: var(--accent);
    text-shadow: 2px 2px 4px var(--shadow);
}

.subtitle {
    font-size: 0.9rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--quiet-text);
    font-weight: 300;
}

.game-card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border-radius: 2px;
    padding: 3rem;
    box-shadow:
        0 20px 60px var(--shadow),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(139, 69, 19, 0.1);
    position: relative;
    animation: slideUp 0.8s ease-out;
}

.game-card::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    bottom: 10px;
    border: 1px solid rgba(139, 69, 19, 0.05);
    pointer-events: none;
}

.start-screen {
    text-align: center;
}

.start-description {
    font-family: 'Crimson Pro', serif;
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--quiet-text);
    margin-bottom: 2rem;
}

.start-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
}

.progress {
    font-size: 0.75rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--quiet-text);
    margin-bottom: 1.5rem;
}

.story-text {
    font-family: 'Crimson Pro', serif;
    font-size: 1.2rem;
    line-height: 1.8;
    margin-bottom: 2rem;
    color: var(--ink);
    font-weight: 300;
    opacity: 0;
    animation: fadeIn 1s ease-out 0.3s forwards;
}

.story-text p + p {
    margin-top: 1rem;
}

.choices {
    display: grid;
    gap: 1rem;
    margin-top: 2rem;
}

.choice-btn {
    background: transparent;
    border: 1px solid var(--accent);
    padding: 1.2rem 1.5rem;
    font-family: 'Zen Kaku Gothic New', sans-serif;
    font-size: 1rem;
    line-height: 1.5;
    letter-spacing: normal;
    text-transform: none;
    color: var(--accent);
    cursor: pointer;
    text-align: left;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    border-radius: 2px;
    opacity: 0;
    animation: slideUp 0.6s ease-out forwards;
}

.choice-btn:nth-child(1) { animation-delay: 0.5s; }
.choice-btn:nth-child(2) { animation-delay: 0.6s; }
.choice-btn:nth-child(3) { animation-delay: 0.7s; }
.choice-btn:nth-child(4) { animation-delay: 0.8s; }

.choice-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--accent);
    transition: left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: -1;
}

/* Hover effects only where there is a real pointer, so a tapped choice
   does not stay highlighted on touch screens. */
@media (hover: hover) {
    .choice-btn:hover::before {
        left: 0;
    }

    .choice-btn:hover {
        color: var(--paper);
        border-color: var(--accent);
        transform: translateX(10px);
        box-shadow: -10px 10px 30px var(--shadow);
    }
}

.choice-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.choice-btn:disabled:hover {
    transform: none;
}

button {
    background: var(--accent);
    border: none;
    padding: 0.75rem 2rem;
    font-family: 'Zen Kaku Gothic New', sans-serif;
    font-size: 0.9rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--paper);
    cursor: pointer;
    border-radius: 2px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px var(--shadow);
}

button:hover {
    background: #6d3610;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--shadow);
}

button:active {
    transform: translateY(0);
}

.loading {
    text-align: center;
    padding: 2rem;
    color: var(--quiet-text);
    font-style: italic;
    animation: pulse 2s ease-in-out infinite;
}

.concept-badge {
    display: inline-block;
    background: rgba(139, 69, 19, 0.1);
    padding: 0.25rem 0.75rem;
    border-radius: 2px;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-top: 1rem;
    color: var(--accent);
    border: 1px solid rgba(139, 69, 19, 0.2);
}

/* Secondary buttons: save, reset */
.quiet-btn {
    padding: 0.5rem 1.5rem;
    font-size: 0.8rem;
    background: transparent;
    border: 1px solid var(--muted);
    color: var(--quiet-text);
    box-shadow: none;
}

.quiet-btn:hover {
    background: var(--muted);
    color: var(--ink);
}

.reset-btn {
    display: block;
    margin-top: 1.5rem;
}

.save-panel {
    margin-top: 2rem;
}

.save-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.save-note {
    font-size: 0.8rem;
    color: var(--quiet-text);
    margin-top: 0.5rem;
}

.path-container {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(139, 69, 19, 0.2);
}

.path-title {
    font-family: 'Crimson Pro', serif;
    font-size: 0.9rem;
    font-weight: 400;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--quiet-text);
    margin-bottom: 1rem;
}

.path-item {
    font-size: 0.85rem;
    padding: 0.5rem 0;
    color: var(--quiet-text);
    border-left: 2px solid rgba(139, 69, 19, 0.2);
    padding-left: 1rem;
    margin-left: 0.5rem;
    margin-bottom: 0.5rem;
    opacity: 0;
    animation: fadeIn 0.5s ease-out forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.5;
    }
    50% {
        opacity: 1;
    }
}

.error {
    background: rgba(139, 69, 19, 0.1);
    border: 1px solid var(--accent);
    padding: 1rem;
    border-radius: 2px;
    margin: 1rem 0;
    color: var(--accent);
}

.footer {
    margin-top: 2rem;
    text-align: center;
    font-size: 0.8rem;
    color: var(--quiet-text);
}

.footer a {
    color: var(--accent);
    margin-left: 0.5rem;
}

/* Keyboard focus */
button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

/* Respect the "reduce motion" system setting */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-delay: 0s !important;
        transition-duration: 0.01ms !important;
    }
}

@media (max-width: 768px) {
    .title {
        font-size: 2.5rem;
    }

    body {
        padding: 1rem;
    }

    .game-card {
        padding: 1.5rem;
    }

    .story-text {
        font-size: 1.1rem;
    }
}
