:root {
  color-scheme: light;
  --bg: #fff8ec;
  --surface: #ffffff;
  --ink: #2d2722;
  --muted: #7b6f65;
  --line: #ead9c7;
  --pink: #ff8fab;
  --pink-dark: #e85d84;
  --mint: #83d6bd;
  --yellow: #ffd166;
  --blue: #73b7ff;
  --danger: #c2410c;
  --shadow: 0 18px 40px rgba(125, 86, 54, 0.14);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 10% 15%, rgba(255, 209, 102, 0.22), transparent 28%),
    radial-gradient(circle at 85% 10%, rgba(115, 183, 255, 0.18), transparent 26%),
    var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.page {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 42px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 26px;
  align-items: center;
  min-height: 300px;
  padding: 34px;
  border: 2px solid #f4d2bc;
  border-radius: 22px;
  background: linear-gradient(135deg, #fff 0%, #fff6df 100%);
  box-shadow: var(--shadow);
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: #e7fff4;
  color: #087f5b;
  font-weight: 800;
  font-size: 14px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  margin-top: 16px;
  font-size: clamp(38px, 7vw, 72px);
  line-height: 1;
  letter-spacing: 0;
}

.hero-copy p {
  margin-top: 14px;
  color: var(--muted);
  font-size: 18px;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 26px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 9px;
  width: min(390px, 100%);
  min-height: 46px;
  padding: 0 14px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}

.search-box span {
  color: var(--muted);
  font-size: 20px;
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
}

.hero-art {
  position: relative;
  display: grid;
  min-height: 220px;
  place-items: center;
}

.mascot {
  position: relative;
  width: 190px;
  height: 190px;
  border: 4px solid #2d2722;
  border-radius: 42% 42% 48% 48%;
  background: var(--pink);
  box-shadow: 12px 12px 0 #2d2722;
}

.mascot::before,
.mascot::after {
  content: "";
  position: absolute;
  top: 58px;
  width: 20px;
  height: 28px;
  border-radius: 999px;
  background: #2d2722;
}

.mascot::before {
  left: 48px;
}

.mascot::after {
  right: 48px;
}

.mascot span {
  position: absolute;
  left: 50%;
  bottom: 48px;
  width: 58px;
  height: 28px;
  transform: translateX(-50%);
  border: 4px solid #2d2722;
  border-top: 0;
  border-radius: 0 0 999px 999px;
  background: #fff0f4;
}

.mascot.small {
  width: 78px;
  height: 78px;
  border-width: 3px;
  border-radius: 24px;
  box-shadow: 5px 5px 0 #2d2722;
}

.mascot.small::before,
.mascot.small::after {
  top: 27px;
  width: 8px;
  height: 11px;
}

.mascot.small::before {
  left: 23px;
}

.mascot.small::after {
  right: 23px;
}

.mascot.small span {
  bottom: 17px;
  width: 24px;
  height: 12px;
  border-width: 3px;
}

.price-bubble {
  position: absolute;
  right: 34px;
  top: 18px;
  display: grid;
  width: 86px;
  height: 86px;
  place-items: center;
  border: 4px solid #2d2722;
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: 7px 7px 0 #2d2722;
  font-size: 36px;
  font-weight: 900;
}

.primary,
.ghost,
.danger {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  font-weight: 800;
  white-space: nowrap;
}

.primary {
  background: var(--pink);
  color: #2d2722;
  box-shadow: 4px 4px 0 #2d2722;
}

.primary:hover {
  background: var(--pink-dark);
  color: #fff;
}

.ghost {
  border: 2px solid #2d2722;
  background: #fff;
  color: #2d2722;
}

.danger {
  background: #ffe4dc;
  color: var(--danger);
}

.wide {
  width: 100%;
}

.admin-only,
body.admin-mode #adminEntryBtn {
  display: none !important;
}

body.admin-mode .admin-only {
  display: inline-flex !important;
}

.status-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin: 20px 0;
}

.status-bar div {
  display: grid;
  min-width: 155px;
  gap: 4px;
  padding: 14px 16px;
  border: 2px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.76);
}

