/* 星匣 — Chrome 61 baseline · deep violet / holographic / champagne gold */

html {
  touch-action: manipulation;
  height: 100%;
}

body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #12081f;
  color: #f5e6c8;
  -webkit-touch-callout: none;
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 100vh;
  overflow: hidden;
  background: #0c0618;
  background: -webkit-linear-gradient(165deg, #1a0a2e 0%, #0c0618 45%, #1e1035 100%);
  background: linear-gradient(165deg, #1a0a2e 0%, #0c0618 45%, #1e1035 100%);
}

#game-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 1;
  touch-action: none;
}

.screen {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: -webkit-flex;
  display: flex;
  -webkit-flex-direction: column;
  flex-direction: column;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: center;
  justify-content: center;
  pointer-events: none;
  padding: 24px;
  padding-top: 24px;
  padding-top: var(--safe-area-inset-top, env(safe-area-inset-top, 0px));
  padding-bottom: 24px;
  padding-bottom: var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
}

.screen.overlay {
  background: rgba(8, 4, 18, 0.78);
  pointer-events: auto;
  z-index: 20;
}

.screen > * {
  pointer-events: auto;
}

.hidden {
  display: none !important;
}

.foil-glow {
  position: absolute;
  top: 18%;
  left: 50%;
  width: 260px;
  height: 260px;
  margin-left: -130px;
  border-radius: 50%;
  background: rgba(180, 120, 255, 0.35);
  -webkit-filter: blur(48px);
  filter: blur(48px);
  pointer-events: none;
  z-index: 0;
  -webkit-animation: foilPulse 3.2s ease-in-out infinite;
  animation: foilPulse 3.2s ease-in-out infinite;
}

@-webkit-keyframes foilPulse {
  0%, 100% { opacity: 0.7; -webkit-transform: scale(1); transform: scale(1); }
  50% { opacity: 1; -webkit-transform: scale(1.08); transform: scale(1.08); }
}

@keyframes foilPulse {
  0%, 100% { opacity: 0.7; -webkit-transform: scale(1); transform: scale(1); }
  50% { opacity: 1; -webkit-transform: scale(1.08); transform: scale(1.08); }
}

.title-block {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 30px 26px 28px;
  border-radius: 24px;
  background: rgba(28, 14, 48, 0.88);
  border: 1px solid rgba(230, 190, 120, 0.35);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45),
              0 0 40px rgba(160, 100, 255, 0.2),
              0 1px 0 rgba(255, 220, 160, 0.25) inset;
  max-width: 330px;
  width: 88%;
}

.eyebrow {
  font-size: 11px;
  letter-spacing: 0.28em;
  color: #c8a878;
  margin-bottom: 10px;
}

.game-title {
  font-size: 54px;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: #f5e6c8;
  line-height: 1.1;
  text-indent: 0.22em;
  text-shadow: 0 0 24px rgba(200, 150, 255, 0.55), 0 2px 0 rgba(0, 0, 0, 0.4);
}

.tagline {
  margin-top: 12px;
  font-size: 14px;
  color: #c4a8d8;
  letter-spacing: 0.06em;
}

.best-line {
  margin-top: 16px;
  margin-bottom: 20px;
  font-size: 14px;
  color: #e8c878;
}

.primary-btn {
  display: inline-block;
  border: none;
  outline: none;
  cursor: pointer;
  padding: 14px 34px;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: #2a1838;
  background: #e8c878;
  background: -webkit-linear-gradient(135deg, #f5e0a8 0%, #e0b060 50%, #c898f0 100%);
  background: linear-gradient(135deg, #f5e0a8 0%, #e0b060 50%, #c898f0 100%);
  box-shadow: 0 10px 28px rgba(200, 140, 80, 0.35),
              0 0 20px rgba(180, 120, 255, 0.25);
  -webkit-appearance: none;
  appearance: none;
}

.primary-btn:active {
  opacity: 0.85;
  -webkit-transform: scale(0.97);
  transform: scale(0.97);
}

.primary-btn.pulse {
  -webkit-animation: goldPulse 2.2s ease-in-out infinite;
  animation: goldPulse 2.2s ease-in-out infinite;
}

@-webkit-keyframes goldPulse {
  0%, 100% { box-shadow: 0 10px 28px rgba(200, 140, 80, 0.35), 0 0 20px rgba(180, 120, 255, 0.25); }
  50% { box-shadow: 0 14px 36px rgba(200, 140, 80, 0.5), 0 0 32px rgba(180, 120, 255, 0.4); }
}

@keyframes goldPulse {
  0%, 100% { box-shadow: 0 10px 28px rgba(200, 140, 80, 0.35), 0 0 20px rgba(180, 120, 255, 0.25); }
  50% { box-shadow: 0 14px 36px rgba(200, 140, 80, 0.5), 0 0 32px rgba(180, 120, 255, 0.4); }
}

.ghost-btn {
  display: inline-block;
  border: 1px solid rgba(230, 190, 120, 0.4);
  outline: none;
  cursor: pointer;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: #e8d0a0;
  background: rgba(40, 20, 60, 0.6);
  -webkit-appearance: none;
  appearance: none;
}

.ghost-btn:active {
  opacity: 0.75;
}

.title-sub-actions {
  margin-top: 14px;
  display: -webkit-flex;
  display: flex;
  -webkit-justify-content: center;
  justify-content: center;
  -webkit-flex-wrap: wrap;
  flex-wrap: wrap;
}

.title-sub-actions .ghost-btn {
  margin: 4px;
}

.hint-foot {
  position: absolute;
  bottom: 32px;
  bottom: calc(32px + var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px)));
  left: 0;
  right: 0;
  text-align: center;
  font-size: 11px;
  color: #8a70a0;
  letter-spacing: 0.06em;
  z-index: 2;
  pointer-events: none;
}

