body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #1e272e;
  color: #f5f6fa;
  margin: 0;
  padding: 0;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: #2f3640;
  border-bottom: 1px solid #4b4b4b;
}
.site-header h1 {
  margin: 0;
  font-size: 1.5rem;
}
.site-header nav {
  display: flex;
  gap: 1.25rem;
}
.site-header nav a {
  color: #74b9ff;
  text-decoration: none;
  font-weight: 500;
}
.site-header nav a:hover {
  text-decoration: underline;
}

.value-proposition {
  background: linear-gradient(135deg, #2d3436 0%, #1e272e 100%);
  border: 1px solid #4b4b4b;
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}
.value-proposition .value-lead {
  margin: 0 0 0.5rem 0;
  font-size: 1.05rem;
  line-height: 1.5;
}
.value-proposition .value-note {
  margin: 0;
  font-size: 0.95rem;
  color: #b2bec3;
  line-height: 1.45;
}

.site-footer {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid #4b4b4b;
  text-align: center;
}
.site-footer a {
  color: #74b9ff;
  text-decoration: none;
}
.site-footer a:hover {
  text-decoration: underline;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
}

h1, h2, h3 {
  margin-top: 0;
}

.card {
  background: #2f3640;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* Feedback page */
.feedback-form label {
  display: block;
  margin-top: 1rem;
  margin-bottom: 0.25rem;
  font-weight: 500;
}
.feedback-form label:first-of-type { margin-top: 0; }
.feedback-form input[type="email"] {
  width: 100%;
  max-width: 320px;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  border: 1px solid #4b4b4b;
  background: #1e272e;
  color: #f5f6fa;
}
.feedback-form textarea {
  font-family: inherit;
}
.feedback-form button {
  margin-top: 1rem;
}
.feedback-message {
  margin-top: 1rem;
  padding: 0.75rem;
  border-radius: 6px;
}
.feedback-message-success {
  background: rgba(0, 200, 100, 0.2);
  border: 1px solid rgba(0, 200, 100, 0.5);
  color: #55efc4;
}
.feedback-message-error {
  background: rgba(255, 100, 100, 0.2);
  border: 1px solid rgba(255, 100, 100, 0.5);
  color: #ff7675;
}

.feedback-list {
  margin-top: 0.5rem;
}
.feedback-list-empty {
  color: #b2bec3;
  font-style: italic;
  margin: 0;
}
.feedback-entries {
  list-style: none;
  padding: 0;
  margin: 0;
}
.feedback-entry {
  border-bottom: 1px solid #4b4b4b;
  padding: 0.75rem 0;
}
.feedback-entry:last-child {
  border-bottom: none;
}
.feedback-entry-date {
  display: block;
  font-size: 0.85rem;
  color: #b2bec3;
  margin-bottom: 0.25rem;
}
.feedback-entry-comment {
  color: #f5f6fa;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Sections 2, 3, 4 hidden until analysis completes */
.section-later {
  display: none !important;
}

textarea {
  width: 100%;
  min-height: 140px;
  border-radius: 6px;
  border: 1px solid #4b4b4b;
  padding: 0.75rem;
  font-family: monospace;
  resize: vertical;
  background: #1e272e;
  color: #f5f6fa;
}

button {
  background: #0984e3;
  border: none;
  color: white;
  padding: 0.6rem 1.2rem;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
}

button:hover {
  background: #74b9ff;
}

#result {
  font-weight: 600;
  margin-bottom: 0.5rem;
}

#mistakes ul {
  list-style: none;
  padding-left: 0;
}

#mistakes li {
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
}

#mistakes li:hover {
  background: rgba(255,255,255,0.05);
}

pre {
  background: #1e272e;
  padding: 0.75rem;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 0.85rem;
}

.mistake-view {
  margin-top: 1rem;
}

