:root {
  --bg-0: #071a1f;
  --bg-1: #0a2b2f;
  --bg-2: #113e3f;
  --panel: rgba(8, 24, 29, 0.82);
  --line: rgba(137, 255, 211, 0.22);
  --text: #e9fff8;
  --muted: #a3c8be;
  --green: #28d27b;
  --blue: #3fc7ff;
  --orange: #ffb34d;
  --rose: #ff5f87;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: radial-gradient(120% 80% at 50% 10%, #1f6360 0%, var(--bg-1) 35%, var(--bg-0) 100%);
}

body {
  display: flex;
  justify-content: center;
  overflow: hidden;
}

.bg-glow {
  position: fixed;
  inset: -30%;
  background:
    radial-gradient(circle at 20% 20%, rgba(88, 255, 190, 0.12), transparent 35%),
    radial-gradient(circle at 80% 30%, rgba(70, 193, 255, 0.15), transparent 40%),
    radial-gradient(circle at 50% 80%, rgba(255, 109, 154, 0.1), transparent 35%);
  pointer-events: none;
  animation: drift 12s linear infinite alternate;
}

@keyframes drift {
  from {
    transform: translate3d(-2%, 0, 0) scale(1);
  }
  to {
    transform: translate3d(2%, -1%, 0) scale(1.05);
  }
}

.app {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 430px;
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 10px;
  padding: env(safe-area-inset-top, 12px) 12px env(safe-area-inset-bottom, 18px);
}

.hud {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px;
  backdrop-filter: blur(4px);
}

.hud-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.pill {
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 7px 10px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
}

.pill.timer {
  color: #baffde;
}

.pill.score {
  color: #b7f2ff;
}

.pill.combo {
  color: #ffdcb1;
}

.best-line {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

.risk-board {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 12px 10px;
}

.risk-board h2 {
  margin: 0 0 8px;
  font-size: 13px;
  letter-spacing: 0.5px;
  color: #cefff1;
}

.risk-item {
  display: grid;
  grid-template-columns: 44px 1fr 28px;
  gap: 8px;
  align-items: center;
  margin-bottom: 7px;
  font-size: 12px;
}

.risk-item:last-child {
  margin-bottom: 0;
}

.risk-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.risk-track i {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #4bffb4, #ffc44d 65%, #ff5e74 100%);
  transition: width 0.25s ease;
}

.card-wrap {
  position: relative;
  display: grid;
  align-items: center;
}

.post-card {
  width: 100%;
  min-height: min(40vh, 330px);
  background: linear-gradient(145deg, rgba(13, 45, 44, 0.92), rgba(8, 27, 34, 0.9));
  border: 1px solid rgba(160, 255, 222, 0.35);
  border-radius: 22px;
  box-shadow: 0 20px 36px rgba(0, 0, 0, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  transform-origin: center;
  transition: transform 0.22s ease, border-color 0.22s ease;
}

.post-card.flash {
  transform: scale(0.98);
  border-color: rgba(255, 206, 145, 0.95);
}

#cardText {
  margin: 0;
  font-size: clamp(23px, 6.2vw, 31px);
  font-weight: 800;
  line-height: 1.32;
  letter-spacing: 0.4px;
  text-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  word-break: break-word;
}

#cardHint {
  font-size: 13px;
  color: #9bd8c6;
}

.event-banner {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translate(-50%, -12px);
  opacity: 0;
  pointer-events: none;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 91, 124, 0.18);
  border: 1px solid rgba(255, 172, 191, 0.68);
  color: #ffdce5;
  font-size: 12px;
  white-space: nowrap;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.event-banner.show {
  transform: translate(-50%, 0);
  opacity: 1;
}

.feedback {
  position: absolute;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%) translateY(8px);
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(177, 255, 222, 0.62);
  background: rgba(8, 20, 24, 0.84);
  font-size: 12px;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  text-align: center;
  max-width: 92%;
}

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

.actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.action {
  border: 0;
  border-radius: 14px;
  padding: 13px 6px;
  color: #05131b;
  font-weight: 800;
  font-size: 14px;
  box-shadow: 0 9px 24px rgba(0, 0, 0, 0.25);
}

.action:active {
  transform: translateY(1px) scale(0.99);
}

.action.all {
  background: linear-gradient(180deg, #ffd67b, #ffb751);
}

.action.friends {
  background: linear-gradient(180deg, #79f3c5, #36ce95);
}

.action.self {
  background: linear-gradient(180deg, #9be8ff, #52bff0);
}

.panel {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 5;
  padding: 16px;
  background: rgba(1, 10, 14, 0.64);
  backdrop-filter: blur(4px);
}

.panel.active {
  display: flex;
}

.panel-card {
  width: min(100%, 390px);
  border-radius: 22px;
  border: 1px solid rgba(170, 255, 225, 0.3);
  background: linear-gradient(160deg, rgba(10, 35, 39, 0.96), rgba(6, 21, 29, 0.94));
  box-shadow: 0 20px 52px rgba(0, 0, 0, 0.45);
  padding: 24px 18px;
  text-align: center;
}

.panel-card h1,
.panel-card h2 {
  margin: 0 0 8px;
  font-size: clamp(28px, 8vw, 36px);
  line-height: 1.16;
}

.panel-card.result h2 {
  font-size: clamp(24px, 7vw, 31px);
}

.panel-card p {
  margin: 0 0 16px;
  color: #bee7da;
  line-height: 1.45;
}

.main-btn {
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 13px 14px;
  font-size: 16px;
  font-weight: 800;
  color: #072119;
  background: linear-gradient(180deg, #7cffc4, #2fd58c);
}

.main-btn.ghost {
  background: rgba(71, 175, 255, 0.22);
  border: 1px solid rgba(153, 220, 255, 0.56);
  color: #dbf3ff;
  margin-bottom: 8px;
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.result-grid div {
  background: rgba(143, 255, 217, 0.07);
  border: 1px solid rgba(143, 255, 217, 0.2);
  border-radius: 11px;
  padding: 10px 8px;
}

.result-grid span {
  display: block;
  font-size: 12px;
  color: #9cd2c1;
}

.result-grid b {
  display: block;
  margin-top: 3px;
  font-size: 19px;
}

#shareText {
  width: 100%;
  border: 1px solid rgba(163, 255, 224, 0.35);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.2);
  color: #cbffef;
  height: 72px;
  resize: none;
  padding: 9px;
  font-size: 12px;
  line-height: 1.4;
  margin-bottom: 10px;
}

.result-actions {
  display: grid;
  gap: 8px;
}

@media (orientation: landscape) and (max-height: 520px) {
  .app {
    grid-template-rows: auto auto auto auto;
  }

  .post-card {
    min-height: 170px;
  }
}
