:root {
  --bg-cream: #FFF7EA;
  --bg-warm: #FFE9C7;
  --ink: #3D2618;
  --ink-soft: #7A5B47;
  --card: #FFFFFF;
  --brand: #FF7A2F;
  --brand-deep: #E55812;
  --accent-green: #3BB273;
  --accent-blue: #3B8BEB;
  --accent-purple: #8A5CF6;
  --accent-gold: #F5B400;
  --danger: #E84855;
  --shadow-sm: 0 3px 0 rgba(61, 38, 24, 0.14);
  --shadow-md: 0 8px 20px rgba(108, 62, 24, 0.14);
  --shadow-btn: 0 4px 0 rgba(61, 38, 24, 0.22);
  --radius-lg: 22px;
  --radius-md: 15px;
  --radius-sm: 11px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 20% 0%, #FFFBF2 0%, #FFEBD0 55%, #FFDCA8 100%);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  overflow: hidden;
  touch-action: manipulation;
}

body.scrollable {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.app-shell {
  width: 100%;
  max-width: 480px;
  height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  position: relative;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px 6px;
  z-index: 20;
  flex-shrink: 0;
}

.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 2px solid rgba(61, 38, 24, 0.14);
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 3px 0 rgba(61, 38, 24, 0.12);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
  text-decoration: none;
  line-height: 1;
}

.pill-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 rgba(61, 38, 24, 0.12);
}

.pill-btn.icon-only {
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 16px;
}

.status-badge {
  background: rgba(255, 255, 255, 0.88);
  border: 2px solid rgba(61, 38, 24, 0.12);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 800;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.status-badge strong {
  color: var(--brand-deep);
  font-size: 14px;
}

.primary-btn {
  border: none;
  background: linear-gradient(180deg, #FF993B 0%, #F26419 100%);
  color: #fff;
  font-size: 16px;
  font-weight: 900;
  padding: 13px 22px;
  border-radius: 16px;
  box-shadow: 0 5px 0 #BD4309, 0 8px 18px rgba(242, 100, 25, 0.35);
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
}

.primary-btn:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #BD4309;
}

.secondary-btn {
  border: 2px solid rgba(61, 38, 24, 0.16);
  background: #FFFDF8;
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
  padding: 11px 18px;
  border-radius: 15px;
  box-shadow: 0 4px 0 rgba(61, 38, 24, 0.12);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
}

.secondary-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 rgba(61, 38, 24, 0.12);
}

/* Bottom prop bar */
.prop-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 8px 12px 10px;
  flex-shrink: 0;
}

.prop-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 4px 7px;
  border-radius: 15px;
  border: 2px solid rgba(61, 38, 24, 0.14);
  background: linear-gradient(180deg, #FFFFFF 0%, #FFF3E0 100%);
  color: var(--ink);
  box-shadow: 0 4px 0 rgba(61, 38, 24, 0.14);
  cursor: pointer;
  transition: transform 0.08s ease, opacity 0.15s ease;
}

.prop-btn:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 1px 0 rgba(61, 38, 24, 0.14);
}

.prop-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.prop-btn.highlight {
  background: linear-gradient(180deg, #FFE46B 0%, #FFB703 100%);
  border-color: #C97D00;
  box-shadow: 0 4px 0 #B86F00;
}

.prop-btn .prop-ico {
  font-size: 20px;
  line-height: 1.1;
}

.prop-btn .prop-name {
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.prop-btn .prop-count {
  position: absolute;
  top: -6px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--brand-deep);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Toast notification */
.toast {
  position: fixed;
  top: calc(var(--safe-top) + 64px);
  left: 50%;
  transform: translateX(-50%) translateY(-16px);
  background: rgba(54, 34, 22, 0.92);
  color: #FFF9EE;
  padding: 9px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  white-space: nowrap;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Modal overlay */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(34, 20, 12, 0.62);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 150;
  padding: 20px;
}

.modal-mask.open {
  display: flex;
  animation: fadeIn 0.2s ease;
}

.modal-card {
  width: 100%;
  max-width: 350px;
  background: linear-gradient(180deg, #FFFDF8 0%, #FFF3DE 100%);
  border: 3px solid #FFFFFF;
  border-radius: 26px;
  padding: 24px 20px 20px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  animation: popIn 0.28s cubic-bezier(0.22, 1.28, 0.36, 1);
  max-height: 84dvh;
  overflow-y: auto;
}

.modal-emoji {
  font-size: 56px;
  line-height: 1.1;
  margin-bottom: 6px;
}

.modal-title {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 900;
  color: var(--ink);
}

.modal-desc {
  margin: 0 0 16px;
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.5;
}

.modal-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}

.modal-stat {
  background: rgba(255, 255, 255, 0.85);
  border: 2px solid rgba(61, 38, 24, 0.08);
  border-radius: 14px;
  padding: 10px 8px;
}

.modal-stat .k {
  font-size: 11px;
  color: var(--ink-soft);
  font-weight: 700;
}

.modal-stat .v {
  font-size: 20px;
  font-weight: 900;
  color: var(--brand-deep);
  margin-top: 2px;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-actions-row {
  display: flex;
  gap: 10px;
}

.modal-actions-row > * {
  flex: 1;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.84) translateY(16px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes shakeX {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

.shake {
  animation: shakeX 0.34s ease;
}
