*,
*::before,
*::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body { max-width: 100%; overflow-x: hidden; }

body {
  font-family: Manrope, system-ui, sans-serif;
  background: #E9D5C5;
  color: #3B2118;
  min-height: 100dvh;
  line-height: 1.5;
}

a { color: #9A3412; text-decoration: none; }
button, input { font: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid #C2410C; outline-offset: 2px; }

.wrap {
  width: min(430px, 100%);
  margin: 0 auto;
  padding-left: 16px;
  padding-right: 16px;
}

.mast {
  background: #9A3412;
  color: #F4E8D8;
  padding-top: env(safe-area-inset-top);
}

.mast .wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 56px;
  padding-top: 12px;
  padding-bottom: 12px;
}

.mast span {
  font-size: 12px;
  font-weight: 800;
  background: #F4E8D8;
  color: #9A3412;
  padding: 4px 8px;
  border-radius: 2px;
}

h1 {
  margin: 18px 0 6px;
  font-size: 1.65rem;
  letter-spacing: -0.03em;
}

.lead, .note, footer { color: #8A6A58; font-size: 0.92rem; }

.book {
  margin: 16px 0 24px;
  background: #FFF9F3;
  border: 1px solid #D7B8A3;
  box-shadow: 0 8px 0 #C4A28A;
}

.leaf { padding: 16px 16px 12px; }

.tab {
  display: inline-block;
  margin-bottom: 8px;
  padding: 3px 8px;
  background: #9A3412;
  color: #F4E8D8;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 2px 2px 0 0;
}

.num {
  font-size: clamp(1.35rem, 6vw, 1.7rem);
  font-weight: 800;
  white-space: nowrap;
  margin-bottom: 12px;
}

.num.sm { font-size: 1.2rem; }

.row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 8px;
}

.chip {
  min-height: 42px;
  border: 1px solid #D7B8A3;
  background: #F3E4D4;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 800;
  cursor: pointer;
  color: #3B2118;
}

.chip.is-on { background: #9A3412; border-color: #9A3412; color: #fff; }
.chip:disabled { opacity: 0.45; }

.perf {
  height: 10px;
  margin: 0 12px;
  background:
    radial-gradient(circle at 8px 5px, #E9D5C5 4px, transparent 4.5px) 0 0 / 16px 10px repeat-x;
  border-top: 1px dashed #D7B8A3;
  border-bottom: 1px dashed #D7B8A3;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 28px;
  background: transparent;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 0;
  background: linear-gradient(90deg, #C2410C var(--progress, 28%), #E4C9B5 var(--progress, 28%));
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -5px;
  border-radius: 2px;
  background: #9A3412;
  border: 2px solid #FFF9F3;
}

input[type="range"]::-moz-range-track {
  height: 6px;
  background: #E4C9B5;
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: 2px solid #FFF9F3;
  background: #9A3412;
  border-radius: 2px;
}

.ends {
  display: flex;
  justify-content: space-between;
  font-size: 0.74rem;
  color: #8A6A58;
}

.note { margin: 12px 16px 14px; }

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: calc(100% - 32px);
  margin: 0 16px 16px;
  min-height: 52px;
  border: 0;
  border-radius: 4px;
  background: #9A3412;
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.btn.ghost {
  margin-top: 0;
  background: transparent;
  border: 1px solid #D7B8A3;
  color: #3B2118;
}

.btn:disabled { opacity: 0.5; }

.wait { text-align: center; padding: 32px 16px; font-weight: 800; }

.out { text-align: center; padding: 16px 0 4px; }

.k {
  font-size: 12px;
  font-weight: 800;
  color: #9A3412;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.code {
  margin: 10px 16px 12px;
  padding: 14px;
  background: #F3E4D4;
  border-top: 4px solid #9A3412;
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.faq-item {
  margin-bottom: 8px;
  border-bottom: 2px solid #C4A28A;
}

.faq-q {
  width: 100%;
  min-height: 50px;
  padding: 12px 0;
  border: 0;
  background: transparent;
  text-align: left;
  font-weight: 700;
  cursor: pointer;
  color: #3B2118;
}

.faq-a { display: none; padding: 0 0 12px; color: #8A6A58; font-size: 0.9rem; }
.faq-item.is-open .faq-a { display: block; }

footer {
  padding: 24px 16px calc(32px + env(safe-area-inset-bottom));
  text-align: center;
}

footer nav {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 10px;
}

.legal { padding-top: 8px; }
.legal h1 { font-size: 1.5rem; }
.paper {
  margin: 16px 0 32px;
  padding: 18px 16px;
  background: #FFF9F3;
  border-top: 4px solid #9A3412;
}
.paper h2 { margin: 18px 0 8px; font-size: 1rem; color: #9A3412; }
.paper p, .paper li { color: #8A6A58; }
.paper ul { padding-left: 18px; margin-top: 8px; }
.back { display: inline-block; margin-bottom: 10px; }