.boards-container {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.board-section {
  flex: 1;
  min-width: 300px;
  background: #2f3640;
  border-radius: 8px;
  padding: 1rem;
}

.board-section h3 {
  margin-top: 0;
  margin-bottom: 0.75rem;
  font-size: 1rem;
}

.board-section .pv-moves-list {
  max-height: 240px;
  overflow: auto;
  padding-right: 0.25rem;
}

.board-section .pv-move {
  font-size: 0.8rem;
  padding: 0.15rem 0.3rem;
}

.board-wrapper-outer {
  display: inline-block;
  position: relative;
}

.board-wrapper {
  display: flex;
  justify-content: center;
  margin-bottom: 0.75rem;
  width: 460px;
  height: 460px;
}

.board-wrapper > div,
.board-wrapper > table {
  width: 460px !important;
  height: 460px !important;
}

.replay-board-wrapper {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 0;
  margin: 0.75rem 0;
}

.replay-layout {
  display: flex;
  gap: 1rem;
  align-items: stretch;
}

.replay-left {
  width: 320px;
  flex: 0 0 320px;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.replay-center {
  flex: 0 0 auto;
  margin-left: 2.5rem;
  display: flex;
  flex-direction: column;
}

.replay-right {
  width: 380px;
  flex: 0 0 380px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

@media (max-width: 1180px) {
  .replay-layout {
    flex-direction: column;
  }
  .replay-left,
  .replay-right {
    width: 100%;
    flex: 1 1 auto;
  }
}

.replay-side-card {
  background: #1e272e;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.08);
  padding: 0.75rem;
}

.replay-side-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: #b2bec3;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.5rem;
}

.replay-mistakes-mini {
  max-height: 260px;
  overflow: auto;
}

.replay-moves-section-compact {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.replay-moves-section-compact .replay-moves-list {
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  margin-top: 0;
  min-height: 0;
}

.replay-moves-section-compact .pv-move {
  padding: 0.2rem 0.3rem;
  font-size: 0.82rem;
}

.replay-moves-section-compact .moves-row {
  grid-template-columns: 2rem 1fr 1fr;
  gap: 0.35rem;
}

.replay-moves-section-compact .move-blank {
  height: 1.2rem;
}

/* Ensure replay board renders exactly 460x460 like other boards */
#replay-board > div,
#replay-board > table {
  width: 460px !important;
  height: 460px !important;
}

.eval-bar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  margin-left: 0.5rem;
}

/* Eval bar: white at bottom, black at top; center = 0; range ±8 pawns */
.eval-bar {
  width: 20px;
  height: 460px;
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  flex-direction: column-reverse; /* black at top, white at bottom */
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.1);
}

.eval-bar-white {
  background: linear-gradient(to top, #f0d9b5, #e8d5a3);
  transition: height 0.2s ease-out;
  min-height: 2px;
}

.eval-bar-black {
  background: linear-gradient(to bottom, #2d3436, #000000);
  flex: 1;
  transition: height 0.2s ease-out;
  min-height: 2px;
}

.eval-bar-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #ffeaa7;
  min-width: 2.5em;
  text-align: center;
}

.board-with-eval {
  display: flex;
  align-items: flex-start;
  gap: 0;
  justify-content: center;
}

.board-with-eval .board-wrapper {
  margin-bottom: 0;
}

.board-with-eval .eval-bar-wrap {
  margin-left: 0.5rem;
  margin-top: 0;
}

.board-with-eval .eval-bar {
  height: 460px;
}

.replay-moves-section {
  margin-top: 1rem;
  padding: 0.75rem;
  background: #1e272e;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.08);
}

.replay-moves-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #b2bec3;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.replay-moves-list {
  min-height: 2rem;
}

.replay-info {
  margin: 0.5rem 0;
  font-size: 1rem;
  color: #ffeaa7;
  font-weight: 600;
}

.replay-hint {
  margin-top: 0;
  margin-bottom: 0.5rem;
  color: #b2bec3;
  font-size: 0.9rem;
}

.board-nav {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 0.75rem;
}

.board-nav button {
  padding: 0.4rem 0.8rem;
  font-size: 0.9rem;
}

.board-nav button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.board-nav .board-nav-reset {
  background: #e17055;
  color: #fff;
}

.board-nav .board-nav-reset:hover {
  background: #fdcb6e;
  color: #2d3436;
}

.pv-moves-list {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.85rem;
}

.moves-table {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.moves-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
}

@media (max-width: 860px) {
  .moves-columns {
    grid-template-columns: 1fr;
  }
}

.moves-row {
  display: grid;
  grid-template-columns: 2.6rem 1fr 1fr;
  gap: 0.4rem;
  align-items: center;
}

.move-num {
  color: #b2bec3;
  text-align: right;
  font-variant-numeric: tabular-nums;
  padding-right: 0.1rem;
}

.move-blank {
  height: 1.65rem;
}

.move-span-all {
  grid-column: 2 / span 2;
  justify-self: start;
}

