:root {
  --bg: #2c384f;
  --fg: #ffffff;
  --fg-dim: rgba(255, 255, 255, 0.7);
  --accent: #ffffff;
  --accent-bg: rgba(255, 255, 255, 0.1);
  --accent-bg-hover: rgba(255, 255, 255, 0.2);
  --accent-bg-selected: rgba(255, 255, 255, 0.3);
  --error: #ffb4a8;
  --radius: 4px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: var(--font);
  color: var(--fg);
  background: var(--bg);
  overflow: hidden;
}

#bg {
  position: fixed;
  inset: 0;
  background: var(--bg) url("assets/background.png") center / cover no-repeat;
  z-index: 0;
}
#bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

#top {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 10;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 0;
}
#progress {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: rgba(255, 255, 255, 0.15);
}
#progress-bar {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.3s ease;
}
#progress-label {
  position: absolute;
  top: 12px;
  left: 20px;
  font-size: 12px;
  color: var(--fg-dim);
}
#logo {
  position: absolute;
  top: 16px;
  right: 24px;
  height: 36px;
  width: auto;
}

#stage {
  position: relative;
  z-index: 5;
  height: 100%;
  overflow: hidden;
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  padding: 80px 24px 100px;
  overflow-y: auto;
  transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.45s ease;
  opacity: 1;
  transform: translateY(0);
}
.screen.enter-from-below { transform: translateY(100vh); opacity: 0; }
.screen.enter-from-above { transform: translateY(-100vh); opacity: 0; }
.screen.leave-up { transform: translateY(-100vh); opacity: 0; }
.screen.leave-down { transform: translateY(100vh); opacity: 0; }

.card {
  width: 100%;
  max-width: 720px;
  margin: auto;
}
.card.center { text-align: center; }

.qnum {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--fg-dim);
  margin-bottom: 8px;
}
.qnum::after { content: "→"; }

h1.title {
  font-size: 24px;
  font-weight: 400;
  line-height: 1.35;
  margin: 0 0 12px;
}
.card.center h1.title { font-size: 32px; }
h1.title .req { color: var(--error); margin-left: 4px; }
h1.title a { color: var(--fg); }

.desc {
  font-size: 18px;
  line-height: 1.5;
  color: var(--fg-dim);
  margin: 0 0 24px;
  white-space: pre-line;
}
.desc a { color: var(--fg); text-decoration: underline; }
.desc p { margin: 0 0 12px; }

input[type="text"], input[type="email"], input[type="url"], textarea {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.4);
  color: var(--fg);
  font-family: var(--font);
  font-size: 28px;
  padding: 8px 0;
  outline: none;
  transition: border-color 0.2s;
}
input:focus, textarea:focus { border-bottom-color: var(--fg); }
input::placeholder, textarea::placeholder { color: rgba(255, 255, 255, 0.35); }
textarea {
  resize: none;
  min-height: 48px;
  max-height: 40vh;
  font-size: 22px;
  line-height: 1.4;
}
.hint {
  margin-top: 10px;
  font-size: 13px;
  color: var(--fg-dim);
}
.hint kbd, .btnrow kbd {
  display: inline-block;
  font-family: var(--font);
  font-size: 11px;
  padding: 1px 5px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 3px;
  margin: 0 2px;
}

.date-row {
  display: flex;
  gap: 16px;
  align-items: flex-end;
}
.date-row label {
  display: flex;
  flex-direction: column;
  font-size: 12px;
  color: var(--fg-dim);
  gap: 4px;
}
.date-row input { width: 100%; }
.date-row .sep { font-size: 28px; padding-bottom: 8px; color: var(--fg-dim); }
.date-row label.mm, .date-row label.dd { width: 70px; }
.date-row label.yyyy { width: 110px; }

.choices {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 480px;
}
.choice {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px 8px 8px;
  background: var(--accent-bg);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 18px;
  color: var(--fg);
  text-align: left;
  font-family: var(--font);
  transition: background 0.15s;
  min-height: 44px;
}
.choice:hover { background: var(--accent-bg-hover); }
.choice.selected {
  background: var(--accent-bg-selected);
  border-color: var(--fg);
  box-shadow: 0 0 0 1px var(--fg) inset;
}
.choice .key {
  flex: none;
  width: 24px; height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 3px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.25);
}
.choice.selected .key { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.choice .check { margin-left: auto; opacity: 0; }
.choice.selected .check { opacity: 1; }
.choice input.other-text {
  font-size: 18px;
  padding: 2px 0;
  flex: 1;
}

.file-drop {
  display: block;
  border: 1px dashed rgba(255, 255, 255, 0.5);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  background: var(--accent-bg);
  transition: background 0.15s;
}
.file-drop:hover, .file-drop.drag { background: var(--accent-bg-hover); }
.file-drop input { display: none; }
.file-drop .fname { margin-top: 12px; font-size: 14px; color: var(--fg-dim); }

.btnrow {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 28px;
}
.btnrow .press { font-size: 13px; color: var(--fg-dim); }
.card.center .btnrow { justify-content: center; }

button.primary {
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: var(--radius);
  padding: 10px 18px;
  font-size: 18px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.2);
}
button.primary:hover { filter: brightness(0.92); }
button.primary.big { font-size: 20px; padding: 12px 24px; }

.error {
  margin-top: 12px;
  font-size: 14px;
  color: #3b1f1c;
  background: var(--error);
  display: inline-block;
  padding: 4px 8px;
  border-radius: var(--radius);
}

#nav {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 10;
  display: flex;
  gap: 2px;
}
#nav button {
  width: 40px; height: 40px;
  background: var(--accent);
  color: var(--bg);
  border: none;
  cursor: pointer;
  font-size: 12px;
}
#nav button:first-child { border-radius: var(--radius) 0 0 var(--radius); }
#nav button:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
#nav button:disabled { opacity: 0.4; cursor: default; }

@media (max-width: 600px) {
  h1.title { font-size: 20px; }
  .card.center h1.title { font-size: 24px; }
  input[type="text"], input[type="email"], input[type="url"] { font-size: 22px; }
  .desc { font-size: 16px; }
  #logo { height: 28px; right: 16px; }
}

/* Review screen */
.review { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.rv-row {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "q edit" "a edit";
  gap: 2px 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius);
  align-items: center;
}
.rv-q { grid-area: q; font-size: 14px; color: var(--fg-dim); line-height: 1.3; }
.rv-n { display: inline-block; min-width: 28px; font-size: 12px; opacity: 0.7; }
.rv-a { grid-area: a; font-size: 16px; white-space: pre-wrap; word-break: break-word; }
.rv-a.empty { color: rgba(255, 255, 255, 0.4); font-style: italic; }
.rv-edit {
  grid-area: edit;
  background: transparent; color: var(--fg);
  border: 1px solid rgba(255, 255, 255, 0.5); border-radius: var(--radius);
  padding: 6px 12px; font-size: 13px; font-family: var(--font); cursor: pointer;
}
.rv-edit:hover { background: var(--accent-bg-hover); }
