:root {
  --ink: #1c140e;
  --paper: #f3e6c4;
  --card: #fff8ea;
  --red: #d62828;
  --safe-top: 0px;
  --safe-top: var(--safe-area-inset-top, env(safe-area-inset-top, 0px));
  --safe-bottom: 0px;
  --safe-bottom: var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
}

* { box-sizing: border-box; }

html {
  max-width: 100%;
  overscroll-behavior-x: none;
  touch-action: pan-y;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  max-width: 100%;
  overscroll-behavior-x: none;
  touch-action: pan-y;
  background: #d9c39a;
  color: var(--ink);
  font-family: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

button {
  font-family: inherit;
  color: inherit;
  -webkit-appearance: none;
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
}

button:active { opacity: 0.86; }

.app {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--paper);
  border: 3px solid var(--ink);
  box-shadow: none;
  padding-bottom: 8px;
}

.mast {
  padding: 14px 16px 8px;
  padding-top: calc(14px + var(--safe-top));
  overflow: hidden;
}

.mast-row {
  display: flex;
  align-items: center;
}

.kicker {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 1px;
  font-size: 14px;
  font-weight: 800;
}

.issue {
  margin: 0 0 0 auto;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  font-weight: 800;
  background: var(--ink);
  color: var(--card);
  padding: 2px 8px;
  transform: rotate(6deg);
}

h1 {
  display: inline-block;
  margin: 8px 0 0;
  padding: 2px 8px 4px;
  background: var(--red);
  color: #fff8ea;
  font-size: 26px;
  line-height: 1.15;
  letter-spacing: 1px;
  box-shadow: 4px 4px 0 var(--ink);
  transform: rotate(-1deg);
}

.tagline {
  margin: 8px 0 0;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 1px;
}

.ticker {
  position: sticky;
  top: 0;
  top: var(--safe-top);
  z-index: 4;
  padding: 8px 16px 10px;
  background: #efe0b8;
  border-top: 3px solid var(--ink);
  border-bottom: 3px solid var(--ink);
}

.ticker-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  overflow: hidden;
}

.mood {
  flex: 1 1 100%;
  min-width: 0;
  margin: 0 0 6px;
  overflow: hidden;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.ticker-actions {
  flex: none;
  margin-left: auto;
}

.chip {
  display: inline-block;
  min-height: 44px;
  margin-left: 8px;
  padding: 6px 10px;
  border: 2px solid var(--ink);
  background: var(--card);
  box-shadow: 2px 2px 0 var(--ink);
  font-weight: 800;
  font-size: 13px;
  line-height: 1.2;
  vertical-align: middle;
}

.ticker-actions .chip:first-child { margin-left: 0; }

.chip-hot {
  background: var(--red);
  color: #fff8ea;
}

.chip:active,
.prestige:active,
.sheet-btn:active,
.asset:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 var(--ink);
}

.chip:disabled {
  opacity: 0.7;
}

.money-label {
  margin: 6px 0 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
}

.money-line {
  margin: 0;
  max-width: 100%;
  overflow: hidden;
  font-family: Impact, "Arial Black", sans-serif;
  font-size: 44px;
  line-height: 0.9;
  letter-spacing: 0;
  white-space: nowrap;
}

.rate,
.buff,
.progress,
.meta {
  margin: 2px 0 0;
  font-size: 13px;
  font-weight: 700;
}

.buff {
  min-height: 1.2em;
  color: var(--red);
}

.meter {
  height: 12px;
  margin-top: 6px;
  border: 2px solid var(--ink);
  background: var(--card);
}

.meter-fill {
  height: 100%;
  width: 0;
  background: var(--red);
}

.stage {
  position: relative;
  display: block;
  height: 232px;
  margin: 14px 16px 0;
  border: 4px solid var(--ink);
  background: #f7ecd2;
  box-shadow: 6px 6px 0 var(--ink);
  overflow: hidden;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

.stage:focus {
  outline: 3px solid var(--red);
  outline-offset: 2px;
}

.stage:before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  background-image: radial-gradient(rgba(28, 20, 14, 0.16) 0.8px, transparent 0.9px);
  background-size: 7px 7px;
  pointer-events: none;
}

.scene {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
}

.splashes,
.bust,
.sticker,
.price,
.floater {
  position: absolute;
  z-index: 2;
  pointer-events: none;
}

.splashes {
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
}

.drop {
  position: absolute;
  width: 9px;
  height: 9px;
  margin-left: -4px;
  margin-top: -4px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: #7ec8e0;
}

.motion .drop {
  animation: popdrop 0.55s ease-out forwards;
}

.floater {
  left: 42%;
  top: 38%;
  font-family: Impact, "Arial Black", sans-serif;
  font-size: 22px;
  color: #fff8ea;
  text-shadow: 2px 2px 0 var(--ink);
}

.motion .floater {
  animation: floatup 0.7s ease-out forwards;
}

.bust {
  display: none;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  padding: 12px;
  background: #e7f3ea;
}

.stage.is-bust .bust { display: block; }

.bust-file,
.bust-foot {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 800;
}

.bust-foot { margin: 6px 0 0; }

