:root {
  --bg: #11120f;
  --fg: #f2f0eb;
  --fg-dim: #aaa9a2;
  --accent: #dd6b4d;
  --accent-2: #dd6b4d;
  --panel: #191a17;
  --panel-2: #22231f;
  --border: rgba(205, 222, 241, 0.18);
  --shadow: rgba(0, 0, 0, 0.48);
  --mono: ui-monospace, "JetBrains Mono", "Fira Code", Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
}

body {
  min-height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(circle at 72% 12%, rgba(221, 107, 77, 0.14), transparent 34%),
    radial-gradient(circle at 18% 24%, rgba(159, 165, 160, 0.12), transparent 38%),
    linear-gradient(180deg, #171815 0%, #191817 58%, #0f100e 100%);
}

button,
a { font: inherit; }

a { color: inherit; text-decoration: none; }

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.room-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px clamp(18px, 4vw, 46px);
  pointer-events: none;
}

.brand,
.room-nav { pointer-events: auto; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: #f5f8fb;
  font-weight: 700;
}

.brand-name,
.brand-owner {
  white-space: nowrap;
}

.brand-owner {
  margin-left: 2px;
  color: var(--fg-dim);
  font-size: 0.78rem;
  font-weight: 500;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(221, 107, 77, 0.42);
  border-radius: 7px;
  color: var(--accent);
  font-family: var(--mono);
  background: rgba(8, 15, 24, 0.74);
}

.room-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  max-width: min(760px, calc(100vw - 190px));
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(9, 13, 18, 0.68);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  scrollbar-width: none;
}

.room-nav::-webkit-scrollbar {
  display: none;
}

.room-nav button {
  flex: 0 0 auto;
  min-width: 54px;
  border: 0;
  border-radius: 6px;
  padding: 7px 9px;
  color: var(--fg-dim);
  background: transparent;
  cursor: pointer;
  touch-action: manipulation;
}

.room-nav button:hover,
.room-nav button:focus-visible {
  color: var(--fg);
  background: rgba(221, 107, 77, 0.16);
  outline: none;
}

.room-home {
  position: relative;
  width: 100vw;
  height: 100dvh;
}

.room-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  transition: right .55s cubic-bezier(.2, .8, .2, 1);
}

body.panel-open .room-stage {
  right: min(460px, 38vw);
}

.room-canvas {
  position: absolute;
  inset: 0;
}

.room-canvas canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.room-title {
  position: absolute;
  left: clamp(18px, 5vw, 70px);
  bottom: clamp(76px, 11vh, 128px);
  z-index: 5;
  width: min(470px, calc(100vw - 36px));
  pointer-events: none;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.56);
  transition: opacity .25s;
}

body.panel-open .room-title { opacity: .22; }

.prompt {
  margin: 0 0 8px;
  color: #b4c7dc;
  font-family: var(--mono);
  font-size: 0.9rem;
}

.room-title h1 {
  margin: 0;
  font-size: clamp(2.35rem, 6vw, 5.6rem);
  line-height: 0.95;
  color: #f8fbff;
}

.room-title p:last-child {
  max-width: 390px;
  margin: 16px 0 0;
  color: #d4dde8;
  font-size: clamp(0.95rem, 1.5vw, 1.12rem);
  line-height: 1.8;
}

.room-tooltip {
  position: fixed;
  z-index: 45;
  max-width: min(280px, calc(100vw - 24px));
  padding: 8px 10px;
  border: 1px solid rgba(188, 207, 229, 0.24);
  border-radius: 7px;
  color: #f7fbff;
  background: rgba(10, 14, 19, 0.84);
  box-shadow: 0 12px 30px var(--shadow);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.45;
  pointer-events: none;
  transform: translate(14px, 14px);
}

.room-panel[hidden] { display: none; }

.room-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  width: min(460px, 38vw);
  min-width: 360px;
  overflow-y: auto;
  padding: 86px 28px 86px;
  border-left: 1px solid rgba(205, 222, 241, 0.2);
  background:
    linear-gradient(180deg, rgba(22, 30, 40, 0.97), rgba(9, 13, 18, 0.98)),
    var(--panel);
  box-shadow: -22px 0 80px rgba(0, 0, 0, 0.42);
}

