:root {
  --ink: #162219;
  --cream: #fff8e8;
  --bamboo: #79b94b;
  --bamboo-light: #b7e86a;
  --bamboo-dark: #356e3a;
  --orange: #f09a45;
  --red: #e95844;
  --sky: #b9e4df;
  --panel: rgba(23, 38, 28, 0.84);
  --panel-light: rgba(255, 250, 235, 0.94);
  --shadow: 0 16px 42px rgba(18, 37, 22, 0.24);
  font-family: "Arial Rounded MT Bold", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: #17231b;
}

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

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  user-select: none;
}

button {
  font: inherit;
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #17231b;
  touch-action: none;
}

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

.hidden {
  display: none !important;
}

.hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hud-top {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  left: max(14px, env(safe-area-inset-left));
  right: max(14px, env(safe-area-inset-right));
  display: grid;
  grid-template-columns: 92px 1fr 46px;
  gap: 10px;
  align-items: start;
}

.stat-card,
.timer-card,
.player-card,
.target-card {
  background: var(--panel);
  color: white;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.stat-card {
  height: 66px;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 8px 13px;
  border: 1px solid rgba(255,255,255,.12);
}

.stat-label,
.timer-card > span {
  color: rgba(255,255,255,.64);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
}

.alive-card strong {
  font-size: 24px;
  line-height: 1.1;
}

.alive-card small {
  color: rgba(255,255,255,.45);
  font-size: 12px;
}

.timer-card {
  justify-self: center;
  width: min(188px, 46vw);
  height: 66px;
  border-radius: 22px;
  padding: 8px 20px 9px;
  text-align: center;
  border: 1px solid rgba(255,255,255,.12);
}

.timer-card strong {
  display: block;
  font-size: 24px;
  letter-spacing: .04em;
  line-height: 1.12;
}

.timer-track {
  height: 3px;
  margin-top: 5px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(255,255,255,.14);
}

.timer-track i {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--bamboo-light), #f5c65b);
  transform-origin: left;
}

.icon-btn {
  pointer-events: auto;
  width: 46px;
  height: 46px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.13);
  background: var(--panel);
  color: white;
  cursor: pointer;
  font-size: 20px;
  backdrop-filter: blur(12px);
}

.icon-btn.muted {
  opacity: .45;
  text-decoration: line-through;
}

.player-card {
  position: absolute;
  top: max(91px, calc(env(safe-area-inset-top) + 77px));
  left: max(14px, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  width: 218px;
  min-height: 63px;
  padding: 9px 12px 10px 9px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,.1);
}

.avatar-mini {
  flex: 0 0 45px;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  position: relative;
  background: #fff8e7;
  box-shadow: inset 0 -4px 0 rgba(0,0,0,.08);
}

.avatar-mini::before,
.avatar-mini::after {
  content: "";
  position: absolute;
  top: -4px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: #1c261f;
}

.avatar-mini::before { left: 0; }
.avatar-mini::after { right: 0; }

.avatar-mini span {
  position: absolute;
  top: 15px;
  width: 13px;
  height: 17px;
  border-radius: 50%;
  background: #1c261f;
  z-index: 2;
}

.avatar-mini span:first-child { left: 8px; transform: rotate(22deg); }
.avatar-mini span:last-child { right: 8px; transform: rotate(-22deg); }

.player-stats {
  flex: 1;
  min-width: 0;
  padding-left: 10px;
}

.stat-row,
.weight-row {
  display: flex;
  align-items: center;
}

.stat-row {
  justify-content: space-between;
  gap: 8px;
}

.stat-row strong {
  font-size: 12px;
  white-space: nowrap;
}

.rank-badge {
  padding: 2px 6px;
  border-radius: 7px;
  background: var(--bamboo);
  color: #102013;
  font-size: 10px;
  font-weight: 900;
}

.weight-row {
  gap: 6px;
  margin-top: 7px;
  color: rgba(255,255,255,.6);
  font-size: 9px;
}

.weight-row b {
  color: white;
  min-width: 31px;
  text-align: right;
  font-size: 10px;
}

.weight-track {
  flex: 1;
  height: 5px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(255,255,255,.12);
}

