/* ====================================================================
   Toepen Web — Stylesheet
   Warm parchment theme matching the original tkinter GUI
   ==================================================================== */

:root {
    --bg:       #e9e0cd;
    --table:    #ddd0b4;
    --card:     #fdfcf7;
    --card-bk:  #c9b687;
    --edge:     #a4977a;
    --ink:      #3a3a3a;
    --red:      #a93226;
    --gold:     #c9a227;
    --btn:      #d3c49d;
    --btn-hover:#c4b48a;
    --bar-bg:   #cfc3a4;
    --bar-fg:   #857550;
    --ai-tint:  #f0e5c8;
    --shadow:   rgba(0,0,0,0.12);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--bg);
    font-family: 'Inter', 'Segoe UI', sans-serif;
    touch-action: manipulation;
}

#app {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

#game-canvas {
    display: block;
    cursor: default;
    /* Slight shadow to lift the canvas */
    filter: drop-shadow(0 2px 8px var(--shadow));
}

/* ---- Loading overlay ---- */

#loading-overlay {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #e9e0cd 0%, #d8cdb4 50%, #c9bd9e 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

#loading-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loading-content {
    text-align: center;
    color: var(--ink);
}

.loading-icon {
    font-size: 72px;
    margin-bottom: 12px;
    animation: pulse 1.6s ease-in-out infinite;
    color: var(--ink);
    text-shadow: 0 2px 8px var(--shadow);
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.1); opacity: 1; }
}

.loading-content h1 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 48px;
    font-weight: 700;
    letter-spacing: 2px;
    margin-bottom: 18px;
    background: linear-gradient(135deg, var(--ink) 0%, var(--bar-fg) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

#loading-text {
    font-size: 15px;
    margin-bottom: 16px;
    color: var(--bar-fg);
}

.progress-bar {
    width: 320px;
    max-width: 80vw;
    height: 10px;
    background: var(--bar-bg);
    border-radius: 5px;
    overflow: hidden;
    margin: 0 auto 10px;
    border: 1px solid var(--edge);
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--bar-fg), var(--gold));
    border-radius: 5px;
    transition: width 0.3s ease;
}

.loading-sub {
    font-size: 12px;
    color: var(--edge);
}

/* ---- Mobile controls ---- */

#mobile-controls {
    position: fixed;
    bottom: 12px;
    right: 12px;
    display: flex;
    gap: 8px;
    z-index: 50;
}

.ctrl-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid var(--edge);
    background: var(--btn);
    color: var(--ink);
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    box-shadow: 0 2px 6px var(--shadow);
    font-family: 'Inter', sans-serif;
}

.ctrl-btn:hover,
.ctrl-btn:active {
    background: var(--btn-hover);
    transform: scale(1.08);
}

/* ---- Responsive ---- */

@media (max-width: 768px) {
    #mobile-controls {
        display: flex !important;
    }
}

@media (min-width: 769px) {
    #mobile-controls {
        display: none !important;
    }
}
