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

body {
    font-family: 'Faustina', serif;
    background: #000;
    overflow: hidden;
    height: 100vh;
    margin: 0;
    padding: 0;
}

.game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    background: #000;
    margin: 0;
    padding: 0;
}

.background-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 1s ease-in-out;
    z-index: 1;
}

.background-image.active {
    opacity: 1;
}

.bust-image {
    position: absolute;
    bottom: 40px;
    height: 65%;
    width: auto;
    z-index: 5; /* Above background, below dialog */
    transition: opacity ease-in-out;
}

.bust-image.left {
    left: 3%;
     transform: translateX(-3%);
}

.bust-image.right {
    right: 3%;
    transform: translateX(3%);
}

.dialog-container {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    background-image: url('https://i.imgur.com/sQ62x3q.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    width: 60%;
    height: 25%;
    padding: 30px 60px 40px 60px;
    transition: opacity 0.5s ease-in-out;
    z-index: 10;
    opacity: 0;
    pointer-events: none;
}

.dialog-container.active {
    opacity: 1;
    pointer-events: auto;
}

.dialog-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    justify-content: center;
}

.dialog-line {
    height: 33.33%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow: hidden;
}

.speaker-line {
    color: #ffffff;
    font-weight: 600;
    font-size: 3.1vmin;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
}

.text-line {
    color: #ffffff;
    font-size: 3.1vmin;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
    padding: 0 10px;
}

.controls {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 100;
    background: rgba(15, 15, 15, 0.95);
    padding: 16px 20px;
    border-radius: 12px;
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    min-width: 300px;
    font-family: 'Faustina', serif;
}

.controls.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px);
}

.controls button {
    background: #4a90e2;
    color: white;
    border: none;
    padding: 8px 12px;
    margin: 2px;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'Faustina', serif;
    font-size: 1.2em;
    transition: all 0.3s;
    min-width: 40px;
}

.controls button:hover {
    background: #357abd;
    transform: translateY(-1px);
}

.controls button:disabled {
    background: #666;
    cursor: not-allowed;
    transform: none;
}

.controls-header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.controls-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 4px;
    padding-top: 0px;
}

.controls-title {
    color: rgba(255, 255, 255, 0.35);
    font-size: 0.7em;
    font-weight: 300;
    letter-spacing: 0.3px;
    text-transform: lowercase;
    font-family: 'Faustina', serif;
    opacity: 0.9;
}

.controls-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    align-items: center;
}

.editor-btn {
    grid-column: span 2;
}

.nav-controls {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    margin-top: 8px;
}

.debug-area {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100;
}

.debug-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
}

.github-link-debug {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    transition: all 0.3s ease;
    padding: 8px 12px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(15, 15, 15, 0.95);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.85em;
    font-family: 'Faustina', serif;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.github-link-debug:hover {
    color: #fff;
    background: rgba(74, 144, 226, 0.15);
    border-color: rgba(74, 144, 226, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 144, 226, 0.2);
}

.github-link-debug .github-icon {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.debug-info {
    background: rgba(0,0,0,0.8);
    color: #fff;
    padding: 12px;
    border-radius: 6px;
    font-size: 0.9em;
    border: 1px solid #333;
    min-width: 120px;
    text-align: center;
    font-family: 'Faustina', serif;
}

.github-link-debug {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    transition: all 0.3s ease;
    padding: 8px 12px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(15, 15, 15, 0.95);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.85em;
    font-family: 'Faustina', serif;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.github-link-debug:hover {
    color: #fff;
    background: rgba(74, 144, 226, 0.15);
    border-color: rgba(74, 144, 226, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 144, 226, 0.2);
}

.github-link-debug .github-icon {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.debug-info {
    background: rgba(0,0,0,0.8);
    color: #fff;
    padding: 12px;
    border-radius: 6px;
    font-size: 0.9em;
    border: 1px solid #333;
    min-width: 120px;
    text-align: center;
    font-family: 'Faustina', serif;
}

.text-line strong {
    font-weight: bold;
}

.text-line em {
    font-style: italic;
}

.text-line span[style*="text-decoration: underline"] {
    text-decoration: underline;
}

.glitch-char {
    color: var(--text-color, #000000);
    transition: color 0s; /* No transition to prevent color bleeding */
    display: inline-block;
    width: 1ch;
    text-align: center;
    font-family: 'Courier New', 'Monaco', monospace;
    min-width: 1ch;
}

.glitch-container .glitch-char {
    transition: none;
}

.speaker-line .glitch-char {
    font-weight: 600;
    font-size: inherit;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    font-family: 'Courier New', 'Monaco', monospace;
}

.text-line .glitch-char {
    font-size: inherit;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
    font-family: 'Courier New', 'Monaco', monospace;
}

.loading-indicator {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(15, 15, 15, 0.95);
    color: #4a90e2;
    padding: 12px 20px;
    border-radius: 8px;
    font-family: 'Faustina', serif;
    font-size: 0.9em;
    z-index: 150;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(74, 144, 226, 0.3);
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.loading-indicator.active {
    opacity: 1;
    transform: translateY(0);
}

.loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(74, 144, 226, 0.3);
    border-top: 2px solid #4a90e2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.controls button:disabled {
    background: #666;
    cursor: not-allowed;
    transform: none;
    opacity: 0.5;
}

.controls button:disabled:hover {
    background: #666;
    transform: none;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.controls.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px);
}

.debug-area {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100;
    transition: all 0.3s ease;
}

.debug-area.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px);
}

.start-message {
    position: fixed;
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 80;
    background: rgba(15, 15, 15, 0.85);
    color: rgba(255, 255, 255, 0.8);
    padding: 6px 12px;
    border-radius: 8px;
    font-family: 'Faustina', serif;
    font-size: 0.9em;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    opacity: 0;
    pointer-events: none;
}

.start-message.active {
    opacity: 1;
}

.controls button:disabled {
    background: #666 !important;
    cursor: not-allowed !important;
    transform: none !important;
    opacity: 0.5;
}

.controls button:disabled:hover {
    background: #666 !important;
    transform: none !important;
}