.weight-track i {
  display: block;
  height: 100%;
  width: 10%;
  border-radius: inherit;
  background: linear-gradient(90deg, #e4f78d, #83d45f);
  transition: width .2s ease;
}

.target-card {
  position: absolute;
  top: max(91px, calc(env(safe-area-inset-top) + 77px));
  right: max(14px, env(safe-area-inset-right));
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 130px;
  padding: 9px 11px;
  border-radius: 17px;
  border: 1px solid rgba(242, 195, 83, .32);
  animation: targetIn .22s ease-out;
}

@keyframes targetIn {
  from { transform: translateY(-5px) scale(.96); opacity: 0; }
}

.target-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid #f4c457;
  border-radius: 50%;
  color: #f4c457;
  font-weight: 900;
}

.target-card div {
  display: flex;
  flex-direction: column;
}

.target-card small {
  color: rgba(255,255,255,.55);
  font-size: 8px;
  letter-spacing: .1em;
}

.target-card strong {
  font-size: 12px;
}

.target-distance {
  margin-left: auto;
  color: #f5cf78;
  font-size: 9px;
}

.element-status {
  position: absolute;
  top: max(162px, calc(env(safe-area-inset-top) + 148px));
  left: max(14px, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 137px;
  padding: 7px 10px 7px 8px;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 15px;
  color: white;
  background: rgba(23, 38, 28, .78);
  box-shadow: 0 9px 24px rgba(14, 31, 19, .18);
  backdrop-filter: blur(10px);
}

.element-status > i {
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  border-radius: 9px;
  background: #efd05f;
  box-shadow: 0 0 12px rgba(255, 221, 92, .45);
}

.element-status > div {
  display: flex;
  flex-direction: column;
  min-width: 35px;
}

.element-status small {
  color: rgba(255,255,255,.48);
  font-size: 7px;
  font-weight: 800;
  letter-spacing: .08em;
}

.element-status strong {
  font-size: 13px;
  line-height: 1.1;
}

.element-status > span {
  margin-left: auto;
  color: #f4d986;
  font-size: 8px;
  font-weight: 800;
  white-space: nowrap;
}

.combo-toast {
  position: absolute;
  top: 31%;
  left: 50%;
  transform: translateX(-50%) rotate(-2deg);
  display: flex;
  align-items: baseline;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 14px;
  color: var(--ink);
  background: #f6dc76;
  border: 2px solid rgba(255,255,255,.78);
  box-shadow: 0 8px 24px rgba(38, 58, 32, .22);
  animation: comboPop .24s cubic-bezier(.2,1.5,.5,1);
}

@keyframes comboPop {
  from { transform: translateX(-50%) scale(.65) rotate(-5deg); opacity: 0; }
}

.combo-toast span {
  font-size: 18px;
  font-weight: 900;
}

.combo-toast small {
  font-weight: 800;
  font-size: 9px;
}

.announcement {
  position: absolute;
  top: 22%;
  left: 50%;
  transform: translateX(-50%);
  min-width: 210px;
  padding: 10px 22px 12px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 16px;
  text-align: center;
  color: white;
  background: rgba(19, 31, 22, .9);
  box-shadow: var(--shadow);
  animation: announceIn .32s cubic-bezier(.18,.88,.3,1.12);
}

@keyframes announceIn {
  from { opacity: 0; transform: translate(-50%, -14px) scale(.9); }
}

.announcement small {
  display: block;
  color: #f1ba54;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .24em;
}

.announcement strong {
  display: block;
  margin-top: 3px;
  font-size: 17px;
}

.kill-feed {
  position: absolute;
  top: 242px;
  right: max(14px, env(safe-area-inset-right));
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  max-width: 60vw;
}

.feed-item {
  padding: 6px 9px;
  border-radius: 9px;
  color: white;
  background: rgba(19, 31, 22, .72);
  font-size: 9px;
  animation: feedIn .2s ease-out;
}

.feed-item b {
  color: #f4cd64;
}

@keyframes feedIn {
  from { opacity: 0; transform: translateX(12px); }
}

.controls {
  position: absolute;
  left: max(19px, env(safe-area-inset-left));
  right: max(19px, env(safe-area-inset-right));
  bottom: max(21px, env(safe-area-inset-bottom));
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  pointer-events: none;
}

.joystick {
  pointer-events: auto;
  position: relative;
  width: 118px;
  height: 118px;
  border-radius: 50%;
  background: rgba(20, 37, 25, .22);
  border: 1px solid rgba(255,255,255,.24);
  box-shadow: inset 0 0 0 8px rgba(255,255,255,.035);
  touch-action: none;
}

.joystick-ring {
  position: absolute;
  inset: 23px;
  border-radius: 50%;
  border: 1px dashed rgba(255,255,255,.2);
}

.joystick-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.35);
  background: rgba(245, 251, 225, .8);
  box-shadow: 0 7px 16px rgba(15, 31, 20, .22);
  transform: translate(-50%, -50%);
  transition: background .15s;
}

