:root {
  --bg: #14081c;
  --card: #2a1038;
  --gold: #f6d36b;
  --gold-deep: #e0a14a;
  --red: #ff3b5c;
  --ink: #fff7e8;
  --muted: #d7b8c8;
  --btn: #ff3b5c;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
}

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

html,
body {
  height: 100%;
  background: #07040c;
  color: var(--ink);
  font-family: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  user-select: none;
  overflow: hidden;
}

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

#app {
  position: relative;
  width: min(100vw, 430px);
  height: 100%;
  height: 100dvh;
  background: var(--bg);
  overflow: hidden;
  touch-action: none;
}

#stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#hud {
  position: absolute;
  top: calc(10px + var(--safe-top));
  left: 14px;
  right: 14px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
  z-index: 2;
}

.hud-card h1 {
  font-size: 22px;
  letter-spacing: 0.12em;
  text-shadow: 0 2px 0 #4a1840, 0 0 18px rgba(246, 211, 107, 0.45);
}

.hud-kicker,
#round-line,
#count-line {
  font-size: 12px;
  color: var(--gold);
  letter-spacing: 0.08em;
}

#round-line {
  margin-top: 2px;
  color: var(--ink);
}

.hud-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: auto;
}

#mute-btn {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(20, 8, 28, 0.55);
  color: var(--gold);
  font-size: 18px;
  box-shadow: inset 0 0 0 1px rgba(246, 211, 107, 0.35);
}

#hint {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: calc(18px + var(--safe-bot));
  text-align: center;
  font-size: 14px;
  color: var(--muted);
  z-index: 2;
  pointer-events: none;
  text-shadow: 0 1px 8px #14081c;
}

#banner {
  position: absolute;
  left: 50%;
  top: calc(86px + var(--safe-top));
  transform: translate(-50%, 0);
  z-index: 3;
  pointer-events: none;
  padding: 10px 22px;
  border-radius: 999px;
  background: rgba(255, 59, 92, 0.92);
  color: #fff;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0.16em;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  animation: pop 0.28s ease-out;
}

#banner.gold {
  background: rgba(246, 211, 107, 0.95);
  color: #3a1608;
}

#banner.quiet {
  background: rgba(20, 8, 28, 0.78);
  font-size: 18px;
  letter-spacing: 0.08em;
}

.screen {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 20px 16px calc(28px + var(--safe-bot));
  background: linear-gradient(180deg, rgba(7, 4, 12, 0.15), rgba(7, 4, 12, 0.72) 45%, rgba(7, 4, 12, 0.88));
}

.card {
  width: 100%;
  background: linear-gradient(180deg, #4a1c4c, #2a1038);
  border: 2px solid var(--gold);
  border-radius: 22px;
  padding: 22px 20px 18px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  text-align: center;
}

.show-tag {
  display: inline-block;
  margin-bottom: 8px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(246, 211, 107, 0.16);
  color: var(--gold);
  font-size: 11px;
  letter-spacing: 0.14em;
}

.card h1,
.card h2 {
  font-size: 40px;
  letter-spacing: 0.16em;
  line-height: 1.1;
  text-shadow: 0 3px 0 #6b1d3a;
}

.card .sub {
  margin-top: 4px;
  color: var(--gold);
  letter-spacing: 0.2em;
  font-size: 14px;
}

.lead,
.note,
#result-lead {
  margin-top: 12px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

.steps {
  margin: 16px 0 4px;
  padding: 12px 16px;
  list-style: none;
  background: rgba(0, 0, 0, 0.22);
  border-radius: 14px;
  text-align: left;
}

.steps li {
  position: relative;
  padding: 6px 0 6px 28px;
  font-size: 15px;
}

.steps li::before {
  position: absolute;
  left: 0;
  top: 6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--gold);
  color: #3a1608;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
  line-height: 20px;
}

.steps li:nth-child(1)::before { content: "1"; }
.steps li:nth-child(2)::before { content: "2"; }
.steps li:nth-child(3)::before { content: "3"; }
.steps li:nth-child(4)::before { content: "4"; }

.card button,
#start-btn,
#again-btn {
  margin-top: 18px;
  width: 100%;
  min-height: 54px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(180deg, #ff6b81, var(--btn));
  color: #fff;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.18em;
  box-shadow: 0 8px 0 #9d1833;
}

.card button:active {
  transform: translateY(3px);
  box-shadow: 0 5px 0 #9d1833;
}

#result.win .card {
  border-color: var(--gold);
}

#result.lose .card {
  border-color: #ff8aa0;
}

[hidden] {
  display: none !important;
}

.card button,
#start-btn,
#again-btn,
#mute-btn {
  cursor: pointer;
  font-family: inherit;
}

@keyframes pop {
  from {
    transform: translate(-50%, 8px) scale(0.7);
    opacity: 0;
  }
  to {
    transform: translate(-50%, 0) scale(1);
    opacity: 1;
  }
}
