* {
  box-sizing: border-box;
}

:root {
  --ink: #000;
  --paper: #fffef0;
  --panel: #fffdf7;
  --red: #e23636;
  --blue: #1e90ff;
  --yellow: #ffd700;
  --green: #20a464;
  --gray: #2c2c2c;
}

body {
  margin: 0;
  background-color: var(--paper);
  background-image:
    radial-gradient(circle, rgba(0, 0, 0, 0.12) 1px, transparent 1.6px),
    linear-gradient(135deg, rgba(30, 144, 255, 0.08), transparent 34%),
    linear-gradient(315deg, rgba(226, 54, 54, 0.06), transparent 38%);
  background-position: 0 0, 0 0, 0 0;
  background-size: 18px 18px, 100% 100%, 100% 100%;
  color: var(--ink);
  font-family: "Noto Sans SC", "Comic Neue", "Microsoft YaHei", sans-serif;
}

body::before {
  position: fixed;
  inset: 0;
  background:
    repeating-linear-gradient(
      112deg,
      transparent 0 42px,
      rgba(0, 0, 0, 0.06) 43px 45px,
      transparent 46px 96px
    );
  content: "";
  opacity: 0.35;
  pointer-events: none;
  z-index: -1;
}

button,
input,
textarea {
  font: inherit;
  min-width: 0;
}

.app {
  position: relative;
  width: min(1180px, calc(100% - 28px));
  margin: 22px auto 48px;
}

.app::before {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 74px;
  height: 58px;
  display: grid;
  place-items: center;
  border: 3px solid var(--ink);
  background: var(--yellow);
  box-shadow: 5px 5px 0 var(--ink);
  clip-path: polygon(8% 0, 100% 0, 92% 50%, 100% 100%, 7% 100%, 0 50%);
  color: var(--red);
  content: "GO!";
  font-family: "Bangers", "Noto Sans SC", sans-serif;
  font-size: 28px;
  line-height: 1;
  transform: rotate(5deg);
  pointer-events: none;
  z-index: 2;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background:
    radial-gradient(circle at 82% 20%, rgba(255, 215, 0, 0.35) 1px, transparent 2px),
    #fff;
  background-size: 12px 12px, auto;
  box-shadow: 7px 7px 0 var(--ink);
  padding: 18px 100px 18px 20px;
}

.app-header p {
  margin: 8px 0 0;
  color: #444;
  font-weight: 700;
}

.tool-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 6px;
  border: 3px solid var(--ink);
  border-radius: 9px;
  background: #fff;
  padding: 5px;
}

.tool-tab {
  background: #fff;
  box-shadow: none;
  color: var(--ink);
}

.tool-tab:hover {
  box-shadow: none;
}

.tool-tab.active {
  background: var(--red);
  color: #fff;
}

.tool-tab#couponToolTab.active {
  background: var(--blue);
}

.tool-tab#magicToolTab.active {
  background: var(--yellow);
  color: var(--ink);
}

.toolbar,
.request-panel,
.filters,
.location-panel,
.schedule,
.status,
.merchant-card,
.favorites-panel,
.history-panel,
.coupon-card,
.qr-dialog,
.magic-panel,
.magic-coupon-panel,
.magic-result-panel {
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 7px 7px 0 var(--ink);
}

.magic-panel,
.magic-coupon-panel,
.magic-result-panel {
  margin-top: 14px;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 7px 7px 0 var(--ink);
  padding: 16px;
}

.magic-panel {
  margin-top: 0;
  background:
    radial-gradient(circle at 86% 18%, rgba(255, 215, 0, 0.38) 1px, transparent 2px),
    var(--panel);
  background-size: 12px 12px, auto;
}

.magic-heading {
  align-items: center;
}

.magic-warning {
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: var(--yellow);
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 900;
}

.magic-list-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 140px;
  gap: 10px;
  margin-top: 14px;
}