.joystick.active .joystick-knob {
  background: rgba(255, 255, 255, .95);
}

.action-cluster {
  display: flex;
  align-items: flex-end;
  gap: 13px;
  pointer-events: auto;
}

.round-action {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  touch-action: none;
}

.round-action small {
  font-size: 8px;
  font-weight: 900;
  letter-spacing: .08em;
}

.action-icon {
  margin-top: 1px;
  font-size: 25px;
  line-height: .9;
  font-weight: 900;
}

.lock-action {
  width: 66px;
  height: 66px;
  color: #f9f5e6;
  background: rgba(24, 39, 29, .72);
  border: 1px solid rgba(255,255,255,.22);
  box-shadow: 0 8px 22px rgba(12, 26, 16, .22);
}

.lock-action.locked {
  color: #25321d;
  background: #f4ce6a;
  border-color: white;
}

.roll-action {
  width: 92px;
  height: 92px;
  color: #223016;
  background: radial-gradient(circle at 35% 28%, #e7fa96 0, #9edc59 46%, #6fb64f 100%);
  border: 4px solid rgba(255,255,255,.78);
  box-shadow: 0 10px 24px rgba(25, 59, 30, .35), inset 0 -8px 0 rgba(41, 100, 45, .18);
}

.roll-action:active,
.roll-action.active {
  transform: scale(.95);
}

.roll-action.empty {
  filter: grayscale(.65);
}

.charge-ring {
  position: absolute;
  inset: -5px;
  width: calc(100% + 10px);
  height: calc(100% + 10px);
  transform: rotate(-90deg);
  pointer-events: none;
}

.charge-track,
.charge-arc {
  fill: none;
  stroke-width: 5;
}

.charge-track {
  stroke: rgba(16, 42, 18, .14);
}

.charge-arc {
  stroke: #f9f6db;
  stroke-linecap: round;
  stroke-dasharray: 276.5;
  stroke-dashoffset: 0;
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
}

.start-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: max(22px, env(safe-area-inset-top)) 24px max(18px, env(safe-area-inset-bottom));
  text-align: center;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% 17%, rgba(255,255,255,.72) 0 4%, transparent 23%),
    radial-gradient(circle at 12% 8%, rgba(255,255,255,.58) 0 1.5%, transparent 8%),
    linear-gradient(160deg, #d1ede0 0%, #eff3cf 43%, #f8ce7d 100%);
}

.start-screen::before {
  content: "";
  position: absolute;
  inset: auto -20% -25% -20%;
  height: 49%;
  border-radius: 50% 50% 0 0;
  background:
    radial-gradient(ellipse at 20% 20%, rgba(255,255,255,.2), transparent 50%),
    #5b944a;
  box-shadow: inset 0 16px 40px rgba(33, 79, 35, .2);
  transform: rotate(-3deg);
}

.start-screen::after {
  content: "";
  position: absolute;
  left: -12%;
  right: -12%;
  bottom: 15%;
  height: 50px;
  background: rgba(255,255,255,.17);
  border-radius: 50%;
  filter: blur(3px);
  transform: rotate(4deg);
}

