:root{
  --info-font-size: 17px;
  --info-color: #ffffff;
  --card-bg: rgba(217,217,217,0.50);
  --field-bg: #ffffff;
  --field-text: #484848;
  --field-font-size: 20px;
  --field-font-weight: 600;
  --selection-card-w: 300px;
  --selection-card-h: 150px;
  --field-w: 260px;
  --field-h: 48px;
  --footer-h: 70px;
  --footer-pad-x: 36px;
  --strip-gap: 16px;
  --strip-gap-mobile: 12px;
  --strip-radius: 16px;
  --results-left: 120px;
  --results-gap: 24px;
  --w-rank: 3ch;
  --w-deck: 40%;
  --w-star: 6.5ch;
  --w-num: 8ch;
}

*{
  box-sizing: border-box;
}

html, body{
  height: 100%;
}

body{
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans";
  color: #111;
  padding-bottom: var(--footer-h);
  background: #0b1e1a;
  background-image: url('assets/Background Alt.jpg');
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
  background-attachment: scroll;
  min-height: 100svh;
}

.visually-hidden{
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.selection-wrap{
  position: relative;
  width: 100%;
  min-height: calc(100vh - var(--footer-h));
}

.selection-card{
  position: absolute;
  top: 64px;
  right: 64px;
  left: auto;
  width: var(--selection-card-w);
  min-height: var(--selection-card-h);
  height: auto;
  background: var(--card-bg);
  border-radius: 14px;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  padding-top: 22px;
  padding-bottom: 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  box-shadow: 0 10px 24px rgba(0,0,0,0.15);
}

.select-field{
  width: var(--field-w);
  height: var(--field-h);
  background: var(--field-bg);
  border-radius: 10px;
  border: none;
  padding: 0 44px 0 14px;
  font-family: "Segoe UI Symbol", "Apple Color Emoji", ui-sans-serif, system-ui, sans-serif;
  font-size: var(--field-font-size);
  font-weight: var(--field-font-weight);
  color: var(--field-text);
  line-height: var(--field-h);
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url('assets/Dropdown.png');
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px 10px;
  box-shadow: 0 1px 0 rgba(0,0,0,0.06) inset, 0 1px 2px rgba(0,0,0,0.08);
  cursor: pointer;
}

.select-field:focus{
  outline: 2px solid rgba(0,0,0,0.15);
}

.info-bar{
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--footer-h, 100px);
  width: 100%;
  color: var(--info-color);
  font-size: var(--info-font-size);
  font-weight: 450;
  background: rgba(16, 182, 99, 0.5);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  padding: 0 var(--footer-pad-x);
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.info-left{
  justify-self: start;
  opacity: 0.95;
}

.info-center{
  justify-self: center;
}

.info-right{
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 10px;
  line-height: 1;
}

.brand-logo{
  height: 38px;
  display: block;
  object-fit: contain;
}

.discord-logo{
  height: 28px;
  width: auto;
  display: block;
  object-fit: contain;
}

.info-bar .info-right .discord-logo{
  display: block;
  height: 26px;
  width: auto;
  position: relative;
  top: 1px;
}

.info-bar .info-right span{
  line-height: 1;
  position: relative;
  top: 0px;
}

.run-btn{
  width: var(--field-w, 260px);
  max-width: 100%;
  height: 44px;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  color: #ffffff;
  background: #2f7a5d;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,0.12);
  transition: transform 0.06s ease, filter 0.12s ease, background-color 0.12s ease;
  margin-top: 6px;
}

.run-btn:hover{
  background: #2a6d54;
  filter: brightness(1.02);
}

.run-btn:active{
  transform: translateY(1px);
}

.run-btn:disabled{
  opacity: 0.55;
  cursor: not-allowed;
  background: #6b7f77;
}

.results-card{
  position: fixed;
  left: var(--results-left);
  top: 64px;
  right: calc(64px + var(--selection-card-w) + var(--results-gap));
  background: rgba(0,0,0,.35);
  color: #fff;
  border-radius: 14px;
  box-shadow: 0 10px 24px rgba(0,0,0,.15);
  padding: 12px 14px;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 5;
}

.results-title{
  margin: 4px 0 8px;
  font-size: 18px;
  font-weight: 700;
}

.results-scroll{
  max-height: calc(100dvh - 64px - 56px - 90px);
  overflow: auto;
}

.results-table{
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-variant-numeric: tabular-nums;
}

.results-table thead th{
  text-align: left;
  padding: 6px 8px;
  line-height: 1.25;
  font-size: 14px;
  font-weight: 700;
  border-bottom: 1px solid rgba(255,255,255,.25);
}

.results-table tbody td{
  padding: 6px 8px;
  line-height: 1.25;
  font-size: 14px;
  border-bottom: 1px solid rgba(255,255,255,.12);
  vertical-align: top;
}

.results-table tbody tr:hover{
  background: rgba(255,255,255,.06);
}

.col-rank{
  width: var(--w-rank);
  text-align: right;
}

.col-deck{
  width: auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.col-stars{
  width: 26ch;
}

.col-percent{
  width: var(--w-star);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.col-num{
  width: var(--w-num);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.results-table .placeholder td{
  text-align: center;
  opacity: .85;
}

.results-table tbody tr:nth-child(odd){
  background: rgba(255,255,255,0.03);
}

.results-table thead th.col-star,
.results-table thead th.col-num,
.results-table tbody td.col-star,
.results-table tbody td.col-percent,
.results-table tbody td.col-num{
  text-align: right;
}

.results-table col.cg-rank{
  width: var(--w-rank);
}

.results-table col.cg-deck{
  width: var(--w-deck);
}

.results-table col.cg-star{
  width: var(--w-star);
}

.results-table col.cg-num{
  width: var(--w-num);
}

.run-overlay{
  position: fixed;
  left: 0;
  top: 0;
  transform: translateX(-50%);
  display: none;
  z-index: 7;
  text-align: center;
  pointer-events: none;
}

.run-overlay img{
  width: 72px;
  height: 72px;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.25));
  display: block;
  margin: 0 auto 8px;
}

.run-overlay-text{
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,.35);
}

.run-overlay.show{
  display: block;
}

.card-strip{
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--footer-h, 0px) + var(--strip-gap, 16px));
  z-index: 6;
  background: rgba(0,0,0,.25);
  border-radius: var(--strip-radius);
  padding: 20px 25px 14px;
  padding-bottom: 25px;
  box-shadow: 0 10px 24px rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  max-width: min(95vw, 1200px);
  width: max-content;
}

