/**
 * Gist /try Page Styles (Brand v3.5)
 *
 * BRAND SOURCE:
 * Canonical reference: packages/ui/brand-guide/production/index.html.
 * `src/ssr/brand.ts` mirrors these CSS variables for TS-side SSR consumers;
 * keep both in sync when the brand palette moves.
 *
 * The Chrome extension's `extension/ui/brand.css` is intentionally still on
 * the pre-v3.5 palette; plan 213 leaves the extension surfaces untouched.
 * /try lives in the backend (Cloudflare Worker SSR), so it can't <link>
 * any extension stylesheet directly — the v3.5 tokens are declared here.
 *
 * DESIGN SYSTEM:
 * - Fonts: Instrument Sans (body + display 700), Instrument Serif (italic
 *   display), JetBrains Mono — loaded via Google Fonts in try.ts SSR shell
 * - Gradient: #FF6B6B → #FFD93D → #FF8E53 (sunrise — coral → gold → orange)
 * - Ink hierarchy: opacity-modulated against paper (primary 100%, secondary
 *   68%, tertiary 42%, faint 45%) so light/dark share one scale
 * - Paper hierarchy: paper, wash, surface (warm cream tiers in light;
 *   ink-as-paper in dark)
 * - Radius scale: 8 / 12 / 16 / 999 (no orphan values)
 * - Spacing: 4px grid
 * - Wordmark: canonical proportions from Reader's .gist-identity
 *
 * TYPOGRAPHY:
 * - Instrument Sans (primary), system fonts as fallbacks
 * - Weights: 400 (body), 500 (medium), 600 (semibold), 700 (bold) — no 800
 * - Tracking: -0.03em for headlines, normal for body
 */

/* ============================================
   DESIGN TOKENS — Light Mode (Default)
   v3.5 — warm cream paper, translucent ink tiers.
   ============================================ */
:root {
  /* Typography */
  --font-sans: 'Instrument Sans', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  --font-serif: 'Instrument Serif', Georgia, 'Times New Roman', serif;
  --font-display: 'Instrument Sans', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  /**
   * Marketing headline font — Instrument Sans at weight 700.
   * v3.5 caps display weight at 700; heft comes from tight letter-spacing
   * (-0.03em) and scale, not mass. Mirrors Font.display in src/ssr/brand.ts.
   */
  --font-headline: 'Instrument Sans', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;

  /* Text hierarchy — opacity-modulated against paper */
  --ink: #1C1C24;
  --ink-secondary: rgba(28,28,36,0.68);
  --ink-tertiary: rgba(28,28,36,0.42);
  --ink-faint: rgba(28,28,36,0.45);

  /* Background hierarchy — warm cream paper tiers */
  --paper: #FAF6EE;
  --wash: #F5EFE2;
  --surface: #ECE5D2;

  /* Borders — ink tinted so they track the paper tier */
  --border: rgba(28,28,36,0.13);
  --border-light: rgba(28,28,36,0.06);

  /* Brand — Sunrise Gradient */
  --gradient-start: #FF6B6B;
  --gradient-mid: #FFD93D;
  --gradient-end: #FF8E53;
  --gradient: linear-gradient(135deg, var(--gradient-start), var(--gradient-mid), var(--gradient-end));

  /* Semantic — values mirror src/styles/tokens.css */
  --error: #DC2626;
  --error-wash: #fef2f2;
  --success: #10B981;
  --success-hover: #059669;
  --success-bg: #ecfdf5;

  /* Focus ring (/try-specific — used by input container + auth inputs) */
  --focus-ring: 0 0 0 3px rgba(255, 107, 107, 0.15);

  /* Border Radius Scale */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 999px;

  /* Spacing — 4px grid */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
}

/* ============================================
   DESIGN TOKENS — Dark Mode (v3.5)
   Ink-as-paper inversion: warm cream becomes ink, deep charcoal becomes
   paper. Ink tiers re-modulate against the new paper at the same percent
   stops as light mode so the hierarchy reads identically.
   ============================================ */
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #FAF6EE;
    --ink-secondary: rgba(250,246,238,0.68);
    --ink-tertiary: rgba(250,246,238,0.42);
    --ink-faint: rgba(250,246,238,0.30);

    --paper: #15161C;
    --wash: #1C1D24;
    --surface: #22232B;

    --border: rgba(250,246,238,0.10);
    --border-light: rgba(250,246,238,0.04);

    --error: #f87171;
    --error-wash: #2d1f1f;

    --success: #34d399;
    --success-bg: #0f2922;
  }
}

