:root {
  --bg: #0b0c0f;
  --surface: #111218;
  --card: #151722;

  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.64);
  --hairline: rgba(255, 255, 255, 0.10);

  --accent: #0a84ff;
  --accent-weak: rgba(10, 132, 255, 0.18);

  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 10px;

  --shadow-1: 0 1px 0 rgba(255, 255, 255, 0.04), 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-2: 0 1px 0 rgba(255, 255, 255, 0.05), 0 12px 32px rgba(0, 0, 0, 0.45);

  --ease: cubic-bezier(0.2, 0, 0, 1);
  --dur-1: 140ms;
  --dur-2: 180ms;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}

.header {
  width: 100%;
  margin: 0 0 12px;
  padding: 16px 16px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
}
.header__row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.header__title { font-size: 18px; font-weight: 700; }
.header__subtitle { font-size: 13px; color: var(--muted); margin-top: 4px; }

.menuBtn {
  display: none;
  appearance: none;
  border: 1px solid var(--hairline);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: box-shadow var(--dur-2) var(--ease), border-color var(--dur-1) var(--ease);
}
.menuBtn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--accent-weak);
  border-color: rgba(10, 132, 255, 0.55);
}

.menuOverlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  z-index: 50;
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
}
.menuSheet {
  width: min(520px, 100%);
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(17, 18, 24, 0.88);
  box-shadow: var(--shadow-2);
  padding: 10px;
  display: grid;
  gap: 8px;
}
.menuItem {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  padding: 12px 12px;
  border-radius: 14px;
  cursor: pointer;
  text-align: left;
}
.menuItem.is-active {
  border-color: rgba(10, 132, 255, 0.45);
  background: rgba(10, 132, 255, 0.14);
}

@media (max-width: 640px) {
  body[data-menu="open"] .menuOverlay { display: flex; }

  /* Phone: show sheet near top-right (under the menu button area) */
  .menuOverlay {
    align-items: flex-start;
    justify-content: flex-end;
    padding:
      calc(12px + env(safe-area-inset-top))
      calc(12px + env(safe-area-inset-right))
      calc(12px + env(safe-area-inset-bottom))
      calc(12px + env(safe-area-inset-left));
  }
  .menuSheet {
    width: min(240px, calc(100vw - 24px));
    max-height: min(60vh, calc(100vh - 120px));
    overflow: auto;
  }
}

.profile {
  width: 100%;
  margin: 0;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
}
.profile__title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 10px;
}
.profile__body {
  font-size: 13px;
  color: var(--muted);
  min-height: 1em;
}
.profile__grid {
  display: grid;
  gap: 14px 20px;
  grid-template-columns: 1fr;
}
.profile__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.profile__item {
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  line-height: 1.2;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 640px) {
  /* keep same chip style on phone */
}
.profile__item.is-top1 {
  border-color: rgba(10, 132, 255, 0.45);
  background: rgba(10, 132, 255, 0.16);
}
.profile__item.is-top1::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--accent);
  flex: 0 0 auto;
}

.layout {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 16px 24px;
  display: grid;
  gap: 12px;
  /* Default: desktop/tablet use 3-column layout */
  grid-template-columns: 1.3fr 3fr 1.7fr;
  align-items: start;
}
@media (max-width: 640px) {
  /* Phone: single column + menu overlay entry point */
  .layout { grid-template-columns: 1fr; }
}

.col { min-width: 0; }
.profile__col { min-width: 0; }
.col__title {
  font-size: 14px;
  font-weight: 700;
  padding: 6px 4px 2px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  padding: 12px;
}
.status { color: var(--muted); font-size: 13px; padding: 6px 4px 10px; }

.seg {
  display: flex;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.02);
  margin-bottom: 6px;
}
.seg__btn {
  flex: 1;
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 10px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: background var(--dur-1) var(--ease), box-shadow var(--dur-2) var(--ease);
}
.seg__btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--accent-weak);
}
.seg__btn.is-active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.waterfall { column-count: 2; column-gap: 12px; }
@media (min-width: 768px) {
  .waterfall { column-count: 3; }
}
@media (min-width: 1024px) {
  .waterfall { column-count: 2; }
}
.waterfall .card { break-inside: avoid; margin: 0 0 12px; }
.grid {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
}
@media (min-width: 768px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
}

.card {
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: none;
  transition: transform var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease), border-color var(--dur-1) var(--ease);
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
  border-color: rgba(255, 255, 255, 0.14);
}
.card__poster {
  aspect-ratio: 2 / 3;
  background: rgba(255, 255, 255, 0.04);
  position: relative;
}
.badge {
  position: absolute;
  top: 5px;
  right: 5px;
  padding: 3px 5px;
  font-size: 10px;
  line-height: 1;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(17, 18, 24, 0.32);
  color: var(--text);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.card__body { padding: 10px; }
.card__title { font-size: 13px; font-weight: 600; }
.card__meta { font-size: 12px; color: var(--muted); margin-top: 6px; }
.card.card--link { cursor: pointer; }
.card.card--link:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--accent-weak); border-color: rgba(10, 132, 255, 0.55); }

.rec { display: flex; flex-direction: column; gap: 10px; }
.rec__block {
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
  overflow: hidden;
}
.rec__row {
  width: 100%;
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 12px 12px;
  cursor: pointer;
  text-align: left;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  transition: background var(--dur-1) var(--ease);
}
.rec__row:hover { background: rgba(255, 255, 255, 0.03); }
.rec__row:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px rgba(10, 132, 255, 0.45), 0 0 0 4px var(--accent-weak);
}
.rec__rowTitle { font-size: 13px; font-weight: 600; }
.rec__rowMeta { font-size: 12px; color: var(--muted); white-space: nowrap; }
.rec__grid {
  border-top: 1px solid var(--hairline);
  padding: 12px;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (min-width: 768px) {
  .rec__grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
  .rec__grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
.rec__grid .card:hover { transform: translateY(-1px); box-shadow: var(--shadow-1); }

.bottomTabs { display: none; }
@media (max-width: 640px) {
  body[data-main="records"] .col--recs { display: none; }
  body[data-main="recs"] .col--records { display: none; }

  .grid {
    gap: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bottomTabs { display: none; }
  .menuBtn { display: inline-flex; }
}

.footer {
  max-width: 1120px;
  margin: 14px auto 24px;
  padding: 0 16px;
}
.footer__text {
  color: var(--muted);
  font-size: 12px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
