* {
    box-sizing: border-box;
}
	
html, body {
    height: 100%;
    margin: 0;
}
	
body {
    margin: 0;
    background: #0b0b10;
    font-family: Arial, Helvetica, sans-serif;
    color: #aaa;
	 display: flex;
    flex-direction: column;
}

.header {

    height: 48px;
    min-height: 48px;

    display: flex;
    align-items: center;

    padding: 0 28px;

    border-bottom: 1px solid #1a1a22;

    background: #0d0f16;

}

.logo {

    font-size: 18px;
    font-weight: bold;
    color: #ddd;

    margin-right: 48px;

}

.nav {

    display: flex;
    gap: 8px;

}

.nav-link {

    color: #888;

    text-decoration: none;

    font-size: 13px;

    letter-spacing: 1px;

    padding: 8px 14px;

    border-radius: 6px;

    transition:
        background 0.2s,
        color 0.2s;

}

.nav-link:hover {

    background: #1b1f2c;

    color: #ddd;

}

.nav-link.active {

    background: #242b3f;

    color: white;

}
/* Main container: 3 columns */
.main {
    flex: 1;                 /* fill remaining space between header and footer */
    display: flex;
    justify-content: center;  /* center horizontally */
    align-items: center;      /* center vertically */
    gap: 40px;
    padding: 20px;
}

/* Column wrappers */
.column {
    display: flex;
    flex-direction: column;
    gap: 20px;
}


/* Left column: Fumen input + Uploaded runs */
.fumen-panel, .uploaded-runs-panel, .saved-runs-panel{
    width: 350px;
    padding: 18px;
    background: #11131a;
    border: 2px solid #1f2230;
    box-shadow: 0 0 25px rgba(0,0,0,0.8);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.fumen-title, .uploaded-title {
    font-size: 11px;
    letter-spacing: 1px;
    color: #666;
}

#fumen-input {
    resize: none;
    background: #0e1016;
    border: 1px solid #1f2230;
    padding: 10px;
    color: #ddd;
    font-family: monospace;
    font-size: 12px;
    outline: none;
    transition: border 0.2s, box-shadow 0.2s;
}

#fumen-input:focus {
    border: 1px solid #2a2f44;
    box-shadow: 0 0 8px rgba(60,80,140,0.4);
}

#load-fumen, #analyse-frame, #save-current-run {
    height: 34px;
    background: #1a1d2a;
    border: 1px solid #2a2f44;
    color: #aaa;
    font-size: 11px;
    letter-spacing: 1px;
    cursor: pointer;
    transition: background 0.2s, border 0.2s;
}

#analyse-frame {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

	
#load-fumen:disabled,
#analyse-frame:disabled, #save-current-run:disabled {
    background: #12141d;          /* darker */
    border: 1px solid #1c1f2d;    /* softer border */
    color: #555;                  /* muted text */
    cursor: not-allowed;
    opacity: 0.7;
}
	
/* Make button content align nicely */
#analyse-frame {
    display:flex;
    align-items:center;
    justify-content:center;
    gap:8px;
}

/* Spinner */
.button-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.2);
    border-top: 2px solid #aaa;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

/* Spin animation */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

#load-fumen:hover {
    background: #22263a;
    border: 1px solid #3a4170;
}
	
#uploaded-table, #saved-runs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

#uploaded-table th, #uploaded-table td, #saved-runs-table th, #saved-runs-table td {
    border: 1px solid #1f2230;
    padding: 6px;
    text-align: left;
    color: #ddd;
}

#uploaded-table th, #saved-runs-table th{
    background: #1a1d2a;
    color: #aaa;
}


/* Game area wrapper: width only as needed */
.game-area-wrapper {
    display: flex;
    align-items: flex-start; /* keep top aligned for left/right panels */
    gap: 60px;
}

/* Game area: board + sides */
.game-area {
    display: flex;
    align-items: flex-start;
    gap: 60px;
}

/* Board styling */
.board-container {
    padding: 8px;
    background: #11131a;
    border: 2px solid #1f2230;
    box-shadow: 0 0 25px rgba(0,0,0,0.8);
}

canvas {
    display: block;
    background: #151826;
}

/* Side hold / queue */
.side {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
}

.label {
    font-size: 11px;
    letter-spacing: 1px;
    color: #666;
}

.piece-grid {
    display: grid;
    grid-template-columns: repeat(4, 16px);
    grid-template-rows: repeat(4, 16px);
}

.mini-cell {
    width: 16px;
    height: 16px;
    background: transparent;
}

/* Frame controls */
#frame-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    color: #aaa;
    font-size: 18px;
    margin-bottom:5px;
}

#frame-controls div {
    cursor: pointer;
}

#frame-indicator {
    font-size: 14px;
    cursor: default;
}

/* Right column: Analysis panel */
.analysis-panel {
    width: 280px;
    padding: 18px;
    background: #11131a;
    border: 2px solid #1f2230;
    box-shadow: 0 0 25px rgba(0,0,0,0.8);
    display: flex;
    flex-direction: column;
    gap: 12px;
	height:200px;
}

.analysis-title {
    font-size: 11px;
    letter-spacing: 1px;
    color: #666;
}
	
	.load-triangle {
    width: 0;
    height: 0;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-left: 12px solid #00ff00; /* bright green */
    cursor: pointer;
    margin: auto; /* center in the table cell */
    transition: transform 0.2s;
}
	
.clear-button {
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

.icon {
    width: 18px;
    height: 18px;
    stroke: #cc0000;
    stroke-width: 2;
    fill: none;
    transition: transform 0.2s, stroke 0.2s;
}

.clear-button:hover .icon {
    transform: scale(1.2);
    stroke: #ff0000;
}
#uploaded-table tbody tr.run-active {
    outline: 2px solid gold;
    outline-offset: -2px;
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.6);
}

