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

:root {
  --bg-color: #F5F0E8;
  --text-color: #333;
  --text-muted: #666;
  --border-color: #ddd;
  --positive-color: #2A9D8F;
  --negative-color: #E63946;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-color);
  color: var(--text-color);
  min-height: 100vh;
  padding: 20px;
}

.app {
  max-width: 1400px;
  margin: 0 auto;
}

.app-title {
  text-align: center;
  margin-bottom: 30px;
  font-size: 24px;
  font-weight: 600;
  color: var(--text-color);
}

/* Upload Section */
.upload-section {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 400px;
}

.drop-zone {
  width: 100%;
  max-width: 500px;
  padding: 60px 40px;
  border: 2px dashed var(--border-color);
  border-radius: 12px;
  background: white;
  cursor: pointer;
  transition: all 0.2s ease;
}

.drop-zone:hover,
.drop-zone.dragover {
  border-color: var(--positive-color);
  background: #f9fdfb;
}

.drop-zone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.upload-icon {
  width: 48px;
  height: 48px;
  color: var(--text-muted);
}

.drop-zone-text {
  font-size: 16px;
  font-weight: 500;
}

.drop-zone-hint {
  font-size: 14px;
  color: var(--text-muted);
}

/* Result Section */
.result-section {
  width: 100%;
}

.toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  justify-content: center;
}

.btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn svg {
  width: 18px;
  height: 18px;
}

.btn-primary {
  background: var(--positive-color);
  color: white;
}

.btn-primary:hover {
  background: #238b7e;
}

.btn-secondary {
  background: white;
  color: var(--text-color);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: #f5f5f5;
}

.dashboard-container {
  overflow-x: auto;
}

/* Dashboard */
.dashboard {
  background: var(--bg-color);
  padding: 30px;
  min-width: 1000px;
}

/* Header */
.header {
  margin-bottom: 10px;
}

.date {
  font-size: 16px;
  color: #1D3557;
  font-weight: 700;
}

.date-tag {
  display: inline-block;
  border: 2px solid #1D3557;
  padding: 5px 12px;
  border-radius: 6px;
  background: white;
}

/* Player Header Row */
.player-header-row {
  display: grid;
  grid-template-columns: 80px repeat(var(--player-count, 10), 1fr);
  gap: 10px;
  margin-bottom: 5px;
}

.player-name-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.player-name {
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.player-color-bar {
  width: 80%;
  height: 4px;
  border-radius: 2px;
}

/* NET Row */
.net-row {
  display: grid;
  grid-template-columns: 80px repeat(var(--player-count, 10), 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.label-cell {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  display: flex;
  align-items: center;
}

.net-cell {
  font-size: 14px;
  font-weight: 600;
  text-align: center;
}

/* PNL Chart */
.pnl-chart-container {
  display: flex;
  gap: 10px;
  height: 250px;
  margin-bottom: 30px;
}

.y-axis {
  width: 60px;
  position: relative;
  flex-shrink: 0;
}

.y-label {
  position: absolute;
  right: 10px;
  font-size: 11px;
  color: var(--text-muted);
  transform: translateY(-50%);
}

.y-label.zero {
  font-weight: 600;
}

.bars-container {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(var(--player-count, 10), 1fr);
  gap: 10px;
  position: relative;
  padding: 0 20px;
}

.grid-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  border-top: 1px dashed #ccc;
}

.grid-line.zero-line {
  border-top: 1px dashed #999;
}

.bar-wrapper {
  position: relative;
  height: 100%;
}

.bar {
  position: absolute;
  left: 10%;
  right: 10%;
  display: flex;
  flex-direction: column;
  border-radius: 3px;
  overflow: hidden;
  transition: opacity 0.2s;
  cursor: pointer;
}

.bar.wins-bar {
  flex-direction: column-reverse; /* Stack from bottom up for wins */
}

.bar.losses-bar {
  flex-direction: column; /* Stack from top down for losses */
}

.bar:hover {
  opacity: 0.85;
}

.bar-segment {
  width: 100%;
  transition: filter 0.2s;
  position: relative;
  cursor: pointer;
}

.bar-segment:hover {
  filter: brightness(1.15);
}

/* Floating Tooltip */
.chart-tooltip {
  position: absolute;
  background: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s;
  pointer-events: none;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* PNL Line Graph Section */
.line-graph-section {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 2px solid #ddd;
}

.section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-color);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 15px;
}

.line-graph-container {
  margin-bottom: 15px;
  background: white;
  border-radius: 8px;
  padding: 10px 15px;
}

.line-graph-header {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 5px;
}

.line-graph-svg {
  width: 100%;
  height: auto;
  max-height: 120px;
}

.line-graph-label {
  font-size: 11px;
  fill: var(--text-muted);
}

.line-graph-line {
  stroke-linecap: round;
  stroke-linejoin: round;
}

.line-graph-hit {
  cursor: pointer;
}

/* Stats Table */
.stats-table {
  margin-bottom: 30px;
}

.stat-row {
  display: grid;
  grid-template-columns: 80px repeat(var(--player-count, 10), 1fr);
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #eee;
}

.stat-row:last-child {
  border-bottom: none;
}

.stat-cell {
  font-size: 12px;
  text-align: center;
}

.stat-row.with-bar .stat-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}