.card-strip.hidden{
  display: none;
}

.card-strip-row{
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 22px;
  white-space: nowrap;
}

.card-strip-row img{
  height: var(--strip-item-h, 64px);
  width: auto;
  display: block;
  object-fit: contain;
  border-radius: 8px;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.25));
  user-select: none;
}

.card-chip{
  display: flex;
  flex-direction: column;
  align-items: center;
  width: var(--w, 80px);
}

.card-chip .chip-name{
  font-size: 12px;
  line-height: 1.1;
  text-align: center;
  color: #fff;
  opacity: .9;
  margin-top: 6px;
  margin-bottom: 10px;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-chip img{
  height: var(--icon-h, 64px);
  width: auto;
  object-fit: contain;
  display: block;
  border-radius: 8px;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.25));
}

.card-chip .chip-ctrl{
  width: 100%;
  margin-top: 8px;
}

.card-chip .chip-ctrl select{
  width: 100%;
  height: 26px;
  border: none;
  border-radius: 8px;
  padding: 0 8px;
  font-weight: 600;
  background: #fff;
  color: #222;
  cursor: pointer;
}

@media (max-width: 1024px){
  :root{
    --field-font-size: 18px;
    --field-h: 50px;
  }

  body{
    padding-bottom: 0;
  }

  .info-bar{
    display: none !important;
  }

  .selection-wrap{
    min-height: 100vh;
    display: grid;
    place-items: start center;
    padding-top: 56px;
  }

  .selection-card{
    position: static;
    width: min(92vw, 440px);
    height: auto;
    padding: 18px;
    gap: 14px;
    border-radius: 12px;
  }

  .select-field{
    width: 100%;
    height: var(--field-h);
    font-size: var(--field-font-size);
    background-position: right 12px center;
  }

  .results-card{
    position: static;
    left: auto;
    right: auto;
    top: auto;
    margin: 14px;
  }

  .results-scroll{
    max-height: none;
  }

  .run-overlay img{
    width: 64px;
    height: 64px;
  }

  .card-strip{
    --strip-pad-top: 20px;
    --strip-pad-x: 28px;
    padding: var(--strip-pad-top) var(--strip-pad-x) 12px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + var(--strip-gap-mobile, 12px));
  }

  .card-strip-row{
    --chip-gap: 18px;
  }

  .card-chip .chip-name{
    margin-top: 4px;
    margin-bottom: 8px;
  }
}