.room-panel-close {
  position: fixed;
  top: 22px;
  right: 22px;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--fg-dim);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
  touch-action: manipulation;
}

.room-panel-close:hover,
.room-panel-close:focus-visible {
  color: var(--fg);
  border-color: rgba(221, 107, 77, 0.62);
  outline: none;
}

.room-panel-kicker {
  margin: 0 0 8px;
  color: var(--accent-2);
  font-family: var(--mono);
  font-size: 0.78rem;
}

.room-panel h2 {
  margin: 0 44px 18px 0;
  color: #f8fbff;
  font-size: clamp(1.45rem, 2.4vw, 2rem);
  line-height: 1.22;
}

.room-panel-body {
  color: #d8e2ed;
  line-height: 1.72;
}

.room-panel-body p { margin: 0 0 14px; }

.room-panel-body ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.room-panel-body li {
  padding: 9px 0;
  border-top: 1px solid rgba(188, 207, 229, 0.12);
}

.room-panel-body code {
  font-family: var(--mono);
  color: #f1a08c;
  background: rgba(221, 107, 77, 0.12);
  border-radius: 4px;
  padding: 1px 6px;
}

.photo-wall {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.photo-card {
  position: relative;
  min-height: 124px;
  margin: 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(88,166,255,.55), rgba(242,182,109,.24)),
    #172230;
}

