:root {
  color-scheme: light;
  --header-orange: #ff3900;
  --safe-area-top: 0px;
  --safe-area-bottom: 0px;
  --safe-area-top: env(safe-area-inset-top, 0px);
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
  --accent: #f4512c;
  --ink: #262626;
  --muted: #8a8a8a;
  --line: rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background: #f4f6f8;
  font-family: Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-tap-highlight-color: transparent;
}

html {
  background: var(--header-orange);
}

body {
  overflow-x: hidden;
}

body::before {
  position: fixed;
  z-index: 40;
  top: 0;
  right: 0;
  left: 0;
  height: var(--safe-area-top);
  background: var(--header-orange);
  content: "";
  pointer-events: none;
}

button,
input {
  font: inherit;
}

.page {
  /* Older Android WebViews may not understand dynamic viewport units. */
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  background: #fff;
  padding-top: 0;
  padding-top: var(--safe-area-top);
}

.screen {
  position: relative;
  width: min(100vw, 480px);
  min-height: calc(100vh - var(--safe-area-top));
  min-height: calc(100svh - var(--safe-area-top));
  min-height: calc(100dvh - var(--safe-area-top));
  background: #fff;
  line-height: 0;
  user-select: none;
  -webkit-user-select: none;
}

.screen__visual {
  position: relative;
  width: 100%;
  aspect-ratio: 291 / 647;
}

#screenCanvas {
  display: block;
  width: 100%;
  height: auto;
  background: #fff;
}

#hotspots {
  position: absolute;
  inset: 0;
}

.hotspot {
  position: absolute;
  min-width: 28px;
  min-height: 28px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: text;
  touch-action: manipulation;
  transition: background-color 160ms ease, box-shadow 160ms ease;
}

.hotspot:hover {
  outline: none;
  background: transparent;
  box-shadow: none;
}

.hotspot:focus-visible {
  outline: none;
  box-shadow: none;
}

.editor[hidden] {
  display: none;
}

.editor {
  position: fixed;
  z-index: 20;
  inset: 0;
}

.editor__backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  border: 0;
  padding: 0;
  background: rgba(22, 25, 29, 0.42);
  cursor: default;
}

.editor__sheet {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  width: min(100%, 480px);
  margin: 0 auto;
  padding: 10px 18px 18px;
  padding: 10px 18px calc(18px + var(--safe-area-bottom));
  border-radius: 18px 18px 0 0;
  background: #fff;
  box-shadow: 0 -10px 35px rgba(0, 0, 0, 0.18);
  line-height: 1.4;
  animation: sheet-in 180ms ease-out;
}

.editor__handle {
  width: 42px;
  height: 4px;
  margin: 0 auto 12px;
  border-radius: 4px;
  background: #d8dadd;
}

.editor h1 {
  margin: 0 0 14px;
  color: var(--ink);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0;
}

.editor__label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0;
}

.editor__input {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 10px 13px;
  border: 1px solid #dadde1;
  border-radius: 10px;
  outline: 0;
  color: #1f2328;
  background: #f7f8fa;
  font-size: 18px;
  line-height: 1.3;
  letter-spacing: 0;
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.editor__input:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(244, 81, 44, 0.14);
}

.editor__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.button {
  min-height: 46px;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0;
  transition: transform 120ms ease, filter 160ms ease;
}

.button:active {
  transform: scale(0.98);
}

.button--ghost {
  color: #575b62;
  background: #f0f2f4;
}

.button--primary {
  color: #fff;
  background: var(--accent);
}

.button:hover {
  filter: brightness(0.97);
}

.toast {
  position: fixed;
  z-index: 30;
  right: 50%;
  bottom: 20px;
  bottom: calc(20px + var(--safe-area-bottom));
  max-width: calc(100vw - 40px);
  margin: 0;
  padding: 9px 14px;
  border-radius: 999px;
  color: #fff;
  background: rgba(29, 32, 36, 0.88);
  font-size: 13px;
  line-height: 1.2;
  opacity: 0;
  pointer-events: none;
  transform: translate(50%, 10px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(50%, 0);
}

@keyframes sheet-in {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

@media (min-width: 481px) {
  .screen {
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05), 0 18px 60px rgba(0, 0, 0, 0.12);
  }
}
