/* ---------- Base + page centering ---------- */
*, *::before, *::after { box-sizing: border-box; }
:root {
  --container-max-width: 760px;
  --container-padding: 2rem;
  --transition-speed: 0.3s;
}

/* Prevent layout shifts */
html {
  height: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: linear-gradient(135deg, #eef2f6, #e2e8f0);
  color: #0f172a;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeSpeed;
  overflow-x: hidden;
}
body {
  margin: 0;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: linear-gradient(135deg, #eef2f6, #e2e8f0);
  padding: 24px;
  color: #0f172a;
}

/* ---------- Card ---------- */
.container {
  position: relative;
  width: min(92vw, var(--container-max-width));
  text-align: center;
  padding: var(--container-padding);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 10px 28px rgba(2, 12, 27, 0.08);
  margin: 2rem auto;
  will-change: transform, opacity;
  transition: opacity var(--transition-speed) ease-in-out;
  overflow: visible;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}

/* Sticky note - clean implementation */
#stickyNote {
  display: none;
  position: fixed !important;
  top: 20px !important;
  right: 20px !important;
  left: auto !important;
  bottom: auto !important;
  width: 280px;
  max-width: 90vw;
  max-height: 80vh;
  background: #fffef2;
  border: 1px solid #fde68a;
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(0,0,0,0.12);
  padding: 16px;
  box-sizing: border-box;
  overflow-y: auto;
  z-index: 1000000;
  color: #1f2937;
  text-align: left;
  margin: 0 !important;
  transform: none !important;
}

#stickyNote.visible {
  display: block !important;
}

.sticky-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e2e8f0;
}

.sticky-close {
  background: none;
  border: none;
  font-size: 1.2em;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  color: #64748b;
}

.sticky-close:hover {
  color: #0f172a;
}

.sticky-content {
  font-size: 0.9em;
  line-height: 1.5;
}

.sticky-content ol {
  margin: 0;
  padding-left: 20px;
}

.sticky-content li {
  margin-bottom: 8px;
}

.sticky-content b {
  color: #1e40af;
}

/* Scope & neutralize inherited min-heights that cause tall controls */
.container input,
.container button {
  min-height: 0 !important;
  height: auto;
  font: inherit;
}

/* ---------- Header ---------- */
.logo {
  display: block;
  margin: 0 auto 1rem;
  max-width: 180px;
  border-radius: 16px;
}
.title {
  font-size: 2rem;
  margin: 0.5rem 0 0.25rem;
  color: #1e293b;
  letter-spacing: 0.2px;
}
.subtitle {
  font-size: 1rem;
  color: #475569;
  margin: 0 0 2rem;
}

/* ---------- Controls (uniform height + comfy padding) ---------- */
:root { 
  --ctl-h: 30px;
  --btn-bg: #005eb8;
  --btn-hover: #1a6fc4;
  --btn-active: #004d94;
  --btn-transition: all 0.2s ease;
}

.control {
  height: var(--ctl-h) !important;   /* force consistent height (Safari/Brave) */
  line-height: 1.2;
  border-radius: 12px;
}

.input {
  flex: 1 1 280px;
  min-width: 0;                      /* prevents overflow on narrow screens */
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #0f172a;
  padding: 0 14px;
  font-size: 15px;
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.input:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.25);
}
.input::placeholder { color: #9aa7b5; }  /* lighter placeholder */

/* Buttons */
.btn {
  padding: 0 16px;
  background: var(--btn-bg);
  border: 1px solid transparent;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--btn-transition);
  flex: 0 0 auto;
  will-change: transform, background-color;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.btn:hover { 
  background: var(--btn-hover);
  transform: translateY(-1px);
}

.btn:active { 
  transform: translateY(0);
  background: var(--btn-active);
}

/* Disable hover effects on touch devices */
@media (hover: none) {
  .btn:hover {
    transform: none;
    background: var(--btn-bg);
  }
}

/* Inline ? button (same height) */
.icon-btn {
  width: var(--ctl-h);
  background: #005eb8;
  border: 1px solid transparent;
  color: #fff;
  font-weight: 800;
  font-size: 18px;
  cursor: pointer;
  transition: transform 80ms ease, filter 120ms ease;
  box-shadow: 0 3px 10px rgba(0, 94, 184, 0.35);
  flex: 0 0 auto;                    /* DON'T stretch */
}
.icon-btn:hover { filter: brightness(1.08); }
.icon-btn:active { transform: translateY(1px); }

/* ---------- Rows (narrower, responsive) ---------- */
.row {
  display: flex;
  justify-content: center;
  align-items: center;               /* avoid tall stretch */
  gap: 0.6rem;
  margin-top: .8rem;
  width: 100%;
  max-width: 520px;                  /* comfortable width on desktop */
  margin-inline: auto;
  flex-wrap: nowrap;
}

/* Prompt field same height as Mailbox; slightly wider base */
.prompt-input { flex-basis: 340px; }

.sticky-content { font-size: 14px; }
.sticky-content ul { margin: 0.25rem 0 0; padding-left: 1.1rem; }
.sticky-content li { margin: 0.25rem 0; }

/* ---------- Mobile (no giant boxes, proper stacking) ---------- */
@media (max-width: 520px) {
  .row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.6rem;
    max-width: 92vw;
  }

  /* Inputs should fill width but not grow taller */
  .row .input {
    flex: 0 0 auto;     /* don’t stretch vertically */
    width: 100%;
  }

  /* Buttons fill width but keep fixed height */
  .row .btn,
  .row .icon-btn {
    flex: 0 0 auto;
    width: 100%;
    height: var(--ctl-h);
  }
}