@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@500;700&family=Work+Sans:wght@400;500;600&display=swap');

:root {
  --ink: #e2e8f0;
  --muted: rgba(226, 232, 240, 0.7);
  --accent: #f59e0b;
  --accent-strong: #f97316;
  --teal: #14b8a6;
  --teal-dark: #0f766e;
  --panel: rgba(15, 23, 42, 0.92);
  --panel-soft: rgba(15, 23, 42, 0.75);
  --stroke: rgba(148, 163, 184, 0.2);
}

/* Background image with overlay */
body {
  font-family: "Work Sans", "Trebuchet MS", "Gill Sans", "Calibri", sans-serif;
  margin: 0;
  padding: 1.5rem 1rem 2rem;
  color: var(--ink);
  background: url('./assets/images/background.png') no-repeat center center fixed;
  background-size: cover;
  position: relative;
  min-height: 100vh;
}

/* Overlay for readability */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(180deg, rgba(3, 7, 18, 0.88), rgba(15, 23, 42, 0.8));
  z-index: -1;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at top, rgba(15, 118, 110, 0.18), transparent 60%),
              linear-gradient(120deg, rgba(148, 163, 184, 0.08) 0%, transparent 55%);
  mix-blend-mode: screen;
  opacity: 0.8;
  pointer-events: none;
  z-index: -1;
}

.hero-title {
  font-family: "Cinzel", "Trebuchet MS", "Gill Sans", "Calibri", serif;
  text-align: center;
  margin: 0 0 0.5rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-size: 1.9rem;
}

.beta-tag {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: rgba(251, 191, 36, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.35);
  vertical-align: middle;
}

.tagline {
  text-align: center;
  margin: 0;
  font-size: 0.8rem;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--muted);
}

.landing {
  max-width: 1100px;
  margin: 0 auto 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.landing-hero {
  padding: 1.2rem 1.5rem;
  border-radius: 14px;
  background: linear-gradient(140deg, rgba(30, 41, 59, 0.85), rgba(15, 23, 42, 0.85));
  border: 1px solid rgba(148, 163, 184, 0.25);
  box-shadow: 0 18px 32px rgba(2, 6, 23, 0.35);
}

.landing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.9rem;
}

