:root {
  color-scheme: light dark;
  --background: #f4f5f7;
  --surface: #ffffff;
  --surface-subtle: #f8f9fb;
  --text: #172b4d;
  --text-muted: #5e6c84;
  --border: #dfe1e6;
  --border-strong: #b3bac5;
  --primary: #0c66e4;
  --primary-hover: #0055cc;
  --primary-text: #ffffff;
  --focus: #579dff;
  --success: #216e4e;
  --success-background: #dcfff1;
  --warning-background: #fff7d6;
  --warning-border: #f5cd47;
  --warning-text: #533f04;
  --shadow: 0 10px 30px rgba(9, 30, 66, 0.08);
  --radius: 12px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #101214;
    --surface: #1d2125;
    --surface-subtle: #22272b;
    --text: #f1f2f4;
    --text-muted: #b6c2cf;
    --border: #454f59;
    --border-strong: #738496;
    --primary: #579dff;
    --primary-hover: #85b8ff;
    --primary-text: #101214;
    --focus: #85b8ff;
    --success: #7ee2b8;
    --success-background: #164b35;
    --warning-background: #4f3f02;
    --warning-border: #cf9f02;
    --warning-text: #f8e6a0;
    --shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
  }
}

:root[data-theme="light"] {
  color-scheme: light;
  --background: #f4f5f7;
  --surface: #ffffff;
  --surface-subtle: #f8f9fb;
  --text: #172b4d;
  --text-muted: #5e6c84;
  --border: #dfe1e6;
  --border-strong: #b3bac5;
  --primary: #0c66e4;
  --primary-hover: #0055cc;
  --primary-text: #ffffff;
  --focus: #579dff;
  --success: #216e4e;
  --success-background: #dcfff1;
  --warning-background: #fff7d6;
  --warning-border: #f5cd47;
  --warning-text: #533f04;
  --shadow: 0 10px 30px rgba(9, 30, 66, 0.08);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --background: #101214;
  --surface: #1d2125;
  --surface-subtle: #22272b;
  --text: #f1f2f4;
  --text-muted: #b6c2cf;
  --border: #454f59;
  --border-strong: #738496;
  --primary: #579dff;
  --primary-hover: #85b8ff;
  --primary-text: #101214;
  --focus: #85b8ff;
  --success: #7ee2b8;
  --success-background: #164b35;
  --warning-background: #4f3f02;
  --warning-border: #cf9f02;
  --warning-text: #f8e6a0;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--background);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--background);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.45;
}

button,
textarea {
  font: inherit;
}

button,
a,
textarea {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
textarea:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 45%, transparent);
  outline-offset: 2px;
}

.app-shell {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 32px;
}

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(26px, 3vw, 40px);
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.subtitle {
  max-width: 760px;
  margin: 9px 0 0;
  color: var(--text-muted);
  font-size: 16px;
}

.privacy-badge {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  border: 1px solid color-mix(in srgb, var(--success) 30%, var(--border));
  border-radius: 999px;
  color: var(--success);
  background: var(--success-background);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.privacy-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.compatibility-note {
  margin-bottom: 18px;
  padding: 11px 14px;
  border: 1px solid var(--warning-border);
  border-radius: 8px;
  color: var(--warning-text);
  background: var(--warning-background);
  font-size: 13px;
}

.converter-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
}

