﻿:root{
  --bg0: #050607;
  --bg1: #090b0f;
  --panel: rgba(14,14,16,0.9);
  --panel2: rgba(10,10,12,0.92);
  --text: rgba(242,245,248,0.92);
  --muted: rgba(242,245,248,0.62);
  --line: rgba(255,255,255,0.08);
  --flame: rgba(255, 138, 42, 1);
  --ember: rgba(255, 77, 46, 1);
  --blood: rgba(150, 25, 25, 1);
  --good: rgba(56,214,122,1);
  --warn: rgba(255, 193, 7, 1);
  --bad: rgba(239, 83, 80, 1);
}

*{ box-sizing: border-box; }

html,body{
  height: 100%;
}

body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  color: var(--text);
  background:
    radial-gradient(1200px 700px at 10% -10%, rgba(255, 138, 42, 0.14), transparent 60%),
    radial-gradient(1000px 600px at 100% 0%, rgba(255, 77, 46, 0.10), transparent 65%),
    radial-gradient(900px 600px at 40% 120%, rgba(150, 25, 25, 0.12), transparent 60%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
}

a{ color: inherit; text-decoration: none; }

.container{
  width: min(1200px, 96vw);
  margin: 16px auto 32px;
  display:grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.topbar{
  position: sticky;
  top: 0;
  z-index: 30;
  display:flex;
  align-items:center;
  gap: 14px;
  padding: 14px 18px;
  background:
    radial-gradient(900px 280px at 20% 0%, rgba(255, 138, 42, 0.10), transparent 60%),
    radial-gradient(700px 220px at 85% 0%, rgba(255, 77, 46, 0.10), transparent 55%),
    rgba(8, 9, 10, 0.65);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  backdrop-filter: blur(10px);
}

.brand{
  display:flex;
  align-items:center;
  gap: 12px;
  min-width: 240px;
}

.ember{
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 30%, #ffd0a6 0%, var(--flame) 25%, var(--ember) 55%, var(--blood) 100%);
  box-shadow:
    0 0 12px rgba(255, 138, 42, 0.55),
    0 0 24px rgba(255, 77, 46, 0.25);
}

.title{
  font-weight: 950;
  letter-spacing: 0.2px;
  line-height: 1.05;
}

.subtitle{
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.actions{
  display:flex;
  align-items:center;
  gap: 12px;
  flex: 1;
}

.search{
  flex: 1;
  min-width: 240px;
  height: 38px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.18);
  color: var(--text);
  outline:none;
}
.search::placeholder{ color: rgba(242,245,248,0.42); }

.right{
  display:flex;
  align-items:center;
  gap: 10px;
  margin-left: auto;
}

.logo{
  height: 30px;
  width: auto;
  opacity: 0.95;
  filter: drop-shadow(0 6px 18px rgba(0,0,0,0.55));
}

.btn{
  height: 38px;
  padding: 0 16px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  font-weight: 800;
  letter-spacing: 0.2px;
  cursor:pointer;
  transition: transform .06s ease, background .12s ease, border-color .12s ease;
}
.btn:hover{
  background: rgba(255,255,255,0.09);
  border-color: rgba(255,255,255,0.14);
}
.btn:active{ transform: translateY(1px); }
.btn.small{ height: 34px; padding: 0 12px; border-radius: 12px; }
.btn:disabled{ opacity: 0.5; cursor: default; }

.select{
  height: 38px;
  padding: 0 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.18);
  color: var(--text);
  font-weight: 800;
}

.panel{
  background:
    radial-gradient(900px 320px at 30% 0%, rgba(255, 138, 42, 0.10), transparent 60%),
    linear-gradient(180deg, var(--panel), var(--panel2));
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 18px;
  overflow:hidden;
}