/* HUD */
.hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 8;
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: flex-start;
  align-items: flex-start;
  -webkit-justify-content: space-between;
  justify-content: space-between;
  padding: 14px 16px;
  padding-top: 14px;
  padding-top: calc(14px + var(--safe-area-inset-top, env(safe-area-inset-top, 0px)));
  pointer-events: none;
}

.hud-title-mini {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: #f5e6c8;
  text-shadow: 0 0 12px rgba(180, 120, 255, 0.5);
}

.hud-tickets {
  margin-top: 4px;
  font-size: 13px;
  color: #e8c878;
}

.hud-pity {
  margin-top: 2px;
  font-size: 11px;
  color: #a888c0;
}

.hud-right {
  display: -webkit-flex;
  display: flex;
  pointer-events: auto;
}

.hud-right .icon-btn {
  margin-left: 8px;
}

.icon-btn {
  pointer-events: auto;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(230, 190, 120, 0.3);
  border-radius: 50%;
  background: rgba(30, 14, 48, 0.85);
  color: #e8d0a0;
  font-size: 15px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.icon-btn.small {
  width: 32px;
  height: 32px;
  font-size: 13px;
}

.icon-btn:active {
  opacity: 0.75;
}

.icon-btn.muted {
  color: #8870a0;
}

/* Opening */
.opening-hint {
  font-size: 15px;
  letter-spacing: 0.2em;
  color: #e8d0a0;
  text-shadow: 0 0 20px rgba(200, 150, 255, 0.6);
  -webkit-animation: fadeBlink 1.2s ease-in-out infinite;
  animation: fadeBlink 1.2s ease-in-out infinite;
}

@-webkit-keyframes fadeBlink {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

@keyframes fadeBlink {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

/* Result */
.result-card {
  text-align: center;
  padding: 20px 18px 22px;
  border-radius: 22px;
  background: rgba(24, 12, 42, 0.94);
  border: 1px solid rgba(230, 190, 120, 0.4);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5),
              0 0 40px rgba(160, 100, 255, 0.25);
  max-width: 320px;
  width: 90%;
}

.result-card.rarity-N { box-shadow: 0 24px 60px rgba(0,0,0,0.5), 0 0 28px rgba(160, 170, 200, 0.3); }
.result-card.rarity-R { box-shadow: 0 24px 60px rgba(0,0,0,0.5), 0 0 36px rgba(100, 160, 255, 0.4); }
.result-card.rarity-SR { box-shadow: 0 24px 60px rgba(0,0,0,0.5), 0 0 44px rgba(200, 120, 255, 0.5); }
.result-card.rarity-SSR { box-shadow: 0 24px 60px rgba(0,0,0,0.5), 0 0 56px rgba(255, 200, 80, 0.55); }

.result-rarity {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.28em;
  margin-bottom: 10px;
  color: #e8d0a0;
}

#card-canvas {
  display: block;
  width: 200px;
  height: 257px;
  margin: 0 auto;
  border-radius: 14px;
  background: #1a1030;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.result-name {
  margin-top: 14px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: #f8ecd0;
}

.result-sub {
  margin-top: 6px;
  margin-bottom: 16px;
  font-size: 12px;
  color: #a888c0;
}

.result-actions {
  display: -webkit-flex;
  display: flex;
  -webkit-flex-direction: column;
  flex-direction: column;
  -webkit-align-items: center;
  align-items: center;
}

.result-actions .primary-btn,
.result-actions .ghost-btn {
  margin-top: 8px;
  min-width: 160px;
}

/* Album */
.album-panel {
  width: 92%;
  max-width: 380px;
  max-height: 82%;
  background: rgba(22, 10, 40, 0.96);
  border: 1px solid rgba(230, 190, 120, 0.3);
  border-radius: 20px;
  padding: 16px;
  display: -webkit-flex;
  display: flex;
  -webkit-flex-direction: column;
  flex-direction: column;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.album-head {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: space-between;
  justify-content: space-between;
  margin-bottom: 8px;
}

.card-title {
  font-size: 18px;
  letter-spacing: 0.14em;
  color: #f5e6c8;
}

.album-progress {
  font-size: 12px;
  color: #a888c0;
  margin-bottom: 12px;
}

.album-grid {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  display: -webkit-flex;
  display: flex;
  -webkit-flex-wrap: wrap;
  flex-wrap: wrap;
  -webkit-justify-content: flex-start;
  justify-content: flex-start;
  max-height: 55vh;
  min-height: 0;
}

.album-cell {
  width: 25%;
  padding: 4px;
  box-sizing: border-box;
}

.album-cell-inner {
  aspect-ratio: auto;
  height: 0;
  padding-bottom: 120%;
  position: relative;
  border-radius: 10px;
  background: rgba(40, 24, 60, 0.9);
  border: 1px solid rgba(120, 90, 150, 0.35);
  overflow: hidden;
}

.album-cell-inner.unlocked {
  border-color: rgba(230, 190, 120, 0.45);
  box-shadow: 0 0 12px rgba(180, 120, 255, 0.2);
}

.album-cell-inner .cell-art {
  position: absolute;
  top: 8%;
  left: 10%;
  right: 10%;
  bottom: 28%;
}

.album-cell-inner .cell-name {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 6px;
  text-align: center;
  font-size: 9px;
  color: #c8b0d8;
  letter-spacing: 0.04em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 2px;
}

.album-cell-inner.locked .cell-name {
  color: #665878;
}

.album-cell-inner .cell-rarity {
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 8px;
  font-weight: 700;
  color: #e8c878;
}

/* Shake */
.shake-panel {
  text-align: center;
  padding: 28px 24px;
  border-radius: 22px;
  background: rgba(24, 12, 42, 0.95);
  border: 1px solid rgba(230, 190, 120, 0.35);
  max-width: 300px;
  width: 88%;
}

.shake-desc {
  margin-top: 10px;
  font-size: 13px;
  color: #b898d0;
}

.shake-count {
  margin-top: 14px;
  font-size: 28px;
  font-weight: 700;
  color: #e8c878;
  letter-spacing: 0.08em;
}

.shake-box {
  width: 120px;
  height: 120px;
  margin: 20px auto;
  border-radius: 18px;
  background: -webkit-linear-gradient(145deg, #4a2880, #2a1048);
  background: linear-gradient(145deg, #4a2880, #2a1048);
  border: 2px solid rgba(230, 190, 120, 0.5);
  box-shadow: 0 0 30px rgba(180, 120, 255, 0.35);
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: center;
  justify-content: center;
  font-size: 42px;
  color: #f5e6c8;
  touch-action: none;
  cursor: grab;
}

.shake-box.shaking {
  -webkit-animation: boxShake 0.2s ease;
  animation: boxShake 0.2s ease;
}

@-webkit-keyframes boxShake {
  0%, 100% { -webkit-transform: translateX(0) rotate(0); transform: translateX(0) rotate(0); }
  25% { -webkit-transform: translateX(-10px) rotate(-6deg); transform: translateX(-10px) rotate(-6deg); }
  75% { -webkit-transform: translateX(10px) rotate(6deg); transform: translateX(10px) rotate(6deg); }
}

@keyframes boxShake {
  0%, 100% { -webkit-transform: translateX(0) rotate(0); transform: translateX(0) rotate(0); }
  25% { -webkit-transform: translateX(-10px) rotate(-6deg); transform: translateX(-10px) rotate(-6deg); }
  75% { -webkit-transform: translateX(10px) rotate(6deg); transform: translateX(10px) rotate(6deg); }
}

.toast {
  position: absolute;
  left: 50%;
  bottom: 90px;
  bottom: calc(90px + var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px)));
  z-index: 40;
  -webkit-transform: translateX(-50%);
  transform: translateX(-50%);
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(40, 20, 60, 0.92);
  border: 1px solid rgba(230, 190, 120, 0.35);
  color: #f5e6c8;
  font-size: 13px;
  white-space: nowrap;
  pointer-events: none;
}