.editor-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.card-header {
  display: flex;
  min-height: 60px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.card-header label {
  display: block;
  font-weight: 700;
}

.counter {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.button-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.button {
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease, transform 80ms ease;
}

.button:active:not(:disabled) {
  transform: translateY(1px);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.button-quiet {
  border-color: var(--border);
  color: var(--text);
  background: var(--surface-subtle);
}

.button-quiet:hover:not(:disabled) {
  border-color: var(--border-strong);
  background: color-mix(in srgb, var(--surface-subtle) 72%, var(--border));
}

.button-primary {
  color: var(--primary-text);
  background: var(--primary);
}

.button-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.textarea-wrap {
  position: relative;
  min-height: 420px;
}

textarea {
  display: block;
  width: 100%;
  min-height: 420px;
  margin: 0;
  padding: 16px;
  resize: vertical;
  border: 0;
  border-radius: 0;
  color: var(--text);
  background: var(--surface);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.55;
  tab-size: 2;
}

textarea::placeholder {
  color: color-mix(in srgb, var(--text-muted) 75%, transparent);
}

textarea:focus {
  position: relative;
  z-index: 1;
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

#jira-output {
  background: var(--surface-subtle);
}

.card-help {
  min-height: 43px;
  margin: 0;
  padding: 11px 14px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  background: var(--surface-subtle);
  font-size: 12px;
}

code,
kbd {
  font-family: var(--mono);
}

kbd {
  padding: 1px 4px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--surface);
  font-size: 11px;
}

.drop-overlay {
  position: absolute;
  inset: 10px;
  z-index: 4;
  display: none;
  place-items: center;
  border: 2px dashed var(--primary);
  border-radius: 8px;
  color: var(--primary);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  font-weight: 750;
  pointer-events: none;
}

.input-card.is-dragging .drop-overlay {
  display: grid;
}

.app-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 2px 0;
  color: var(--text-muted);
  font-size: 12px;
}

.app-footer a {
  color: var(--primary);
  text-decoration: none;
}

.app-footer a:hover {
  text-decoration: underline;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 20;
  max-width: min(360px, calc(100vw - 40px));
  padding: 10px 13px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 150ms ease, transform 150ms ease;
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body.embed-mode {
  min-height: auto;
}

body.embed-mode .app-shell {
  padding: 14px;
}

body.embed-mode .app-header {
  align-items: center;
  margin-bottom: 10px;
}

body.embed-mode .eyebrow,
body.embed-mode .subtitle,
body.embed-mode .compatibility-note,
body.embed-mode .app-footer {
  display: none;
}

body.embed-mode h1 {
  font-size: 20px;
  letter-spacing: -0.015em;
}

body.embed-mode .privacy-badge {
  padding: 5px 8px;
  font-size: 11px;
}

body.embed-mode .converter-form {
  gap: 10px;
}

body.embed-mode .editor-card {
  box-shadow: none;
}

body.embed-mode .textarea-wrap,
body.embed-mode textarea {
  min-height: 320px;
}

body.embed-mode .card-help {
  display: none;
}

.example-shell {
  width: min(1200px, 100%);
  margin: 0 auto;
  padding: 28px;
}

.example-shell h1 {
  font-size: 28px;
}

.example-copy {
  max-width: 760px;
  color: var(--text-muted);
}

.example-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 18px;
  margin-top: 20px;
}

.example-panel {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.example-panel h2 {
  margin: 0;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 16px;
}

.example-panel form {
  padding: 16px;
}

.example-panel textarea {
  min-height: 180px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.example-panel .button {
  margin-top: 10px;
}

.example-result {
  min-height: 150px;
  margin: 14px 16px 16px;
  padding: 12px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-subtle);
  font-family: var(--mono);
  font-size: 12px;
  white-space: pre-wrap;
}

.example-frame {
  display: block;
  width: 100%;
  min-height: 620px;
  border: 0;
  background: var(--surface);
}

@media (max-width: 920px) {
  .converter-form,
  .example-grid {
    grid-template-columns: 1fr;
  }

  body.embed-mode .converter-form {
    grid-template-columns: 1fr;
  }

  .textarea-wrap,
  textarea,
  body.embed-mode .textarea-wrap,
  body.embed-mode textarea {
    min-height: 300px;
  }
}

@media (max-width: 640px) {
  .app-shell,
  .example-shell {
    padding: 16px;
  }

  .app-header {
    display: block;
  }

  .privacy-badge {
    margin-top: 12px;
  }

  .card-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .button-row {
    width: 100%;
  }

  .button-row .button {
    flex: 1 1 auto;
  }

  .app-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  body.embed-mode .app-header {
    display: flex;
  }
}
