/* BỐ CỤC CHÍNH 2 CỘT */
.timer-workspace {
  display: grid;
  grid-template-columns: 350px 1fr;
  min-height: calc(100vh - 61px);
  background-color: #0b0e14;
}

/* CỘT TRÁI: SESSION & THỐNG KÊ */
.stats-sidebar {
  background-color: #11161d;
  border-right: 1px solid #222b36;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.session-box {
  background-color: #161c24;
  border: 1px solid #26303d;
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.session-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.session-top label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #8b949e;
  letter-spacing: 0.5px;
}

.session-btns {
  display: flex;
  gap: 5px;
}

.s-icon-btn {
  background-color: #0d1117;
  border: 1px solid #2b3544;
  color: #c9d1d9;
  padding: 3px 8px;
  border-radius: 5px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.s-icon-btn:hover {
  border-color: #10b981;
  color: #34d399;
}

.s-icon-btn.danger:hover {
  border-color: #f85149;
  color: #f85149;
}

.session-select {
  width: 100%;
  background-color: #0d1117;
  border: 1px solid #2b3544;
  color: #f0f6fc;
  padding: 8px 10px;
  border-radius: 7px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.session-select:focus {
  outline: none;
  border-color: #10b981;
}

/* KPI GRID */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.kpi-card {
  background-color: #161c24;
  border: 1px solid #222b36;
  border-radius: 8px;
  padding: 9px 10px;
  text-align: center;
}

.kpi-card span {
  display: block;
  font-size: 0.73rem;
  color: #8b949e;
  margin-bottom: 2px;
}

.kpi-card strong {
  font-family: monospace;
  font-size: 1.05rem;
  color: #34d399;
}

/* BIỂU ĐỒ SVG */
.chart-card {
  background-color: #161c24;
  border: 1px solid #222b36;
  border-radius: 9px;
  padding: 10px 12px;
}

.panel-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: #8b949e;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.trend-chart {
  width: 100%;
  height: 85px;
  background-color: #0d1117;
  border-radius: 6px;
  border: 1px solid #1c232d;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6e7681;
  font-size: 0.78rem;
}

.trend-chart svg {
  width: 100%;
  height: 100%;
}

/* LỊCH SỬ */
.history-card {
  flex: 1;
  background-color: #161c24;
  border: 1px solid #222b36;
  border-radius: 9px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  min-height: 200px;
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 0.74rem;
  font-weight: 700;
  color: #8b949e;
}

.btn-clear-mini {
  background: transparent;
  border: 1px solid rgba(248, 81, 73, 0.4);
  color: #f85149;
  padding: 2px 8px;
  border-radius: 5px;
  font-size: 0.73rem;
  cursor: pointer;
}

.btn-clear-mini:hover {
  background-color: rgba(248, 81, 73, 0.15);
}

.table-scroll {
  flex: 1;
  max-height: 250px;
  overflow-y: auto;
}

.solve-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
  text-align: left;
}

.solve-table th {
  color: #6e7681;
  font-size: 0.72rem;
  padding: 5px 6px;
  border-bottom: 1px solid #222b36;
  position: sticky;
  top: 0;
  background-color: #161c24;
}

.solve-table td {
  padding: 6px;
  border-bottom: 1px solid #1e2631;
  font-family: monospace;
  color: #c9d1d9;
}

.row-del-btn {
  background: transparent;
  border: none;
  color: #6e7681;
  cursor: pointer;
  font-size: 0.85rem;
}

.row-del-btn:hover {
  color: #f85149;
}

/* CỘT PHẢI: SÂN KHẤU BẤM GIỜ */
.timer-stage {
  padding: 18px 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
}

.scramble-panel {
  background-color: #11161d;
  border: 1px solid #222b36;
  border-radius: 10px;
  padding: 14px 18px;
}

.scramble-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.puzzle-switch {
  display: inline-flex;
  background-color: #0d1117;
  padding: 3px;
  border-radius: 8px;
  border: 1px solid #222b36;
}

.pz-btn {
  background: transparent;
  border: none;
  color: #8b949e;
  padding: 5px 14px;
  font-size: 0.84rem;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
}

.pz-btn.active {
  background-color: #10b981;
  color: #0d1117;
}

.wca-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.84rem;
  color: #c9d1d9;
  cursor: pointer;
  user-select: none;
}

.wca-toggle input {
  accent-color: #10b981;
  width: 16px;
  height: 16px;
}

.scramble-text {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: clamp(1.1rem, 2.3vw, 1.55rem);
  font-weight: 700;
  color: #f0f6fc;
  text-align: center;
  line-height: 1.5;
  letter-spacing: 0.8px;
}

/* ĐỒNG HỒ */
.clock-zone {
  position: relative;
  flex: 1;
  min-height: 260px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  user-select: none;
  touch-action: manipulation;
}

.clock-glow {
  position: absolute;
  width: 300px;
  height: 150px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.12) 0%, transparent 70%);
  pointer-events: none;
}

.inspection-badge {
  background-color: rgba(250, 204, 21, 0.15);
  color: #facc15;
  border: 1px solid rgba(250, 204, 21, 0.4);
  font-size: 0.76rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 99px;
  margin-bottom: 10px;
  letter-spacing: 0.5px;
}

.inspection-badge.hidden {
  display: none;
}

#timer-display {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: clamp(4.5rem, 12vw, 7.6rem);
  font-weight: 800;
  line-height: 1;
  color: #f0f6fc;
  font-variant-numeric: tabular-nums;
  z-index: 1;
}

#timer-display.holding { color: #f85149; }
#timer-display.ready { color: #10b981; }
#timer-display.inspecting { color: #facc15; }

.timer-hint {
  margin-top: 14px;
  color: #6e7681;
  font-size: 0.86rem;
  text-align: center;
}

/* THANH DƯỚI CÙNG */
.bottom-dock {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.last-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  background-color: #11161d;
  border: 1px solid #222b36;
  padding: 9px 16px;
  border-radius: 10px;
  flex-wrap: wrap;
}

.last-time-info {
  font-family: monospace;
  font-size: 0.88rem;
  color: #8b949e;
}

.penalty-group {
  display: flex;
  gap: 6px;
}

.pen-btn {
  background-color: #161c24;
  border: 1px solid #2b3544;
  color: #c9d1d9;
  padding: 5px 13px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

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

.pen-btn.active {
  background-color: #10b981;
  color: #0d1117;
  border-color: #10b981;
}

.pen-btn.del:hover:not(:disabled) {
  border-color: #f85149;
  color: #f85149;
}

.shortcut-bar {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 0.76rem;
  color: #6e7681;
}

.shortcut-bar kbd {
  background-color: #161c24;
  border: 1px solid #2b3544;
  border-radius: 4px;
  padding: 1px 5px;
  font-family: monospace;
  color: #c9d1d9;
}

@media (max-width: 860px) {
  .timer-workspace {
    grid-template-columns: 1fr;
  }
  .stats-sidebar {
    order: 2;
    border-right: none;
    border-top: 1px solid #222b36;
  }
  .timer-stage {
    order: 1;
    padding: 14px;
  }
  .shortcut-bar {
    display: none;
  }
}