.landing-stack {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.landing details > .section-label {
  cursor: pointer;
  list-style: none;
}

.landing details > .section-label::-webkit-details-marker {
  display: none;
}

.landing details > .section-label::after {
  content: '▾';
  float: right;
  opacity: 0.7;
}

.landing details[open] > .section-label::after {
  content: '▴';
}

.landing-footer {
  margin: 0.75rem auto 0;
  max-width: 900px;
  text-align: center;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.decklist-controls {
  margin: 0;
  text-align: left;
}

.decklist-controls label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.mode-select {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  margin: 0.9rem auto 0;
}

.decklist-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.decklist-input {
  flex: 1 1 360px;
  min-width: 220px;
  padding: 0.45rem 0.6rem;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: var(--panel-soft);
  color: var(--ink);
  font-size: 0.85rem;
}

.decklist-input::placeholder {
  color: rgba(226, 232, 240, 0.45);
}

.decklist-status {
  margin-top: 0.4rem;
  font-size: 0.8rem;
  color: var(--muted);
  min-height: 1.1rem;
}

.decklist-status a {
  color: #5eead4;
}

.decklist-status[data-state="error"] {
  color: #fda4af;
}

button {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  cursor: pointer;
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: linear-gradient(135deg, var(--teal-dark), var(--teal));
  color: #fff;
  border-radius: 5px;
  box-shadow: 0 6px 16px rgba(15, 118, 110, 0.25);
  transition: transform 0.15s, box-shadow 0.2s;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(15, 118, 110, 0.3);
}

.scenario {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  max-width: 1280px;
  margin: 0 auto;
}

.section-divider {
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, rgba(94, 234, 212, 0), rgba(94, 234, 212, 0.35), rgba(94, 234, 212, 0));
  margin: 0.4rem 0;
}

.scenario-top {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  width: 100%;
}

/* Card styles */
.card {
  background-color: var(--panel);
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  padding: 0.75rem 0.9rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  border: 1px solid var(--stroke);
}

.card h2 {
  margin: 0.35rem 0;
  font-size: 1.05rem;
  color: #5eead4;
  letter-spacing: 0.4px;
}

.decklist-card {
  text-align: left;
  gap: 0.85rem;
  border: 1px solid rgba(245, 158, 11, 0.25);
  box-shadow: 0 16px 28px rgba(2, 6, 23, 0.3);
}

.decklist-card .section-label {
  text-align: left;
}

.mode-select button {
  flex: 1 1 140px;
  min-width: 140px;
}

.patch-notes-card {
  text-align: left;
  gap: 0.5rem;
}

.patch-notes-empty {
  font-size: 0.85rem;
  font-style: italic;
  color: var(--muted);
}

.patch-notes-list {
  display: grid;
  gap: 0.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.patch-note {
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(30, 41, 59, 0.6);
}

.patch-note-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

.patch-note-body {
  font-size: 0.85rem;
  color: rgba(226, 232, 240, 0.9);
}

/* Legends card */
.legends-card {
  flex: 3 1 620px;
  position: relative;
}

.legends-container {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  flex-wrap: wrap;
}

.board-main {
  gap: 1.4rem;
}

.board-group {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  flex-wrap: wrap;
}

.board-rows {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.legend-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.legend-image {
  width: 96px;
  border-radius: 6px;
  box-shadow: 0 6px 16px rgba(31, 41, 55, 0.2);
}

.legend-image-placeholder {
  width: 96px;
  height: 144px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(30, 41, 59, 0.85);
  border-radius: 6px;
  font-size: 0.8rem;
  text-align: center;
  padding: 2px;
  box-shadow: inset 0 0 0 1px rgba(94, 234, 212, 0.25);
}

.token-die {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 72px;
  height: 72px;
  transform: translate(-50%, -50%);
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.gemstone-die {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 72px;
  height: 72px;
  transform: translate(-50%, -50%);
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.badgermole-die {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 72px;
  height: 72px;
  transform: translate(-50%, -50%);
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.sickness {
  color: #fb7185;
  font-weight: bold;
  font-size: 0.85rem;
}

/* Small cards (Mana, Modifiers, Timing) */
.mana-counters-card {
  min-width: 220px;
  padding: 0;
}

.mana-pane {
  width: 100%;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 8px;
  background-color: rgba(15, 23, 42, 0.92);
}

.mana-pane-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  list-style: none;
  padding: 0.4rem 0.6rem;
  color: #5eead4;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-size: 0.75rem;
}

.mana-pane-label::-webkit-details-marker {
  display: none;
}

.mana-pane-label::after {
  content: '>';
  font-size: 0.85rem;
  transition: transform 0.2s;
}

.mana-pane[open] .mana-pane-label::after {
  transform: rotate(90deg);
}

.mana-pane-label:hover {
  background: rgba(15, 118, 110, 0.15);
}

.mana-counters {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 0;
  padding: 0.6rem;
}

.mana-counter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
  background: rgba(15, 118, 110, 0.22);
  border: 1px solid rgba(94, 234, 212, 0.3);
}

.mana-counter img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 2px 6px rgba(31, 41, 55, 0.2);
}

.counter-controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.counter-btn {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: none;
  background: #0f766e;
  color: #fff;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.2s;
}

.counter-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(15, 118, 110, 0.25);
}

.counter-value {
  min-width: 18px;
  text-align: center;
  font-weight: bold;
  color: #e2e8f0;
}

.modifier, .modifier-positive, .modifier-negative, .modifier-neutral {
  padding: 0.25rem 0.4rem;
  border-radius: 4px;
  margin: 0.15rem 0;
  font-size: 0.8rem;
}

.modifier-rarity {
  margin-left: 0.35rem;
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.85;
}

.modifier-rarity-common {
  color: #9ca3af;
}

.modifier-rarity-uncommon {
  color: #22c55e;
}

.modifier-rarity-rare {
  color: #3b82f6;
}

.modifier-rarity-very-rare {
  color: #f97316;
}

.modifiers-card {
  padding: 0.6rem 0.8rem;
}

.modifiers-list {
  margin-top: 0.5rem;
}

.modifiers-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  text-align: center;
}

.modifiers-row-header th {
  text-align: center;
  padding: 0.3rem 0;
  font-weight: 700;
}

.modifier-rarity-header {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.7rem;
}

.modifiers-items-cell {
  padding: 0.25rem 0;
  text-align: center;
}

.modifier-chip {
  display: inline-block;
  margin: 0.15rem 0.2rem 0.15rem 0;
}

.modifier-positive {
  background-color: rgba(22, 101, 52, 0.4);
  color: #86efac;
}

.modifier-negative {
  background-color: rgba(153, 27, 27, 0.4);
  color: #fecaca;
}

.modifier-neutral {
  background-color: rgba(202, 138, 4, 0.35);
  color: #fde68a;
}

.timing {
  font-weight: bold;
  color: #5eead4;
  font-size: 0.95rem;
  margin-top: 0.3rem;
}

.timer-expired {
  color: #f87171;
}

.bottom-bar {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 1fr);
  gap: 0.6rem;
  align-items: start;
  justify-content: center;
  width: 100%;
}

