:root {
  --bg-main: #06080e;
  --bg-panel: rgba(18, 23, 36, 0.88);
  --bg-card: linear-gradient(145deg, #101629, #17223a 70%, #0f1a2e);
  --text-main: #eef3ff;
  --text-dim: #9ca8c7;
  --accent-neon: #00f5a0;
  --accent-warn: #ff4d9d;
  --accent-hot: #ff6b4a;
  --accent-cold: #59a8ff;
  --shadow-soft: 0 18px 44px rgba(0, 0, 0, 0.4);
  --radius-lg: 22px;
  --radius-md: 14px;
  --safe-bottom: max(12px, env(safe-area-inset-bottom));
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(circle at 20% -10%, #19325a 0%, #090d17 50%, #04060c 100%);
  color: var(--text-main);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  display: flex;
  justify-content: center;
  padding: 12px;
}

.app-shell {
  width: 100%;
  max-width: 460px;
  min-height: calc(100vh - 24px);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.top-bar {
  padding: 10px 4px 0;
}

.game-title {
  margin: 0;
  font-size: clamp(1.45rem, 4.2vw, 1.8rem);
  letter-spacing: 0.04em;
}

.subtitle {
  margin: 6px 0 0;
  color: var(--text-dim);
  font-size: 0.92rem;
}

.screen-stack {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.screen {
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: enter 240ms ease-out;
}

.hidden {
  display: none !important;
}

.panel {
  border-radius: var(--radius-lg);
  background: var(--bg-panel);
  border: 1px solid rgba(112, 143, 198, 0.2);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(8px);
}

.start-screen {
  gap: 14px;
}

.hero-panel {
  padding: 18px 16px;
}

.badge {
  display: inline-flex;
  align-items: center;
  margin: 0 0 10px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 245, 160, 0.12);
  color: var(--accent-neon);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
}

h2,
h3,
p {
  margin: 0;
}

.hero-panel h2 {
  font-size: 1.35rem;
  line-height: 1.32;
}

.lead {
  margin-top: 10px;
  color: #d8e1f7;
  line-height: 1.6;
  font-size: 0.95rem;
}

.high-score-wrap {
  margin-top: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(91, 156, 255, 0.12);
  color: #d5e8ff;
}

.high-score-wrap strong {
  font-size: 1.45rem;
  color: #8fcbff;
}

.rules-panel {
  padding: 14px 16px;
}

.rules-panel h3 {
  margin-bottom: 8px;
}

.rules-panel ul {
  margin: 0;
  padding-left: 18px;
  color: #d7deef;
  display: grid;
  gap: 7px;
  line-height: 1.4;
  font-size: 0.92rem;
}

.hud {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.score-box,
.combo-box,
.round-box {
  border-radius: 12px;
  padding: 8px 6px;
  text-align: center;
  background: rgba(89, 120, 181, 0.14);
}

.score-box span,
.combo-box span,
.round-box span {
  color: var(--text-dim);
  font-size: 0.78rem;
}

.score-box strong,
.combo-box strong,
.round-box strong {
  display: block;
  margin-top: 4px;
  font-size: 1.15rem;
}

.timer-wrap {
  display: grid;
  gap: 6px;
  font-size: 0.84rem;
  color: #cad4f0;
}

.timer-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(159, 178, 219, 0.16);
  overflow: hidden;
}

.timer-fill {
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #1af7aa, #e5ff72 60%, #ff7d57);
  transition: width 60ms linear;
}

#timerText {
  justify-self: end;
  font-variant-numeric: tabular-nums;
  color: #fcefb9;
}

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

.stress-item {
  border-radius: 12px;
  padding: 8px;
  background: rgba(62, 82, 127, 0.18);
  display: grid;
  gap: 6px;
}

.stress-item span {
  font-size: 0.78rem;
  color: #d6ddf3;
}

.stress-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(139, 158, 197, 0.2);
  overflow: hidden;
}

.stress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #21d4fd, #ff6b6b);
  transition: width 180ms ease;
}

.stress-item em {
  justify-self: end;
  font-style: normal;
  font-size: 0.76rem;
  color: #f2adc8;
}