.site-footer {
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    letter-spacing: 1px;
    color: #555;
    border-top: 1px solid #1a1a22;
    background: #0b0b10;
    flex-shrink: 0;
}

	#play-run, #stop-run{
		height: 34px;    
		   padding: 6px 16px;
        background: #1a1d2a;
        border: 1px solid #2a2f44;
        color: #aaa;
        font-size: 12px;
        letter-spacing: 1px;
        cursor: pointer;
        transition: background 0.2s, border 0.2s;
	}
	
.analysis-box {
    background: #0e1016;
    border: 1px solid #1f2230;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.analysis-label {
    font-size: 11px;
    letter-spacing: 1px;
    color: #666;
}

.analysis-text {
    font-size: 14px;
    color: #ccc;
    line-height: 1.6;
}

/* Highlighted dynamic values */
.analysis-highlight {
    color: #ddd;
    font-weight: 600;
    padding: 2px 6px;
    background: #1a1d2a;
    border: 1px solid #2a2f44;
}

/* Optional: subtle piece color hook */
.analysis-highlight.piece {
    letter-spacing: 1px;
}
	
.analysis-results-box {
	margin-top:10px;
}
	
/* Smooth transition */
#analysis-panel {
    transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

/* Correct move */
.analysis-correct {
    box-shadow:
        0 0 12px rgba(0, 255, 120, 0.35),
        0 0 24px rgba(0, 255, 120, 0.15);
}

/* Wrong move */
.analysis-incorrect {
    box-shadow:
        0 0 12px rgba(255, 60, 60, 0.35),
        0 0 24px rgba(255, 60, 60, 0.15);
}

.current-run-card {

    background: #171923;
    border: 1px solid #303342;
    border-radius: 8px;
    margin-top:5px;
    padding: 15px;

}


.run-name {

    font-size: 18px;
    font-weight: bold;

    margin-bottom: 15px;

}



.run-stats {

    display:flex;
    justify-content:space-between;

    margin-bottom:15px;

}



.run-stat {

    display:flex;
    flex-direction:column;

    text-align:center;

}



.stat-label {

    font-size:12px;
    opacity:0.7;

}



.run-frame-info {

    text-align:center;

    margin-bottom:15px;

    color:#aaa;

}



#save-current-run {

    width:100%;

}

.columns-wrapper{
    display:flex;
    align-items:flex-start;   /* instead of center */
    justify-content:center;
    gap:32px;
    margin-top:20px;
}

.center-column{
    width:560px;              /* a bit wider */
    display:flex;
    flex-direction:column;
    align-items:center;
    gap:10px;
}

.timeline-panel{

    width:100%;

    padding:5px 16px 16px 16px;

    border-radius:12px;

    background:#20242d;
    height:182px;
}

#timeline{

    display:flex;
    gap:12px;

    overflow-x:auto;

    padding: 3px 3px 10px 3px;

}

.timeline-frame{

    cursor:pointer;

    flex:0 0 auto;

}

.timeline-frame.active{

    outline:3px solid gold;

}

.timeline-frame-num{
    text-align:center;
    margin-bottom:3px;
}

#saved-runs-table th:nth-child(5),
#saved-runs-table th:nth-child(6),
#saved-runs-table td:nth-child(5),
#saved-runs-table td:nth-child(6) {

    width: 35px;
    text-align:center;
    padding:4px;

}

.load-triangle:hover {
    transform: scale(1.2);
}

.clear-button {
    height:20px;
}

#saved-runs-table th,
#saved-runs-table td {
    text-align: center;
    vertical-align: middle;
}

.clear-button,
.load-triangle {
    margin: auto;
}

.analysis-progress {
    position: relative;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-width: 70px; /* whatever comfortably fits "99 / 99" */
}

#analysis-status-spinner {
    position: absolute;
    right: -3px;
    transform: translateY(-50%);
}

.timeline-frame.analysis-correct {

    box-shadow:
        0 0 8px rgba(0,255,120,0.7),
        0 0 18px rgba(0,255,120,0.4);

}


.timeline-frame.analysis-incorrect {

    box-shadow:
        0 0 8px rgba(255,60,60,0.7),
        0 0 18px rgba(255,60,60,0.4);

}

.page-panel {

    width: 100%;
    max-width: 1200px;
    min-height: 650px;

    padding: 40px;

    background: #11131a;
    border: 2px solid #1f2230;
    border-radius: 8px;

    box-shadow: 0 0 25px rgba(0, 0, 0, 0.8);

    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;

}

.page-title {

    margin: 0;

    font-size: 32px;
    font-weight: 600;

    color: #ddd;

}

.page-subtitle {

    margin-top: 16px;

    font-size: 15px;

    color: #777;

}

.primary-button {
    height: 34px;
    background: #1a1d2a;
    border: 1px solid #2a2f44;
    color: #aaa;
    font-size: 11px;
    letter-spacing: 1px;
    cursor: pointer;
    transition: background 0.2s, border 0.2s;
}

.primary-button:hover {
    background: #22263a;
    border: 1px solid #3a4170;
}

.primary-button:disabled {
    background: #12141d;
    border: 1px solid #1c1f2d;
    color: #555;
    cursor: not-allowed;
    opacity: 0.7;
}

.spinner {
    width: 14px;
    height: 14px;
    border: 2px solid #bbb;
    border-top-color: #fff;
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
    animation: spin .8s linear infinite;
}

.hidden {
    display: none;
}

.generation-status {
    margin-top: 8px;
    min-height: 20px;
    color: #bbb;
    font-size: .9rem;
}

@keyframes spin {

    to {
        transform: rotate(360deg);
    }

}