:root {
  color-scheme: dark;
  --shell-height: 100vh;
  --shell-width: 100vw;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: #181715;
  color: #f6e9c9;
}
@supports (height: 100dvh) { :root { --shell-height: 100dvh; } }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
body { background: #181715; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 2px solid #f6dd91; outline-offset: 3px; }
.game-shell {
  position: fixed;
  inset: 0 auto auto 0;
  width: var(--shell-width);
  height: var(--shell-height);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
  overflow: hidden;
  background: #181715;
  isolation: isolate;
}
.game-shell:fullscreen, .game-shell:-webkit-full-screen { width: 100%; height: 100%; }
.game-stage { width: min(100%, 46.176vh); height: 100%; aspect-ratio: 640 / 1386; flex: 0 0 auto; overflow: hidden; background: #181715; }
#game-frame { display: block; width: 100%; height: 100%; border: 0; background: #181715; }
.game-tools {
  position: absolute;
  top: max(8px, env(safe-area-inset-top, 0px));
  right: max(8px, env(safe-area-inset-right, 0px));
  z-index: 10;
}
.tool-buttons { display: flex; gap: 6px; }
.tool-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 3px;
  border: 1px solid #b9a06f70;
  border-radius: 12px;
  background: #29241ee8;
  color: #faedce;
  box-shadow: 0 3px 12px #0004;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
.tool-button:hover { background: #443827; }
.tool-button:active { background: #57452e; }
.tool-button:disabled { cursor: wait; opacity: .65; }
.tool-button svg { display: block; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#more-button svg { fill: currentColor; stroke: none; }
.tool-button span { font-size: 10px; line-height: 12px; letter-spacing: .05em; }
.fullscreen-exit-icon { display: none !important; }
[data-fullscreen="true"] .fullscreen-enter-icon { display: none !important; }
[data-fullscreen="true"] .fullscreen-exit-icon { display: block !important; }
.tool-menu {
  position: absolute;
  right: 0;
  top: 52px;
  width: 174px;
  padding: 5px;
  border: 1px solid #b9a06f60;
  border-radius: 12px;
  background: #28231bf5;
  box-shadow: 0 8px 30px #0006;
}
.tool-menu a, .tool-menu button {
  display: flex;
  align-items: center;
  min-height: 44px;
  width: 100%;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #f5e7c9;
  text-decoration: none;
  text-align: left;
  padding: 10px 13px;
  font-size: 13px;
  touch-action: manipulation;
}
.tool-menu a:hover, .tool-menu button:hover { background: #ffffff0d; }
.install-panel {
  position: absolute;
  z-index: 20;
  bottom: max(12px, env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  width: min(360px, calc(100% - 24px));
  border: 1px solid #b9a06f70;
  border-radius: 15px;
  padding: 10px 14px 16px;
  background: #28231bf7;
  box-shadow: 0 8px 35px #0008;
}
.install-heading-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.install-panel h2 { margin: 0; font-size: 15px; font-weight: 600; }
.close-button { border: 0; background: transparent; color: #f6e9c9; min-width: 44px; min-height: 44px; font-size: 26px; line-height: 1; }
.install-panel p { margin: 6px 0 0; color: #d9ccb4; font-size: 13px; line-height: 1.9; }
.shell-status {
  position: absolute;
  z-index: 30;
  bottom: max(20px, env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: min(380px, calc(100% - 28px));
  margin: 0;
  padding: 11px 15px;
  border: 1px solid #b9a06f55;
  border-radius: 12px;
  background: #28231bf5;
  color: #f5e7c9;
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
  pointer-events: none;
}
.noscript-message { position: absolute; inset: 30% 20px auto; text-align: center; font-size: 14px; line-height: 2; }
.noscript-message a { color: inherit; }
@media (prefers-reduced-motion: no-preference) { .tool-button { transition: background-color .15s ease, opacity .15s ease; } }
