/* =========================================================================
   TOKYO N5 QUEST - Premium Cyberpunk Styling
   ========================================================================= */

/* --- CSS Variables & Design Tokens --- */
:root {
    --bg-dark: #070b14;
    --bg-panel: rgba(15, 23, 42, 0.85);
    --neon-blue: #38bdf8;
    --neon-purple: #a855f7;
    --neon-red: #ef4444;
    --neon-green: #22c55e;
    --neon-gold: #fbbf24;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;

    --font-heading: 'Orbitron', sans-serif;
    --font-body: 'Rajdhani', sans-serif;

    --glass-border: rgba(56, 189, 248, 0.5);
    --glass-shadow: inset 0 0 20px rgba(56, 189, 248, 0.1), 0 8px 32px 0 rgba(0, 0, 0, 0.8);
}

/* --- Base Reset & Body --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-dark);
    background-image:
        linear-gradient(rgba(7, 11, 20, 0.7), rgba(7, 11, 20, 0.9)),
        url('background.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    color: var(--text-main);
    font-family: var(--font-body);
    overflow-x: hidden;
    min-height: 100vh;
}

/* --- Typography --- */
h1,
h2,
h3,
h4 {
    font-family: var(--font-heading);
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* --- Layout --- */
#app-container {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    padding: 80px 20px 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.screen {
    width: 100%;
    animation: fadeIn 0.5s ease;
}

.hidden {
    display: none !important;
}

/* --- UI Components --- */
.glass-panel {
    background: var(--bg-panel);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: 8px;
}

/* --- Neon Buttons --- */
.neon-button {
    font-family: var(--font-heading);
    background: transparent;
    color: var(--neon-blue);
    border: 2px solid var(--neon-blue);
    padding: 12px 24px;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
    overflow: hidden;
    border-radius: 4px;
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.2), inset 0 0 10px rgba(0, 243, 255, 0.1);
}

.neon-button:hover:not(:disabled) {
    background: rgba(56, 189, 248, 0.2);
    color: var(--neon-blue);
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.4), inset 0 0 10px rgba(56, 189, 248, 0.2);
    text-shadow: 0 0 8px var(--neon-blue);
}

.neon-button:disabled {
    border-color: var(--text-muted);
    color: var(--text-muted);
    cursor: not-allowed;
    box-shadow: none;
}

.neon-button-small {
    font-family: var(--font-heading);
    background: transparent;
    border: 1px solid var(--neon-blue);
    color: var(--neon-blue);
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
}

.neon-button-small:hover {
    background: rgba(0, 243, 255, 0.2);
    box-shadow: 0 0 10px var(--neon-blue);
}

.danger-action {
    border-color: var(--neon-red);
    color: var(--neon-red);
    box-shadow: 0 0 10px rgba(255, 60, 60, 0.2);
}

.danger-action:hover:not(:disabled) {
    background: var(--neon-red);
    color: var(--bg-dark);
    box-shadow: 0 0 20px var(--neon-red);
}

/* --- Status Bar --- */
#status-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    border-bottom: 1px solid var(--neon-blue);
    border-radius: 0;
}

.stat-container {
    display: flex;
    gap: 30px;
}

.stat-box {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
    font-weight: 700;
}

/* Progress Bars */
.progress-bar-container {
    width: 150px;
    height: 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    transition: width 0.3s ease;
}

.bar-red {
    background: var(--neon-red);
    box-shadow: 0 0 10px var(--neon-red);
}

.bar-blue {
    background: var(--neon-blue);
    box-shadow: 0 0 10px var(--neon-blue);
}

.neon-red {
    color: var(--neon-red);
    text-shadow: 0 0 5px var(--neon-red);
}

.neon-blue {
    color: var(--neon-blue);
    text-shadow: 0 0 5px var(--neon-blue);
}

.neon-gold {
    color: var(--neon-gold);
    text-shadow: 0 0 5px var(--neon-gold);
}

.neon-green {
    color: var(--neon-green);
    text-shadow: 0 0 5px var(--neon-green);
}

/* --- Icons Menu --- */
.menu-icons {
    display: flex;
    gap: 15px;
}

/* --- 1. Splash Screen --- */
#splash-screen {
    text-align: center;
    padding-top: 10vh;
}

.glitch-container {
    position: relative;
    margin-bottom: 20px;
}