.photo-card:nth-child(2) { background: linear-gradient(135deg, rgba(159,211,155,.5), rgba(88,166,255,.2)), #172230; }
.photo-card:nth-child(3) { background: linear-gradient(135deg, rgba(212,106,106,.48), rgba(242,182,109,.25)), #172230; }
.photo-card:nth-child(4) { background: linear-gradient(135deg, rgba(165,214,255,.5), rgba(255,255,255,.14)), #172230; }

.photo-card img {
  display: block;
  width: 100%;
  height: 136px;
  object-fit: cover;
  filter: saturate(.9) contrast(1.04);
}

.photo-card figcaption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: block;
  padding: 34px 10px 10px;
  color: #f8fbff;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,.72));
  font-family: var(--mono);
  font-size: .78rem;
  text-shadow: 0 1px 12px rgba(0,0,0,.55);
}

.github-card {
  display: block;
  border: 1px solid rgba(188, 207, 229, 0.18);
  border-radius: 8px;
  padding: 14px;
  overflow: hidden;
  background: #191a18;
}

.github-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.github-card-head img {
  width: 54px;
  height: 54px;
  border-radius: 50%;
}

.github-card-head strong,
.github-card-head span {
  display: block;
}

.github-card-head span {
  color: var(--fg-dim);
  font-family: var(--mono);
  font-size: .78rem;
}

.github-repos {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.github-repos span {
  display: block;
  border: 1px solid rgba(221, 107, 77, .18);
  border-radius: 6px;
  padding: 8px 10px;
  color: #cfe2f5;
  background: rgba(221, 107, 77, .08);
  font-family: var(--mono);
  font-size: .82rem;
}

.github-card p {
  margin: 10px 0 0;
  color: #f1a08c;
  font-family: var(--mono);
}

.minesweeper-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
  font-family: var(--mono);
  color: #cfe2f5;
}

.mine-reset {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  color: var(--fg);
  background: rgba(221, 107, 77, .12);
  cursor: pointer;
  touch-action: manipulation;
}

.mine-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 4px;
}

.mine-cell {
  aspect-ratio: 1;
  border: 1px solid rgba(205, 222, 241, .18);
  border-radius: 5px;
  color: #dcecff;
  background: #1b2836;
  cursor: pointer;
  font-family: var(--mono);
  font-weight: 700;
  touch-action: manipulation;
}

.mine-cell:hover { background: #24384c; }
.mine-cell.open { background: #0e151d; cursor: default; }
.mine-cell.mine { color: #ffb3b3; background: #3a1d24; }
.mine-cell.flagged { color: #f2b66d; }

.award-list li strong,
.bio-list li strong { color: #f8fbff; }

footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 28;
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 12px 74px 14px 16px;
  color: rgba(216, 226, 237, 0.58);
  font-family: var(--mono);
  font-size: 0.78rem;
  pointer-events: none;
}

.bgm-remote {
  --bgm-collapsed-width: 56px;
  --bgm-expanded-width: 308px;
  --bgm-disc-size: 52px;
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 80;
  width: var(--bgm-collapsed-width);
  height: 92px;
  pointer-events: auto;
  transition: width .32s cubic-bezier(.22, .82, .28, 1);
}

.bgm-remote.is-expanded {
  width: var(--bgm-expanded-width);
}

.bgm-controller {
  position: absolute;
  right: 0;
  bottom: 0;
  width: var(--bgm-expanded-width);
  min-height: 86px;
  padding: 12px 14px 12px 80px;
  border: 1px solid rgba(205, 222, 241, 0.18);
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(13, 20, 29, 0.96), rgba(8, 13, 20, 0.94));
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.42);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  opacity: 0;
  transform: translateX(14px) scale(0.98);
  transform-origin: right center;
  clip-path: inset(0 0 0 calc(100% - var(--bgm-collapsed-width)) round 26px);
  transition: opacity .26s ease, transform .32s cubic-bezier(.22, .82, .28, 1), border-color .18s ease, clip-path .32s cubic-bezier(.22, .82, .28, 1);
  pointer-events: none;
}

.bgm-remote.is-expanded .bgm-controller {
  opacity: 1;
  transform: translateX(0) scale(1);
  clip-path: inset(0 0 0 0 round 26px);
  border-color: rgba(221, 107, 77, 0.24);
  pointer-events: auto;
}

.bgm-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.bgm-label,
.bgm-state-text {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
}

.bgm-label {
  color: rgba(216, 226, 237, 0.58);
  text-transform: uppercase;
}

.bgm-state-text {
  color: rgba(216, 226, 237, 0.84);
}

.bgm-progress {
  width: 100%;
  border: 0;
  padding: 0;
  color: #d8e2ed;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.bgm-progress-track {
  display: block;
  width: 100%;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(205, 222, 241, 0.16);
}

.bgm-progress-fill {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(221, 107, 77, 0.88), rgba(242, 182, 109, 0.88));
}

.bgm-progress-text {
  display: block;
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: rgba(216, 226, 237, 0.76);
}

.bgm-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.bgm-side-btn {
  min-width: 0;
  min-height: 38px;
  border: 1px solid rgba(205, 222, 241, 0.18);
  border-radius: 999px;
  padding: 0 10px;
  color: #d8e2ed;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.78rem;
  touch-action: manipulation;
}

.bgm-side-btn:hover,
.bgm-side-btn:focus-visible,
.bgm-progress:hover .bgm-progress-text,
.bgm-progress:focus-visible .bgm-progress-text {
  color: #f1f6fb;
  outline: none;
}

.bgm-side-btn:hover,
.bgm-side-btn:focus-visible {
  border-color: rgba(221, 107, 77, 0.52);
}

.bgm-side-btn:disabled,
.bgm-progress:disabled {
  opacity: 0.45;
  cursor: default;
}

.bgm-btn {
  position: absolute;
  top: 50%;
  right: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--bgm-disc-size);
  height: var(--bgm-disc-size);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--fg-dim);
  background: radial-gradient(circle at 35% 30%, rgba(36, 48, 64, 0.98), rgba(10, 15, 21, 0.98));
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.38);
  overflow: hidden;
  cursor: pointer;
  transform: translate(0, -50%);
  transition: transform .32s cubic-bezier(.22, .82, .28, 1), color .18s ease, border-color .18s ease, box-shadow .18s ease;
  touch-action: manipulation;
}

.bgm-remote.is-expanded .bgm-btn {
  transform: translate(calc(-1 * (var(--bgm-expanded-width) - var(--bgm-collapsed-width))), -50%);
}

