:root {
  --page-max: 560px;
  --orange: #ff7a1a;
  --orange-deep: #f06a0a;
  --title-green: #1f9d4b;
  --sub-yellow: #ffe566;
  --card: #ffffff;
  --notice: #fff6e8;
  --text: #222222;
  --muted: #666666;
  --line: #efefef;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  --font: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background: #1b3a2c;
  line-height: 1.45;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.page-bg {
  position: fixed;
  inset: 0;
  background:
    url("../assets/bg.jpg") center / cover no-repeat;
  filter: blur(2px) saturate(1.05);
  transform: scale(1.04);
  z-index: 0;
}

.page-overlay {
  position: fixed;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(8, 28, 20, 0.28), rgba(8, 28, 20, 0.45)),
    rgba(0, 0, 0, 0.12);
  z-index: 0;
}

.page {
  position: relative;
  z-index: 1;
  width: min(var(--page-max), calc(100% - 1.5rem));
  margin: 0 auto;
  padding: 1.6rem 0 6.5rem;
}

.hero {
  text-align: center;
  margin-bottom: 1.1rem;
}

.hero-title {
  margin: 0;
  font-size: clamp(1.7rem, 6vw, 2.15rem);
  font-weight: 900;
  letter-spacing: 0.04em;
  color: var(--title-green);
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.35),
    0 2px 10px rgba(0, 0, 0, 0.25);
}

.hero-sub {
  margin: 0.45rem 0 0;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--sub-yellow);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
}

.search-box {
  display: flex;
  align-items: stretch;
  background: #fff;
  border-radius: 999px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.search-box input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  padding: 0.85rem 1rem 0.85rem 1.15rem;
  font-size: 0.92rem;
}

.search-box input::placeholder {
  color: #9a9a9a;
}

.search-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border: 0;
  background: var(--orange);
  color: #fff;
  font-weight: 700;
  padding: 0 1.05rem;
  cursor: pointer;
  transition: background 0.15s;
}

.search-btn:hover {
  background: var(--orange-deep);
}

.notice {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-top: 0.85rem;
  padding: 0.7rem 0.9rem;
  background: var(--notice);
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.notice-icon {
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: var(--orange);
  color: #fff;
  display: grid;
  place-items: center;
}

.notice-marquee {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.notice-marquee p {
  margin: 0;
  font-size: 0.86rem;
  color: #7a5a30;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.links-section {
  display: grid;
  gap: 0.85rem;
  margin-top: 0.95rem;
}

.category-card {
  background: rgba(255, 255, 255, 0.96);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.95rem 0.8rem 1.1rem;
  backdrop-filter: blur(8px);
  animation: rise 0.35s ease both;
}

.category-card:nth-child(2) { animation-delay: 0.04s; }
.category-card:nth-child(3) { animation-delay: 0.08s; }
.category-card:nth-child(4) { animation-delay: 0.12s; }

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.category-head {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0.25rem 0.85rem;
}

.flame {
  width: 1.1rem;
  height: 1.1rem;
  flex-shrink: 0;
  color: var(--orange);
}

.category-head h2 {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.link-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.85rem 0.35rem;
}

.link-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  text-align: center;
  min-width: 0;
}

.link-item:hover .link-icon {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.16);
}

.link-icon {
  width: 3.05rem;
  height: 3.05rem;
  border-radius: 12px;
  overflow: hidden;
  background: #f3f3f3;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.link-icon img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.link-name {
  font-size: 0.78rem;
  font-weight: 500;
  color: #333;
  line-height: 1.25;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 0.15rem;
}

.fav-btn,
.remove-btn {
  position: absolute;
  top: -0.25rem;
  right: 0.05rem;
  width: 1.25rem;
  height: 1.25rem;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
  color: #999;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
  display: grid;
  place-items: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
  padding: 0;
}

.link-item:hover .fav-btn,
.link-item:focus-within .fav-btn,
.link-item:hover .remove-btn,
.link-item:focus-within .remove-btn,
.fav-btn.is-active {
  opacity: 1;
}

.fav-btn.is-active {
  color: var(--orange);
}

.remove-btn:hover {
  color: #e33;
}

.empty-state {
  margin: 0.35rem 0.25rem 0;
  padding: 1.1rem 0.75rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
  background: #fafafa;
  border-radius: var(--radius-sm);
}

.page-end {
  margin-top: 1.1rem;
  text-align: center;
}

.footer-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--orange-deep);
  font-weight: 700;
  padding: 0.6rem 1.2rem;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.footer-action:hover {
  background: #fff;
}

.bottom-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  background: rgba(28, 28, 28, 0.92);
  color: rgba(255, 255, 255, 0.88);
  text-align: center;
  padding: 0.7rem 1rem;
  font-size: 0.8rem;
  backdrop-filter: blur(8px);
}

.bottom-bar p {
  margin: 0;
}

.bottom-bar a {
  color: #ffd2a8;
  text-decoration: none;
}

.bottom-bar a:hover {
  text-decoration: underline;
}

.back-top {
  position: fixed;
  right: 1rem;
  bottom: 3.6rem;
  z-index: 5;
  width: 2.6rem;
  height: 2.6rem;
  border: 0;
  border-radius: 50%;
  background: var(--orange);
  color: #fff;
  box-shadow: 0 8px 20px rgba(255, 122, 26, 0.4);
  cursor: pointer;
  display: grid;
  place-items: center;
  opacity: 1;
  pointer-events: auto;
  transition: opacity 0.2s, transform 0.2s;
}

.back-top.is-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
}

.back-top:hover {
  background: var(--orange-deep);
}

.modal {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: calc(100% - 2rem);
  width: 400px;
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.55);
}

.modal-card {
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.modal-header,
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.95rem 1rem;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.05rem;
}

.modal-close {
  border: 0;
  background: transparent;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: #888;
}

.modal-body {
  display: grid;
  gap: 0.85rem;
  padding: 0 1rem 1rem;
}

.field {
  display: grid;
  gap: 0.3rem;
}

.field span {
  font-size: 0.8rem;
  color: var(--muted);
}

.field input,
.field select {
  width: 100%;
  border: 1px solid #e5e5e5;
  border-radius: 10px;
  padding: 0.7rem 0.8rem;
  outline: none;
  background: #fff;
}

.field input:focus,
.field select:focus {
  border-color: var(--orange);
}

.modal-footer {
  border-top: 1px solid var(--line);
  gap: 0.55rem;
}

.btn-ghost,
.btn-primary {
  border-radius: 999px;
  padding: 0.55rem 1rem;
  cursor: pointer;
  border: 1px solid transparent;
  font-weight: 600;
}

.btn-ghost {
  margin-left: auto;
  background: transparent;
  border-color: #ddd;
  color: #666;
}

.btn-primary {
  background: var(--orange);
  color: #fff;
}

@media (min-width: 720px) {
  :root {
    --page-max: 720px;
  }

  .link-icon {
    width: 3.35rem;
    height: 3.35rem;
  }

  .link-name {
    font-size: 0.84rem;
  }
}

@media (max-width: 380px) {
  .link-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 0.7rem 0.2rem;
  }

  .link-icon {
    width: 2.7rem;
    height: 2.7rem;
    border-radius: 10px;
  }

  .link-name {
    font-size: 0.7rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
