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

body {
  font-family: "Times New Roman", Times, Georgia, serif;
  background: #f8f7f4;
  color: #000;
  min-height: 100vh;
  padding: 40px 30px 80px;
  text-transform: lowercase;
}

.container {
  max-width: 100%;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 30px;
  margin-bottom: 30px;
}

.header-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mode-links {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mode-link {
  color: #999;
  text-decoration: underline;
  font-size: 0.85rem;
}

.mode-link:hover {
  color: #666;
}

.mode-link.active {
  color: #000;
}

.mode-links .sep {
  color: #ccc;
  font-size: 0.8rem;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

h1 {
  font-size: 1.5rem;
  font-weight: 400;
  letter-spacing: -0.02em;
}

.subtitle {
  color: #666;
  font-size: 0.9rem;
}


/* Controls */
.controls {
  display: flex;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 30px;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.control-group label {
  font-size: 0.75rem;
  color: #999;
  letter-spacing: 0.03em;
}

/* Autocomplete */
.autocomplete-wrapper {
  position: relative;
}

.autocomplete-wrapper input {
  width: 280px;
  padding: 8px 0;
  font-family: inherit;
  font-size: 0.9rem;
  border: none;
  border-bottom: 1px solid #000;
  background: transparent;
  color: #000;
  text-transform: lowercase;
  outline: none;
}

.autocomplete-wrapper input::placeholder {
  color: #999;
}

.autocomplete-wrapper input:focus {
  border-bottom-width: 2px;
}

.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  max-height: 300px;
  overflow-y: auto;
  background: #f8f7f4;
  border: 1px solid #000;
  border-top: none;
  z-index: 100;
}

.autocomplete-dropdown .option {
  padding: 10px 8px;
  cursor: pointer;
  font-size: 0.9rem;
  border-bottom: 1px solid #eee;
}

.autocomplete-dropdown .option:last-child {
  border-bottom: none;
}

.autocomplete-dropdown .option:hover,
.autocomplete-dropdown .option.highlighted {
  background: #edecea;
}

.autocomplete-dropdown .option .year {
  color: #999;
  font-size: 0.8rem;
  margin-left: 8px;
}

/* Buttons */
.primary-btn {
  appearance: none;
  background: #000;
  color: #fff;
  border: none;
  padding: 10px 20px;
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  text-transform: lowercase;
}

.primary-btn:hover {
  background: #333;
}

.primary-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.text-btn {
  appearance: none;
  background: none;
  border: none;
  color: #999;
  font-family: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  text-transform: lowercase;
  text-decoration: underline;
  padding: 4px 8px;
}

.text-btn:hover {
  color: #000;
}

.text-btn:disabled {
  color: #ccc;
  cursor: default;
  text-decoration: none;
}

.text-btn:disabled:hover {
  color: #ccc;
}

.sort-btn {
  appearance: none;
  background: none;
  border: none;
  color: #999;
  font-family: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  text-transform: lowercase;
  text-decoration: underline;
  padding: 4px 8px;
}

.sort-btn:hover {
  color: #666;
}

.sort-btn.active {
  color: #000;
}

/* Daily Challenge */
.daily-info {
  font-size: 0.9rem;
}

.daily-seed {
  color: #999;
  font-size: 0.85rem;
}

#daily-set-name {
  font-size: 1rem;
}

#daily-seed {
  font-size: 0.85rem;
  font-family: monospace;
  color: #666;
}

/* Loading */
.loading {
  padding: 40px 0;
  color: #999;
}

/* Pool Section */
.pool-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.pool-header h3 {
  font-size: 1rem;
  font-weight: 400;
}

#pool-count {
  color: #999;
  font-size: 0.9rem;
}

.pool-actions {
  display: flex;
  gap: 4px;
}

/* Expanded/collapsed states */
.deck-area.expanded .deck-columns,
.pool-area.expanded .pool-columns {
  min-height: 300px;
}

/* Builder Layout */
.builder-layout {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

/* Card Grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
}

.card-grid.deck-grid {
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 6px;
}

.card {
  position: relative;
  cursor: pointer;
  transition: transform 0.1s ease, opacity 0.15s ease;
}

.card:hover {
  transform: translateY(-4px);
}

.card img {
  width: 100%;
  border-radius: 4px;
  display: block;
}

.card.in-deck {
  opacity: 0.4;
}

.card .card-count {
  position: absolute;
  top: 4px;
  right: 4px;
  background: #000;
  color: #fff;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 2px;
}

/* Pool Columns Layout */
.pool-columns {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.card-column {
  width: 170px;
  flex-shrink: 0;
}

.column-header {
  font-size: 0.75rem;
  color: #999;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid #eee;
  white-space: nowrap;
}

/* Stacked Cards */
.card-stack {
  position: relative;
}

.card-stack .card {
  position: relative;
  margin-bottom: -200px;
  transition: transform 0.15s ease, opacity 0.15s ease, z-index 0s;
  z-index: var(--stack-index, 0);
}

.card-stack .card:last-child {
  margin-bottom: 0;
}

.card-stack .card:hover {
  filter: brightness(1.1);
}

.card-stack .card.in-deck {
  opacity: 0.3;
}

/* Card Preview */
#card-preview {
  position: fixed;
  width: 300px;
  pointer-events: none;
  z-index: 1000;
  display: none;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.3));
}

