:root {
  --win: #222226;
  --hb: #2e2e32;
  --pop: #36363a;
  --card: rgba(255,255,255,.08);
  --fg: #fff;
  --mu: rgba(255,255,255,.58);
  --line: rgba(255,255,255,.08);
  --btn: rgba(255,255,255,.1);
  --btnh: rgba(255,255,255,.15);
  --btna: rgba(255,255,255,.2);
  --ac: #9141ac;
  --acfg: #fff;
  --actx: #dc8add;
  --font: "Adwaita Sans",Inter,system-ui,sans-serif;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top,0px);
  padding-bottom: env(safe-area-inset-bottom,0px);
  color-scheme: dark;
  scrollbar-color: rgba(255,255,255,.3) transparent;
  scrollbar-width: thin;
}

html {
  scroll-padding-top: env(safe-area-inset-top,0px);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--win);
  color: var(--fg);
  font: 15px/1.5 var(--font);
}

.hb {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  background: var(--hb);
  box-shadow: 0 1px rgba(0,0,0,.4);
}

.wt {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.2;
  min-width: 0;
}

.wt b {
  font-size: 14px;
  font-weight: 700;
}

.wt span {
  font-size: 11px;
  color: var(--mu);
}

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 12px 20px;
}

.hero {
  text-align: center;
  padding: 40px 8px 32px;
}

.hero .ico {
  margin: 0 auto 12px;
  font-size: 84px;
  line-height: 1.1;
  color: var(--actx);
  opacity: .75;
  font-weight: 700;
}

.hero h1 {
  margin: 0 0 10px;
  font-size: 28px;
  line-height: 1.2;
  font-weight: 800;
}

.hero p {
  margin: 0 auto;
  max-width: 54ch;
  color: var(--mu);
}

.hero p.sub {
  margin-top: 8px;
  font-size: 13px;
}

.grp {
  margin-bottom: 26px;
}

.gt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 6px 10px;
  min-height: 34px;
}

.gt h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.card {
  background: var(--card);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(255,255,255,.05);
}

.drop {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  min-height: 64px;
  cursor: pointer;
  background: var(--card);
  border-radius: 12px;
  box-shadow: 0 0 0 1px rgba(255,255,255,.05);
  transition: background .12s;
}

.drop:hover {
  background: rgba(255,255,255,.12);
}

.drop:active {
  background: rgba(255,255,255,.16);
}

.drop:focus-within {
  outline: 2px solid var(--ac);
  outline-offset: -2px;
}

.drop input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.drop .ic {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(145,65,172,.3);
  color: var(--actx);
}

.drop .tx {
  flex: 1;
  min-width: 0;
}

.drop b {
  display: block;
  font-weight: 700;
}

.drop .tx span {
  color: var(--mu);
  font-size: 13px;
}

.drop .chev {
  flex: none;
  color: var(--mu);
}

.er {
  display: flex;
  flex-direction: column;
  padding: 8px 16px;
  min-height: 56px;
  justify-content: center;
  border-top: 1px solid var(--line);
}

.er:first-child {
  border-top: 0;
}

.er:focus-within {
  outline: 2px solid var(--ac);
  outline-offset: -2px;
}

.er label {
  font-size: 12px;
  color: var(--mu);
  margin: 0;
}

input,select,textarea {
  width: 100%;
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: var(--fg);
  font: inherit;
  outline: none;
}

select {
  appearance: none;
  cursor: pointer;
  padding-right: 26px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-opacity='.65' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") right center/16px no-repeat;
}

option {
  background: var(--pop);
  color: var(--fg);
}

textarea {
  min-height: 76px;
  resize: vertical;
}

::placeholder {
  color: rgba(255,255,255,.3);
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: 9px;
  background: var(--btn);
  color: var(--fg);
  font: 700 14px var(--font);
  cursor: pointer;
  transition: background .12s;
}

button:hover {
  background: var(--btnh);
}

button:active {
  background: var(--btna);
}

button.pri {
  background: var(--ac);
  color: var(--acfg);
}

button.pri:hover {
  background: #a24fbd;
}

button.pri:active {
  background: #b25ecb;
}

button:focus-visible {
  outline: 2px solid var(--actx);
  outline-offset: 2px;
}

button:disabled {
  opacity: .4;
  cursor: default;
  pointer-events: none;
}

.row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.gt button {
  min-height: 30px;
  padding: 0 12px;
  font-size: 13px;
}

#list {
  min-height: 72px;
  padding: 16px;
  color: var(--mu);
}

#list:has(.ch) {
  padding: 0;
}

.ch {
  display: grid;
  grid-template-columns: auto minmax(0,1fr) auto auto;
  grid-template-areas: "ord fn kd pg" "ord inp kd pg";
  column-gap: 12px;
  align-items: center;
  min-height: 60px;
  padding: 8px 14px;
  border-top: 1px solid var(--line);
}

.ch:first-child {
  border-top: 0;
}

.ch:focus-within {
  outline: 2px solid var(--ac);
  outline-offset: -2px;
}

.ch .ord {
  grid-area: ord;
}

