:root {
  --text: #122033;
  --muted: #607086;
  --primary: #1d5fd1;
  --primary-strong: #1148a7;
  --danger: #d95a3f;
  --surface: rgba(255, 255, 255, 0.94);
  --surface-soft: rgba(255, 255, 255, 0.72);
  --border: rgba(22, 53, 87, 0.12);
  --shadow: 0 18px 40px rgba(17, 34, 68, 0.14);
  --chip-bg: rgba(29, 95, 209, 0.08);
  --chip-text: #19468e;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  background:
    radial-gradient(circle at top, rgba(29, 95, 209, 0.22), transparent 32%),
    radial-gradient(circle at bottom, rgba(31, 157, 104, 0.12), transparent 28%),
    linear-gradient(180deg, #eef4fb 0%, #f8fbff 100%);
}

.history-mobile-app {
  width: min(100%, 480px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 14px 22px;
}

.view {
  display: grid;
  gap: 16px;
}

.hidden {
  display: none !important;
}

.eyebrow {
  margin: 0;
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.eyebrow-link,
.subtle-link {
  width: fit-content;
  text-decoration: none;
}

.eyebrow-link {
  border-bottom: 1px solid rgba(29, 95, 209, 0.16);
}

.subtle-link {
  color: var(--muted);
  border-bottom: 1px solid rgba(96, 112, 134, 0.18);
}

h1 {
  margin: 0;
  font-size: clamp(28px, 9vw, 38px);
  line-height: 1.08;
}

.subtle {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

.view-blocked,
.view-gate,
.view-history {
  align-content: start;
}

.view-blocked {
  min-height: calc(100vh - 40px);
  padding: 28px 4px;
  gap: 10px;
  place-content: center;
}

.blocked-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  color: rgba(96, 112, 134, 0.92);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.blocked-status,
.blocked-timestamp {
  display: inline-flex;
  align-items: center;
}

.view-gate {
  min-height: calc(100vh - 40px);
  grid-template-rows: auto auto 1fr;
  gap: 24px;
  padding: 12px 4px 0;
}

.gate-copy {
  display: grid;
  gap: 10px;
}

.pin-dots {
  display: flex;
  justify-content: center;
  gap: 14px;
  min-height: 22px;
}

.pin-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 1.5px solid rgba(18, 32, 51, 0.18);
  background: rgba(255, 255, 255, 0.62);
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

.pin-dot.filled {
  background: var(--primary);
  border-color: var(--primary);
  transform: scale(1.05);
}

.keypad {
  align-self: end;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.key-button {
  min-height: 58px;
  border: 0;
  border-radius: 20px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  font-size: 24px;
  font-weight: 600;
}

.key-button:active {
  transform: scale(0.98);
}

.key-button.action {
  font-size: 16px;
  font-weight: 700;
}

.key-button.submit {
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-strong) 100%);
  color: #fff;
}

.key-button.submit:disabled {
  background: rgba(96, 112, 134, 0.28);
  color: rgba(18, 32, 51, 0.48);
  box-shadow: none;
}

.shake {
  animation: shake 220ms ease;
}

.history-header {
  display: grid;
  gap: 8px;
}

.feedback {
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(217, 90, 63, 0.12);
  color: var(--danger);
  font-size: 14px;
  line-height: 1.4;
}

.history-list {
  display: grid;
  gap: 10px;
}

.history-toggle-button {
  min-height: 44px;
  border: 1px solid rgba(22, 53, 87, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
}

.history-card {
  display: grid;
  gap: 9px;
  padding: 13px 15px;
  border-radius: 18px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, opacity 140ms ease, filter 140ms ease, border-color 140ms ease, background 140ms ease;
}

.history-card:active {
  transform: scale(0.992);
}

.history-card-fresh {
  background:
    linear-gradient(180deg, rgba(29, 95, 209, 0.08) 0%, rgba(255, 255, 255, 0.98) 48%),
    var(--surface);
  border-color: rgba(29, 95, 209, 0.18);
  box-shadow: 0 18px 40px rgba(17, 34, 68, 0.16);
}

.history-card-old {
  opacity: 0.5;
  background: rgba(255, 255, 255, 0.68);
  border-color: rgba(22, 53, 87, 0.06);
  box-shadow: 0 8px 18px rgba(17, 34, 68, 0.06);
  filter: saturate(0.45) grayscale(0.08);
}

.history-card-active {
  background:
    linear-gradient(180deg, rgba(29, 95, 209, 0.12) 0%, rgba(255, 255, 255, 1) 52%),
    var(--surface);
  border-color: rgba(29, 95, 209, 0.3);
  box-shadow: 0 20px 44px rgba(17, 34, 68, 0.18), 0 0 0 3px rgba(29, 95, 209, 0.1);
  filter: none;
  opacity: 1;
  transform: translateY(-1px);
}

.history-card-head,
.history-card-meta {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.history-card-head h2,
.history-card-meta p {
  margin: 0;
}

.history-card-head h2 {
  font-size: 19px;
  line-height: 1.2;
}

.history-count {
  color: var(--primary);
  margin-left: auto;
  font-size: 14px;
  font-weight: 700;
}

.name-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.name-chip {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(29, 95, 209, 0.12);
  color: var(--chip-text);
  font-size: 21px;
  font-weight: 700;
  line-height: 1;
}

.empty-state {
  padding: 18px 16px;
  border-radius: 18px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

.retry-button {
  margin-top: 8px;
  min-height: 40px;
  padding: 8px 14px;
  border: 0;
  border-radius: 14px;
  background: var(--primary);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-6px);
  }
  75% {
    transform: translateX(6px);
  }
}

@media (min-width: 769px) {
  .history-mobile-app {
    padding-top: 28px;
  }
}
