:root {
  color: #291f06;
  background: #fed76e;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  background: #fed76e;
}

button,
textarea {
  font: inherit;
  letter-spacing: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

.coupon-page {
  min-height: 100vh;
  padding: 246px 16px calc(92px + env(safe-area-inset-bottom));
  background: #fed76e url("/assets/look-bg.png") center top / 100% 308px no-repeat;
}

.content-column {
  width: min(100%, 350px);
  margin: 0 auto;
}

.action-row,
.query-panel,
.result-panel,
.guide-content {
  width: 100%;
  background: #fffbef;
  border: 1px solid rgba(237, 227, 196, 0.8);
  border-radius: 8px;
}

.action-row {
  min-height: 60px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 0;
  text-align: left;
  cursor: pointer;
}

.action-row img,
.panel-heading img {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
}

.action-copy {
  min-width: 0;
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 3px;
}

.action-copy strong {
  font-size: 13px;
  line-height: 1.25;
}

.action-copy small {
  color: #86630d;
  font-size: 11px;
  line-height: 1.3;
}

.small-action {
  min-width: 48px;
  height: 31px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  padding: 0 10px;
  border: 0;
  border-radius: 16px;
  background: #fece2f;
  color: #291f06;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.query-panel,
.result-panel,
.favorite-panel,
.guide-section {
  margin-bottom: 12px;
}

.query-panel,
.result-panel {
  padding: 13px;
}

.top-entry-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.top-entry {
  min-width: 0;
  min-height: 60px;
  gap: 7px;
  padding: 9px 8px;
}

.top-entry img {
  width: 28px;
  height: 28px;
  flex-basis: 28px;
}

.top-entry .action-copy strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-entry .action-copy small {
  font-size: 10px;
}

.top-entry .small-action {
  min-width: 38px;
  height: 28px;
  padding: 0 7px;
  font-size: 12px;
}

.panel-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.auto-query {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.auto-query input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch {
  position: relative;
  width: 34px;
  height: 20px;
  border: 1px solid #d8c991;
  border-radius: 10px;
  background: #fff;
  transition: background 160ms ease;
}

.switch::after {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(41, 31, 6, 0.3);
  content: "";
  transition: transform 160ms ease;
}

.auto-query input:checked + .switch {
  background: #ffcc33;
}

.auto-query input:checked + .switch::after {
  transform: translateX(14px);
}

textarea {
  width: 100%;
  height: 70px;
  resize: none;
  padding: 10px;
  overflow-y: auto;
  border: 1px solid #ede3c4;
  border-radius: 8px;
  outline: none;
  background: #fffdf7;
  color: #291f06;
  font-size: 12px;
  line-height: 1.5;
}

textarea:focus {
  border-color: #e6af10;
  box-shadow: 0 0 0 3px rgba(254, 206, 47, 0.2);
}

.input-tool-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.tool-button {
  width: 100%;
  min-width: 0;
  height: 44px;
  border: 1px solid #e4d59f;
  border-radius: 7px;
  background: #fff8df;
  color: #654900;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.primary-button {
  position: relative;
  width: 100%;
  min-width: 0;
  height: 44px;
  margin: 0;
  border: 0;
  border-radius: 7px;
  background: linear-gradient(180deg, #fef183, #fdb62b 72%, #fec63c);
  color: #291f06;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.75;
}

.button-loader {
  display: none;
  width: 17px;
  height: 17px;
  margin: auto;
  border: 2px solid rgba(41, 31, 6, 0.25);
  border-top-color: #291f06;
  border-radius: 50%;
  animation: spin 650ms linear infinite;
}

.primary-button.is-loading .button-label {
  display: none;
}

.primary-button.is-loading .button-loader {
  display: block;
}

.home-link {
  width: 100%;
  min-height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 9px;
  border: 1px solid #e7ad14;
  border-radius: 7px;
  background: linear-gradient(180deg, #ffe573, #ffc52f);
  color: #4d3700;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.post-query-actions {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 8px;
  margin-top: 9px;
}

.post-query-actions .home-link {
  margin-top: 0;
}

.second-claim-link {
  background: linear-gradient(180deg, #ffd957, #ffb91f);
  color: #3e2c00;
  font-size: 14px;
}

.favorite-quick-button {
  background: #fff8df;
  font-family: inherit;
  font-size: 14px;
}

.favorite-quick-button.is-favorite {
  border-color: #dca30c;
  background: #fff4c8;
  color: #795800;
}

.status-message {
  min-height: 18px;
  margin: 8px 2px 0;
  color: #86630d;
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.status-message.is-error {
  color: #b21c14;
}

.status-message.is-success {
  color: #087b45;
}

.result-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid #ede3c4;
  font-size: 14px;
}

.result-title {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.favorite-button {
  min-width: 56px;
  height: 30px;
  border: 1px solid #e4b51e;
  border-radius: 15px;
  background: #fff8da;
  color: #765500;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.favorite-button.is-favorite {
  border-color: #139317;
  color: #087b0c;
  background: #f1fff0;
}

.check-icon {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #fbb622;
  color: #fff;
  font-weight: 700;
}

.store-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
}

.store-avatar {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 42px;
  border-radius: 7px;
  background: linear-gradient(145deg, #ed1b24, #ffcd35);
  color: #fff;
  font-size: 19px;
  font-weight: 800;
}

.store-details {
  min-width: 0;
}

.store-details > strong {
  display: block;
  overflow: hidden;
  margin-bottom: 6px;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.store-badges {
  display: flex;
  gap: 6px;
}

.store-badge,
.refresh-badge {
  height: 20px;
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  border: 1px solid;
  border-radius: 10px;
  font-size: 11px;
}

.store-badge {
  border-color: #f00505;
  color: #f00c19;
}

.refresh-badge {
  border-color: #139317;
  color: #089303;
}

.coupon-row {
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 15px;
  border-top: 1px solid #ede3c4;
  border-bottom: 1px solid #ede3c4;
  background: #fff;
}

.coupon-row > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.coupon-label,
.coupon-threshold {
  color: #6c6c6c;
  font-size: 13px;
  font-weight: 700;
}

.coupon-value {
  color: #eb0000;
  font-size: 14px;
}

.coupon-note {
  margin: 7px 0 0;
  color: #86630d;
  font-size: 12px;
}

.favorite-panel {
  width: 100%;
  border: 1px solid rgba(237, 227, 196, 0.9);
  border-radius: 8px;
  background: #fffbef;
  overflow: hidden;
}

.favorite-heading {
  position: relative;
  display: flex;
  align-items: center;
}

.favorite-toggle {
  width: 100%;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 13px;
  border: 0;
  background: transparent;
  color: #291f06;
  text-align: left;
  cursor: pointer;
}

.favorite-toggle > strong {
  font-size: 14px;
}

.favorite-toggle > span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding-right: 2px;
}

.favorite-toggle em {
  color: #86630d;
  font-size: 11px;
  font-style: normal;
}

.favorite-toggle i {
  width: 8px;
  height: 8px;
  display: block;
  border-right: 2px solid #967000;
  border-bottom: 2px solid #967000;
  transform: rotate(45deg);
  transition: transform 160ms ease;
}

.favorite-toggle[aria-expanded="true"] i {
  transform: rotate(225deg);
}

.refresh-favorites {
  position: absolute;
  right: 93px;
  min-width: 66px;
  height: 28px;
  border: 1px solid #e2be45;
  border-radius: 14px;
  background: #fff6d1;
  color: #715200;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.refresh-favorites:disabled {
  opacity: 0.6;
  cursor: wait;
}

.favorite-list {
  border-top: 1px solid #ede3c4;
  background: #fffdf7;
}

.favorite-empty {
  padding: 14px 13px;
  color: #86630d;
  font-size: 12px;
  line-height: 1.5;
}

.favorite-item {
  display: grid;
  gap: 9px;
  padding: 12px 13px;
}

.favorite-item + .favorite-item {
  border-top: 1px solid #ede3c4;
}

.favorite-info {
  min-width: 0;
}

.favorite-info strong,
.favorite-info span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.favorite-info strong {
  font-size: 13px;
}

.favorite-info span {
  margin-top: 3px;
  color: #86630d;
  font-size: 11px;
}

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

.compact-button {
  min-width: 76px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border: 1px solid #e3ca78;
  border-radius: 16px;
  background: #fff5cc;
  color: #624700;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.compact-button.primary {
  border-color: #f2b810;
  background: #fece2f;
  color: #291f06;
}

.compact-button.secondary {
  border-color: #e3bd3d;
  background: #fff5cc;
  color: #624700;
}

.compact-button.danger {
  border-color: #f0b9b5;
  background: #fff6f5;
  color: #b52d26;
}

.guide-row {
  width: 100%;
}

.guide-content {
  margin-top: -1px;
  padding: 13px;
  border-radius: 0 0 8px 8px;
  border-top: 1px solid #ede3c4;
}

.guide-content p {
  margin: 0 0 8px;
  font-size: 12px;
}

.guide-content img {
  display: block;
  width: 100%;
  height: auto;
  margin-top: 4px;
  border-radius: 6px;
  object-fit: contain;
}

.text-link {
  display: inline-block;
  margin-top: 6px;
  color: #9b6800;
  font-size: 12px;
  font-weight: 700;
  text-decoration: underline;
}

.toast {
  position: fixed;
  z-index: 20;
  top: 20px;
  left: 50%;
  max-width: calc(100vw - 32px);
  transform: translateX(-50%);
  padding: 10px 14px;
  border-radius: 6px;
  background: rgba(41, 31, 6, 0.92);
  color: #fff;
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(41, 31, 6, 0.2);
}

.bottom-nav {
  position: fixed;
  z-index: 30;
  right: 0;
  bottom: 0;
  left: 0;
  height: calc(68px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 7px max(16px, calc((100vw - 520px) / 2)) env(safe-area-inset-bottom);
  border-top: 1px solid #e7d59c;
  background: rgba(255, 253, 247, 0.97);
  box-shadow: 0 -8px 24px rgba(92, 62, 0, 0.1);
}

.bottom-nav-item {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #876611;
  font-size: 13px;
  font-weight: 700;
}

.bottom-nav-item.is-active {
  color: #2f2304;
}

.bottom-nav-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid #dfc369;
  border-radius: 7px;
  background: #fff6cf;
  font-size: 11px;
  font-weight: 900;
}

.bottom-nav-item.is-active .bottom-nav-icon {
  border-color: #f4b20e;
  background: #ffca2d;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 520px) {
  .coupon-page {
    padding-top: 190px;
    background-size: 100% auto;
    background-position: center top;
  }
}

@media (min-width: 900px) {
  .coupon-page {
    background-size: 900px 360px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation-duration: 0.01ms !important;
  }
}