/* ============================================
   RESET & BASE
   ============================================ */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  color-scheme: light dark;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: var(--wash);
  color: var(--ink);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ============================================
   LAYOUT
   ============================================ */
.try-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ============================================
   HEADER
   ============================================ */
.try-header {
  padding: var(--space-6) var(--space-8);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Wordmark: canonical proportions from Reader's .gist-identity
   and extension's .wordmark (brand.css). Same bolt, same weight,
   same tracking — one mark across every Gist surface. */
.try-logo {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-display), var(--font-sans);
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: -0.03em;
  text-decoration: none;
  color: var(--ink);
  transition: opacity 0.2s ease;
}

.try-logo:hover {
  opacity: 0.7;
}

.try-logo:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-sm);
}

.try-logo-bolt {
  width: 0.9em;
  height: 1.5em;
  margin-right: 0.08em;
}

.try-nav {
  display: flex;
  align-items: center;
  gap: var(--space-8);
}

.try-nav-link {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--ink-tertiary);
  text-decoration: none;
  transition: color 0.15s ease;
}

.try-nav-link:hover {
  color: var(--ink);
}

.try-nav-link:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-sm);
}

.try-signin-btn {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink-secondary);
  background: transparent;
  border: 1px solid var(--border);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.try-signin-btn:hover {
  background: var(--wash);
  border-color: var(--ink-tertiary);
}

.try-signin-btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.try-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-10) var(--space-6) var(--space-12);
}

/* ============================================
   HERO SECTION
   ============================================ */
.try-hero {
  text-align: center;
  max-width: 720px;
  margin-bottom: var(--space-12);
}

.try-headline {
  font-family: var(--font-headline);
  font-weight: 700;
  font-size: clamp(2.5rem, 7vw, 4rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  text-transform: uppercase;
  margin-bottom: var(--space-5);
  color: var(--ink);
}

.try-headline-line {
  display: block;
}

.try-gradient-text {
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.try-subheadline {
  font-size: 1rem;
  color: var(--ink-secondary);
  line-height: 1.5;
  max-width: 400px;
  margin: 0 auto;
}

/* ============================================
   INPUT CONTAINER
   ============================================ */
.try-input-wrap {
  width: 100%;
  max-width: 680px;
}

.try-input-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  /* Language listbox is absolutely positioned; hidden would clip it. */
  overflow: visible;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.try-input-container:focus-within {
  border-color: var(--gradient-start);
  box-shadow: var(--focus-ring);
}

.try-input-container.drag-over {
  border-color: var(--gradient-mid);
  background: rgba(255, 217, 61, 0.04);
}

.try-textarea {
  width: 100%;
  min-height: 120px;
  max-height: 300px;
  resize: none;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 0.9375rem;
  padding: var(--space-5) var(--space-6);
  color: var(--ink);
  outline: none;
  line-height: 1.5;
}

.try-textarea::placeholder {
  color: var(--ink-faint);
}

.try-textarea[readonly] {
  cursor: not-allowed;
}

/* ============================================
   FILE PREVIEW
   ============================================ */
.try-file-preview {
  display: none;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  margin: 0 var(--space-4) var(--space-3);
  background: var(--wash);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  color: var(--ink-secondary);
}

.try-file-preview.visible {
  display: flex;
}

.try-file-icon {
  width: 18px;
  height: 18px;
  color: var(--gradient-start);
  flex-shrink: 0;
}

.try-file-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.try-file-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  color: var(--ink-faint);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.try-file-remove:hover {
  background: var(--border);
  color: var(--ink);
}

.try-file-remove:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* ============================================
   CONTROLS ROW
   ============================================ */
.try-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border-light);
  background: var(--wash);
}