.bgm-disc-vinyl,
.bgm-disc-core,
.bgm-icon {
  position: absolute;
}

.bgm-disc-vinyl {
  inset: 3px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.22), transparent 16%),
    radial-gradient(circle, rgba(9, 14, 20, 0) 0 16%, rgba(13, 20, 29, 0.88) 17% 26%, rgba(21, 31, 42, 0.96) 27% 42%, rgba(10, 15, 22, 0.98) 43% 56%, rgba(29, 42, 58, 0.96) 57% 72%, rgba(9, 13, 18, 0.98) 73% 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04), inset 0 0 14px rgba(0, 0, 0, 0.46);
}

.bgm-disc-core {
  inset: 50% auto auto 50%;
  width: 15px;
  height: 15px;
  border: 2px solid rgba(242, 182, 109, 0.72);
  border-radius: 50%;
  background: rgba(8, 12, 18, 0.94);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 3px rgba(12, 17, 24, 0.92);
}

.bgm-icon {
  inset: 50% auto auto 50%;
  z-index: 2;
  min-width: 18px;
  transform: translate(-50%, -50%);
  color: #eaf4ff;
  font-family: var(--mono);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.bgm-btn:hover,
.bgm-btn:focus-visible {
  color: var(--accent);
  border-color: rgba(221, 107, 77, 0.64);
  outline: none;
}

.bgm-btn.playing {
  color: #f1a08c;
  border-color: #f1a08c;
  animation: pulse 1.6s ease-in-out infinite;
}

.bgm-btn.playing .bgm-disc-vinyl {
  animation: spinVinyl 4.8s linear infinite;
}

.bgm-remote[data-seekable="false"] .bgm-progress-fill {
  width: 18%;
  opacity: 0.42;
}

.bgm-remote[data-seekable="false"] .bgm-progress-track {
  background: rgba(205, 222, 241, 0.1);
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(221, 107, 77, 0.5); }
  50% { box-shadow: 0 0 0 8px rgba(221, 107, 77, 0); }
}

@keyframes spinVinyl {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@media (max-width: 900px) {
  body {
    overflow: auto;
    min-height: 100svh;
  }
  .room-home {
    width: 100%;
    height: auto;
    min-height: 100svh;
    padding-top: 88px;
    padding-bottom: 96px;
  }
  .room-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    padding: 12px 14px 0;
  }
  .brand {
    font-size: 0.98rem;
  }
  .room-nav {
    max-width: 100%;
    width: 100%;
    gap: 8px;
    padding: 8px;
    scroll-snap-type: x proximity;
  }
  .room-nav button {
    min-height: 40px;
    padding: 9px 12px;
    scroll-snap-align: start;
  }
  .room-stage,
  body.panel-open .room-stage {
    position: relative;
    right: auto;
    height: max(560px, calc(100svh - 84px));
    min-height: 0;
  }
  .room-title {
    left: 16px;
    right: 16px;
    bottom: 22px;
    width: auto;
  }
  .room-title h1 {
    font-size: clamp(2rem, 10vw, 3.35rem);
  }
  .room-title p:last-child {
    max-width: none;
    font-size: 0.92rem;
    line-height: 1.65;
  }
  .room-panel {
    position: relative;
    width: 100%;
    min-width: 0;
    min-height: 0;
    scroll-margin-top: 112px;
    padding: 24px 16px 104px;
    border-left: 0;
    border-top: 1px solid rgba(205, 222, 241, 0.2);
    border-radius: 24px 24px 0 0;
  }
  .room-panel-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 42px;
    height: 42px;
  }
  footer {
    position: static;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 6px;
    padding: 12px 16px 0;
    font-size: 0.68rem;
  }
  .bgm-remote {
    right: 14px;
    bottom: max(14px, env(safe-area-inset-bottom));
    width: 48px;
    height: 48px;
  }
  .bgm-controller {
    display: none;
  }
  .bgm-btn {
    top: 0;
    right: 0;
    width: 48px;
    height: 48px;
    transform: none !important;
  }
}