.pv-move {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  cursor: pointer;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  white-space: nowrap;
}

.pv-move:hover {
  background: rgba(255,255,255,0.12);
}

.pv-move.current {
  background: rgba(129, 236, 236, 0.25);
  border-color: #81ecec;
  font-weight: 600;
}

.pv-move.start {
  color: #b2bec3;
}

.board-arrows-overlay {
  position: absolute;
  left: 0;
  top: 0;
  width: 460px;
  height: 460px;
  pointer-events: none;
}

.board-info {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  color: #b2bec3;
}

.material-info {
  margin-top: 0.75rem;
  padding: 0.5rem;
  background: #1e272e;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.85rem;
}

.analysis-status {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: #1e272e;
  border-radius: 4px;
  font-size: 0.9rem;
  color: #81ecec;
  min-height: 2.5em;
  max-height: 80px;
  overflow-y: auto;
  border: 1px solid rgba(129, 236, 236, 0.2);
  white-space: pre-wrap;
  word-wrap: break-word;
}

.explanation {
  margin-top: 1rem;
  padding: 0.75rem;
  background: #1e272e;
  border-radius: 4px;
  line-height: 1.5;
}

.mistakes-hint {
  margin: 0 0 0.75rem 0;
  font-size: 0.9rem;
  color: #b2bec3;
}

.mistakes-empty {
  padding: 0.5rem 0;
  color: #b2bec3;
}

.mistakes-summary {
  margin-bottom: 1rem;
}

.mistakes-summary h3,
.mistakes-by-phase h3 {
  margin-bottom: 0.5rem;
}

.mistakes-summary-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.mistakes-summary-card {
  flex: 1;
  min-width: 220px;
  background: #1e272e;
  border-radius: 6px;
  padding: 0.6rem 0.8rem;
}

.phase-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.phase-total {
  font-size: 0.9rem;
  color: #b2bec3;
  margin-bottom: 0.35rem;
}

.phase-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
}

.badge-inaccuracy {
  background: rgba(129, 236, 236, 0.15);
  color: #81ecec;
}

.badge-mistake {
  background: rgba(255, 234, 167, 0.15);
  color: #ffeaa7;
}

.badge-blunder {
  background: rgba(255, 118, 117, 0.15);
  color: #ff7675;
}

.mistakes-by-phase {
  margin-top: 0.75rem;
}

.phase-group {
  margin-bottom: 1.25rem;
  background: #1e272e;
  border-radius: 8px;
  padding: 0.75rem 1rem;
}

.phase-group-title {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  font-weight: 600;
}

.phase-group-title .phase-count {
  font-weight: 400;
  color: #b2bec3;
  font-size: 0.9rem;
}

.phase-mistakes-visual {
  margin-top: 0.25rem;
}

.phase-no-mistakes {
  margin: 0;
  color: #b2bec3;
  font-size: 0.9rem;
}

.phase-mistake-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.5rem;
}

.mistake-card {
  cursor: pointer;
  padding: 0.5rem 0.6rem;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.03);
  transition: background 0.15s, border-color 0.15s;
}

.mistake-card:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.2);
}

.mistake-card-move {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.15rem;
}

.mistake-card-severity {
  font-size: 0.8rem;
  margin-bottom: 0.1rem;
}

.mistake-card-san {
  font-size: 0.85rem;
  color: #b2bec3;
}

.mistake-card.sev-inaccuracy .mistake-card-severity { color: #81ecec; }
.mistake-card.sev-mistake .mistake-card-severity { color: #ffeaa7; }
.mistake-card.sev-blunder .mistake-card-severity { color: #ff7675; }

.mistake-list {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.mistake-item {
  margin-bottom: 0.25rem;
}

.mistake-link {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 4px;
  padding: 0.35rem 0.5rem;
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
}

.mistake-link:hover {
  background: rgba(255,255,255,0.05);
}

.mistake-move {
  font-weight: 600;
  min-width: 70px;
}

.mistake-severity {
  font-size: 0.85rem;
}

.mistake-move-san {
  font-size: 0.85rem;
  color: #dfe6e9;
}

.sev-inaccuracy .mistake-severity {
  color: #81ecec;
}

.sev-mistake .mistake-severity {
  color: #ffeaa7;
}

.sev-blunder .mistake-severity {
  color: #ff7675;
}

.app-version {
  margin-top: 1rem;
  font-size: 0.8rem;
  color: #636e72;
}