.system-title {
    font-size: 4rem;
    font-weight: 900;
    text-shadow: 0 0 10px var(--neon-blue), 0 0 20px var(--neon-blue);
    color: #fff;
}

.subtitle {
    color: var(--neon-purple);
    font-size: 1.5rem;
    letter-spacing: 5px;
    margin-bottom: 40px;
    text-shadow: 0 0 10px var(--neon-pink);
}

.flavor-text {
    font-family: monospace;
    color: var(--neon-green);
    margin-bottom: 40px;
    font-size: 1.1rem;
}

/* --- 2. Map Screen --- */
.section-title {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 40px;
    color: var(--neon-blue);
    text-shadow: 0 0 10px rgba(0, 243, 255, 0.5);
}

.map-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    padding: 20px;
}

.district-card {
    background: var(--bg-panel);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.district-card:hover:not(.locked) {
    transform: translateY(-10px);
    box-shadow: 0 10px 30px rgba(0, 243, 255, 0.3);
    border-color: var(--neon-blue);
}

.district-card.locked {
    opacity: 0.5;
    filter: grayscale(100%);
}

.district-img {
    height: 150px;
    background-size: cover;
    background-position: center;
    border-bottom: 2px solid var(--neon-pink);
}

.kanji-img {
    background-image: url('https://images.unsplash.com/photo-1542051841857-5f90071e7989?ixlib=rb-4.0.3&auto=format&fit=crop&w=800&q=80');
}

.vocab-img {
    background-image: url('https://images.unsplash.com/photo-1503899036084-c55cdd92da26?ixlib=rb-4.0.3&auto=format&fit=crop&w=800&q=80');
    border-bottom-color: var(--neon-blue);
}

.grammar-img {
    background-image: url('https://images.unsplash.com/photo-1536098561742-ca998e48cbcc?ixlib=rb-4.0.3&auto=format&fit=crop&w=800&q=80');
    border-bottom-color: var(--neon-gold);
}

.context-img {
    background-image: url('https://images.unsplash.com/photo-1540959733332-eab4deabeeaf?ixlib=rb-4.0.3&auto=format&fit=crop&w=800&q=80');
    border-bottom-color: var(--neon-purple);
}

.district-info {
    padding: 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* --- 3. Game Screen --- */
.combat-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

.enemy-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.enemy-glitch {
    font-size: 5rem;
    color: var(--neon-pink);
    text-shadow: 0 0 20px var(--neon-pink);
    animation: float 3s ease-in-out infinite;
}

.question-box {
    width: 100%;
    padding: 40px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.question-box h2 {
    font-size: 6rem;
    color: #fff;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.8);
}

.question-box h2.long-text {
    font-size: 3.5rem;
}

.hint-box {
    background: rgba(57, 255, 20, 0.1);
    border: 1px dashed var(--neon-green);
    padding: 10px 20px;
    border-radius: 5px;
    color: var(--neon-green);
    font-family: monospace;
}

.action-area {
    width: 100%;
}

.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.answer-btn {
    min-height: 80px;
    font-size: 1.2rem;
    white-space: pre-wrap;
}

/* Boss Input */
.cyber-input {
    width: 100%;
    padding: 15px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--neon-blue);
    color: var(--neon-blue);
    font-family: var(--font-body);
    font-size: 1.5rem;
    outline: none;
    text-align: center;
    margin-bottom: 20px;
}

.cyber-input:focus {
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.3);
}

/* Scramble Input */
.scramble-box {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 15px;
    min-height: 70px;
    border: 1px solid var(--neon-blue);
    margin-bottom: 20px;
    border-radius: 4px;
    justify-content: center;
    align-items: center;
    transition: box-shadow 0.3s ease;
}

.pool-box {
    background: rgba(0, 0, 0, 0.3);
}

.selected-box {
    background: rgba(0, 243, 255, 0.1);
}

.scramble-chip {
    background: var(--bg-dark);
    color: var(--text-main);
    border: 1px solid var(--text-muted);
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s;
    font-size: 1.1rem;
    font-family: var(--font-heading);
}

.scramble-chip:hover {
    border-color: var(--neon-blue);
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.5);
    color: var(--neon-blue);
}

.chip-selected {
    border-color: var(--neon-green);
    color: var(--neon-green);
}

/* Furigana / Ruby Reading Tags */
ruby {
    ruby-position: under;
    ruby-align: center;
}