.magic-selection-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.magic-coupon-grid,
.magic-result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.magic-coupon-card {
  display: grid;
  grid-template-columns: 22px 66px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-height: 84px;
  border: 2px solid var(--ink);
  border-radius: 7px;
  background: #fff;
  padding: 9px;
  cursor: pointer;
}

.magic-coupon-card:has(input:checked) {
  background: #fff9d6;
  box-shadow: 3px 3px 0 var(--ink);
}

.magic-coupon-card input {
  width: 18px;
  height: 18px;
  accent-color: var(--red);
}

.magic-amount {
  display: grid;
  place-items: center;
  min-height: 58px;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: var(--red);
  color: #fff;
}

.magic-amount b {
  font-size: 24px;
  line-height: 1;
}

.magic-amount small,
.magic-coupon-copy small {
  font-size: 11px;
}

.magic-coupon-copy {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.magic-coupon-copy strong,
.magic-coupon-copy small {
  overflow-wrap: anywhere;
}

.magic-coupon-copy small {
  color: #555;
}

.magic-official-link {
  width: fit-content;
  color: #0759a8;
  font-size: 11px;
  font-weight: 900;
  text-decoration: underline;
}

.magic-result-card {
  border: 2px solid var(--ink);
  border-radius: 7px;
  background: #fff;
  padding: 10px;
  box-shadow: 3px 3px 0 var(--ink);
}

.magic-result-card.error-card {
  background: #fff0f0;
}

.magic-result-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.magic-result-title > span {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--yellow);
  font-weight: 900;
}

.magic-result-card p {
  margin: 8px 0 0;
  color: #9d1b1b;
}

.magic-inflated-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 7px;
  margin-top: 10px;
}

.magic-inflated-item {
  display: grid;
  gap: 2px;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: #f0fff7;
  padding: 7px;
}

.magic-inflated-item b {
  color: var(--red);
  font-size: 22px;
}

.magic-inflated-item span,
.magic-inflated-item small {
  font-size: 11px;
}

.toolbar {
  position: relative;
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  gap: 18px;
  align-items: end;
  overflow: hidden;
  padding: 20px;
}

.toolbar::after {
  position: absolute;
  right: -56px;
  bottom: -56px;
  width: 210px;
  height: 210px;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(30, 144, 255, 0.22) 1px, transparent 2px),
    rgba(255, 215, 0, 0.2);
  background-size: 12px 12px;
  content: "";
  pointer-events: none;
}

h1,
h2 {
  margin: 0;
  line-height: 1.08;
}

h1 {
  margin-bottom: 8px;
  color: var(--red);
  font-size: 34px;
  font-weight: 900;
  letter-spacing: 0;
  text-shadow:
    2px 2px 0 var(--yellow),
    4px 4px 0 var(--ink);
}

h2 {
  font-size: 22px;
  font-weight: 900;
}

.summary,
.muted,
.schedule p,
.location-panel p {
  color: #444;
  font-size: 14px;
}

.request-panel {
  display: grid;
  grid-template-columns: 140px 140px minmax(0, 1fr);
  gap: 12px;
  align-items: end;
  margin-top: 14px;
  padding: 13px;
  background:
    linear-gradient(135deg, rgba(30, 144, 255, 0.12), transparent 40%),
    var(--panel);
}

.check-row {
  display: flex;
  align-items: center;
  min-height: 45px;
  gap: 8px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: #fff;
  padding: 9px 10px;
  font-weight: 900;
}

.check-row input,
.switch-row input {
  width: auto;
  accent-color: var(--red);
}

.order-field,
.location-grid label {
  display: grid;
  gap: 6px;
  color: #222;
  font-size: 14px;
  font-weight: 900;
}

.token-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 108px;
  gap: 10px;
}

.filters {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 210px 140px;
  gap: 10px;
  margin-top: 14px;
  padding: 12px;
}

.auto-clear-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 8px 10px;
  font-size: 14px;
  font-weight: 900;
  white-space: nowrap;
}

.auto-clear-row input {
  width: auto;
  accent-color: var(--red);
}

.location-panel,
.schedule {
  margin-top: 14px;
  padding: 14px;
}