.stress-item.risk {
  outline: 1px solid rgba(255, 77, 157, 0.5);
  background: rgba(89, 26, 57, 0.28);
}

.message-area {
  display: flex;
  flex: 1;
  min-height: 220px;
}

.message-card {
  width: 100%;
  padding: 18px 16px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(154, 181, 232, 0.32);
  display: grid;
  gap: 9px;
  animation: pop 220ms ease;
}

.sender-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.sender-tag,
.emotion-tag {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}

.sender-tag {
  background: rgba(0, 245, 160, 0.14);
  color: #8dffd5;
}

.emotion-tag {
  background: rgba(255, 93, 165, 0.16);
  color: #ffabd4;
}

.sender-name {
  font-size: 1rem;
  font-weight: 700;
  color: #dde7ff;
}

.message-text {
  font-size: clamp(1.15rem, 4.2vw, 1.32rem);
  line-height: 1.45;
  font-weight: 700;
  color: #f6f9ff;
  min-height: 72px;
}

.hint-line {
  color: #a9b8da;
  font-size: 0.84rem;
}

.action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding-bottom: var(--safe-bottom);
}

.btn {
  border: none;
  border-radius: 15px;
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
  color: #071021;
  transition: transform 120ms ease, filter 120ms ease;
}

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

.btn:disabled {
  filter: grayscale(0.5);
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  margin-top: 14px;
  width: 100%;
  min-height: 50px;
  background: linear-gradient(135deg, #00f5a0, #45d4ff);
}

.btn-secondary {
  width: 100%;
  min-height: 48px;
  background: linear-gradient(135deg, #b9c4df, #a4b7ce);
}

.big {
  min-height: 56px;
  font-size: 1.02rem;
}

.btn-reply,
.btn-ignore {
  min-height: 62px;
  font-size: 1.18rem;
  box-shadow: var(--shadow-soft);
}

.btn-reply {
  background: linear-gradient(140deg, #00f59d, #60f0ff);
}

.btn-ignore {
  background: linear-gradient(140deg, #ff85c0, #ff9d5b);
}

.over-panel {
  padding: 18px 16px 16px;
  display: grid;
  gap: 10px;
}

.over-panel h2 {
  font-size: 1.34rem;
  line-height: 1.35;
}

.result-line {
  color: #d4ddf5;
}

.result-line strong {
  color: #8ed8ff;
}

.share-box {
  margin-top: 6px;
  display: grid;
  gap: 8px;
}

.share-box label {
  font-size: 0.86rem;
  color: #ced8f2;
}

#shareText {
  width: 100%;
  min-height: 102px;
  resize: none;
  border: 1px solid rgba(140, 162, 211, 0.3);
  border-radius: 12px;
  padding: 10px;
  background: rgba(12, 17, 30, 0.9);
  color: #f0f3ff;
  font: inherit;
  line-height: 1.5;
}

.btn-copy {
  min-height: 46px;
  background: linear-gradient(135deg, #72a6ff, #85ffdb);
}

.copy-tip {
  color: #aab8d6;
  font-size: 0.8rem;
}

.over-actions {
  margin-top: 4px;
  display: grid;
  gap: 8px;
}

.feedback-pop {
  position: fixed;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  z-index: 50;
  padding: 10px 14px;
  border-radius: 999px;
  font-weight: 700;
  background: rgba(10, 16, 30, 0.94);
  border: 1px solid rgba(155, 182, 241, 0.38);
  color: #f2f5ff;
  pointer-events: none;
  animation: feedback 540ms ease forwards;
}

.feedback-pop.good {
  color: #91ffd8;
  border-color: rgba(52, 255, 188, 0.48);
}

.feedback-pop.bad {
  color: #ffb2cd;
  border-color: rgba(255, 127, 174, 0.5);
}

@keyframes pop {
  from {
    transform: translateY(8px) scale(0.97);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

@keyframes enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes feedback {
  0% {
    transform: translate(-50%, -46%);
    opacity: 0;
  }
  15% {
    transform: translate(-50%, -50%);
    opacity: 1;
  }
  80% {
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -58%);
    opacity: 0;
  }
}

@media (min-width: 500px) {
  body {
    padding: 18px;
  }

  .app-shell {
    min-height: calc(100vh - 36px);
  }
}
