:root {
  --page-bg-start: #edf9f2;
  --page-bg-end: #f7fbff;
  --panel: rgba(255, 255, 255, 0.24);
  --panel-strong: rgba(255, 255, 255, 0.45);
  --border: rgba(46, 84, 68, 0.12);
  --text: #254137;
  --muted: rgba(37, 65, 55, 0.72);
  --accent: #5aa77e;
  --accent-deep: #2f7d57;
  --shadow: 0 22px 56px rgba(32, 58, 48, 0.16);
  --scene-image: none;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.72) 36%, transparent 62%),
    linear-gradient(180deg, var(--page-bg-start), var(--page-bg-end));
}

.scene-shell {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background:
    var(--scene-image),
    radial-gradient(circle at top, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.72) 36%, transparent 62%),
    linear-gradient(180deg, var(--page-bg-start), var(--page-bg-end));
}

.background-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.52)),
    var(--scene-image);
  background-size: cover;
  background-position: center center;
  filter: saturate(1.03);
}

#renderCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  background: transparent;
  pointer-events: none;
}

.ui-layer {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding:
    calc(env(safe-area-inset-top, 0px) + 14px)
    14px
    calc(env(safe-area-inset-bottom, 0px) + 16px);
}

.top-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.app-badge,
.load-status,
.debug-panel,
.action-button {
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.app-badge {
  align-self: flex-start;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  box-shadow: var(--shadow);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.load-status {
  max-width: 58%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel);
  color: var(--muted);
  font-size: 0.92rem;
  box-shadow: var(--shadow);
}

.debug-panel {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(47, 125, 87, 0.14);
  border-radius: 18px;
  background: var(--panel-strong);
  box-shadow: var(--shadow);
  font-size: 0.88rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

.spacer {
  flex: 1 1 auto;
}

.actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.action-button {
  min-height: 62px;
  border: 1px solid rgba(47, 125, 87, 0.2);
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.66), rgba(255, 255, 255, 0.42));
  color: var(--accent-deep);
  font-size: 1rem;
  font-weight: 700;
  box-shadow: var(--shadow);
  transition:
    transform 140ms ease,
    box-shadow 140ms ease,
    background 140ms ease;
}

.action-button:active,
.action-button.is-active {
  transform: translateY(1px) scale(0.99);
  box-shadow: 0 12px 24px rgba(32, 58, 48, 0.14);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(226, 246, 234, 0.78));
}

@media (min-width: 700px) {
  .scene-shell {
    max-width: 520px;
    margin: 0 auto;
    border-left: 1px solid rgba(255, 255, 255, 0.4);
    border-right: 1px solid rgba(255, 255, 255, 0.4);
  }
}