.stat-bar-container {
  width: 100%;
  max-width: 80px;
  height: 6px;
  background: #e0e0e0;
  border-radius: 3px;
  overflow: hidden;
}

.stat-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* Tulip Diagrams */
.tulip-container {
  display: grid;
  grid-template-columns: 80px repeat(var(--player-count, 10), 1fr);
  gap: 10px;
  margin-bottom: 30px;
}

.tulip-labels {
  display: flex;
  align-items: center;
  justify-content: center;
}

.tulip-label-svg {
  width: 80px;
  height: 65px;
}

.tulip-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
}

.tulip-svg {
  width: 80px;
  height: 60px;
}

/* Footnotes */
.footnotes {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 800px;
}

.footnotes p {
  margin-bottom: 4px;
}

.footnotes strong {
  color: var(--text-color);
}

/* Hand Search Section */
.hand-search-section {
  margin-top: 30px;
}

.section-separator {
  border: none;
  border-top: 2px solid #ddd;
  margin-bottom: 20px;
}

.search-container {
  margin-bottom: 20px;
}

.search-input {
  width: 100%;
  max-width: 600px;
  padding: 12px 16px;
  font-size: 14px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  background: white;
  transition: border-color 0.2s;
}

.search-input:focus {
  outline: none;
  border-color: var(--positive-color);
}

.search-input::placeholder {
  color: #999;
}

.search-hint {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
  line-height: 1.6;
}

.search-hint div {
  margin-bottom: 2px;
}

.search-hint b {
  color: var(--text-color);
  font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
  background: #f0f0f0;
  padding: 1px 5px;
  border-radius: 3px;
}

.search-results {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

/* Hand Replay Card */
.hand-replay {
  background: white;
  border-radius: 8px;
  padding: 15px 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.hand-replay-header {
  font-size: 14px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #eee;
  color: var(--text-color);
}

.hand-players {
  font-size: 13px;
  margin-bottom: 15px;
  color: var(--text-muted);
}

.hand-street {
  margin-bottom: 12px;
}

.street-header {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-color);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  padding: 4px 0;
  border-bottom: 1px dashed #ddd;
}

.action-line {
  font-size: 13px;
  padding: 3px 0;
  padding-left: 12px;
  color: var(--text-color);
}

.action-line.winner {
  font-weight: 600;
}

.action-line.shown-cards {
  font-style: italic;
}

.hand-result {
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid #eee;
}

/* Card styling */
.card {
  font-weight: 600;
  font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
  padding: 2px 4px;
  background: #f5f5f5;
  border-radius: 3px;
  margin: 0 1px;
}

/* Responsive */
@media (max-width: 768px) {
  body {
    padding: 10px;
  }

  .dashboard {
    padding: 15px;
  }

  .toolbar {
    flex-direction: column;
  }

  .btn {
    justify-content: center;
  }

  .search-input {
    max-width: 100%;
  }
}