rt {
    font-size: 0.55em;
    color: var(--neon-gold);
    line-height: 1;
    letter-spacing: 0;
    text-transform: none;
    font-family: sans-serif;
    font-weight: normal;
}

.corner-btn {
    margin-top: 40px;
    align-self: center;
}

/* --- Modals --- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    width: 90%;
    max-width: 500px;
    padding: 30px;
    position: relative;
    border: 2px solid var(--neon-gold);
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.3s;
}

.close-modal:hover {
    color: var(--neon-red);
}

.modal-title {
    color: var(--neon-gold);
    border-bottom: 1px solid rgba(255, 189, 0, 0.3);
    padding-bottom: 15px;
    margin-bottom: 20px;
    text-align: center;
}

.item-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.shop-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 5px;
    border: 1px solid transparent;
    transition: all 0.3s;
}

.shop-item:hover {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
}

.item-icon {
    font-size: 2rem;
}

.item-details h4 {
    font-size: 1.2rem;
    margin-bottom: 5px;
}

.item-details p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.item-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.inv-slot {
    aspect-ratio: 1;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    cursor: pointer;
    position: relative;
}

.inv-slot:hover {
    border-color: var(--neon-blue);
    box-shadow: inset 0 0 10px rgba(0, 243, 255, 0.2);
}

.inv-count {
    position: absolute;
    bottom: 2px;
    right: 5px;
    font-size: 0.8rem;
    font-family: monospace;
}

/* --- Animations --- */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scan {
    0% {
        top: -10px;
    }

    100% {
        top: 100%;
    }
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-15px);
    }
}

/* --- Level Up Animation --- */
.level-up-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(15, 23, 42, 0.9);
    z-index: 2000;
    backdrop-filter: blur(10px);
}

.level-up-text {
    font-size: 6rem;
    font-weight: 900;
    color: var(--neon-gold);
    text-shadow: 0 0 20px var(--neon-gold), 0 0 40px var(--neon-gold);
    letter-spacing: 15px;
    animation: levelUpPop 2s ease-out forwards;
}

@keyframes levelUpPop {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    20% {
        transform: scale(1.2);
        opacity: 1;
        text-shadow: 0 0 40px var(--neon-gold), 0 0 80px var(--neon-gold);
    }

    80% {
        transform: scale(1);
        opacity: 1;
        text-shadow: 0 0 20px var(--neon-gold), 0 0 40px var(--neon-gold);
    }

    100% {
        transform: scale(1);
        opacity: 0;
    }
}

@keyframes fadeInOut {
    0% {
        background: rgba(0, 0, 0, 0);
    }

    20% {
        background: rgba(0, 0, 0, 0.8);
    }

    80% {
        background: rgba(0, 0, 0, 0.8);
    }

    100% {
        background: rgba(0, 0, 0, 0);
    }
}

/* --- Arise Mechanic --- */
.shadow-extracted {
    color: var(--neon-purple) !important;
    text-shadow: 0 0 15px var(--neon-purple), 0 0 30px var(--neon-purple) !important;
    animation: shadowPulse 2s infinite alternate;
}

@keyframes shadowPulse {
    from {
        text-shadow: 0 0 10px var(--neon-purple);
    }

    to {
        text-shadow: 0 0 25px var(--neon-purple), 0 0 50px var(--neon-purple);
    }
}

/* --- Media Queries --- */
@media (max-width: 1024px) {
    .map-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
}

@media (max-width: 768px) {
    #app-container {
        padding: 220px 10px 20px;
    }

    #status-bar {
        padding: 10px;
        flex-direction: column;
        gap: 15px;
    }

    .stat-container {
        gap: 10px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .stat-box {
        font-size: 1rem;
    }

    .progress-bar-container {
        width: 100px;
    }

    .map-grid {
        grid-template-columns: 1fr;
    }

    .system-title {
        font-size: 2.5rem;
    }

    .subtitle {
        font-size: 1.2rem;
    }

    .level-up-text {
        font-size: 3rem;
        letter-spacing: 5px;
    }

    .question-box {
        padding: 20px;
    }

    .question-box h2 {
        font-size: 3rem;
    }

    .question-box h2.long-text {
        font-size: 2rem;
    }

    .options-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .answer-btn {
        min-height: 60px;
        font-size: 1rem;
        padding: 10px;
    }

    #context-prompt {
        font-size: 1rem !important;
        margin-bottom: 10px !important;
    }
}