.section-label {
  font-weight: bold;
  color: #5eead4;
  margin-bottom: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-size: 0.75rem;
  text-align: left;
}

.lower-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: start;
  justify-content: center;
  width: 100%;
}

.lower-column {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  flex: 4 1 0;
  min-width: 220px;
}

.mana-counters-card {
  flex: 1 1 0;
}

.deck-search-card {
  text-align: left;
  padding: 0;
}

.graveyard-empty {
  text-align: left;
  gap: 0.4rem;
}

.graveyard-empty-message {
  font-size: 0.8rem;
  font-style: italic;
  color: rgba(226, 232, 240, 0.7);
  padding: 0.2rem 0;
}

.deck-search-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  list-style: none;
  padding: 0.4rem 0.6rem;
  color: #5eead4;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-size: 0.75rem;
}

.deck-search-summary::-webkit-details-marker {
  display: none;
}

.deck-search-summary::after {
  content: '>';
  font-size: 0.85rem;
  transition: transform 0.2s;
}

.deck-search-card[open] .deck-search-summary::after {
  transform: rotate(90deg);
}

.deck-search-summary:hover {
  background: rgba(15, 118, 110, 0.15);
}

.deck-search-body {
  padding: 0.6rem;
}

.deck-search-input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.45rem 0.6rem;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.7);
  color: #e2e8f0;
  font-size: 0.85rem;
}

.deck-search-input::placeholder {
  color: rgba(226, 232, 240, 0.5);
}

.deck-search-status {
  margin: 0.4rem 0 0.35rem;
  font-size: 0.75rem;
  color: rgba(226, 232, 240, 0.7);
}

.deck-search-list {
  max-height: 220px;
  overflow: auto;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 6px;
  padding: 0.35rem 0.45rem;
  background: rgba(15, 23, 42, 0.55);
}

.deck-search-item {
  font-size: 0.8rem;
  padding: 0.2rem 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.deck-search-item:last-child {
  border-bottom: none;
}

.deck-search-empty {
  font-size: 0.8rem;
  font-style: italic;
  opacity: 0.75;
  padding: 0.25rem 0;
}

.modifiers-block,
.timing-block {
  background-color: rgba(15, 23, 42, 0.92);
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
  padding: 0.6rem 0.8rem;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.modifiers-block {
  min-width: 220px;
}

.timing-block {
  min-width: 220px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.actions-card {
  min-width: 220px;
}

.timer-pill {
  position: absolute;
  top: 0.5rem;
  right: 0.6rem;
  font-weight: bold;
  font-size: 0.9rem;
  color: #5eead4;
  background: rgba(15, 23, 42, 0.8);
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

/* Cards in hand */
.hand-card-container {
  width: 100%;
  position: relative;
  padding-bottom: 4.6rem;
}

.hand-draw-btn {
  position: absolute;
  left: 0.6rem;
  bottom: 0.6rem;
  margin: 0;
  padding: 0.3rem 0.55rem;
  font-size: 0.75rem;
  border-radius: 999px;
}

.hand-new-scenario-btn {
  position: absolute;
  right: 0.6rem;
  bottom: 0.6rem;
  margin: 0;
  padding: 0.3rem 0.55rem;
  font-size: 0.75rem;
  border-radius: 999px;
}

.hand-cards-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
  margin-top: 0.35rem;
}

.hand-card {
  width: 105px;
  height: 158px;
  background-color: rgba(30, 41, 59, 0.85);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  text-align: center;
  box-shadow: inset 0 0 0 1px rgba(94, 234, 212, 0.2);
}

.hand-card-image {
  width: 105px;
  height: auto;
  border-radius: 6px;
}

.card-preview {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.98);
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.card-preview.visible {
  opacity: 1;
  transform: scale(1);
}

.card-preview img {
  width: 264px;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.35);
  display: block;
}

@media (max-width: 720px) {
  body {
    padding: 1.25rem 0.75rem 1.5rem;
  }

  .hero-title {
    font-size: 1.5rem;
  }

  .landing-hero {
    padding: 1rem;
  }

  .scenario-top {
    flex-direction: column;
    align-items: stretch;
  }

  .mana-counters-card,
  .legends-card {
    flex: 1 1 auto;
  }

  .legends-container {
    justify-content: flex-start;
  }

  .legend-image,
  .legend-image-placeholder {
    width: 88px;
  }

  .legend-image-placeholder {
    height: 132px;
  }

  .hand-cards-row {
    flex-wrap: wrap;
  }

  .bottom-bar {
    grid-template-columns: 1fr;
    justify-items: stretch;
  }

  .lower-row {
    flex-direction: column;
    align-items: stretch;
  }

  .lower-column,
  .mana-counters-card {
    flex: 1 1 100%;
  }
}