.panel-head{
  display:flex;
  align-items:center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

h2{
  margin:0;
  font-size: 16px;
  font-weight: 950;
  letter-spacing: 0.2px;
}

.muted{
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.pager{
  display:flex;
  align-items:center;
  gap: 10px;
}

.table-wrap{ overflow: auto; }

.table{
  width: 100%;
  border-collapse: collapse;
}

thead th{
  text-align:left;
  font-size: 12px;
  color: var(--muted);
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  background: rgba(0,0,0,0.18);
}

tbody td{
  padding: 11px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 14px;
  vertical-align: middle;
}

tbody tr{
  cursor:pointer;
  transition: background .10s ease;
}

tbody tr:hover{
  background: rgba(255,255,255,0.04);
}

.row-grey{
  opacity: 0.50;
}

.name{
  font-weight: 900;
  letter-spacing: 0.15px;
}

.status{
  width: 20px;
  height: 20px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.09);
}
.status.good{
  background: rgba(56,214,122,0.14);
  border-color: rgba(56,214,122,0.30);
}

.col-status{ width: 30px; }

.overlay{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 16px;
  z-index: 80;
}

.modal{
  width: min(760px, 96vw);
  background:
    radial-gradient(760px 260px at 30% 0%, rgba(255, 138, 42, 0.12), transparent 60%),
    linear-gradient(180deg, rgba(14,14,16,0.96), rgba(10,10,12,0.98));
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 18px;
  box-shadow: 0 40px 90px rgba(0,0,0,0.70);
  overflow:hidden;
}

.modal-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  padding: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.modal-title{ font-weight: 900; letter-spacing: 0.2px; }
.modal-subtitle{ color: var(--muted); font-size: 12px; margin-top: 2px; }

.modal-card{ padding: 16px; }
.big{ font-size: 22px; font-weight: 950; letter-spacing: 0.25px; }

.grid{
  margin-top: 14px;
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.kv{
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 10px 12px;
}
.k{
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}
.v{
  font-weight: 850;
  letter-spacing: 0.15px;
  word-break: break-word;
}

.modal-actions{
  display:flex;
  gap: 10px;
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
  justify-content:flex-end;
  flex-wrap: wrap;
}
.modal-actions .btn{ flex: 1; min-width: 190px; }

.icon-btn{
  width: 38px;
  height: 38px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  cursor:pointer;
}
.icon-btn:hover{
  background: rgba(255,255,255,0.09);
  border-color: rgba(255,255,255,0.14);
}

/* Bulk UI */
.bulk{
  display:flex;
  align-items:center;
  gap: 10px;
}

.bulk-meta{
  display:flex;
  flex-direction: column;
  gap: 4px;
}

.bulk-label{
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.2px;
  color: rgba(242,245,248,0.85);
  line-height: 1;
}

.select{
  appearance: none;
  padding: 8px 12px;
}

/* Toggle switch */
.switch{
  position: relative;
  display: inline-block;
  width: 44px;
  height: 26px;
}
.switch input{ display:none; }
.slider{
  position:absolute;
  cursor:pointer;
  inset: 0;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.10);
  transition: .2s;
  border-radius: 999px;
}
.slider:before{
  position:absolute;
  content:"";
  height: 20px;
  width: 20px;
  left: 3px;
  top: 2px;
  background: rgba(242,245,248,0.92);
  transition: .2s;
  border-radius: 999px;
  box-shadow: 0 8px 18px rgba(0,0,0,0.45);
}
input:checked + .slider{
  background: rgba(56,214,122,0.20);
  border-color: rgba(56,214,122,0.30);
}
input:checked + .slider:before{
  transform: translateX(18px);
  background: rgba(56,214,122,0.95);
}

/* Details overlay (dock-right / bottom-sheet) */
.details-overlay{
  position: fixed;
  inset: 0;
  display:flex;
  justify-content:flex-end;   /* dock to the right */
  align-items: stretch;
  padding: 0;
  background: transparent;    /* remove dark backdrop */
  pointer-events: none;       /* only panel is interactive */
  z-index: 90;
}

.details-overlay.hidden{ display:none; }

.details-panel{
  pointer-events: auto;
  width: 420px;
  max-width: 92vw;
  height: 100vh;
  max-height: 100vh;
  overflow: auto;
  border-radius: 0;
  background:
    radial-gradient(700px 260px at 30% 0%, rgba(255, 138, 42, 0.12), transparent 60%),
    linear-gradient(180deg, rgba(14,14,16,0.98), rgba(10,10,12,1));
  border-left: 1px solid rgba(255,255,255,0.10);
  box-shadow: -6px 0 24px rgba(0,0,0,0.75);
}

/* Mobile: bottom sheet */
@media (max-width: 720px) {
  .details-overlay{
    justify-content: center;
    align-items: flex-end;
  }

  .details-panel{
    width: 100%;
    height: min(75vh, 600px);
    border-left: none;
    border-top: 1px solid rgba(255,255,255,0.10);
    box-shadow: 0 -6px 0 24px rgba(0,0,0,0.75);
    border-radius: 16px 16px 0 0;
  }
}

.hidden{ display:none; }

.details-head{
  display:flex;
  align-items:center;
  justify-content: space-between;
  padding: 14px 14px 12px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.details-title{
  font-weight: 950;
  letter-spacing: 0.2px;
}

.details-body{
  padding: 14px;
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.kv-full{ grid-column: 1 / -1; }

.rules{
  font-weight: 700;
  letter-spacing: 0.05px;
  color: rgba(242,245,248,0.88);
  line-height: 1.35;
}

.pills{
  display:flex;
  flex-wrap: wrap;
  gap: 8px;
}
.pill{
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.06);
  font-size: 12px;
  font-weight: 850;
}
.pill.warn{
  border-color: rgba(255,193,7,0.28);
  background: rgba(255,193,7,0.12);
}

@media (max-width: 980px) {
  .topbar{
    flex-wrap: wrap;
  }
  .brand{ min-width: unset; }
  .actions{ order: 3; flex: 1 1 100%; }
  .right{ order: 2; margin-left: auto; }
  .logo{ height: 26px; }
}

@media (max-width: 720px) {
  .panel-head{
    flex-direction: column;
    align-items: stretch;
  }
  .pager{ justify-content: space-between; }

  .details{
    right: 10px;
    left: 10px;
    width: auto;
    top: 72px;
  }

  .grid{ grid-template-columns: 1fr; }
  .details-body{ grid-template-columns: 1fr; }

  thead th:nth-child(3),
  tbody td:nth-child(3){
    display:none;
  }

  thead th:nth-child(4),
  tbody td:nth-child(4){
    display:none;
  }

  .col-status{ order: -1; }
}

.card-art-wrap{
  grid-column: 1 / -1;
  display:flex;
  justify-content:center;
  padding: 8px 6px 2px;
}

.card-art{
  width: min(320px, 78vw);
  height: auto;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.10);
  box-shadow: 0 18px 40px rgba(0,0,0,0.55);
}

.mana{
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  margin: 0 2px -2px 1px;
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 6px 14px rgba(0,0,0,0.35);
}

.mana.tap{
  background:
    radial-gradient(circle at 35% 35%, rgba(255,255,255,0.25), rgba(255,255,255,0.08) 55%, rgba(0,0,0,0.08) 100%),
    linear-gradient(180deg, rgba(18,18,22,0.9), rgba(8,8,10,0.95));
}

.mana.red{
  background: radial-gradient(circle at 35% 35%, rgba(255, 220, 220, 0.75), rgba(255, 77, 46, 0.9) 35%, rgba(150,25,25,0.95) 100%);
}

.mana.white{
  background: radial-gradient(circle at 35% 35%, rgba(255,255,255,0.95), rgba(242,245,248,0.85) 45%, rgba(160,170,180,0.65) 100%);
}

/* --- Mobile usability improvements --- */
@media (max-width: 720px) {
  /* Top bar: stack cleanly and keep controls tappable */
  .topbar{
    padding: 10px 12px;
    gap: 10px;
  }

  .brand{
    flex: 1 1 100%;
    min-width: 0;
  }

  .title{ font-size: 16px; }
  .subtitle{ font-size: 11px; }

  .actions{
    flex: 1 1 100%;
    order: 3;
    gap: 10px;
  }

  .search{
    flex: 1 1 100%;
    min-width: 0;
    height: 40px;
    font-size: 14px;
  }

  .actions .btn{
    height: 40px;
    padding: 0 14px;
  }

  .right{
    width: 100%;
    order: 4;
    margin-left: 0;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
  }

  .bulk{
    width: 100%;
    flex: 1 1 100%;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }

  .bulk-meta{
    flex: 1 1 auto;
    min-width: 0;
  }

  .select{
    width: 100%;
    min-width: 0;
  }

  #queueBtn{
    flex: 1 1 auto;
  }

  #langSelect{
    flex: 0 0 auto;
  }

  .logo{
    height: 22px;
  }

  /* Layout spacing */
  .container{
    padding: 12px;
  }

  .panel{
    border-radius: 16px;
  }

  /* Table: reduce density and hide the least useful column on small screens */
  .table-wrap{
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .table thead th{
    padding: 10px 10px;
    font-size: 11px;
  }

  .table tbody td{
    padding: 11px 10px;
    font-size: 13px;
  }

  .name{
    font-size: 14px;
    line-height: 1.15;
  }

  /* Hide Scryfall ID column on small screens */
  .table th:nth-child(5),
  .table td:nth-child(5){
    display:none;
  }

  /* Ensure status column remains compact */
  .col-status{
    width: 26px;
    min-width: 26px;
  }

  /* Modal: full-width buttons and comfortable padding */
  .modal{
    width: min(560px, 94vw);
  }

  .modal-head{
    padding: 14px;
  }

  .modal-card{
    padding: 14px;
  }

  .big{
    font-size: 18px;
  }

  .modal-actions{
    flex-direction: column;
    align-items: stretch;
  }

  .modal-actions .btn{
    min-width: 0;
    width: 100%;
  }
}

@media (max-width: 420px) {
  /* Extra-small phones */
  .topbar{ padding: 9px 10px; }
  .actions{ gap: 8px; }
  .search{ height: 38px; }
  .actions .btn{ height: 38px; padding: 0 12px; }
  .logo{ height: 20px; }

  .table tbody td{ padding: 10px 9px; }
}