.location-panel {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  gap: 18px;
}

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

.location-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.location-actions button {
  flex: 0 0 auto;
  padding: 6px 10px;
  font-size: 12px;
}

.location-actions .muted {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.schedule p,
.location-panel p {
  margin: 7px 0 0;
}

.switch-row {
  display: flex;
  gap: 8px;
  align-items: center;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--yellow);
  padding: 8px 12px;
  white-space: nowrap;
  font-weight: 900;
}

.schedule-form {
  display: grid;
  grid-template-columns: 180px 108px;
  gap: 10px;
  margin-top: 14px;
}

.schedule-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.time-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: #fff;
  padding: 6px 8px 6px 12px;
  font-weight: 900;
}

.time-chip button {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  padding: 0;
  line-height: 1;
}

input {
  width: 100%;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
}

textarea {
  width: 100%;
  resize: vertical;
  min-height: 116px;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 12px;
  outline: none;
}

textarea:focus {
  box-shadow: 4px 4px 0 var(--blue);
}

input:focus {
  box-shadow: 4px 4px 0 var(--blue);
}

input:disabled {
  background: #f1f1ea;
  color: #777;
}

button {
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: var(--red);
  box-shadow: 4px 4px 0 var(--ink);
  color: #fff;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 900;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

button:hover {
  transform: translate(-1px, -1px);
  box-shadow: 5px 5px 0 var(--ink);
}

button:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--ink);
}

