* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font-family: "Segoe UI", Arial, sans-serif; font-size: 14px; color: #222; background: #eef1f6; }
[hidden] { display: none !important; }

/* ---------- start screen ---------- */
#splash {
  position: fixed; inset: 0; background: #0b1f4d; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  transition: opacity .5s ease;
}
#splash.leaving { opacity: 0; pointer-events: none; }
#hearts { position: absolute; inset: 0; pointer-events: none; }
#hearts span {
  position: absolute; color: #e11d2e; line-height: 1; transform: translate(-50%, -50%);
  text-shadow: 0 0 10px rgba(225, 29, 46, .55);
  animation: beat 1.6s ease-in-out infinite;
}
@keyframes beat {
  0%, 100% { transform: translate(-50%, -50%) scale(1) rotate(var(--r, 0deg)); }
  15% { transform: translate(-50%, -50%) scale(1.22) rotate(var(--r, 0deg)); }
  30% { transform: translate(-50%, -50%) scale(1) rotate(var(--r, 0deg)); }
}
#doit {
  position: relative; z-index: 1;
  font-size: clamp(56px, 11vw, 140px); font-weight: 900; letter-spacing: 2px;
  padding: .25em .9em; border: 6px solid #fff; border-radius: 28px;
  color: #fff; background: #d0142a; cursor: pointer;
  box-shadow: 0 12px 40px rgba(0,0,0,.45), 0 0 0 10px rgba(255,255,255,.08);
  transition: transform .15s ease, background .15s ease;
}
#doit:hover { transform: scale(1.05); background: #e8192f; }
#doit:active { transform: scale(.97); }

/* ---------- main window ---------- */
#app { height: 100%; display: flex; flex-direction: column; }
header {
  background: #0b1f4d; color: #fff; padding: 10px 20px; display: flex; justify-content: space-between; align-items: center;
  font-size: 16px; font-weight: 600;
}
header .heart { color: #e11d2e; }
#counts { font-size: 13px; font-weight: 400; opacity: .9; }
main { flex: 1; display: grid; grid-template-columns: minmax(420px, 44%) 1fr; gap: 16px; padding: 16px; min-height: 0; }
.setup, .composeCol { overflow: auto; min-height: 0; }
.composeCol { display: flex; flex-direction: column; }
.composeCol .card { flex: 1; display: flex; flex-direction: column; min-height: 600px; }

.card { background: #fff; border-radius: 10px; box-shadow: 0 1px 4px rgba(0,0,0,.12); padding: 14px 18px 16px; margin-bottom: 16px; position: relative; }
.card h2 { font-size: 16px; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.card h3 { font-size: 14px; margin: 16px 0 2px; }
.num { display: inline-flex; width: 24px; height: 24px; border-radius: 50%; background: #0b1f4d; color: #fff; font-size: 13px; align-items: center; justify-content: center; }
.chip { margin-left: auto; font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 12px; }
.chip:empty { display: none; }
.chip.ok { background: #e6f4ea; color: #137333; }
.chip.warn { background: #fef7e0; color: #b06000; }
.card.locked > *:not(h2):not(.lockmsg) { display: none !important; }
.card.locked { opacity: .6; }
.lockmsg { color: #5f6368; font-style: italic; }
.card:not(.locked) > .lockmsg { display: none; }

label { display: block; font-weight: 600; margin: 10px 0 4px; }
input[type=text], input[type=email], input[type=password], select, textarea {
  width: 100%; padding: 7px 10px; border: 1px solid #c4ccd6; border-radius: 6px; font: inherit; background: #fff;
}
input[type=file] { font: inherit; }
textarea { font-family: Consolas, monospace; font-size: 12.5px; resize: vertical; }
button { font: inherit; padding: 7px 16px; border-radius: 6px; border: 1px solid #c4ccd6; background: #fff; cursor: pointer; }
button:hover { background: #f1f3f4; }
button.small { padding: 4px 10px; font-size: 13px; }
button.primary { background: #1a73e8; border-color: #1a73e8; color: #fff; font-weight: 600; }
button.primary:hover { background: #1765cc; }
button:disabled { opacity: .55; cursor: default; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; min-width: 0; }
.actions { margin-top: 12px; display: flex; gap: 10px; align-items: center; }
.actions.spread .error { flex: 1; text-align: right; margin: 0; }
.hint { color: #5f6368; font-size: 12px; margin-top: 4px; }
.error { color: #c5221f; margin-top: 8px; white-space: pre-wrap; }
.error:empty { display: none; }
#signedIn { display: flex; align-items: center; gap: 10px; }
#signedIn button { margin-left: auto; }

#cols { border-collapse: collapse; width: 100%; margin-top: 6px; }
#cols th, #cols td { border: 1px solid #dde3ea; padding: 3px 5px; text-align: left; }
#cols th { background: #eef2f7; font-size: 12px; }
#cols td.act { width: 1%; white-space: nowrap; }
#cols td.act button { padding: 2px 7px; font-size: 12px; }
#cols input, #cols select { padding: 4px 7px; }

/* ---------- compose ---------- */
.composeTop { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
#progress { font-weight: 600; flex: 1; }
#jump { width: auto; max-width: 50%; }
#doneBox { background: #e6f4ea; color: #137333; border-radius: 8px; padding: 14px 16px; margin-bottom: 10px; font-size: 15px; }
.compose { flex: 1; display: flex; flex-direction: column; border: 1px solid #d0d4da; border-radius: 10px; overflow: hidden; box-shadow: 0 2px 10px rgba(0,0,0,.12); min-height: 0; }
.titlebar { background: #404040; color: #fff; padding: 9px 16px; font-weight: 600; }
.field { display: flex; align-items: center; border-bottom: 1px solid #e0e0e0; padding: 0 16px; }
.field span { color: #5f6368; width: 64px; flex: none; }
.field input { border: none; border-radius: 0; padding: 9px 0; outline: none; }
.toolbar { display: flex; gap: 4px; padding: 6px 12px; border-bottom: 1px solid #e0e0e0; background: #fafafa; }
.toolbar button { padding: 3px 10px; min-width: 32px; }
.toolbar .red { color: #c5221f; font-weight: 700; }
.toolbar .spacer { flex: 1; }
#body { flex: 1; overflow: auto; padding: 16px; outline: none; min-height: 300px; }
.bottom { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-top: 1px solid #e0e0e0; }
.bottom .send { border-radius: 18px; padding: 8px 28px; }
.bottom .error { margin: 0; }

@media (max-width: 1000px) {
  main { grid-template-columns: 1fr; overflow: auto; }
  .setup, .composeCol { overflow: visible; }
}