#card-preview img {
  width: 100%;
  border-radius: 4%;
  display: block;
}

#card-preview.visible {
  display: block;
}

/* Deck Area */
.deck-area {
  padding-bottom: 16px;
}

/* Section Divider */
.section-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 8px 0;
}

.section-divider hr {
  flex: 1;
  border: none;
  border-top: 1px solid #ccc;
}

.view-toggle {
  appearance: none;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 0.85rem;
  color: #666;
  cursor: pointer;
  text-transform: lowercase;
  padding: 4px 8px;
  white-space: nowrap;
}

.view-toggle:hover {
  color: #000;
}

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

.deck-header h3 {
  font-size: 1rem;
  font-weight: 400;
}

#deck-count {
  font-weight: 600;
}

.deck-columns {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.card-count-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: #000;
  color: #fff;
  font-size: 0.65rem;
  padding: 2px 5px;
  border-radius: 2px;
}

/* Deck Actions */
.deck-actions {
  display: flex;
  gap: 4px;
}

/* Submission Teaser */
.submission-teaser {
  font-size: 0.8rem;
  color: #999;
  margin-left: 12px;
}

/* Results Section */
#results-section {
  max-width: 100%;
}

.results-header {
  margin-bottom: 20px;
}

#back-to-deck {
  padding: 0;
}

.results-count {
  font-size: 1rem;
  margin-bottom: 24px;
}

.results-section-title {
  font-size: 0.85rem;
  font-weight: 400;
  color: #666;
  margin-bottom: 12px;
  display: block;
}

/* Field Stats */
.field-columns {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 24px;
  overflow-x: auto;
}

.field-column {
  min-width: 150px;
  flex-shrink: 0;
}

.field-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 4px;
  font-size: 0.75rem;
  cursor: default;
  border-radius: 2px;
}

.field-row:hover {
  background: #edecea;
}

.field-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.field-bar-wrap {
  width: 40px;
  height: 6px;
  background: #eee;
  flex-shrink: 0;
}

.field-bar {
  display: block;
  height: 100%;
  background: #000;
}

.field-pct {
  width: 28px;
  text-align: right;
  color: #999;
  font-size: 0.7rem;
  flex-shrink: 0;
}

.field-footer {
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.field-basics,
.field-combos {
  margin-top: 0;
}

.basics-row,
.combos-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 0.8rem;
}

.combo-tag {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  color: #666;
}

/* Submissions List */
.submissions-list {
  margin-bottom: 24px;
}

.submission-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 0.85rem;
  border-left: 3px solid transparent;
}

.submission-row:hover {
  background: #edecea;
}

.submission-row.featured {
  border-left-color: #000;
}

.submission-row.mine {
  background: #f0efe8;
}

.sub-name {
  flex: 1;
}

/* Color Dots */
.sub-colors {
  display: flex;
  gap: 3px;
  flex-shrink: 0;
}

.color-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.color-dot.color-W { background: #f0d668; }
.color-dot.color-U { background: #0e68ab; }
.color-dot.color-B { background: #2b2520; }
.color-dot.color-R { background: #d3202a; }
.color-dot.color-G { background: #00733e; }
.color-dot.color-C { background: #ccc; }

.sub-count {
  color: #999;
  font-size: 0.75rem;
}

/* Comparison View */
.comparison-header {
  margin-bottom: 16px;
}

.comparison-header .results-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.comparison-deck {
  margin-bottom: 20px;
}

.comparison-deck .card.only-theirs {
  outline: 2px solid #c44;
  border-radius: 6px;
}

.comparison-deck .card.shared {
  opacity: 1;
}

.diff-summary {
  display: flex;
  gap: 16px;
  font-size: 0.8rem;
  padding: 8px 0;
  margin-bottom: 16px;
  border-top: 1px solid #eee;
}

.only-mine-text { color: #2a7d2a; }
.only-theirs-text { color: #b33; }

/* Utilities */
.hidden {
  display: none !important;
}

