﻿:root {
  --bg-top: #fff6de;
  --bg-bottom: #ffcfb3;
  --card: rgba(255, 253, 246, 0.88);
  --ink: #40261c;
  --muted: #7d5f53;
  --accent: #ff6b57;
  --accent-deep: #dd3d2d;
  --accent-soft: #ffd8bf;
  --line: rgba(64, 38, 28, 0.12);
  --shadow: 0 20px 45px rgba(116, 54, 31, 0.18);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Noto Sans SC", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.7), transparent 30%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
}

body {
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  width: 14rem;
  height: 14rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  filter: blur(8px);
  z-index: 0;
  animation: drift 14s ease-in-out infinite;
}

body::before {
  top: -4rem;
  left: -3rem;
}

body::after {
  right: -4rem;
  bottom: 8rem;
  animation-delay: -7s;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(100%, 32rem);
  margin: 0 auto;
  padding: 1.2rem 1rem 2rem;
}

.hero-card,
.admin-card {
  position: relative;
  overflow: hidden;
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 1.75rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero-card {
  padding: 1.25rem;
}

.admin-card {
  margin-top: 1rem;
  padding: 1.1rem;
}

.admin-card-page {
  margin-top: 0;
}

.noise {
  position: absolute;
  inset: 0;
  opacity: 0.08;
  background-image:
    linear-gradient(transparent 0 49%, rgba(64, 38, 28, 0.16) 50% 51%, transparent 52%),
    linear-gradient(90deg, transparent 0 49%, rgba(64, 38, 28, 0.08) 50% 51%, transparent 52%);
  background-size: 12px 12px;
  pointer-events: none;
}

.topbar {
  position: relative;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  justify-content: space-between;
}

.ghost-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.7rem;
  padding: 0.7rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.74);
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.eyebrow {
  position: relative;
  margin: 0;
  color: var(--accent-deep);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  position: relative;
  margin: 0;
}

h1 {
  margin-top: 0.35rem;
  font-family: "Ma Shan Zheng", cursive;
  font-size: clamp(2rem, 7vw, 3rem);
  line-height: 1.05;
}

.admin-title {
  margin-top: 0.4rem;
  font-size: clamp(1.8rem, 6vw, 2.6rem);
}

h2 {
  margin-top: 0.25rem;
  font-size: 1.05rem;
}

h3 {
  font-size: 0.95rem;
}

.subtitle {
  position: relative;
  margin: 0.65rem 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.front-note {
  margin: 1rem 0 0;
  color: var(--muted);
  text-align: center;
  line-height: 1.6;
  font-size: 0.9rem;
}

.pig-stage {
  position: relative;
  display: grid;
  place-items: center;
  margin: 1.3rem 0 1rem;
  min-height: 10rem;
}

.pig {
  position: relative;
  width: 8.8rem;
  height: 8.8rem;
  animation: wobble 3.6s ease-in-out infinite;
}

.pig-face {
  position: absolute;
  inset: 1rem 0 0;
  margin: auto;
  width: 8rem;
  height: 7.4rem;
  background: #ffb3b1;
  border: 4px solid #40261c;
  border-radius: 48% 48% 45% 45%;
}

.pig-ear {
  position: absolute;
  top: 0.5rem;
  width: 2.3rem;
  height: 2.7rem;
  background: #ff9b98;
  border: 4px solid #40261c;
  border-radius: 60% 60% 15% 15%;
}

.pig-ear-left {
  left: 0.7rem;
  transform: rotate(-20deg);
}

.pig-ear-right {
  right: 0.7rem;
  transform: rotate(20deg);
}

.pig-eye {
  position: absolute;
  top: 2.25rem;
  width: 0.8rem;
  height: 0.45rem;
  border-bottom: 4px solid #40261c;
  border-radius: 50%;
}

.pig-eye-left {
  left: 1.8rem;
  transform: rotate(12deg);
}

.pig-eye-right {
  right: 1.8rem;
  transform: rotate(-12deg);
}

.pig-snout {
  position: absolute;
  left: 50%;
  top: 3rem;
  width: 2.8rem;
  height: 2rem;
  transform: translateX(-50%);
  background: #ff8d8c;
  border: 4px solid #40261c;
  border-radius: 45%;
}

.pig-snout::before,
.pig-snout::after {
  content: "";
  position: absolute;
  top: 0.55rem;
  width: 0.45rem;
  height: 0.72rem;
  background: #40261c;
  border-radius: 999px;
}

.pig-snout::before {
  left: 0.7rem;
}

.pig-snout::after {
  right: 0.7rem;
}

.pig-mouth {
  position: absolute;
  left: 50%;
  bottom: 1.2rem;
  width: 1.7rem;
  height: 0.7rem;
  transform: translateX(-50%);
  border-top: 4px solid #40261c;
  border-radius: 50%;
}

.steam {
  position: absolute;
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  filter: blur(1px);
}

.steam-one {
  top: 1.2rem;
  right: -0.8rem;
  animation: puff 2.6s ease-out infinite;
}

.steam-two {
  top: 0.3rem;
  right: -0.1rem;
  animation: puff 2.6s ease-out infinite 0.8s;
}

.reason-card {
  position: relative;
  padding: 1rem;
  border-radius: 1.4rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 244, 234, 0.95));
  border: 1px solid var(--line);
}

