/*
 * Copyright 2026 Michele Borassi
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

 :root {
    --board-color: #2e7d32;
    --line-color: #1b5e20;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #121212;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
}

h2 { /* Change 'h1' if your title uses a different tag or class */
    color: rgb(188, 240, 180);
}

#status {
    margin-bottom: 10px;
    color: rgb(188, 240, 180);
}

/* The Board Grid */
.board {
    display: grid;
    grid-template-columns: repeat(8, 50px);
    grid-template-rows: repeat(8, 50px);
    width: fit-content;
    height: fit-content;

    /* The base green color */
    background-color: rgb(0, 83, 20);

    /* Paint perfect 1px lines using a repeating linear gradient */
    background-image:
        linear-gradient(to right, rgb(16, 20, 15) 1px, transparent 1px),
        linear-gradient(to bottom, rgb(16, 20, 15) 1px, transparent 1px);

    /* Matches your cell size exactly so the lines fall in the right place */
    background-size: 50px 50px;

    /* The gradient draws top/left lines. Add borders to finish the right/bottom edges. */
    border-right: 1px solid rgb(16, 20, 15);
    border-bottom: 1px solid rgb(16, 20, 15);
}
/* Individual Squares */
.square {
    width: 100%;
    height: 100%;
    /* MUST be transparent so the background grid shows through */
    background-color: transparent;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    position: relative;
}

/* Evaluation Text */
.annotation {
    position: absolute;
    z-index: 10;
    color: rgb(188, 240, 180);
    font-size: 14px;
    font-weight: bold;
    pointer-events: none;
}

/* Add this below your existing .annotation class */
.annotation.optimal {
    color: rgb(249, 229, 52);
}

/* Base Disk Styling */
.disk {
    width: 90%;
    height: 90%;
    border-radius: 50%; /* Makes it a perfect circle */

    /* Hidden by default (CaseState.empty) */
    display: none;
}

/* Black Disk */
.disk.black {
    display: block;
    background-color: rgb(16, 20, 15);
}

/* White Disk */
.disk.white {
    display: block;
    background-color: rgb(224, 228, 219);
}

.controls {
    display: flex;
    gap: 8px; /* Slight gap between buttons */
    margin-bottom: 16px;
    width: 100%;
    /* Ensure this matches your board's width (e.g., 400px) */
    max-width: 400px;
}

.controls button {
    flex: 1; /* Distributes width equally among all buttons */
    background-color: rgb(0, 83, 20); /* primaryContainer */
    color: rgb(188, 240, 180); /* onPrimaryContainer */
    border: none;
    border-radius: 24px; /* Pill shape for Material 3 buttons */
    min-height: 48px; /* Standard minButtonSize touch target */
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
}

.controls button .material-symbols-rounded {
    font-size: 24px;
    font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

#console-output {
    margin-top: 20px;
    width: 414px;
    height: 100px;
    background: #000;
    padding: 10px;
    font-family: monospace;
    font-size: 12px;
    overflow-y: auto;
    border: 1px solid #333;
}

/* Evaluation Statistics */
.stats-container {
    width: 100%;
    /* Make sure this matches your board width */
    max-width: 400px;
    margin-top: 16px;
    margin-bottom: 16px;
    color: rgb(188, 240, 180);
    font-size: 16px;
    font-family: sans-serif;
    font-weight: 500;
}

.stats-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.container {
    width: 100%;
    max-width: 414px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

#board-input {
    width: 100%;
    height: 150px;
    background: #000;
    color: white;
    padding: 12px;
    font-family: monospace;
    font-size: 14px;
    border: 1px solid #333;
    border-radius: 8px;
    box-sizing: border-box;
    resize: vertical;
}

.evaluation-card {
  width: 100%;
  background-color: rgba(0, 83, 20, 0.2); /* Subtle green tint */
  border: 1px solid rgb(0, 83, 20);      /* Solid green border */
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  box-sizing: border-box;
}

.evaluation-header {
  color: rgb(188, 240, 180);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
  font-weight: 600;
}

#evaluation-value {
  font-family: 'Roboto Mono', monospace; /* Monospace for stable number width */
  font-size: 36px;
  font-weight: 700;
  color: white;
  display: block;
}

/* Optional: change color based on state via JS later */
#evaluation-value.thinking {
  color: rgb(188, 240, 180);
  font-size: 24px;
}

.action-button {
    background-color: rgb(0, 83, 20);
    color: rgb(188, 240, 180);
    border: none;
    border-radius: 24px;
    min-height: 48px;
    cursor: pointer;
    font-weight: bold;
    font-size: 16px;
}

.button-row {
    display: flex;
    gap: 12px;
    width: 100%;
}

.button-row .action-button {
    flex: 1; /* Makes both buttons equal width */
}

#examples {
    color: white;
    padding: 12px;
    font-family: monospace;
    font-size: 14px;
    border: 1px solid #333;
    border-radius: 8px;
    box-sizing: border-box;
    resize: vertical;
}

.example-link {
    color: rgb(188, 240, 180);
    font-family: monospace;
    word-break: break-all;
}

.example-link:hover {
    color: white;
}