/* CT Lab — tông xanh dương đậm, khác hẳn app chính (nâu gỗ). */

:root {
  color-scheme: dark;
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --lab-950: #071525;
  --lab-900: #0b1f3a;
  --lab-800: #123056;
  --lab-700: #1d4ed8;
  --lab-600: #2563eb;
  --lab-accent: #60a5fa;
  --lab-accent-soft: #93c5fd;
  --text-main: #e8f0ff;
  --text-muted: #9db4d4;
  --card-bg: #102848;
  --card-border: #23406a;
  --warn-bg: #3a2a12;
  --warn-border: #a16207;
  --warn-text: #fde68a;
  --ok: #34d399;
  --danger: #f87171;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: radial-gradient(ellipse at top, var(--lab-800) 0%, var(--lab-950) 72%);
  color: var(--text-main);
  display: flex;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  width: 100%;
  max-width: 560px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--lab-900) 0%, var(--lab-950) 100%);
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.45);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--card-border);
  background: rgba(7, 21, 37, 0.72);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(8px);
}

.topbar__title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  flex: 1;
}

.topbar__badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--lab-950);
  background: var(--lab-accent-soft);
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
}

.icon-btn {
  appearance: none;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  color: var(--text-main);
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 8px;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover {
  border-color: var(--lab-accent);
}

.page-content {
  padding: 1.1rem 1rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 1;
}

.hero {
  padding: 0.4rem 0 0.2rem;
}

.hero__title {
  margin: 0 0 0.4rem;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.25;
}

.hero__subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.section-title {
  margin: 0.4rem 0 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--lab-accent-soft);
}

.feature-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.feature {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  transition: border-color 160ms var(--ease), transform 160ms var(--ease);
}

a.feature:hover {
  border-color: var(--lab-accent);
  transform: translateY(-1px);
}

.feature--soon {
  opacity: 0.72;
  cursor: default;
}

.feature__row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.feature__title {
  margin: 0 0 0.25rem;
  font-size: 1rem;
  font-weight: 650;
}

.feature__desc {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.86rem;
  line-height: 1.4;
}

.badge {
  flex-shrink: 0;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  white-space: nowrap;
}

.badge--ready {
  background: rgba(52, 211, 153, 0.18);
  color: var(--ok);
  border: 1px solid rgba(52, 211, 153, 0.35);
}

.badge--soon {
  background: rgba(157, 180, 212, 0.12);
  color: var(--text-muted);
  border: 1px solid rgba(157, 180, 212, 0.25);
}

.footnote {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.warn-banner {
  margin: 0;
  padding: 0.75rem 0.85rem;
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  color: var(--warn-text);
  border-radius: 10px;
  font-size: 0.88rem;
  line-height: 1.4;
}

.panel {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.panel__label {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--lab-accent-soft);
}

.fen-input {
  width: 100%;
  min-height: 4.5rem;
  resize: vertical;
  border-radius: 8px;
  border: 1px solid var(--card-border);
  background: var(--lab-950);
  color: var(--text-main);
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 0.78rem;
  padding: 0.55rem 0.65rem;
  line-height: 1.35;
}

.fen-input:focus {
  outline: 2px solid rgba(96, 165, 250, 0.45);
  border-color: var(--lab-accent);
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.btn {
  appearance: none;
  border: 1px solid var(--card-border);
  background: var(--lab-800);
  color: var(--text-main);
  border-radius: 8px;
  padding: 0.55rem 0.85rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.btn:hover:not(:disabled) {
  border-color: var(--lab-accent);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn--primary {
  background: linear-gradient(180deg, var(--lab-600), var(--lab-700));
  border-color: #1e40af;
}

.btn--primary:hover:not(:disabled) {
  filter: brightness(1.08);
}

.field {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.field select,
.field input[type="number"] {
  border-radius: 6px;
  border: 1px solid var(--card-border);
  background: var(--lab-950);
  color: var(--text-main);
  padding: 0.35rem 0.45rem;
  font-size: 0.88rem;
}

.status-line {
  margin: 0;
  min-height: 1.3em;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.status-line--error {
  color: var(--danger);
}

.status-line--busy {
  color: var(--lab-accent-soft);
}

.board-frame {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--card-border);
  background: #1a120c;
}

.board-container {
  width: 100%;
  min-height: 280px;
}

.board-container svg {
  width: 100%;
  height: auto;
  display: block;
}

.live-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem 0.75rem;
  margin: 0.65rem 0 0;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--card-border);
  background: rgba(7, 21, 37, 0.55);
}

.live-stats[hidden] {
  display: none;
}

.live-stats > div {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.live-stats dt {
  margin: 0;
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.live-stats dd {
  margin: 0;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 0.9rem;
  color: var(--lab-accent-soft);
}

.result-card {
  background: rgba(29, 78, 216, 0.12);
  border: 1px solid rgba(96, 165, 250, 0.35);
  border-radius: 12px;
  padding: 0.9rem 1rem;
}

.result-card[hidden] {
  display: none;
}

.result-card h2 {
  margin: 0 0 0.55rem;
  font-size: 0.95rem;
}

.pv-hint {
  margin: 0 0 0.55rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.pv-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 0.7rem;
}

.pv-nav__label {
  flex: 1 1 100%;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 0.8rem;
  color: var(--lab-accent-soft);
}

.pv-cards {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.pv-card {
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  background: rgba(7, 21, 37, 0.45);
}

.pv-card--best {
  border-color: rgba(96, 165, 250, 0.55);
  background: rgba(37, 99, 235, 0.16);
}

.pv-card--active {
  border-color: rgba(52, 211, 153, 0.65);
  box-shadow: inset 0 0 0 1px rgba(52, 211, 153, 0.25);
}

.pv-card__head {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  margin-bottom: 0.35rem;
  cursor: pointer;
}

.pv-card__rank {
  font-weight: 700;
  color: var(--lab-accent);
}

.pv-card__score {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-weight: 700;
  color: var(--ok);
}

.pv-card__depth {
  margin-left: auto;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.pv-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.35rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 0.86rem;
  line-height: 1.5;
  counter-reset: pv-move;
}

.pv-list > li {
  counter-increment: pv-move;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}

.pv-list > li::before {
  content: counter(pv-move) ".";
  color: var(--text-muted);
  font-size: 0.78rem;
}

.pv-move {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0.12rem 0.35rem;
  margin: 0;
  background: rgba(15, 40, 70, 0.65);
  color: var(--lab-accent-soft);
  font: inherit;
  cursor: pointer;
}

.pv-move:hover {
  border-color: rgba(96, 165, 250, 0.55);
  color: #fff;
}

.pv-move--active {
  border-color: rgba(52, 211, 153, 0.75);
  background: rgba(16, 185, 129, 0.22);
  color: #ecfdf5;
}