.brand-panda {
  position: relative;
  z-index: 1;
  width: 112px;
  height: 102px;
  margin-bottom: 2px;
  animation: floatPanda 2.8s ease-in-out infinite;
  filter: drop-shadow(0 12px 9px rgba(38, 72, 36, .18));
}

@keyframes floatPanda {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50% { transform: translateY(-8px) rotate(3deg); }
}

.panda-face {
  position: absolute;
  left: 13px;
  bottom: 2px;
  width: 88px;
  height: 78px;
  border-radius: 48% 48% 44% 44%;
  background: #fffaf0;
  border: 3px solid #243126;
}

.ear {
  position: absolute;
  top: 3px;
  z-index: -1;
  width: 39px;
  height: 39px;
  border-radius: 50%;
  background: #202b22;
  border: 3px solid #243126;
}

.ear.left { left: 4px; transform: rotate(-19deg); }
.ear.right { right: 4px; transform: rotate(19deg); }

.eye {
  position: absolute;
  top: 23px;
  width: 24px;
  height: 31px;
  border-radius: 50%;
  background: #202b22;
}

.eye.left { left: 13px; transform: rotate(24deg); }
.eye.right { right: 13px; transform: rotate(-24deg); }

.eye i {
  position: absolute;
  left: 8px;
  top: 7px;
  width: 7px;
  height: 8px;
  border-radius: 50%;
  background: white;
}

.nose {
  position: absolute;
  left: 50%;
  top: 49px;
  width: 11px;
  height: 8px;
  border-radius: 50% 50% 60% 60%;
  background: #202b22;
  transform: translateX(-50%);
}

.mouth {
  position: absolute;
  left: 50%;
  top: 59px;
  width: 20px;
  height: 9px;
  border-bottom: 2px solid #202b22;
  border-radius: 0 0 50% 50%;
  transform: translateX(-50%);
}

.eyebrow {
  position: relative;
  z-index: 2;
  color: #4f7e3e;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.start-screen h1 {
  position: relative;
  z-index: 2;
  margin: 7px 0 6px;
  font-size: clamp(43px, 13vw, 70px);
  line-height: .84;
  letter-spacing: -.08em;
  text-shadow: 0 3px 0 rgba(255,255,255,.35);
}

.start-screen h1 em {
  display: inline-block;
  color: #f7f3da;
  font-style: normal;
  letter-spacing: -.1em;
  -webkit-text-stroke: 2px #243126;
  text-shadow: 0 5px 0 #243126, 0 8px 18px rgba(26, 55, 29, .2);
}

.tagline {
  position: relative;
  z-index: 2;
  margin: 11px 0 17px;
  font-size: 13px;
  font-weight: 700;
  color: #4a6048;
}

.feature-strip {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-bottom: 17px;
}

.feature-strip span {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 8px;
  border-radius: 99px;
  color: #334b32;
  background: rgba(255,255,255,.45);
  border: 1px solid rgba(255,255,255,.55);
  font-size: 9px;
  font-weight: 800;
  white-space: nowrap;
}

.feature-strip i {
  display: grid;
  place-items: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  color: #f9f7df;
  background: #477c3f;
  font-style: normal;
  font-size: 8px;
}

.start-actions {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: min(290px, 82vw);
  gap: 10px;
}

.primary-btn {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 66px;
  padding: 11px 28px;
  border: 2px solid rgba(255,255,255,.8);
  border-radius: 22px;
  color: #1c291b;
  background: linear-gradient(180deg, #c8ef6f, #83c94f);
  box-shadow: 0 8px 0 #427d3d, 0 15px 30px rgba(50, 91, 40, .26);
  cursor: pointer;
  transition: transform .1s, box-shadow .1s;
}

.primary-btn::before {
  content: "";
  position: absolute;
  left: 8%;
  top: 7px;
  width: 36%;
  height: 17px;
  border-radius: 50%;
  background: rgba(255,255,255,.28);
  transform: rotate(-7deg);
}

.primary-btn:active {
  transform: translateY(5px);
  box-shadow: 0 3px 0 #427d3d, 0 8px 15px rgba(50, 91, 40, .2);
}

.primary-btn span {
  font-size: 20px;
  font-weight: 900;
  letter-spacing: .08em;
}

.primary-btn small {
  margin-top: 2px;
  font-size: 9px;
  font-weight: 800;
  color: rgba(31, 47, 27, .66);
}

.primary-btn.compact {
  width: 100%;
  min-height: 52px;
  margin-top: 18px;
  box-shadow: 0 5px 0 #427d3d;
}

.secondary-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 7px 20px;
  border: 1px solid rgba(53, 92, 49, .2);
  border-radius: 17px;
  color: #28432b;
  background: rgba(255, 253, 236, .52);
  box-shadow: 0 5px 18px rgba(49, 83, 44, .1);
  cursor: pointer;
  transition: transform .1s, background .15s;
}