.try-controls-left {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.try-controls-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* ============================================
   ICON BUTTON
   ============================================ */
.try-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: none;
  background: none;
  border-radius: var(--radius-md);
  color: var(--ink-tertiary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.try-icon-btn:hover {
  background: var(--surface);
  color: var(--ink);
}

.try-icon-btn svg {
  width: 20px;
  height: 20px;
}

.try-icon-btn.is-locked,
.try-icon-btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
}

.try-icon-btn.is-locked:hover,
.try-icon-btn[aria-disabled="true"]:hover {
  background: none;
  color: var(--ink-tertiary);
}

.try-icon-btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.try-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ============================================
   LANGUAGE SELECTOR
   ============================================ */
.try-lang-selector {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.try-lang-trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: none;
  background: none;
  border-radius: var(--radius-md);
  color: var(--ink-tertiary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.try-lang-trigger:hover {
  background: var(--surface);
  color: var(--ink);
}

.try-lang-trigger:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.try-lang-trigger svg {
  width: 20px;
  height: 20px;
}

.try-lang-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ink-secondary);
  display: none;
}

.try-lang-label.visible {
  display: block;
}

.try-lang-dropdown {
  position: absolute;
  bottom: calc(100% + var(--space-2));
  right: 0;
  width: 200px;
  max-height: 320px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  padding: var(--space-2);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: all 0.15s ease;
  z-index: 100;
}

.try-lang-selector.open .try-lang-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* A-034: Viewport-aware flip — open downward when insufficient space above. */
.try-lang-dropdown.flip-down {
  bottom: auto;
  top: calc(100% + var(--space-2));
}

.try-lang-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-tertiary);
  padding: var(--space-2) var(--space-3);
  margin-top: var(--space-2);
}

.try-lang-section-title:first-child {
  margin-top: 0;
}

.try-lang-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border: none;
  background: none;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background 0.1s ease;
}

.try-lang-option:hover {
  background: var(--wash);
}

.try-lang-option:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.try-lang-option.selected {
  color: var(--gradient-start);
}

.try-lang-check {
  width: 14px;
  height: 14px;
  opacity: 0;
}

.try-lang-option.selected .try-lang-check {
  opacity: 1;
}

/* ============================================
   SUBMIT BUTTON
   ============================================ */
.try-submit-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  background: var(--gradient);
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  /* Always dark text on gradient background (like options.css threshold-option.always) */
  color: #1C1C24;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.try-submit-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(255, 107, 107, 0.35);
}

.try-submit-btn:active:not(:disabled) {
  transform: translateY(0);
}

.try-submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.try-submit-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.5), var(--focus-ring);
}

.try-submit-icon {
  width: 14px;
  height: 24px;
}

/* ============================================
   HELPER TEXT
   ============================================ */
.try-helper {
  text-align: center;
  margin-top: var(--space-4);
  font-size: 0.8125rem;
  color: var(--ink-faint);
}

.try-helper.is-speculating {
  color: var(--ink-secondary);
}

/* ============================================
   STATUS MESSAGE
   ============================================ */
.try-status {
  text-align: center;
  margin-top: var(--space-4);
  font-size: 0.875rem;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  display: none;
}

.try-status.visible {
  display: block;
}

.try-status.loading {
  color: var(--ink-secondary);
  background: var(--wash);
}

.try-status.success {
  color: var(--success);
  background: var(--success-bg);
}

.try-status.error {
  color: var(--error);
  background: var(--error-wash);
}

/* ============================================
   RESULT CARDS
   ============================================ */
.try-results {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.try-result-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  box-sizing: border-box;
  min-height: 72px;
  padding: var(--space-4);
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  animation: try-result-enter 0.18s ease-out;
  transition: border-color 0.15s ease;
}

.try-result-card:hover {
  border-color: var(--border);
}

.try-result-card::before {
  content: '';
  align-self: stretch;
  width: 3px;
  min-height: 40px;
  border-radius: var(--radius-full);
  background: var(--gradient);
  flex-shrink: 0;
}

.try-result-card.is-error::before {
  background: var(--error);
}

.try-result-card.is-error:hover {
  border-color: rgba(220, 38, 38, 0.3);
}

.try-result-content {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: var(--space-1);
}