.reason-card.is-burst {
  animation: card-pop 0.42s ease;
}

.reason-badge {
  display: inline-block;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 0.78rem;
  font-weight: 700;
}

.reason-text {
  margin: 0.9rem 0 0;
  font-size: 1.45rem;
  font-weight: 900;
  line-height: 1.45;
}

.reason-note {
  margin: 0.75rem 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.actions,
.list-head {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
}

.actions {
  margin-top: 1rem;
}

.spaced-top {
  margin-top: 1.25rem;
}

button,
textarea,
select,
input {
  font: inherit;
}

button {
  cursor: pointer;
  border: 0;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

button:hover,
.ghost-link:hover {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.65;
  cursor: wait;
  transform: none;
}

.primary-btn,
.ghost-btn,
.delete-btn {
  border-radius: 999px;
  padding: 0.9rem 1rem;
  font-weight: 700;
}

.primary-btn {
  flex: 1;
  background: var(--accent);
  color: #fffdf7;
  box-shadow: 0 10px 18px rgba(221, 61, 45, 0.25);
}

.ghost-btn {
  background: rgba(255, 255, 255, 0.74);
  color: var(--ink);
  border: 1px solid var(--line);
}

.ghost-btn.small,
.delete-btn {
  padding: 0.6rem 0.85rem;
  font-size: 0.9rem;
}

.wide {
  width: 100%;
}

.mini-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
  margin: 1rem 0 0;
}

.mini-stats div {
  padding: 0.95rem;
  border-radius: 1.2rem;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
}

.mini-stats dt {
  color: var(--muted);
  font-size: 0.8rem;
}

.mini-stats dd {
  margin: 0.3rem 0 0;
  font-size: 1rem;
  font-weight: 800;
}

.token-box,
.reason-form,
.reason-list,
.history-list,
.empty-state {
  position: relative;
}

.token-box,
.reason-form {
  display: grid;
  gap: 0.7rem;
}

.reason-form {
  margin-top: 1rem;
}

.token-box {
  margin-top: 1rem;
}

.token-box label,
.reason-form label {
  font-size: 0.9rem;
  font-weight: 700;
}

textarea,
select,
input[type="password"] {
  width: 100%;
  border-radius: 1rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  padding: 0.95rem 1rem;
  color: var(--ink);
}

textarea:focus,
select:focus,
input[type="password"]:focus {
  outline: 2px solid rgba(255, 107, 87, 0.4);
  border-color: rgba(255, 107, 87, 0.5);
}

.check-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 1rem;
  border-radius: 1rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
}

.check-row input {
  width: auto;
  margin: 0;
}

.token-tip,
.admin-status {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  font-size: 0.85rem;
}

.admin-status {
  margin-top: 0.95rem;
  padding: 0.85rem 1rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
}

.admin-status.is-error {
  color: #a33225;
  background: rgba(255, 237, 231, 0.92);
}

.admin-status.is-success {
  color: #1f6f43;
  background: rgba(234, 255, 243, 0.92);
}

.list-head {
  margin-top: 1.25rem;
}

.reason-list,
.history-list {
  display: grid;
  gap: 0.7rem;
  padding: 0;
  margin: 0.85rem 0 0;
  list-style: none;
}

.reason-item,
.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
}

.history-item {
  display: block;
}

.saved-reason,
.saved-meta {
  margin: 0;
}

.saved-reason {
  font-weight: 700;
  line-height: 1.5;
}

.saved-meta {
  margin-top: 0.32rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.delete-btn {
  flex-shrink: 0;
  background: rgba(64, 38, 28, 0.08);
  color: var(--ink);
}

.empty-state {
  padding: 1rem;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 1rem;
}

@keyframes wobble {
  0%,
  100% {
    transform: rotate(-2deg) translateY(0);
  }
  50% {
    transform: rotate(2deg) translateY(-6px);
  }
}

@keyframes puff {
  0% {
    opacity: 0;
    transform: scale(0.4) translateY(1rem);
  }
  25% {
    opacity: 0.8;
  }
  100% {
    opacity: 0;
    transform: scale(1.6) translateY(-1.2rem);
  }
}

@keyframes drift {
  0%,
  100% {
    transform: translate(0, 0);
  }
  50% {
    transform: translate(1rem, 1.2rem);
  }
}

@keyframes card-pop {
  0% {
    transform: scale(0.96) rotate(-1deg);
  }
  60% {
    transform: scale(1.02) rotate(1deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
  }
}

@media (max-width: 420px) {
  .topbar,
  .actions {
    flex-direction: column;
  }

  .primary-btn,
  .ghost-btn,
  .ghost-link {
    width: 100%;
  }

  .reason-item {
    align-items: flex-start;
    flex-direction: column;
  }

  .delete-btn {
    width: 100%;
  }
}
