/* ========== GLOBAL ========== */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #111;
  color: #eee;
}

header,
footer {
  padding: 0.75rem 1rem;
  background: #1b1b1b;
  border-bottom: 1px solid #333;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

footer {
  border-top: 1px solid #333;
  border-bottom: none;
  font-size: 0.85rem;
  color: #aaa;
}

h1,
h2 {
  margin: 0;
}

/* ========== CONTROLS ========== */

#controls {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #333;
}

/* When hidden via the toggle button */
#controls.hidden {
  display: none;
}

.io-wrapper {
  display: flex;
  gap: 1rem;
}

.io-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.io-panel h3 {
  margin: 0 0 0.5rem 0;
}

.io-panel textarea {
  flex: 1;
  min-height: 140px;
  resize: vertical;
  background: #181818;
  border: 1px solid #444;
  color: #eee;
  padding: 0.5rem;
  font-family: monospace;
}

.io-panel button {
  margin-top: 0.5rem;
  align-self: flex-start;
}

/* Export pre should fill the panel nicely */
#export-output {
  flex: 1;
  margin: 0.5rem 0 0 0;
  padding: 0.5rem;
  background: #181818;
  border: 1px solid #444;
  color: #eee;
  max-height: 180px;
  overflow-y: auto;
  font-family: monospace;
  white-space: pre-wrap;
}


#deck-input {
  width: 100%;
  min-height: 120px;
  resize: vertical;
  background: #181818;
  border: 1px solid #444;
  color: #eee;
  padding: 0.5rem;
  font-family: monospace;
}

.buttons {
  display: flex;
  gap: 0.5rem;
}

button {
  padding: 0.4rem 0.9rem;
  border-radius: 4px;
  border: 1px solid #555;
  background: #2b2b2b;
  color: #eee;
  cursor: pointer;
}

button:hover {
  background: #3b3b3b;
}

#export-output {
  margin: 0;
  padding: 0.5rem;
  background: #181818;
  border: 1px solid #444;
  color: #eee;
  max-height: 150px;
  overflow-y: auto;
  font-family: monospace;
  white-space: pre-wrap;
}

/* ========== BOARD LAYOUT ========== */

#board {
  display: flex;
  gap: 1rem;
  padding: 0.75rem 1rem 1rem 1rem;
  align-items: flex-start; /* no vertical centering */
}

/* Main deck area */

.main-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

/* Countdown text next to "Main Deck" */
#main-count {
  font-size: 0.9rem;
  font-weight: normal;
  color: #ccc;
}

/* Manabase basic-land buttons */
.manabase-buttons {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
}

.manabase-buttons span {
  color: #aaa;
}

.manabase-buttons .mana-btn {
  padding: 0.2rem 0.5rem;
  font-size: 0.85rem;
}


#main-area {
  flex: 3;
  min-width: 0;
}

#main-columns {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-top: 0.5rem;
}

/* CMC columns */

.cmc-column {
  min-width: 160px;
  max-width: 160px;
  background: #181818;
  border-radius: 4px;
  border: 1px solid #333;
  padding: 0.25rem;
  position: relative;
}

.cmc-header {
  font-size: 0.8rem;
  text-align: center;
  padding: 0.1rem 0;
  border-bottom: 1px solid #333;
  margin-bottom: 0.25rem;
  color: #bbb;
}

/* ========== CARDS (COMMON) ========== */

.card {
  position: relative;
  width: 100%;
  cursor: grab;
}

.card img {
  width: 100%;
  border-radius: 4px;
  display: block;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.7);
}

/* Hover: only bring to front, no moving */

.card:hover {
  z-index: 50;
  transform: none;
}

/* ========== STACKING BEHAVIOUR ========== */
/* Same behaviour for main columns and sideboard */

/* Overlap value: tweak -180px to show more/less of the next card.
   With standard MTG aspect this leaves roughly the name + mana bar visible. */
.cmc-column > .card,
.sideboard-list > .card {
  margin-top: -180px;
}

/* First card in each stack starts right below the header / top */
.cmc-column > .card:nth-of-type(2),
.sideboard-list > .card:nth-of-type(1) {
  margin-top: 0;
}

/* Optional close button if you ever use it */
.card-close {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.8;
}

/* ========== SIDEBOARD ========== */

#side-area {
  flex: 0 0 160px;   /* same card width as main columns */
  min-width: 160px;
}

.sideboard-list {
  min-height: 300px;
  background: #181818;
  border-radius: 4px;
  border: 1px solid #333;
  padding: 0.25rem;
  overflow-y: auto;
  position: relative;
}

/* ========== DRAG & DROP HINTS ========== */

.dropzone {
  border: 1px solid #333;
}

.dropzone.drop-hover {
  border-color: #66aaff;
  box-shadow: 0 0 6px rgba(102, 170, 255, 0.7);
}

/* Helper text */

.empty-hint {
  font-size: 0.8rem;
  color: #777;
  padding: 0.3rem;
}