.try-result-eyebrow {
  min-width: 0;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.2;
  color: var(--ink-tertiary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.try-result-title {
  min-width: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.try-result-status {
  min-width: 0;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--ink-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.try-result-card.is-error {
  border-color: rgba(220, 38, 38, 0.22);
  background: var(--error-wash);
}

.try-result-card.is-error .try-result-status {
  color: var(--error);
}

/* ============================================
   RESULT READY ACTION (matches homepage `.home-sample-card` open column)
   ============================================ */
.try-result-open {
  flex-shrink: 0;
  text-decoration: none;
  color: inherit;
}

.try-result-open-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  gap: var(--space-1);
}

.try-result-open-icon {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  color: var(--ink);
  border-radius: var(--radius-md);
  transition: background 0.15s ease, color 0.15s ease;
}

.try-result-open-label {
  margin: 0;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1;
  text-align: center;
  text-transform: lowercase;
  color: var(--ink-tertiary);
  transition: color 0.15s ease;
}

.try-result-card.is-ready:hover .try-result-open-icon {
  background: var(--wash);
  color: var(--gradient-start);
}

.try-result-card.is-ready:hover .try-result-open-label {
  color: var(--gradient-start);
}

.try-result-open:focus-visible {
  outline: none;
}

.try-result-open:focus-visible .try-result-open-icon {
  box-shadow: var(--focus-ring);
}

.try-result-open-icon svg {
  width: 20px;
  height: 20px;
}

/* ============================================
   INLINE TOAST
   ============================================ */
.try-toast {
  text-align: center;
  margin-top: var(--space-3);
  font-size: 0.8125rem;
  color: var(--ink-secondary);
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  min-height: 1.25em;
}

.try-toast.visible {
  opacity: 1;
  transform: translateY(0);
}

/* A-043: Dark mode success colors now use --success/--success-bg tokens in :root. */

/* ============================================
   AUTH MODAL
   ============================================ */
.try-auth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 1000;
}

.try-auth-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.try-auth-modal {
  position: relative;
  width: min(420px, 92vw);
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.try-auth-close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  background: transparent;
  border: none;
  color: var(--ink-tertiary);
  cursor: pointer;
  padding: var(--space-2);
  border-radius: var(--radius-sm);
}

.try-auth-close:hover {
  background: var(--wash);
  color: var(--ink);
}

.try-auth-close:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.try-auth-close svg {
  width: 18px;
  height: 18px;
}

.try-auth-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: var(--space-2);
}

.try-auth-subtitle {
  font-size: 0.95rem;
  color: var(--ink-secondary);
  margin-bottom: var(--space-6);
}

.try-auth-error {
  display: none;
  color: var(--error);
  background: var(--error-wash);
  border: 1px solid rgba(220, 38, 38, 0.2);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  margin-bottom: var(--space-4);
}

.try-auth-error.visible {
  display: block;
}

.try-auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.try-auth-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-secondary);
}

.try-auth-input {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-size: 0.95rem;
  color: var(--ink);
}

.try-auth-input:focus {
  outline: none;
  border-color: var(--gradient-start);
  box-shadow: var(--focus-ring);
}

.try-auth-submit {
  margin-top: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  border: none;
  background: var(--gradient);
  color: #1C1C24;
  font-weight: 700;
  cursor: pointer;
}

.try-auth-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.try-auth-submit:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.5), var(--focus-ring);
}

.try-auth-divider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--ink-faint);
  font-size: 0.85rem;
  margin: var(--space-5) 0;
}

.try-auth-divider::before,
.try-auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-light);
}

/* Google sign-in button: aligned with .auth-button--google from brand.css.
   "Continue with Google" copy + Google G icon + radius-sm + brand font treatment. */
.try-auth-google {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.try-auth-google svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.try-auth-google:hover:not(:disabled) {
  background: var(--wash);
  border-color: var(--ink-tertiary);
}

.try-auth-google:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.try-auth-google:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* ============================================
   FOOTER
   ============================================ */
.try-footer {
  padding: var(--space-6) var(--space-8);
  display: flex;
  justify-content: center;
  gap: var(--space-8);
  border-top: 1px solid var(--border-light);
}

.try-footer-link {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ink-faint);
  text-decoration: none;
  transition: color 0.15s ease;
}

.try-footer-link:hover {
  color: var(--ink-secondary);
}

