/* Copied from uttt/static/css/game_styles.css, scoped to #uttt-ai so it doesn't leak into base.html */
#uttt-ai.content-layout {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(260px, 1fr) 2fr;
    min-height: calc(100vh - 160px);
    gap: 1rem;
    padding-inline: 16px;
}

#uttt-ai .info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    align-self: center;
    justify-self: center;
    width: 100%;
    max-width: 360px;
}

#uttt-ai .board-container {
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 160px);
}

#uttt-ai.content-layout.with-analysis {
    grid-template-columns: minmax(240px, 1fr) 2fr minmax(300px, 1.2fr);
}

#uttt-ai #board-wrap {
    position: relative;
    width: min(88vmin, 100% - 24px, 760px);
    aspect-ratio: 1 / 1;
    margin: 28px auto 20px 24px;
}

#uttt-ai #coords-top, #uttt-ai #coords-left {
    position: absolute;
    display: grid;
    color: #888;
    font-size: 0.8rem;
    text-align: center;
    pointer-events: none;
}

#uttt-ai #coords-top {
    left: 0;
    right: 0;
    top: -22px;
    grid-template-columns: repeat(9, 1fr);
}

#uttt-ai #coords-left {
    top: 0;
    bottom: 0;
    left: -20px;
    grid-template-rows: repeat(9, 1fr);
    align-items: center;
}

/* ---------------- analysis */
#uttt-ai #analysis-section {
    align-self: center;
    width: 100%;
    max-width: 420px;
    max-height: 96vh;
    overflow-y: auto;
}

#uttt-ai #eval-graph-wrap {
    border: 1px solid #ccc;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
}

#uttt-ai #eval-graph {
    display: block;
    width: 100%;
    height: 120px;
}

#uttt-ai #move-list {
    display: grid;
    grid-template-columns: 2.5rem 1fr 1fr;
    max-height: 30vh;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

#uttt-ai #move-list .num {
    background: #f3f3f3;
    color: #888;
    text-align: center;
    padding: 2px 0;
}

#uttt-ai #move-list .mv {
    padding: 2px 8px;
    cursor: pointer;
}

#uttt-ai #move-list .mv:hover { background: #eef4ff; }
#uttt-ai #move-list .mv.selected { background: #cfe0ff; font-weight: bold; }

#uttt-ai .mark-inaccuracy { color: #d4a000; font-weight: bold; }
#uttt-ai .mark-mistake { color: #e07000; font-weight: bold; }
#uttt-ai .mark-blunder { color: #d00000; font-weight: bold; }

#uttt-ai .cell.best-move {
    outline: 3px dashed #1e9e3a;
    outline-offset: -5px;
}

#uttt-ai .cell .ghost {
    opacity: 0.3;
    width: 80%;
    height: 80%;
    display: flex;
    align-items: center;
    justify-content: center;
}

#uttt-ai .cell .ghost svg { width: 100%; height: 100%; }

#uttt-ai #game-board {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    grid-template-rows: repeat(9, 1fr);
    width: 100%;
    height: 100%;
    gap: 0;
}

#uttt-ai .cell {
    aspect-ratio: 1 / 1;
    border: 1px solid #999;
    background-color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    cursor: pointer;
    box-sizing: border-box;
    transition: background-color 0.15s;
}

#uttt-ai .cell.legal {
    background-color: lightgreen;
}

#uttt-ai .cell.legal:hover {
    background-color: #7fd67f;
}

#uttt-ai .cell.last-move {
    background-color: #fff3a0;
}

#uttt-ai .cell.win-x { background-color: #dbe7ff; }
#uttt-ai .cell.win-o { background-color: #ffdede; }
#uttt-ai .cell.drawn { background-color: #e9e9e9; }

#uttt-ai .thick-right-border {
    border-right-width: 3px;
    border-right-color: #333;
}

#uttt-ai .thick-bottom-border {
    border-bottom-width: 3px;
    border-bottom-color: #333;
}

/* big X / O drawn over won sections */
#uttt-ai #section-overlay {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    pointer-events: none;
}

#uttt-ai .section-mark {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.55;
}

#uttt-ai .section-mark svg {
    width: 85%;
    height: 85%;
}

#uttt-ai #player-indicator {
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#uttt-ai #player-indicator svg {
    width: 24px;
    height: 24px;
}

#uttt-ai #player-name {
    font-size: 1.4rem;
    margin-bottom: 0.25rem;
    font-weight: bold;
}

#uttt-ai #turn-indicator {
    font-size: 1.2rem;
    font-weight: bold;
}

@media (max-width: 1100px) {
    #uttt-ai.content-layout, #uttt-ai.content-layout.with-analysis {
        grid-template-columns: 1fr;
    }
    #uttt-ai #analysis-section {
        justify-self: center;
        max-height: none;
        margin-bottom: 16px;
    }
    #uttt-ai .board-container {
        min-height: auto;
    }
    #uttt-ai .info {
        padding-top: 16px;
    }
}
