:root {
  --bg: #0d0f12;
  --panel: #1a1d22;
  --text: #e8e6e1;
  --muted: #9a958c;
  --accent: #c9a24a;
  --border: #33373e;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.4 system-ui, "Segoe UI", Arial, sans-serif;
  overflow: hidden;
}

#app {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

#screen-host {
  --sw: 360;
  --sh: 640;
  position: relative;
  /* the game screen, scaled to fit the viewport at its own aspect ratio */
  width: min(100vw, calc(100vh * var(--sw) / var(--sh)));
  aspect-ratio: var(--sw) / var(--sh);
}

#screen {
  width: 100%;
  height: 100%;
  display: block;
  background: #000;
  image-rendering: auto;
  touch-action: none;
}

/* WebGL screen of the Android adapter's OpenGL renderer; input stays on #screen below it */
.screen-gl {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.status {
  position: absolute;
  inset: auto 0 12px 0;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  pointer-events: none;
}

.status:empty {
  display: none;
}

.midp-form-commands button {
  min-width: 72px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.midp-form-commands button:active {
  background: var(--accent);
  color: #000;
}

/* MIDP high-level screens (Form / Alert) */
.midp-form {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  padding: 16px;
}

.midp-form-box {
  width: 100%;
  max-width: 420px; /* a short code/name entry: full window width made the fields needlessly long */
  max-height: 100%;
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
}

.midp-form-title {
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 10px;
}

.midp-item {
  display: block;
  margin-bottom: 10px;
}

.midp-label {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 4px;
}

.midp-item input[type="text"],
.midp-item input[type="password"] {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #0f1114;
  color: var(--text);
  font: inherit;
}

.midp-option {
  display: block;
  padding: 4px 0;
}

.midp-form-commands {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 8px;
}

/* in-place text entry (Android adapter Display.getInput2) */
.midp-textinput {
  position: absolute;
  box-sizing: border-box;
  margin: 0;
  padding: 0 2px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  background: transparent;
  font-family: Roboto, "Droid Sans", Arial, sans-serif;
  outline: none;
}

.midp-textinput-full {
  inset: 0;
  width: 100%;
  height: 100%;
  background: #fff;
  color: #000;
  font-size: 18px;
}