button.secondary {
  background: var(--yellow);
  color: var(--ink);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.status {
  margin-top: 14px;
  padding: 13px 15px;
  background: #fff;
  color: #333;
  font-weight: 700;
}

.status.error {
  background: #fff0f0;
  color: #b42318;
}

.merchant-panel {
  margin-top: 18px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.merchant-tabs {
  display: inline-grid;
  grid-template-columns: repeat(3, minmax(96px, 1fr));
  gap: 7px;
  border: 3px solid var(--ink);
  border-radius: 10px;
  background: #fff;
  padding: 5px;
  box-shadow: 5px 5px 0 var(--ink);
}

.tab-button {
  background: #fff;
  box-shadow: none;
  color: var(--ink);
  padding: 8px 12px;
  white-space: nowrap;
}

.tab-button:hover {
  box-shadow: none;
}

.tab-button.active {
  background: var(--blue);
  color: #fff;
}

.tab-button.active:first-child {
  background: var(--red);
}

.tab-button.active:last-child {
  background: var(--green);
}

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

.merchant-grid[hidden],
[hidden] {
  display: none !important;
}

.empty-list {
  grid-column: 1 / -1;
  border: 3px dashed var(--ink);
  border-radius: 8px;
  background: #fff;
  color: #444;
  padding: 18px;
  text-align: center;
  font-weight: 900;
}

.merchant-card {
  display: grid;
  grid-template-columns: 98px minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  background:
    radial-gradient(circle at 100% 0, rgba(255, 215, 0, 0.22), transparent 30%),
    #fff;
}

.merchant-card:nth-child(odd) {
  transform: rotate(-0.25deg);
}

.merchant-card:nth-child(even) {
  transform: rotate(0.25deg);
}

.merchant-card:hover {
  transform: translateY(-2px) rotate(0deg);
}

.merchant-img {
  width: 98px;
  height: 98px;
  border: 3px solid var(--ink);
  border-radius: 8px;
  object-fit: cover;
  background: #f1f1ea;
}

.merchant-main {
  min-width: 0;
}

.merchant-title-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.source-badge {
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: var(--yellow);
  color: var(--red);
  padding: 4px 7px;
  font-size: 12px;
  font-weight: 900;
  transform: skew(-6deg);
  white-space: nowrap;
}

.merchant-name {
  overflow: hidden;
  color: #111;
  font-size: 18px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.merchant-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.pill {
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: #fffef0;
  color: #111;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.links a,
.copy-link {
  border: 2px solid var(--ink);
  border-radius: 7px;
  box-shadow: 3px 3px 0 var(--ink);
  padding: 7px 9px;
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
}

.links a {
  background: var(--blue);
  color: #fff;
}

.links a:hover,
.copy-link:hover {
  transform: translate(-1px, -1px);
}

.copy-link {
  background: var(--yellow);
  color: var(--ink);
}

.coupon-query-link {
  background: var(--green);
  color: #fff;
}

.coupon-query-panel {
  padding-top: 2px;
}

.coupon-intro {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 4px 12px;
}

.coupon-intro p,
.favorites-panel p,
.coupon-card p {
  margin: 6px 0 0;
  color: #444;
}

.burst-label {
  display: grid;
  place-items: center;
  width: 112px;
  height: 76px;
  flex: 0 0 auto;
  background: var(--yellow);
  clip-path: polygon(50% 0, 61% 17%, 81% 7%, 82% 28%, 100% 32%, 87% 50%, 100% 67%, 80% 71%, 80% 94%, 60% 83%, 49% 100%, 39% 82%, 18% 94%, 19% 71%, 0 67%, 13% 49%, 0 32%, 20% 28%, 19% 7%, 40% 17%);
  color: var(--red);
  font-family: "Bangers", sans-serif;
  font-size: 24px;
  text-shadow: 2px 2px 0 #fff;
  transform: rotate(-5deg);
}

.coupon-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 12px;
  align-items: stretch;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(30, 144, 255, 0.1), transparent 45%),
    #fff;
  box-shadow: 7px 7px 0 var(--ink);
  padding: 14px;
}

.coupon-result {
  margin-top: 18px;
}

.favorites-panel,
.history-panel {
  margin-top: 22px;
  padding: 16px;
}

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

.coupon-card {
  overflow: hidden;
  padding: 14px;
  background:
    radial-gradient(circle at 96% 6%, rgba(255, 215, 0, 0.28) 1px, transparent 2px),
    #fff;
  background-size: 12px 12px, auto;
}

.coupon-card.featured {
  border-color: var(--blue);
  box-shadow: 8px 8px 0 var(--ink);
}

.coupon-card.compact {
  padding: 10px;
}

.coupon-card.compact .coupon-card-head {
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 9px;
}

.coupon-card.compact .coupon-card-head img,
.coupon-card.compact .coupon-placeholder {
  width: 56px;
  height: 56px;
  border-width: 2px;
}

.coupon-card.compact h3 {
  margin-top: 4px;
  font-size: 17px;
}

.coupon-card.compact p {
  margin-top: 3px;
  font-size: 12px;
}

.coupon-card.compact .coupon-actions,
.coupon-card.compact .coupon-card-tools {
  gap: 6px;
  margin-top: 8px;
}

.coupon-card.compact .coupon-actions a,
.coupon-card.compact .coupon-actions button {
  box-shadow: 2px 2px 0 var(--ink);
  padding: 5px 7px;
  font-size: 12px;
}

.toolbar,
.token-form,
.request-panel,
.location-panel,
.location-grid,
.schedule,
.schedule-form,
.filters,
.coupon-form,
.favorites-panel,
.history-panel,
.coupon-grid,
.coupon-card {
  min-width: 0;
  max-width: 100%;
}

.coupon-card.compact .coupon-card-tools {
  padding-top: 7px;
}

.coupon-card-head {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.coupon-card-head img,
.coupon-placeholder {
  width: 70px;
  height: 70px;
  border: 3px solid var(--ink);
  border-radius: 8px;
  object-fit: cover;
  background: var(--yellow);
}

.coupon-placeholder {
  display: grid;
  place-items: center;
  color: var(--red);
  font-size: 30px;
  font-weight: 900;
}

.coupon-card-title {
  min-width: 0;
}

.coupon-card-title-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.coupon-entry-switch {
  display: inline-grid;
  grid-template-columns: repeat(2, auto);
  flex: 0 0 auto;
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: #fff;
}

.coupon-entry-switch button {
  min-width: 0;
  border: 0;
  border-radius: 0;
  background: #fff;
  box-shadow: none;
  color: var(--ink);
  padding: 2px 5px;
  font-size: 10px;
  line-height: 1.2;
  white-space: nowrap;
}

.coupon-entry-switch button + button {
  border-left: 1px solid var(--ink);
}

.coupon-entry-switch button:hover,
.coupon-entry-switch button:active {
  transform: none;
  box-shadow: none;
}

.coupon-entry-switch button.active {
  background: var(--yellow);
  color: var(--ink);
}

.coupon-card h3 {
  overflow: hidden;
  margin: 6px 0 0;
  font-size: 19px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.coupon-card p {
  font-size: 13px;
}

.coupon-state {
  display: inline-block;
  border: 2px solid var(--ink);
  border-radius: 5px;
  padding: 3px 7px;
  font-size: 13px;
  font-weight: 900;
  transform: skew(-5deg);
}

.coupon-state.available {
  background: var(--green);
  color: #fff;
}

.coupon-state.unavailable {
  background: #eee;
  color: #333;
}

.coupon-state.unknown {
  background: var(--yellow);
  color: #111;
}

.coupon-actions,
.coupon-card-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.coupon-actions a,
.coupon-actions button {
  border: 2px solid var(--ink);
  border-radius: 7px;
  background: var(--blue);
  box-shadow: 3px 3px 0 var(--ink);
  color: #fff;
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
}

.coupon-actions .browser-action {
  background: var(--green);
}

.coupon-actions button {
  background: var(--yellow);
  color: var(--ink);
}

.coupon-card-tools {
  align-items: center;
  border-top: 2px dashed #777;
  padding-top: 10px;
}

.coupon-card-tools button {
  border-width: 2px;
  box-shadow: 2px 2px 0 var(--ink);
  padding: 6px 9px;
  font-size: 12px;
}

.coupon-card-tools span {
  margin-left: auto;
  color: #666;
  font-size: 12px;
}

.danger-quiet {
  background: #fff;
  color: var(--red);
}

.qr-dialog {
  width: min(390px, calc(100% - 30px));
  padding: 22px;
  text-align: center;
}

.qr-dialog::backdrop {
  background: rgba(0, 0, 0, 0.65);
}

.qr-dialog img {
  display: block;
  width: min(100%, 320px);
  margin: 16px auto;
  border: 3px solid var(--ink);
  background: #fff;
}

.dialog-close {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  padding: 0;
  line-height: 1;
}

@media (max-width: 820px) {
  .app {
    width: min(100% - 18px, 1180px);
    margin-top: 12px;
  }

  .toolbar,
  .request-panel,
  .token-form,
  .filters,
  .location-panel,
  .location-grid,
  .schedule-form,
  .merchant-grid,
  .coupon-form,
  .coupon-grid {
    grid-template-columns: 1fr;
  }

  .app-header {
    align-items: stretch;
    flex-direction: column;
    padding: 15px;
    box-shadow: 4px 4px 0 var(--ink);
  }

  .tool-tabs {
    width: 100%;
  }

  .app::before {
    display: none;
  }

  .section-head,
  .schedule-head {
    align-items: stretch;
    flex-direction: column;
  }

  .merchant-tabs {
    width: 100%;
  }

  .toolbar,
  .request-panel,
  .filters,
  .location-panel,
  .schedule,
  .status {
    box-shadow: 4px 4px 0 var(--ink);
  }

  .filters {
    margin-top: 12px;
  }

  .merchant-grid {
    gap: 9px;
    margin-top: 9px;
  }

  .merchant-card {
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 8px;
    padding: 8px;
    box-shadow: 4px 4px 0 var(--ink);
  }

  .merchant-img {
    width: 64px;
    height: 64px;
    aspect-ratio: auto;
    border-width: 2px;
    border-radius: 6px;
  }

  .merchant-title-row {
    gap: 6px;
    margin-bottom: 5px;
  }

  .source-badge {
    padding: 2px 5px;
    font-size: 11px;
  }

  .merchant-name {
    font-size: 15px;
  }

  .merchant-meta {
    gap: 4px;
    margin-bottom: 6px;
  }

  .pill {
    border-width: 1.5px;
    padding: 2px 6px;
    font-size: 11px;
  }

  .links {
    gap: 5px;
  }

  .links a,
  .copy-link,
  .coupon-query-link {
    border-width: 2px;
    box-shadow: 2px 2px 0 var(--ink);
    padding: 5px 7px;
    font-size: 12px;
  }

  .coupon-intro {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .burst-label {
    width: 78px;
    height: 58px;
    font-size: 18px;
  }

  .coupon-form,
  .favorites-panel,
  .history-panel,
  .coupon-card {
    box-shadow: 4px 4px 0 var(--ink);
  }

  .coupon-card-tools span {
    width: 100%;
    margin-left: 0;
  }

  .coupon-result {
    margin-top: 12px;
  }

}

/* Compact operational layout */
.app {
  width: min(1080px, calc(100% - 24px));
  margin-top: 14px;
}

.app-header {
  margin-bottom: 12px;
  padding-top: 14px;
  padding-bottom: 14px;
}

.toolbar {
  gap: 12px;
  padding: 14px;
}

.request-panel,
.location-panel,
.schedule {
  margin-top: 10px;
  padding: 10px;
}

.filters,
.status {
  margin-top: 10px;
}

input,
textarea {
  padding: 9px 10px;
}

textarea {
  min-height: 82px;
}

button {
  padding: 8px 11px;
}

.coupon-query-panel {
  padding-top: 0;
}

.coupon-intro {
  padding: 10px 2px 8px;
}

.coupon-form {
  gap: 9px;
  padding: 10px;
}

.favorites-panel,
.history-panel {
  margin-top: 14px;
  padding: 12px;
}

.coupon-grid {
  gap: 10px;
  margin-top: 10px;
}

.coupon-card.compact {
  padding: 8px;
}

.coupon-card.compact .coupon-card-head {
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 8px;
}

.coupon-card.compact .coupon-card-head img,
.coupon-card.compact .coupon-placeholder {
  width: 48px;
  height: 48px;
}

.coupon-card.compact .coupon-placeholder {
  font-size: 22px;
}

.coupon-card.compact h3 {
  font-size: 16px;
}

.coupon-card.compact .coupon-state {
  padding: 2px 5px;
  font-size: 11px;
}

.coupon-card.compact .coupon-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
}

.coupon-card.compact .coupon-actions a,
.coupon-card.compact .coupon-actions button {
  min-width: 0;
  padding: 5px 3px;
  overflow: hidden;
  font-size: 11px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.coupon-card.compact .coupon-card-tools {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
}

.coupon-card.compact .coupon-card-tools span {
  overflow: hidden;
  margin-left: 0;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 820px) {
  .app {
    width: calc(100% - 12px);
    margin: 7px auto 28px;
  }

  .app-header,
  .toolbar,
  .request-panel,
  .filters,
  .location-panel,
  .schedule,
  .status,
  .favorites-panel,
  .history-panel,
  .coupon-form,
  .coupon-card {
    border-width: 2px;
    box-shadow: 3px 3px 0 var(--ink);
  }

  .app-header {
    gap: 10px;
    margin-bottom: 10px;
    padding: 10px;
  }

  h1 {
    margin-bottom: 4px;
    font-size: 27px;
    text-shadow: 1px 1px 0 var(--yellow), 3px 3px 0 var(--ink);
  }

  h2 {
    font-size: 19px;
  }

  .app-header p,
  .summary,
  .muted,
  .schedule p,
  .location-panel p {
    margin-top: 4px;
    font-size: 12px;
  }

  .tool-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border-width: 2px;
    padding: 3px;
  }

  .tool-tab {
    border-width: 2px;
    box-shadow: none;
    padding: 7px 5px;
    font-size: 12px;
  }

  .toolbar {
    gap: 8px;
    padding: 10px;
  }

  .brand {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
  }

  .token-form {
    grid-template-columns: minmax(0, 1fr) 92px;
    gap: 7px;
  }

  .request-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    padding: 8px;
  }

  .request-panel .order-field {
    grid-column: 1 / -1;
  }

  .check-row {
    min-height: 38px;
    border-width: 2px;
    padding: 6px 8px;
    font-size: 13px;
  }

  .order-field,
  .location-grid label {
    gap: 4px;
    font-size: 12px;
  }

  .location-panel {
    gap: 7px;
    padding: 9px;
  }

  .location-panel p {
    display: none;
  }

  .location-copy {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }

  .location-actions {
    margin-top: 0;
  }

  .location-actions button {
    padding: 5px 8px;
  }

  .location-actions .muted {
    max-width: 120px;
    font-size: 11px;
  }

  .location-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .schedule {
    padding: 9px;
  }

  .schedule-head {
    align-items: center;
    flex-direction: row;
  }

  .schedule p {
    display: none;
  }

  .switch-row {
    border-width: 2px;
    padding: 6px 9px;
    font-size: 13px;
  }

  .schedule-form {
    grid-template-columns: minmax(0, 1fr) 92px;
    gap: 7px;
    margin-top: 8px;
  }

  .schedule-list {
    gap: 6px;
    margin-top: 8px;
  }

  .time-chip {
    padding: 4px 6px 4px 9px;
    font-size: 12px;
  }

  .filters {
    grid-template-columns: minmax(0, 1fr) 120px;
    gap: 7px;
    padding: 8px;
  }

  .filters #searchInput {
    grid-column: 1 / -1;
  }

  .auto-clear-row {
    min-height: 40px;
    border-width: 2px;
    padding: 5px 7px;
    font-size: 12px;
  }

  .status {
    padding: 8px 10px;
    font-size: 13px;
  }

  input,
  textarea {
    border-width: 2px;
    padding: 8px;
    font-size: 14px;
  }

  button {
    border-width: 2px;
    box-shadow: 2px 2px 0 var(--ink);
    padding: 7px 9px;
    font-size: 13px;
  }

  .coupon-intro {
    padding: 7px 1px 6px;
  }

  .coupon-form {
    grid-template-columns: minmax(0, 1fr) 96px;
    gap: 7px;
    padding: 8px;
  }

  .coupon-form textarea {
    min-height: 68px;
    resize: none;
  }

  .token-form button,
  .coupon-form button,
  .schedule-form button {
    min-width: 0;
    padding-right: 5px;
    padding-left: 5px;
    white-space: normal;
  }

  .favorites-panel,
  .history-panel {
    margin-top: 10px;
    padding: 9px;
  }

  .coupon-grid {
    gap: 7px;
    margin-top: 8px;
  }

  .coupon-card.compact .coupon-card-tools {
    grid-template-columns: auto auto;
  }

  .coupon-card.compact .coupon-card-tools span {
    grid-column: 1 / -1;
    text-align: left;
  }

  .coupon-entry-switch {
    border-width: 1.5px;
  }

  .coupon-entry-switch button {
    padding: 2px 4px;
    font-size: 9px;
  }

  .merchant-card {
    transform: none !important;
  }

  .magic-panel,
  .magic-coupon-panel,
  .magic-result-panel {
    margin-top: 10px;
    padding: 9px;
    box-shadow: 4px 4px 0 var(--ink);
  }

  .magic-list-form {
    grid-template-columns: minmax(0, 1fr) 104px;
    gap: 7px;
    margin-top: 9px;
  }

  .magic-coupon-grid,
  .magic-result-grid {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .magic-coupon-card {
    min-height: 72px;
    grid-template-columns: 20px 58px minmax(0, 1fr);
    padding: 7px;
  }

  .magic-amount {
    min-height: 52px;
  }

  .magic-selection-actions {
    width: 100%;
  }

  .magic-selection-actions button {
    flex: 1 1 130px;
  }
}

@media (max-width: 350px) {
  .coupon-card.compact .coupon-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .token-form,
  .coupon-form,
  .magic-list-form {
    grid-template-columns: 1fr;
  }
}
