.qwrki {
  --q-ink: #1c1915;
  --q-muted: #6d645c;
  --q-line: #e4ddd4;
  --q-paper: #fbfaf7;
  --q-accent: #9a5b32;
  container-type: inline-size;
  container-name: qwrki;
  color: var(--q-ink);
  font-size: 16px;
  line-height: 1.45;
  width: 100%;
  max-width: 100%;
  margin: 12px 0 8px;
}

.qwrki,
.qwrki * { box-sizing: border-box; }

.qwrki-form {
  display: grid;
  gap: 16px;
}

.qwrki-main,
.qwrki-ticket {
  background: var(--q-paper);
  border: 1px solid var(--q-line);
  border-radius: 16px;
}

.qwrki-main { padding: 16px 16px 4px; }
.qwrki-ticket { padding: 16px; }

.qwrki-kicker {
  margin: 0;
  color: var(--q-accent);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.qwrki-limit,
.qwrki-head { margin: 0 0 14px; }
.qwrki-limit { color: var(--q-muted); font-size: 13px; }

.qwrki-units,
.qwrki-choice {
  border: 0;
  margin: 0 0 14px;
  padding: 0;
}

.qwrki-units legend,
.qwrki-choice legend,
.qwrki-field > span,
.qwrki-qty span {
  display: block;
  margin-bottom: 6px;
  color: var(--q-muted);
  font-size: 13px;
  font-weight: 700;
}

.qwrki-unit-list { display: flex; flex-wrap: wrap; gap: 8px; }
.qwrki-unit { position: relative; }
.qwrki-unit input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
}
.qwrki-unit span {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--q-line);
  border-radius: 999px;
  background: #fff;
  color: var(--q-ink);
  cursor: pointer;
}
.qwrki-unit input:checked + span {
  background: var(--q-ink);
  border-color: var(--q-ink);
  color: #fff;
}
.qwrki-unit input:focus-visible + span {
  outline: 2px solid var(--q-accent);
  outline-offset: 2px;
}

.qwrki-field { display: block; margin-bottom: 14px; }
.qwrki-field em {
  font-style: normal;
  font-weight: 600;
  color: var(--q-ink);
}
.qwrki-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.qwrki-pair.is-one { grid-template-columns: 1fr; }

.qwrki-pattern-open {
  display: inline-flex;
  align-items: center;
  margin: 0 0 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--q-accent);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.qwrki-modal[hidden] { display: none !important; }
.qwrki-modal {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: grid;
  place-items: end center;
  padding: 12px;
}
.qwrki-modal-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(22, 16, 12, 0.62);
  cursor: pointer;
}
.qwrki-modal-panel {
  position: relative;
  z-index: 1;
  width: min(920px, 100%);
  max-height: min(86vh, 820px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 22px 22px 16px 16px;
  background: #fff;
  color: var(--q-ink);
  box-shadow: 0 24px 80px rgba(22, 16, 12, 0.28);
}
.qwrki-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--q-line);
}
.qwrki-modal-head h2 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.03em;
}
.qwrki-modal-x {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--q-line);
  border-radius: 999px;
  background: #fff;
  color: var(--q-ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.qwrki-pattern-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  overflow: auto;
  padding: 14px;
}
.qwrki-pattern-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 8px;
  border: 1px solid var(--q-line);
  border-radius: 16px;
  background: var(--q-paper);
  color: var(--q-ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.qwrki-pattern-card.is-on,
.qwrki-pattern-card:hover {
  border-color: var(--q-accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--q-accent) 35%, transparent);
}
.qwrki-pattern-photo {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 12px;
  background: #efe8e0;
}
.qwrki-pattern-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.qwrki-pattern-empty {
  color: var(--q-muted);
  font-size: 12px;
}
.qwrki-pattern-name {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
}
html.qwrki-modal-open { overflow: hidden; }

@media (min-width: 760px) {
  .qwrki-modal { place-items: center; }
  .qwrki-modal-panel { border-radius: 22px; }
}

.qwrki input[type="text"],
.qwrki input[type="number"],
.qwrki select,
.qwrki textarea {
  width: 100% !important;
  max-width: 100%;
  min-height: 48px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #d9cfc3;
  border-radius: 12px;
  background: #fff;
  color: var(--q-ink);
  font: inherit;
  box-shadow: none;
}

.qwrki textarea { min-height: 76px; resize: vertical; }
.qwrki input:focus,
.qwrki select:focus,
.qwrki textarea:focus {
  border-color: var(--q-accent);
  outline: 2px solid color-mix(in srgb, var(--q-accent) 25%, transparent);
}

.qwrki-choice { display: grid; gap: 8px; }
.qwrki-choice label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
}
.qwrki-choice input { width: 18px; height: 18px; accent-color: var(--q-accent); }

.qwrki-total {
  margin: 8px 0 0;
  color: var(--q-ink);
  font-size: 32px;
  font-weight: 720;
  letter-spacing: -0.03em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.qwrki-ex { min-height: 1.2em; margin: 6px 0 0; color: var(--q-muted); font-size: 13px; }
.qwrki-break {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 7px 16px;
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px dashed var(--q-line);
}
.qwrki-break dt { margin: 0; color: var(--q-muted); font-size: 13px; }
.qwrki-break dd { margin: 0; text-align: right; font-size: 14px; font-variant-numeric: tabular-nums; }
.qwrki-error {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fde8e4;
  color: #6b2a22;
  font-size: 14px;
}
.qwrki-buy { display: flex; gap: 10px; align-items: end; margin-top: 16px; }
.qwrki-qty { width: 84px; }
.qwrki-qty input { text-align: center; }

.qwrki .qwrki-submit {
  flex: 1;
  min-height: 48px;
  border: 0;
  border-radius: 12px;
  background: var(--q-ink);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
}
.qwrki .qwrki-submit:hover { background: #000; color: #fff; }
.qwrki .qwrki-submit:disabled { background: #c8b8ae; color: #fff; cursor: not-allowed; }
.qwrki.is-quoting .qwrki-total { opacity: 0.45; }

.qwrki-admin-hint {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--q-paper, #fbfaf7);
  color: #1c1915;
}

@container qwrki (min-width: 720px) {
  .qwrki-form { grid-template-columns: minmax(0, 1fr) 280px; align-items: start; }
  .qwrki-ticket { position: sticky; top: 12px; }
}

@media (max-width: 640px) {
  .qwrki-pair { grid-template-columns: 1fr; }
  .qwrki-total { font-size: 28px; }
}