.ch .fn {
  grid-area: fn;
  font-size: 12px;
  color: var(--mu);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ch input {
  grid-area: inp;
}

.ch .kd {
  grid-area: kd;
  width: auto;
  min-height: 32px;
  padding: 0 28px 0 12px;
  border-radius: 9px;
  background-color: var(--btn);
  background-position: right 8px center;
  font-size: 13px;
  font-weight: 700;
}

.ch .kd:hover {
  background-color: var(--btnh);
}

.ch .kd:focus-visible {
  outline: 2px solid var(--actx);
  outline-offset: 2px;
}

.ch .pg {
  grid-area: pg;
  min-width: 44px;
  text-align: right;
  font-size: 13px;
  color: var(--actx);
  font-variant-numeric: tabular-nums;
}

.fn.man {
  display: flex;
  align-items: center;
  gap: 8px;
}

.fn.man span {
  overflow: hidden;
  text-overflow: ellipsis;
}

button.lnk {
  flex: none;
  min-height: 0;
  padding: 0 6px;
  background: transparent;
  color: var(--actx);
  font-size: 12px;
}

.ord {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ord button {
  min-height: 0;
  width: 26px;
  height: 20px;
  padding: 0;
  font-size: 9px;
  border-radius: 6px;
  background: transparent;
  color: var(--mu);
}

.ord button:hover {
  background: var(--btn);
  color: var(--fg);
}

.bar {
  position: sticky;
  bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--hb);
  border-radius: 14px;
  padding: 10px 10px 10px 18px;
  box-shadow: 0 0 0 1px rgba(255,255,255,.07),0 8px 24px rgba(0,0,0,.45);
}

.bar .info {
  flex: 1;
  min-width: 180px;
}

.bar .pri {
  border-radius: 999px;
  padding: 0 24px;
}

#sum {
  font-weight: 700;
}

#st,#st2,#pickCount {
  font-size: 13px;
  color: var(--mu);
}

progress {
  appearance: none;
  display: block;
  width: 100%;
  height: 6px;
  margin-top: 6px;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255,255,255,.12);
}

progress::-webkit-progress-bar {
  background: rgba(255,255,255,.12);
}

progress::-webkit-progress-value {
  background: var(--actx);
  border-radius: 999px;
}

progress::-moz-progress-bar {
  background: var(--actx);
  border-radius: 999px;
}

.hide {
  display: none;
}

dialog {
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: var(--pop);
  color: var(--fg);
  width: min(640px,94vw);
  max-height: min(86vh,760px);
  box-shadow: 0 0 0 1px rgba(255,255,255,.08),0 16px 48px rgba(0,0,0,.6);
}

dialog::backdrop {
  background: rgba(0,0,0,.55);
}

dialog[open] {
  display: flex;
}

.dlg {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 0;
}

.dhb {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  min-height: 52px;
}

.dhb button:first-child {
  justify-self: start;
}

.dhb button:last-child {
  justify-self: end;
}

.dbody {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 4px 14px 16px;
}

.pk-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--mu);
  margin: 18px 4px 8px;
}

.pk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill,minmax(92px,1fr));
  gap: 8px;
}

.pk-thumb {
  position: relative;
  display: block;
  aspect-ratio: 2/3;
  margin: 0;
  border-radius: 9px;
  overflow: hidden;
  background: var(--win);
  cursor: pointer;
}

.pk-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pk-thumb input {
  appearance: none;
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 1;
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.85);
  background: rgba(0,0,0,.45);
}

.pk-thumb input:checked {
  border-color: var(--ac);
  background: var(--ac) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center/14px no-repeat;
}

.pk-thumb span {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 2px 6px;
  font-size: 10px;
  color: #fff;
  background: rgba(0,0,0,.65);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pk-thumb:has(input:checked) {
  outline: 3px solid var(--ac);
  outline-offset: -3px;
}

@media (max-width:560px) {
  .hero {
    padding: 28px 4px 24px;
  }
  .hero .ico {
    font-size: 68px;
  }
  .hero h1 {
    font-size: 24px;
  }
  .bar {
    bottom: 8px;
    padding: 12px;
  }
  .bar .info {
    min-width: 100%;
  }
  .bar .row {
    width: 100%;
  }
  .bar .row button {
    flex: 1;
  }
  .gt .row {
    width: 100%;
  }
  .gt .row button {
    flex: 1;
  }
  .ch {
    grid-template-columns: auto minmax(0,1fr) auto;
    grid-template-areas: "ord fn pg" "ord inp pg" "ord kd kd";
  }
  .ch .kd {
    margin-top: 6px;
    width: 100%;
  }
}

@media (pointer:coarse) {
  button {
    min-height: 44px;
  }
  .gt button {
    min-height: 40px;
  }
  .ord button {
    width: 36px;
    height: 30px;
    font-size: 11px;
  }
  .ch {
    padding: 10px 14px;
  }
  .ch .kd {
    min-height: 40px;
  }
  .er {
    padding: 10px 16px;
  }
  input,select,textarea {
    font-size: 16px;
  }
}

@media (prefers-reduced-motion:reduce) {
  * {
    transition: none!important;
  }
}

button.flat {
  background: transparent;
}

button.flat:hover {
  background: var(--btn);
}

.hb .lang {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  gap: 6px;
  padding: 0 10px;
  font-size: 13px;
}