.secondary-btn:active {
  transform: scale(.98);
  background: rgba(255, 253, 236, .75);
}

.secondary-btn span {
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .04em;
}

.secondary-btn small {
  margin-top: 1px;
  color: #6d7c66;
  font-size: 8px;
  font-weight: 800;
}

.text-btn {
  border: 0;
  padding: 9px;
  color: #365d36;
  background: transparent;
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
  text-decoration: underline;
  text-decoration-color: rgba(55, 94, 55, .25);
  text-underline-offset: 4px;
}

.best-row {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 13px;
  padding: 5px 14px;
  border-radius: 99px;
  color: rgba(33, 55, 31, .65);
  background: rgba(255,255,255,.3);
  font-size: 9px;
  font-weight: 700;
}

.home-rank-card {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  width: min(290px, 82vw);
  min-height: 57px;
  margin-top: 12px;
  padding: 7px 8px;
  border: 1px solid rgba(255,255,255,.66);
  border-radius: 18px;
  background: rgba(255, 252, 235, .52);
  box-shadow: 0 8px 22px rgba(48, 80, 43, .12);
  backdrop-filter: blur(8px);
}

.home-rank-badge {
  display: grid;
  place-items: center;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  border: 2px solid rgba(255,255,255,.82);
  border-radius: 14px;
  color: #fffcea;
  background: #509b62;
  box-shadow: 0 5px 12px rgba(39, 91, 54, .2);
  font-size: 17px;
  font-weight: 900;
}

.home-rank-copy {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  padding-left: 9px;
}

.home-rank-copy small {
  color: #768571;
  font-size: 7px;
  font-weight: 800;
  letter-spacing: .08em;
}

