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

body {
    background: #0a0a0a;
    color: #e0e0e0;
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
    overflow-x: hidden;
    overflow-y: auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Top bar */
.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: rgba(10, 10, 10, 0.85);
    backdrop-filter: blur(8px);
    z-index: 100;
    border-bottom: 1px solid #222;
}

.top-bar h1 {
    font-size: 14px;
    font-weight: 600;
    color: #ccc;
    letter-spacing: 0.5px;
}

.top-bar select {
    background: #1a1a1a;
    color: #e0e0e0;
    border: 1px solid #333;
    border-radius: 4px;
    padding: 4px 8px;
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
}

.top-bar select:hover {
    border-color: #555;
}

/* Canvas container */
.canvas-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 44px;
    flex-shrink: 0;
}

#nca-canvas {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    cursor: crosshair;
    /* CSS-scale to fill viewport (maintaining aspect ratio, leaving room for top bar) */
    width: min(90vw, calc(100vh - 60px));
    height: min(90vw, calc(100vh - 60px));
    border: 1px solid #222;
}

/* HUD overlay */
#hud {
    position: fixed;
    top: 44px;
    left: 8px;
    font-size: 13px;
    line-height: 1.5;
    background: rgba(0, 0, 0, 0.7);
    padding: 6px 10px;
    border-radius: 4px;
    pointer-events: none;
    z-index: 50;
    min-width: 180px;
}

#hud span {
    display: block;
}

/* Help overlay */
#help-overlay {
    display: none;
    position: fixed;
    top: 44px;
    right: 8px;
    font-size: 13px;
    line-height: 1.6;
    background: rgba(0, 0, 0, 0.85);
    padding: 10px 14px;
    border-radius: 4px;
    border: 1px solid #333;
    z-index: 50;
    color: #8cf;
}

#help-overlay .help-title {
    color: #fff;
    font-weight: 600;
    margin-bottom: 4px;
    border-bottom: 1px solid #333;
    padding-bottom: 4px;
}

#help-overlay .help-key {
    color: #ff9;
    display: inline-block;
    min-width: 70px;
}

/* Loading overlay */
#loading {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 10, 10, 0.95);
    color: #888;
    font-size: 16px;
    z-index: 200;
}

/* Touch hint (mobile) */
.touch-hint {
    display: none;
    position: fixed;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    color: #666;
    z-index: 50;
}

@media (hover: none) and (pointer: coarse) {
    .touch-hint {
        display: block;
    }
}

/* Scroll hint */
.scroll-hint {
    position: fixed;
    bottom: 20px;
    left: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    color: #666;
    z-index: 50;
    cursor: pointer;
    transition: color 0.2s, opacity 0.4s;
    animation: nudge 2s ease-in-out infinite;
}

.scroll-hint:hover {
    color: #aaa;
}

.scroll-hint.hidden {
    opacity: 0;
    pointer-events: none;
}

.scroll-hint-label {
    font-size: 11px;
}

.scroll-hint-arrow {
    width: 14px;
    height: 14px;
}

@keyframes nudge {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(4px); }
}

/* Info section */
.info-section {
    width: 100%;
    max-width: 720px;
    padding: 40px 24px 60px;
    flex-shrink: 0;
}

.info-content h2 {
    font-size: 14px;
    font-weight: 600;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 28px;
    margin-bottom: 10px;
    padding-bottom: 4px;
    border-bottom: 1px solid #1a1a1a;
}

.info-content h2:first-child {
    margin-top: 0;
}

.info-content p,
.info-content li {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.7;
    color: #999;
    margin-bottom: 10px;
}

.info-content strong {
    color: #ccc;
    font-weight: 500;
}

.info-content ol,
.info-content ul {
    padding-left: 20px;
    margin-bottom: 10px;
}

.info-content li {
    margin-bottom: 4px;
}

.info-footer {
    margin-top: 24px;
    font-size: 12px !important;
    color: #555 !important;
}