.grid {
  display: grid;
  grid-template-columns: 1.3fr 0.8fr 0.7fr;
  grid-gap: 0;
  border-top: 2px solid var(--ink);
  border-left: 2px solid var(--ink);
  background: #fff;
}

.grid span {
  padding: 4px 6px;
  border-right: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.grid span:nth-child(-n + 3) {
  background: #1f7a45;
  color: #fff8ea;
}

.sticker {
  top: 8px;
  right: 8px;
  padding: 4px 6px;
  background: var(--red);
  color: #fff8ea;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: 1px;
  transform: rotate(8deg);
  box-shadow: 2px 2px 0 var(--ink);
}

.price {
  left: 8px;
  bottom: 8px;
  padding: 3px 6px;
  background: var(--ink);
  color: #fff8ea;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.15;
}

.stage.is-bust .sticker,
.stage.is-bust .price { display: none; }

.caption {
  min-height: 2.7em;
  margin: 10px 16px;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.35;
}

.banner-ad {
  position: relative;
  margin: 4px 16px 14px;
  padding: 16px 10px 10px;
  background: var(--card);
  border: 3px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  overflow: hidden;
}

.banner-ad.is-empty { display: none; }

.ad-label {
  position: absolute;
  top: -11px;
  left: 10px;
  z-index: 1;
  padding: 0 8px;
  background: var(--paper);
  border: 2px solid var(--ink);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  line-height: 18px;
}

.ad-slot {
  min-height: 50px;
  max-width: 100%;
  overflow: hidden;
}

.ad-slot .adsbygoogle {
  display: block;
  width: 100% !important;
  height: auto !important;
  min-height: 50px;
  max-width: 100%;
  margin: 0 auto !important;
  overflow: visible !important;
}

.ad-slot iframe,
.ad-slot div {
  max-width: 100% !important;
  min-width: 0 !important;
}

.ad-slot iframe {
  width: 100% !important;
  margin-left: 0 !important;
}

.shop { padding: 0 16px 16px; }

.shop-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.shop h2 {
  margin: 0;
  font-size: 16px;
  letter-spacing: 2px;
}

.shop-head p {
  margin: 0 0 0 8px;
  font-size: 12px;
  font-weight: 700;
}

.asset {
  position: relative;
  display: block;
  width: 100%;
  min-height: 72px;
  margin-bottom: 10px;
  padding: 10px 112px 10px 10px;
  border: 3px solid var(--ink);
  background: var(--card);
  box-shadow: 3px 3px 0 var(--ink);
  text-align: left;
  cursor: pointer;
}

.asset-main {
  display: flex;
  align-items: flex-start;
}

.asset-no {
  flex: none;
  width: 28px;
  margin-right: 8px;
  background: var(--ink);
  color: var(--card);
  font-family: Impact, "Arial Black", sans-serif;
  font-size: 14px;
  line-height: 22px;
  text-align: center;
}

.asset-copy {
  display: block;
  min-width: 0;
}

.asset-name {
  font-size: 16px;
  font-weight: 800;
}

.asset-own {
  margin-left: 6px;
  color: var(--red);
  font-family: Impact, "Arial Black", sans-serif;
  font-size: 16px;
}

.asset-gag,
.asset-effect {
  display: block;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.asset-gag { margin-top: 2px; }

.asset-effect { color: #5c4d3a; }

.asset-cost {
  position: absolute;
  top: 10px;
  right: 8px;
  max-width: 100px;
  padding: 4px 6px;
  background: var(--red);
  color: #fff8ea;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
  text-align: center;
}

.asset.is-owned .asset-cost { background: var(--ink); }

.asset.is-poor .asset-cost { background: #8d8376; }

.tabs {
  display: flex;
  margin: 0 0 8px;
}

.tab {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  margin-right: 6px;
  padding: 4px;
  border: 3px solid var(--ink);
  background: var(--card);
  box-shadow: 2px 2px 0 var(--ink);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.tabs .tab:last-child { margin-right: 0; }

.tab.is-on {
  background: var(--red);
  color: #fff8ea;
}

.souvenir-count {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 800;
}

#panel-souvenir {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
}

#panel-souvenir.is-hidden { display: none; }

.souvenir {
  display: block;
  width: 48%;
  margin: 0 0 8px;
  padding: 8px 8px 10px;
  border: 3px solid var(--ink);
  background: var(--card);
  box-shadow: 3px 3px 0 var(--ink);
}

.souvenir.is-locked {
  background: #e6d8b8;
  box-shadow: 3px 3px 0 #8d8376;
}

.souvenir-stamp {
  margin: 0;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
}

.souvenir-name {
  margin: 2px 0 0;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.3;
}

.souvenir-line {
  margin: 4px 0 0;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.souvenir.is-locked .souvenir-name,
.souvenir.is-locked .souvenir-line,
.souvenir.is-locked .souvenir-stamp { color: #6d6256; }

.is-hidden { display: none; }

.dock {
  padding: 10px 16px 12px;
  padding-bottom: calc(12px + var(--safe-bottom));
  background: #efe0b8;
  border-top: 3px solid var(--ink);
}

.prestige {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 3px solid var(--ink);
  background: var(--ink);
  color: #f6edd6;
  box-shadow: 4px 4px 0 #8d3a32;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
}

.prestige.is-ready {
  background: var(--red);
  color: #fff8ea;
}

.dock-note {
  margin: 8px 0 0;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

.toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 24px;
  z-index: 40;
  width: auto;
  max-width: 440px;
  margin: 0 auto;
  padding: 10px 14px;
  border: 3px solid var(--ink);
  background: var(--ink);
  color: #fff8ea;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  opacity: 0;
  pointer-events: none;
}

.toast.is-on { opacity: 1; }

.mask {
  display: none;
  position: fixed;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  background: rgba(28, 20, 14, 0.56);
}

.mask.is-open {
  display: flex;
  align-items: center;
  justify-content: center;
}

#share-sheet.mask.is-open {
  align-items: flex-end;
}

.dialog,
.sheet {
  width: 86%;
  max-width: 420px;
  padding: 16px;
  border: 4px solid var(--ink);
  background: var(--paper);
  box-shadow: 6px 6px 0 var(--ink);
}

.sheet {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  border-bottom: 0;
  padding-bottom: calc(16px + var(--safe-bottom));
}

.dialog-kicker,
.sheet-title {
  margin: 0;
  font-family: Impact, "Arial Black", sans-serif;
  letter-spacing: 1px;
}

.dialog h3 {
  margin: 6px 0 0;
  font-size: 22px;
}

.dialog-body {
  margin: 8px 0 0;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.45;
}

.dialog-actions {
  margin-top: 14px;
  text-align: right;
}

.sheet-grip {
  width: 42px;
  height: 5px;
  margin: 0 auto 10px;
  background: var(--ink);
}

.sheet-btn {
  display: block;
  width: 100%;
  min-height: 48px;
  margin-top: 8px;
  border: 3px solid var(--ink);
  background: var(--card);
  box-shadow: 3px 3px 0 var(--ink);
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
}

.sheet-quiet {
  background: transparent;
  box-shadow: none;
}

.dialog-cover {
  width: 90%;
  max-height: 86vh;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.dialog-cover img {
  display: block;
  width: 100%;
  height: auto;
  margin-top: 8px;
  border: 3px solid var(--ink);
  background: var(--card);
}

.shotview {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  overflow: hidden;
  padding: 18px;
  background: rgba(28, 20, 14, 0.72);
}

.shotview[hidden] { display: none; }

.shotview-card {
  width: 100%;
  min-width: 0;
  max-width: 420px;
  max-height: 92vh;
  overflow: auto;
  padding: 14px;
  background: var(--paper);
  border: 4px solid var(--ink);
  box-shadow: 6px 6px 0 var(--ink);
}

.shotview-cap {
  margin: 0 0 8px;
  text-align: center;
  font-size: 16px;
  font-weight: 800;
}

.shotview-img-wrap {
  position: relative;
  width: 100%;
}

.shotview-img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  border: 3px solid var(--ink);
  background: var(--card);
  -webkit-touch-callout: default;
  -webkit-user-select: auto;
  user-select: auto;
}

.shotview-wx-hint {
  position: absolute;
  left: 50%;
  top: 12px;
  z-index: 2;
  padding: 6px 12px;
  color: #fff8ea;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  pointer-events: none;
  background: rgba(28, 20, 14, 0.78);
  border: 2px solid var(--ink);
  transform: translateX(-50%);
}

.shotview-tip {
  margin: 10px 0 12px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
}

.shotview-row {
  display: flex;
}

.shotview-row .chip {
  flex: 1 1 0;
  margin-left: 0;
  text-align: center;
}

.shotview-row .chip + .chip { margin-left: 8px; }

.copysheet {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  z-index: 55;
  display: none;
  padding: 22px 18px;
  background: rgba(28, 20, 14, 0.82);
  overflow-y: auto;
}

.copysheet.is-on {
  display: flex;
  align-items: center;
  justify-content: center;
}

.copysheet-in {
  width: 100%;
  max-width: 420px;
  padding: 16px;
  background: var(--paper);
  border: 4px solid var(--ink);
  box-shadow: 6px 6px 0 var(--ink);
}

.copysheet-h {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.4;
}

.copysheet textarea {
  display: block;
  width: 100%;
  margin: 0 0 12px;
  padding: 8px;
  border: 3px solid var(--ink);
  background: var(--card);
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}

.offscreen {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}

.offscreen canvas {
  display: block;
  width: 0;
  height: 0;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

body.is-lock { overflow: hidden; }

.motion .stage.is-bust {
  animation: shake 0.35s linear 2;
}

@keyframes popdrop {
  0% { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx, 8px), var(--dy, -26px)) scale(0.3); opacity: 0; }
}

@keyframes floatup {
  0% { transform: translate(0, 0); opacity: 1; }
  100% { transform: translate(0, -36px); opacity: 0; }
}

@keyframes shake {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(-3px, 1px); }
  75% { transform: translate(3px, -1px); }
}

@media (min-width: 520px) {
  body { padding: 16px 0 24px; }
}
