/*----------------------------------------
  Color Palette & Variables
----------------------------------------*/
:root {
  --bg:            #121212;
  --fg:            #e0e0e0;
  --panel-bg:      #1e1e1e;
  --panel-shadow:  rgba(0,0,0,0.7);
  --primary:       #66bb6a;  /* bright green */
  --secondary:     #42a5f5;  /* sky blue */
  --accent:        #ffca28;  /* amber */
  --danger:        #ef5350;
  --warning:       #ffa726;
  --info:          #29b6f6;
  --muted:         #888888;
  --radius:        8px;
  --transition:    0.2s ease-in-out;
}

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

body {
  font-family: 'Roboto', sans-serif;
  background: var(--bg);
  color: var(--fg);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-header, .app-footer {
  background: var(--panel-bg);
  text-align: center;
  padding: 1rem;
  box-shadow: 0 2px 4px var(--panel-shadow);
}

.app-header h1 {
  color: var(--primary);
  font-size: 1.5rem;
}

.app-footer p {
  color: var(--muted);
  font-size: 0.9rem;
}

.app-main {
  flex: 1;
  padding: 1rem;
}

/*----------------------------------------
  Forms & Buttons
----------------------------------------*/
.pgn-input {
  max-width: 800px;
  margin: 0 auto 2rem;
}

.pgn-input textarea {
  width: 100%;
  height: 120px;
  background: var(--panel-bg);
  border: 1px solid var(--muted);
  border-radius: var(--radius);
  padding: 0.75rem;
  color: var(--fg);
  resize: vertical;
  transition: border-color var(--transition);
}
.pgn-input textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.btn {
  display: inline-block;
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  cursor: pointer;
  transition: background-color var(--transition), transform var(--transition);
  margin-top: 0.5rem;
}
.btn.primary {
  background: var(--primary);
  color: var(--bg);
}
.btn.primary:hover {
  background: #388e3c;
}
.btn.secondary {
  background: var(--secondary);
  color: var(--bg);
}
.btn.secondary:hover {
  background: #1976d2;
}

/*----------------------------------------
  Screens
----------------------------------------*/
.screen {
  display: none;
}
.screen.active {
  display: block;
}

/*----------------------------------------
  Summary Screen
----------------------------------------*/
.summary-screen {
  max-width: 600px;
  margin: 0 auto 2rem;
  background: var(--panel-bg);
  padding: 1.5rem;
  border-radius: var(--radius);
  box-shadow: 0 2px 8px var(--panel-shadow);
  text-align: center;
}
.summary-screen h2 {
  color: var(--secondary);
  margin-bottom: 1rem;
}
.accuracy-values {
  display: flex;
  justify-content: center;
  gap: 2rem;
  font-size: 1.2rem;
  margin-bottom: 1rem;
}
.move-types {
  list-style: none;
  padding: 0;
  margin-bottom: 1rem;
}
.move-types li {
  color: var(--muted);
  margin: 0.4rem 0;
}

/*----------------------------------------
  Board + Moves Layout
----------------------------------------*/
#container {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  justify-content: center;
}
#board {
  width: 400px;
  max-width: 100%;
  background: var(--panel-bg);
  border: 2px solid var(--muted);
  border-radius: var(--radius);
  box-shadow: 0 4px 8px var(--panel-shadow);
}
#moves-table {
  flex: 1;
  min-width: 280px;
  max-width: 400px;
}
#moves-table table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 2px 8px var(--panel-shadow);
}
#moves-table th,
#moves-table td {
  padding: 0.75rem;
  text-align: center;
  border-bottom: 1px solid var(--muted);
}
#moves-table th {
  background: var(--primary);
  color: var(--bg);
  font-weight: 600;
}
#moves-table td.move-cell {
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
}
#moves-table td.move-cell:hover {
  background: var(--accent);
  transform: translateY(-2px);
}
#moves-table td.selected {
  background: var(--info);
  color: var(--bg);
}

/*----------------------------------------
  Info & Recommendation
----------------------------------------*/
.info-bar {
  text-align: center;
  margin: 1rem 0;
  font-size: 1.1rem;
  color: var(--muted);
}
.better-move-panel {
  max-width: 600px;
  margin: 1rem auto;
  background: var(--panel-bg);
  padding: 1rem;
  border-left: 6px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: 0 2px 8px var(--panel-shadow);
}
.better-move-panel h3 {
  color: var(--primary);
  margin-bottom: 0.5rem;
}
.better-move-panel p {
  color: var(--fg);
  font-size: 1.1rem;
}
.better-move-panel strong {
  color: var(--danger);
}

/*----------------------------------------
  Responsive Tweaks
----------------------------------------*/
@media (max-width: 768px) {
  #container { flex-direction: column; align-items: center; }
  .accuracy-values { flex-direction: column; gap: 1rem; }
}

/* The little tag above the piece */
.annotation {
  position: absolute;
  top: -10px;
  left: 40%;
  transform: translateX(-50%);
  background: rgba(255,255,255,0.8);
  padding: 2px 4px;
  border-radius: 100%;
  font-size: 12px;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 0 2px rgba(0,0,0,0.3);
}

/* Core annotation styles */
.annotation.best-move {
  background: rgba(0,255,0,0.8);
  color: rgb(255, 255, 255);
  border: 1px solid green;
  font-weight: bold;
}
.annotation.best-move::before {
  content: '★';
  color: green;
  font-size: 16px;
  font-weight: bold;
}

.annotation.excellent-move {
  background: rgba(27, 200, 0, 0.8);
  color: rgb(184, 255, 183);
}
.annotation.excellent-move::before {
  content: '✓';
  font-size: 14px;
}

.annotation.good-move {
  background: rgba(27, 200, 0, 0.8);
  color: rgb(184, 255, 183);
}
.annotation.good-move::before {
  content: '✓';
  font-size: 14px;
}

.annotation.inaccuracy {
  background: rgba(255,255,0,0.8);
  color: goldenrod;
  border: 1px solid goldenrod;
}
.annotation.inaccuracy::before {
  content: '!?';
  color: rgb(93,67,0);
  font-size: 14px;
}

.annotation.mistake {
  background: rgba(255,165,0,0.8);
  color: orange;
  border: 1px solid orange;
}
.annotation.mistake::before {
  content: '?';
  color: rgb(54,23,0);
  font-size: 14px;
}

.annotation.blunder {
  background: rgba(255,0,0,0.8);
  color: red;
  border: 1px solid red;
  font-weight: bold;
}
.annotation.blunder::before {
  content: '??';
  color: rgb(255,234,234);
  font-size: 14px;
  font-weight: bold;
}

/* Special tags */
.annotation.book {
  background: rgba(200,200,200,0.8);
  color: gray;
}
.annotation.book::before {
  content: '📚';
  font-size: 14px;
}

.annotation.brilliant-move {
  background: gold;
  color: darkorange;
}
.annotation.brilliant-move::before {
  content: '!!';
  font-size: 16px;
}

.annotation.great-move {
  background: rgba(0,150,255,0.8);
  color: blue;
}
.annotation.great-move::before {
  content: '!';
  font-size: 16px;
}

.annotation.miss {
  background: rgb(255,229,192);
  color: crimson;
}
.annotation.miss::before {
  content: '✗';
  font-size: 14px;
  color: rgb(93,67,0);
}

.annotation.opening-move {
  background: rgba(200,200,200,0.8);
  color: gray;
}
.annotation.opening-move::before {
  content: '⏳';
  font-size: 14px;
}