.try-footer-link:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-sm);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  .try-header {
    padding: var(--space-5) var(--space-5);
  }

  .try-nav {
    gap: var(--space-4);
  }

  .try-nav-link {
    display: none;
  }

  .try-main {
    padding: var(--space-6) var(--space-4) var(--space-10);
  }

  .try-hero {
    margin-bottom: var(--space-8);
  }

  .try-subheadline {
    font-size: 1rem;
  }

  .try-textarea {
    min-height: 100px;
    padding: var(--space-4) var(--space-5);
    font-size: 0.9375rem;
  }

  .try-controls {
    padding: var(--space-3);
  }

  .try-submit-btn {
    padding: var(--space-3) var(--space-4);
    font-size: 0.875rem;
  }

  .try-result-card {
    align-items: flex-start;
    min-height: 76px;
    padding: var(--space-3);
  }

  .try-result-open {
    flex-shrink: 0;
    align-self: center;
  }

  /* A-033: Show compact label on mobile instead of hiding entirely. */
  .try-lang-label.visible {
    display: block;
    max-width: 3ch;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .try-footer {
    padding: var(--space-5);
    gap: var(--space-6);
  }
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes try-result-enter {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* A-042: CSS class for spinner so prefers-reduced-motion rule applies. */
.try-spinner {
  animation: spin 0.6s linear infinite;
}

/* ============================================
   CREATE-MODULE TABS (Phase 1)
   Tabbed signage row above the input container.
   Hidden when CREATE_MODULE_TABS_ENABLED is off (slot is not rendered).
   Per-preset affordance styling lands in Phase 2.
   ============================================ */
.try-create-module {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  width: 100%;
}

.try-mode-tabs {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0;
  margin: 0;
  border-bottom: 1px solid var(--border);
  /* Mobile: tabs may horizontally scroll without wrapping labels. */
  overflow-x: auto;
  scrollbar-width: none;
}

.try-mode-tabs::-webkit-scrollbar {
  display: none;
}

.try-mode-tab {
  /* Quiet signage — Inter, generous padding, underline-style indicator. */
  appearance: none;
  background: transparent;
  border: 0;
  padding: var(--space-3) var(--space-4);
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--ink-tertiary);
  cursor: pointer;
  white-space: nowrap;
  position: relative;
  /* 44px minimum touch target on mobile per plan. */
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  transition: color 150ms ease;
}

.try-mode-tab-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.try-mode-tab-label {
  line-height: 1;
}

.try-mode-tab:hover {
  color: var(--ink-secondary);
}

.try-mode-tab:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-sm);
}

.try-mode-tab--active {
  color: var(--ink);
  font-weight: 600;
}

.try-mode-tab--active::after {
  content: '';
  position: absolute;
  left: var(--space-4);
  right: var(--space-4);
  bottom: -1px;
  height: 2px;
  background: var(--gradient);
  border-radius: var(--radius-full);
}

/* Dark mode: handled by the existing :root @media block above which remaps
   --ink, --ink-tertiary, and --border. No tab-specific override needed. */

/* ============================================
   CREATE-MODULE PRESET AFFORDANCES (Phase 2)
   File-type pills, drag highlight, mode hint copy.
   All gated to flag-on rendering by the SSR-injected wrapper.
   ============================================ */

/* File-type pills: hidden by default, shown only in File preset.
   Rendered as a <ul> so AT can announce a list of supported file types;
   reset the native list styling (bullets, indent) here. */
.try-file-pills {
  display: none;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.try-create-module[data-create-mode="file"] .try-file-pills {
  display: flex;
}

/* Pills are informational only — non-interactive chips.
   Mirrors the brand chip style used elsewhere on /try. */
.try-file-pill {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--ink-secondary);
  background: var(--wash);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  /* Hint that these are not clickable. */
  cursor: default;
  user-select: none;
}

/* Whole-wrapper drop highlight. The legacy inputContainer.drag-over still
   exists for flag-off, so we add a parallel wrapper-level affordance here. */
.try-create-module[data-drag-active="true"] {
  outline: 2px dashed var(--gradient-start);
  outline-offset: var(--space-2);
  border-radius: var(--radius-lg);
}

/* Mode hint paragraph: hidden until populated. aria-live is set on the
   element so screen readers pick up the change automatically. */
.try-mode-hint {
  display: none;
  margin: 0;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--ink-tertiary);
  line-height: 1.4;
}

.try-mode-hint.visible {
  display: block;
}

/* File preset gives the upload control a touch more weight. The textarea
   row is collapsed slightly so the drop affordance feels primary without
   removing the textarea (Markdown still loads into it). */
.try-create-module[data-file-controls-primary="true"] .try-icon-btn {
  background: var(--wash);
  border: 1px solid var(--border);
}

@media (max-width: 600px) {
  .try-mode-tabs {
    /* Tabs already scroll horizontally; just nudge the underline cushion. */
    padding-bottom: 0;
  }
}


/* ============================================
   REDUCED MOTION
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
}
