:root {
  --bg: #f4f4f5;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: #d1d5db;
  --primary: #111827;
  --primary-contrast: #ffffff;
  --secondary: #e5e7eb;
  --danger: #b91c1c;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Times New Roman", serif;
}

body {
  min-height: 100vh;
  padding: max(16px, env(safe-area-inset-top)) 12px max(20px, env(safe-area-inset-bottom));
}

.app-shell {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
}

.brand-wrap {
  text-align: center;
  padding: 8px 0 14px;
}

.brand-logo {
  width: min(280px, 78vw);
  height: auto;
}

.container {
  width: 100%;
}

.card {
  background: var(--card);
  border-radius: 20px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.08);
  padding: 20px 16px;
}

.card + .card { margin-top: 16px; }

.eyebrow {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
}

h1 {
  margin: 0 0 12px;
  text-align: center;
  font-size: clamp(1.7rem, 6vw, 2.5rem);
  line-height: 1.1;
}

.lead {
  margin: 0 auto 18px;
  max-width: 650px;
  text-align: center;
  font-size: 1rem;
  line-height: 1.5;
}

.home-actions {
  display: grid;
  gap: 12px;
  margin: 22px 0;
}

button {
  border: none;
  font-family: inherit;
  cursor: pointer;
}

.cta-button,
.primary-button,
.secondary-button,
.link-button,
.mic-button {
  min-height: 52px;
  border-radius: 14px;
  font-size: 1rem;
}

.cta-button,
.primary-button {
  background: var(--primary);
  color: var(--primary-contrast);
  width: 100%;
  padding: 14px 16px;
  font-weight: bold;
}

.cta-button-secondary,
.secondary-button {
  background: var(--secondary);
  color: var(--text);
  width: 100%;
  padding: 14px 16px;
}

.link-button {
  background: transparent;
  color: var(--text);
  padding: 0;
  min-height: 0;
}

.privacyNotice {
  margin-top: 18px;
  text-align: center;
  font-size: 0.92rem;
  line-height: 1.5;
  color: #4b5563;
}

.top-row,
.preview-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.statement-badge {
  background: #f3f4f6;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.9rem;
}

.progress-wrap {
  margin: 16px 0 18px;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.92rem;
  color: var(--muted);
  margin-bottom: 8px;
}

.progress-bar {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
}

#progressFill {
  width: 0;
  height: 100%;
  background: var(--primary);
}

.question-box {
  margin-bottom: 18px;
}

.question-number {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.92rem;
}

.question-box h2 {
  margin: 0;
  font-size: clamp(1.45rem, 5vw, 2rem);
  line-height: 1.2;
}

.question-hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.input-area {
  display: grid;
  gap: 12px;
}

.answer-field {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  font-size: 1.05rem;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}

textarea.answer-field {
  min-height: 180px;
  resize: vertical;
}

select.answer-field {
  min-height: 56px;
}

.mic-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.mic-button {
  width: 68px;
  height: 68px;
  border-radius: 999px;
  background: #f3f4f6;
  border: 1px solid var(--line);
  font-size: 1.6rem;
}

.mic-button.listening {
  background: var(--danger);
  color: #fff;
}

.mic-hint,
.status {
  text-align: center;
  font-size: 0.95rem;
  color: var(--muted);
}

.status {
  min-height: 22px;
  margin-top: 12px;
}

.sticky-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  position: sticky;
  bottom: 8px;
  background: linear-gradient(to top, rgba(255,255,255,0.96), rgba(255,255,255,0.9));
  padding-top: 14px;
  margin-top: 18px;
}

.preview-document {
  margin-top: 18px;
  padding: 20px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  font-size: 12pt;
  line-height: 1.55;
  text-align: justify;
}

.top-right-ref {
  text-align: right;
  font-weight: bold;
  margin-bottom: 18px;
  line-height: 1.5;
}

.header-top {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 16px;
  margin-bottom: 18px;
  font-weight: bold;
}

.court-name {
  white-space: pre-line;
  text-align: left;
  text-transform: none;
  text-decoration: none;
}

.claim-number { text-align: right; }

.preview-document h3,
.preview-document h4,
.party-line,
.party-separator {
  text-align: center;
}

.between-label {
  text-align: left;
  margin: 16px 0 10px;
}

.preview-document h3,
.preview-document h4 {
  text-transform: uppercase;
  margin: 26px 0 12px;
}

.party-label {
  font-style: italic;
}

.signature-block p {
  margin: 4px 0;
}

@media (min-width: 768px) {
  body { padding-left: 20px; padding-right: 20px; }
  .card { padding: 28px 28px; }
  .preview-document { padding: 40px 48px; }
  .home-actions { grid-template-columns: 1fr 1fr; }
  .preview-toolbar { justify-content: center; }
  .preview-toolbar button { width: auto; min-width: 180px; }
}

@media print {
  body { background: #fff; padding: 0; }
  .brand-wrap, .preview-toolbar { display: none !important; }
  .card { box-shadow: none; border-radius: 0; padding: 0; }
  .preview-document { border: none; margin: 0; padding: 0; }
}


.statement-title-block {
  margin: 24px 0 18px;
  text-align: center;
}

.statement-title-block h3 {
  margin: 10px 0;
}

.statement-title-line {
  width: 260px;
  max-width: 70%;
  border-top: 1px solid #000;
  margin: 0 auto;
}

/* Court party block: answer centred, fixed legal label right-aligned. */
.party-row {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  align-items: center;
  margin: 4px 0;
}

.party-spacer {
  min-height: 1px;
}

.party-center {
  text-align: center;
}

.party-right {
  text-align: right;
}

.exhibit-page-preview {
  margin-top: 42px;
  padding-top: 24px;
  border-top: 1px dashed var(--line);
}

@media (max-width: 640px) {
  .party-row {
    grid-template-columns: 0.4fr 1.8fr 1fr;
    gap: 6px;
  }

  .party-right {
    font-size: 0.95em;
  }
}
