:root {
  color-scheme: light dark;
  --pine: #16241f;
  --ivory: #f6f6eb;
  --lime: #d4f57c;
  --paper: #f5f6ef;
  --ink: #1c2a24;
  --muted: #4e6156;
  font-family: "DM Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; background: var(--pine); }
body {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  overflow: hidden;
}

button { cursor: pointer; font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }

.app-bar {
  flex: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 4px clamp(10px, 2vw, 26px);
  background: var(--pine);
  color: var(--ivory);
}
.wordmark, .actions, .install-button, .open-chat {
  display: inline-flex;
  align-items: center;
}
.wordmark {
  margin: 0;
  gap: 9px;
  font-size: 21px;
  font-weight: 650;
  letter-spacing: -.055em;
  line-height: 1;
  white-space: nowrap;
}
.wordmark img { border: 1px solid #536359; border-radius: 8px; }
.actions { gap: 6px; }
.open-chat, .install-button, .dismiss-button { min-height: 44px; border-radius: 8px; }
.open-chat { width: 44px; justify-content: center; color: #c3cfc3; }
.install-button, .dismiss-button {
  justify-content: center;
  gap: 7px;
  padding: 0 14px;
  border: 0;
  background: var(--lime);
  color: var(--pine);
  font-size: 14px;
  font-weight: 650;
}
.install-button:focus-visible { outline-color: var(--ivory); }
@media (hover: hover) {
  .open-chat:hover { background: #2b3d32; color: white; }
  .install-button:hover, .dismiss-button:hover { background: #e2ffa1; }
}

main { position: relative; flex: 1; min-height: 0; background: var(--paper); }
iframe { display: block; width: 100%; height: 100%; border: 0; }
.network-note {
  flex: none;
  margin: 0;
  padding: 7px 16px;
  background: #f1eac9;
  color: #453e22;
  text-align: center;
  font-size: 13px;
}
.offline-view {
  display: grid;
  height: 100%;
  place-items: center;
  padding: 24px;
  color: var(--ink);
  text-align: center;
}
.app-icon { display: block; border-radius: 23%; }
.offline-view .app-icon { margin-inline: auto; }
.offline-view h2, dialog h2 { margin: 18px 0 8px; font-size: 22px; }
.offline-view p, dialog p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.65; }

dialog {
  width: min(350px, calc(100% - 32px));
  max-height: calc(100% - 32px);
  padding: 24px;
  border: 1px solid #819183;
  border-radius: 16px;
  background: var(--paper);
  color: var(--ink);
}
dialog::backdrop { background: rgb(11 21 16 / 55%); }
dialog form { margin: 22px 0 0; text-align: right; }

@media (prefers-color-scheme: dark) {
  :root { --paper: #1e2b25; --ink: #f0f3e8; --muted: #c0cbbd; }
}
@media (display-mode: standalone) {
  .app-bar { display: none; }
}
.standalone .app-bar { display: none; }
