:root {
  color-scheme: light;
  --bg: var(--tg-theme-bg-color, #f6e7cf);
  --text: var(--tg-theme-text-color, #3a2416);
  --panel: var(--tg-theme-secondary-bg-color, rgba(255, 248, 239, 0.94));
  --hint: var(--tg-theme-hint-color, #7a5b45);
  --line: var(--tg-theme-section-separator-color, rgba(58, 36, 22, 0.12));
  font-family: Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, serif;
}

* { box-sizing: border-box; }

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

body {
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

#stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.panel {
  position: fixed;
  z-index: 2;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(28rem, calc(100% - 32px));
  margin: 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: 0 10px 30px rgba(58, 36, 22, 0.12);
  max-height: min(70vh, 100%);
  overflow: auto;
}

#status {
  margin: 0;
  font-size: 1rem;
  line-height: 1.45;
}

#actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

#actions:empty { display: none; }

.note {
  flex: 1 0 100%;
  margin: 0;
  color: var(--hint);
  font-size: 0.92rem;
}

.btn {
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  background: #8c3d22;
  color: #fff8ef;
  font: inherit;
  cursor: pointer;
}

.editor {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
}

.field input, .field select {
  font: inherit;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fffaf3;
  color: var(--text);
}

@media (min-width: 800px) {
  .panel { bottom: 28px; }
}