.status-bar span {
  color: var(--muted);
  font-size: 13px;
}

.status-bar strong {
  font-size: 20px;
}

.products {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
}

.product-card {
  position: relative;
  display: grid;
  min-height: 190px;
  gap: 14px;
  padding: 18px;
  border: 2px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.product-card::before {
  content: "";
  position: absolute;
  right: 16px;
  top: 16px;
  width: 34px;
  height: 34px;
  border: 3px solid #2d2722;
  border-radius: 12px;
  background: var(--mint);
  transform: rotate(8deg);
}

.category {
  width: fit-content;
  max-width: calc(100% - 52px);
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eaf7ff;
  color: #0b5d9a;
  font-size: 13px;
  font-weight: 800;
}

.product-card h3 {
  margin: 0;
  padding-right: 44px;
  font-size: 20px;
  line-height: 1.3;
}

.price {
  font-size: 34px;
  font-weight: 900;
  color: var(--pink-dark);
}

.note {
  min-height: 22px;
  color: var(--muted);
  line-height: 1.5;
}

.card-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

.text-btn {
  min-height: 34px;
  padding: 0 10px;
  border-radius: 999px;
  background: #fff5d6;
  color: #2d2722;
  font-weight: 800;
}

.text-btn.danger-text {
  background: #ffe4dc;
  color: var(--danger);
}

.empty-state {
  display: grid;
  justify-items: center;
  gap: 8px;
  margin-top: 18px;
  padding: 34px;
  border: 2px dashed var(--line);
  border-radius: 20px;
  color: var(--muted);
}

.empty-state strong {
  color: var(--ink);
  font-size: 20px;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(45, 39, 34, 0.38);
}

.login-card,
.dialog-form {
  position: relative;
  display: grid;
  gap: 16px;
  width: min(430px, 100%);
  padding: 24px;
  border: 3px solid #2d2722;
  border-radius: 22px;
  background: #fffdf8;
  box-shadow: 9px 9px 0 #2d2722;
}

.login-card h2 {
  font-size: 26px;
}

.login-card p {
  color: var(--muted);
  line-height: 1.5;
}

.close-login,
.icon-btn {
  position: absolute;
  right: 14px;
  top: 14px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #fff5d6;
  color: #2d2722;
  font-size: 24px;
  font-weight: 900;
}

label {
  display: grid;
  gap: 7px;
  color: #4b4038;
  font-size: 14px;
  font-weight: 800;
}

input {
  min-height: 42px;
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
  outline: 0;
}

input:focus {
  border-color: var(--blue);
}

.form-error {
  min-height: 18px;
  color: var(--danger);
  font-size: 14px;
}

dialog {
  width: min(560px, calc(100vw - 28px));
  border: 0;
  padding: 0;
  background: transparent;
}

dialog::backdrop {
  background: rgba(45, 39, 34, 0.38);
}

.dialog-form {
  width: 100%;
}

.dialog-head h2 {
  padding-right: 46px;
  font-size: 24px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 30;
  transform: translateY(18px);
  opacity: 0;
  pointer-events: none;
  border: 3px solid #2d2722;
  border-radius: 16px;
  background: #fff;
  color: #2d2722;
  padding: 12px 14px;
  box-shadow: 6px 6px 0 #2d2722;
  transition: 0.2s ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 820px) {
  .hero {
    grid-template-columns: 1fr;
    padding: 24px;
  }

  .hero-art {
    min-height: 190px;
  }

  .mascot {
    width: 160px;
    height: 160px;
  }

  .price-bubble {
    right: calc(50% - 150px);
  }
}

@media (max-width: 560px) {
  .page {
    width: min(100% - 20px, 1120px);
    padding-top: 10px;
  }

  .hero {
    border-radius: 18px;
  }

  .hero-actions,
  .status-bar,
  .dialog-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .search-box,
  .hero-actions button,
  .status-bar div,
  .status-bar button {
    width: 100%;
  }

  .form-row {
    grid-template-columns: 1fr;
  }
}