.home-rank-copy strong {
  max-width: 128px;
  overflow: hidden;
  color: #283d28;
  font-size: 12px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-rank-copy span {
  color: #768571;
  font-size: 8px;
}

.home-rank-copy b {
  color: #486944;
}

.friends-btn {
  align-self: stretch;
  min-width: 62px;
  border: 0;
  border-radius: 12px;
  color: #365f39;
  background: rgba(112, 172, 80, .17);
  cursor: pointer;
  font-size: 9px;
  font-weight: 900;
}

.best-row strong {
  color: #263d26;
  font-size: 12px;
}

.control-hint {
  position: relative;
  z-index: 2;
  display: flex;
  gap: 12px;
  margin-top: 11px;
  color: rgba(33, 55, 31, .52);
  font-size: 8px;
}

kbd {
  display: inline-block;
  min-width: 20px;
  padding: 2px 4px;
  border-radius: 5px;
  color: #2f4b2e;
  background: rgba(255,255,255,.55);
  border: 1px solid rgba(255,255,255,.8);
  box-shadow: 0 2px 0 rgba(60, 87, 54, .14);
  font: inherit;
  font-weight: 900;
}

.tutorial {
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(16, 29, 20, .64);
  backdrop-filter: blur(9px);
}

.tutorial-card {
  width: min(370px, 92vw);
  padding: 22px 22px 19px;
  border-radius: 28px;
  background: var(--cream);
  box-shadow: 0 24px 60px rgba(7, 20, 10, .4);
  border: 1px solid white;
}

.tutorial-badge {
  display: inline-flex;
  padding: 5px 9px;
  border-radius: 99px;
  color: #365d2e;
  background: #e6f1b9;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .12em;
}

.tutorial-card h2 {
  margin: 9px 0 16px;
  font-size: 26px;
  letter-spacing: -.04em;
}

.tutorial-row {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 11px 0;
  border-top: 1px solid rgba(28, 47, 29, .09);
}

.tutorial-row > div:last-child {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tutorial-row strong {
  font-size: 13px;
}

.tutorial-row small {
  font-size: 10px;
  line-height: 1.45;
  color: #687563;
}

.tut-icon {
  display: grid;
  place-items: center;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  font-size: 22px;
  font-weight: 900;
}

.tut-icon.move { color: #35643b; background: #d7ebc2; }
.tut-icon.lock { color: #8b6729; background: #f6e5ad; }
.tut-icon.roll { color: #29452b; background: #d6ee72; }
.tut-icon.element { color: #fff8dc; background: linear-gradient(135deg, #e3c25c, #cf6b51 48%, #67a96b); }

.result-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: max(22px, env(safe-area-inset-top)) 24px max(20px, env(safe-area-inset-bottom));
  text-align: center;
  background:
    radial-gradient(circle at 50% 34%, rgba(252, 225, 126, .44), transparent 33%),
    linear-gradient(155deg, #d5ecdd 0%, #eef2c9 52%, #f4c778 100%);
}

.result-rays {
  position: absolute;
  left: 50%;
  top: 35%;
  width: 640px;
  height: 640px;
  transform: translate(-50%, -50%);
  opacity: .15;
  background: repeating-conic-gradient(from 0deg, #4b7b42 0deg 8deg, transparent 8deg 20deg);
  animation: rotateRays 25s linear infinite;
}

@keyframes rotateRays {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

.result-emblem {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 105px;
  height: 105px;
  margin-bottom: 12px;
  border: 6px solid white;
  border-radius: 50%;
  color: #fff8dc;
  background: #314e31;
  box-shadow: 0 8px 0 #1f3522, 0 18px 35px rgba(32, 61, 29, .25);
}

.result-emblem::before,
.result-emblem::after {
  content: "✦";
  position: absolute;
  top: 36px;
  color: #f5ce65;
  font-size: 14px;
}

.result-emblem::before { left: -2px; }
.result-emblem::after { right: -2px; }

.result-emblem span {
  font-size: 35px;
  font-weight: 900;
  letter-spacing: -.08em;
}

.result-screen > *:not(.result-rays) {
  position: relative;
  z-index: 1;
}

.result-screen h2 {
  margin: 5px 0 4px;
  font-size: clamp(34px, 10vw, 46px);
  letter-spacing: -.07em;
}

.result-screen > p {
  margin: 3px 0 18px;
  color: #65725e;
  font-size: 11px;
  font-weight: 700;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: min(390px, 90vw);
  padding: 13px 5px;
  border-radius: 20px;
  background: rgba(255, 251, 238, .65);
  border: 1px solid rgba(255,255,255,.8);
  box-shadow: 0 8px 24px rgba(37, 63, 33, .08);
}

.result-grid div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-right: 1px solid rgba(50, 74, 45, .1);
}

.result-grid div:last-child {
  border-right: 0;
}

.result-grid small {
  color: #71806a;
  font-size: 8px;
}

.result-grid strong {
  font-size: 16px;
}

.new-best {
  margin-top: 10px;
  padding: 5px 12px;
  border-radius: 99px;
  color: #6d4c16;
  background: #f3d473;
  font-size: 9px;
  font-weight: 900;
}

.rank-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: min(390px, 90vw);
  margin-top: 9px;
  padding: 8px 10px;
  border-radius: 14px;
  background: rgba(255, 252, 237, .58);
  border: 1px solid rgba(255,255,255,.7);
}

.rank-result > span {
  padding: 4px 8px;
  border-radius: 99px;
  color: #365f38;
  background: rgba(109, 174, 82, .16);
  font-size: 9px;
  font-weight: 900;
}

.rank-result > div {
  display: flex;
  align-items: center;
  gap: 6px;
}

.rank-result i {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  color: white;
  background: #509b62;
  font-style: normal;
  font-size: 10px;
  font-weight: 900;
}

.rank-result strong {
  font-size: 11px;
}

.comeback-tip {
  min-height: 17px;
  margin-top: 8px;
  color: #4b6d45;
  font-size: 10px;
  font-weight: 800;
}

.result-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: min(290px, 82vw);
  margin-top: 8px;
}

.result-secondary-actions {
  display: flex;
  justify-content: center;
  gap: 22px;
}

.friends-screen {
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(16, 30, 20, .65);
  backdrop-filter: blur(10px);
}

.friends-card {
  width: min(380px, 92vw);
  max-height: min(720px, 92vh);
  overflow: hidden;
  padding: 20px;
  border: 1px solid rgba(255,255,255,.86);
  border-radius: 28px;
  background: #fff9e9;
  box-shadow: 0 24px 64px rgba(9, 24, 12, .38);
}

.friends-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.friends-header h2 {
  margin: 8px 0 0;
  font-size: 28px;
  letter-spacing: -.06em;
}

.friends-close {
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  border: 1px solid rgba(39, 65, 37, .1);
  border-radius: 12px;
  color: #50604b;
  background: #f2edd9;
  cursor: pointer;
  font-size: 23px;
  line-height: 1;
}

.friend-player-summary {
  margin: 14px 0 9px;
  padding: 10px 12px;
  border-radius: 15px;
  color: #2f4b2e;
  background: linear-gradient(135deg, rgba(205, 231, 143, .72), rgba(243, 224, 157, .64));
  font-size: 10px;
  font-weight: 800;
}

.friend-list {
  max-height: min(390px, 48vh);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.friend-row {
  display: grid;
  grid-template-columns: 25px 34px 1fr auto;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 6px 5px;
  border-top: 1px solid rgba(42, 66, 38, .08);
}

.friend-row.me {
  margin: 3px 0;
  border: 1px solid rgba(103, 157, 75, .3);
  border-radius: 13px;
  background: rgba(191, 225, 131, .2);
}

.friend-pos {
  color: #72806c;
  font-size: 11px;
  font-weight: 900;
  text-align: center;
}

.friend-pos.top {
  color: #ba802d;
}

.friend-avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 11px;
  color: white;
  background: #557e4a;
  font-size: 12px;
  font-weight: 900;
}

.friend-info {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 1px;
}

.friend-info strong {
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.friend-info small {
  color: #7c8776;
  font-size: 8px;
}

.friend-rating {
  color: #486644;
  font-size: 10px;
  font-weight: 900;
}

.friends-note {
  margin: 11px 2px 0;
  color: #7b8475;
  font-size: 8px;
  line-height: 1.45;
}

.friends-card .primary-btn.compact {
  margin-top: 10px;
}

.revive-screen {
  display: grid;
  place-items: center;
  padding: 22px;
  background:
    radial-gradient(circle at 50% 35%, rgba(246, 211, 101, .22), transparent 34%),
    rgba(17, 30, 20, .78);
  backdrop-filter: blur(11px);
}

.revive-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(360px, 90vw);
  padding: 22px 22px 18px;
  border: 1px solid rgba(255,255,255,.86);
  border-radius: 28px;
  background:
    radial-gradient(circle at 50% 5%, rgba(255,255,255,.7), transparent 30%),
    #fff9e9;
  box-shadow: 0 24px 64px rgba(8, 22, 11, .46);
  text-align: center;
}

.revive-badge {
  align-self: flex-end;
  padding: 5px 9px;
  border-radius: 99px;
  color: #7a5d26;
  background: #f5df9f;
  font-size: 8px;
  font-weight: 900;
}

.revive-panda {
  display: grid;
  place-items: center;
  width: 78px;
  height: 78px;
  margin-top: 3px;
  border: 5px solid #263329;
  border-radius: 50%;
  color: #2b392d;
  background: #fffaf0;
  box-shadow: 0 7px 0 #d1c49c, 0 16px 30px rgba(52, 66, 38, .2);
  font-size: 34px;
  font-weight: 900;
}

.revive-card h2 {
  margin: 17px 0 4px;
  font-size: 27px;
  letter-spacing: -.06em;
}

.revive-card > p {
  margin: 0;
  color: #73806e;
  font-size: 10px;
}

.revive-rewards {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px;
  margin: 15px 0 17px;
}

.revive-rewards span {
  padding: 6px 8px;
  border-radius: 99px;
  color: #49623f;
  background: #edf2d4;
  font-size: 8px;
  font-weight: 800;
}

.revive-card .primary-btn {
  width: 100%;
}

.revive-card .text-btn {
  margin-top: 3px;
}

.ad-playback {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  min-height: 66px;
  border: 2px solid #d6e49b;
  border-radius: 20px;
  color: #40583b;
  background: #eef4d2;
  font-size: 10px;
  font-weight: 800;
}

.ad-playback strong {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  border-radius: 50%;
  color: white;
  background: #527f43;
  font-size: 13px;
}

.rotate-hint {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 30px;
  color: white;
  background: #17231b;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
}

@media (max-height: 720px) {
  .brand-panda { width: 88px; height: 80px; transform: scale(.82); margin-bottom: -4px; }
  .start-screen h1 { font-size: clamp(38px, 11.8vw, 56px); }
  .tagline { margin: 8px 0 10px; }
  .feature-strip { margin-bottom: 11px; }
  .control-hint { display: none; }
  .best-row { margin-top: 8px; }
  .home-rank-card { min-height: 50px; margin-top: 8px; }
  .home-rank-badge { width: 36px; height: 36px; flex-basis: 36px; }
  .primary-btn { min-height: 58px; }
  .result-emblem { width: 82px; height: 82px; margin-bottom: 8px; }
  .result-emblem span { font-size: 29px; }
  .result-screen > p { margin-bottom: 11px; }
  .tutorial-card { padding-top: 17px; }
  .tutorial-row { padding: 8px 0; }
  .rank-result { margin-top: 5px; padding: 5px 8px; }
  .friends-card { max-height: 94vh; padding: 15px; }
  .friend-list { max-height: 44vh; }
  .friend-row { min-height: 40px; }
}

@media (min-width: 700px) {
  .start-screen h1 { font-size: 78px; }
  .brand-panda { width: 132px; height: 118px; transform: scale(1.12); margin-bottom: 17px; }
  .start-screen { padding-bottom: 30px; }
  .feature-strip span { font-size: 11px; }
  .tagline { font-size: 15px; }
  .joystick { width: 132px; height: 132px; }
  .roll-action { width: 104px; height: 104px; }
  .lock-action { width: 76px; height: 76px; }
  .controls { left: max(38px, env(safe-area-inset-left)); right: max(38px, env(safe-area-inset-right)); }
}

@media (orientation: landscape) and (max-height: 560px) {
  .start-screen {
    display: grid;
    grid-template-columns: 160px 1fr;
    grid-template-rows: auto auto auto auto;
    gap: 0 18px;
    text-align: left;
    padding-left: 8vw;
    padding-right: 8vw;
  }
  .brand-panda {
    grid-row: 1 / 5;
    align-self: center;
    justify-self: center;
    margin: 0;
  }
  .start-screen .eyebrow,
  .start-screen h1,
  .tagline,
  .feature-strip,
  .start-actions,
  .home-rank-card,
  .best-row,
  .control-hint {
    grid-column: 2;
    justify-self: start;
  }
  .start-screen h1 {
    font-size: 50px;
    line-height: .82;
    margin: 4px 0 2px;
  }
  .tagline { margin: 5px 0; }
  .feature-strip { margin-bottom: 5px; }
  .start-actions { width: 280px; }
  .home-rank-card { width: 280px; margin-top: 5px; }
  .best-row { margin-top: 6px; }
  .control-hint { display: none; }
  .result-screen h2 { margin: 1px 0; }
  .result-emblem { width: 72px; height: 72px; margin-bottom: 5px; }
  .result-emblem span { font-size: 25px; }
  .result-screen > p { margin-bottom: 7px; }
  .result-grid { max-width: 410px; padding: 8px 5px; }
  .result-actions { width: 270px; margin-top: 3px; }
  .result-actions .primary-btn { min-height: 52px; }
  .result-actions .text-btn { padding: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
  }
}
