:root {
  color-scheme: light;
  --page: #f5f5f7;
  --window: #fbfbfd;
  --panel: #ffffff;
  --panel-soft: #f7f7f8;
  --line: #d8d8dd;
  --line-strong: #c7c7cc;
  --text: #1d1d1f;
  --secondary: #4f4f55;
  --tertiary: #63636a;
  --blue: #005ecc;
  --blue-dark: #004ea8;
  --blue-soft: #f0f6ff;
  --blue-line: #c7ddff;
  --blue-text: #0a4ea3;
  --amber-text: #8a5a00;
  --danger-text: #a5122a;
  --red: #ff5f57;
  --yellow: #febc2e;
  --green: #28c840;
  --warning-bg: #fff7ed;
  --warning-border: #fed7aa;
  --danger-bg: #fff1f2;
  --danger-border: #fecdd3;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--page);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", Arial, sans-serif;
  letter-spacing: 0;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
}

button,
textarea,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.app-window {
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--window);
  box-shadow: var(--shadow);
}

.window-bar {
  display: grid;
  grid-template-columns: 70px 1fr auto;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(#f4f4f6, #ececef);
}

.window-controls {
  display: flex;
  gap: 8px;
}

.control {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.12);
}

.control-close {
  background: var(--red);
}

.control-minimize {
  background: var(--yellow);
}

.control-zoom {
  background: var(--green);
}

.brand {
  justify-self: center;
  color: var(--secondary);
  font-size: 0.86rem;
  font-weight: 650;
  text-decoration: none;
}

.toolbar-actions {
  align-items: center;
  display: flex;
  gap: 4px;
}

.toolbar-button,
.ghost-button,
.link-button,
.secondary-button,
.primary-button {
  min-height: 32px;
  border-radius: 7px;
  border: 1px solid transparent;
  padding: 6px 11px;
  font-weight: 600;
}

.toolbar-button,
.ghost-button,
.link-button {
  background: transparent;
  color: var(--blue);
}

.toolbar-button:hover,
.ghost-button:hover,
.link-button:hover {
  background: rgba(0, 122, 255, 0.08);
}

.tool-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
  padding: 22px 18px 14px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--tertiary);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 7px;
  font-size: clamp(1.7rem, 7vw, 2.4rem);
  line-height: 1.06;
  letter-spacing: 0;
}

#heroSubtitle {
  max-width: 620px;
  margin-bottom: 0;
  color: var(--secondary);
  font-size: 0.96rem;
  line-height: 1.45;
}

.usage-pill {
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--secondary);
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 650;
}

.mode-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2px;
  width: calc(100% - 36px);
  margin: 0 18px 16px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #e9e9ec;
}

.mode-tab {
  min-height: 34px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--secondary);
  padding: 6px 8px;
  text-align: center;
}

.mode-tab span {
  display: block;
  font-size: 0.86rem;
  font-weight: 650;
  line-height: 1.2;
}

.mode-tab small {
  display: none;
}

.mode-tab.active {
  background: #ffffff;
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.16);
}

.workspace {
  display: grid;
  gap: 14px;
  padding: 0 18px 18px;
}

.input-card,
.result-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
}

.input-card,
.result-card {
  padding: 14px;
}

.card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.card-heading h2 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.25;
}

.input-label {
  display: block;
  margin-bottom: 8px;
  color: var(--secondary);
  font-size: 0.88rem;
  line-height: 1.35;
}

textarea {
  width: 100%;
  min-height: 150px;
  resize: vertical;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  padding: 11px;
  font-size: 0.96rem;
  line-height: 1.45;
}

textarea:focus,
input:focus {
  border-color: var(--blue);
  outline: 3px solid rgba(0, 122, 255, 0.16);
}

.input-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 7px 0 12px;
  color: var(--tertiary);
  font-size: 0.78rem;
}

.screenshot-row {
  align-items: center;
  color: var(--tertiary);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.file-button {
  cursor: pointer;
  display: inline-flex;
}

.screenshot-preview {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-top: 10px;
  overflow: hidden;
  width: min(100%, 260px);
}

.screenshot-preview img {
  display: block;
  height: auto;
  max-height: 220px;
  object-fit: contain;
  width: 100%;
}

.link-button {
  min-height: auto;
  padding: 2px 0;
}

.context-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin: 0 0 12px;
  padding: 0;
  border: 0;
}

.context-group legend {
  grid-column: 1 / -1;
  margin-bottom: 2px;
  color: var(--secondary);
  font-size: 0.78rem;
  font-weight: 650;
}

.context-group label {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
  color: var(--secondary);
  padding: 6px;
  font-size: 0.8rem;
  text-align: center;
}

.context-group input {
  width: 13px;
  height: 13px;
  accent-color: var(--blue);
}

.privacy-note,
.form-message {
  margin: 0;
  color: var(--tertiary);
  font-size: 0.78rem;
  line-height: 1.35;
}

.privacy-note {
  margin-bottom: 12px;
}

.primary-button {
  width: 100%;
  min-height: 40px;
  background: var(--blue);
  color: #ffffff;
}

.primary-button:hover {
  background: var(--blue-dark);
}

.secondary-button {
  background: var(--panel-soft);
  border-color: var(--line);
  color: var(--text);
}

.form-message {
  min-height: 18px;
  margin-top: 8px;
}

.result-card {
  scroll-margin-top: 12px;
}

.result-block,
.reply-section {
  border-top: 1px solid var(--line);
  padding: 12px 0;
}

.result-card .result-block:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.result-block h3,
.reply-section h3 {
  margin-bottom: 7px;
  color: var(--tertiary);
  font-size: 0.76rem;
  font-weight: 750;
  text-transform: uppercase;
}

.result-block p,
.result-block li {
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.45;
}

.result-block p {
  margin-bottom: 0;
}

.result-block ul {
  margin: 0;
  padding-left: 18px;
}

.highlight-block {
  border-radius: 8px;
  background: var(--blue-soft);
  border: 1px solid var(--blue-line) !important;
  padding: 12px !important;
}

.highlight-block h3 {
  color: var(--blue-text);
}

.next-move {
  border-radius: 8px;
  background: var(--warning-bg);
  border: 1px solid var(--warning-border) !important;
  padding: 12px !important;
}

.next-move h3 {
  color: var(--amber-text);
}

.avoid-block {
  border-radius: 8px;
  background: var(--danger-bg);
  border: 1px solid var(--danger-border) !important;
  padding: 12px !important;
  margin-top: 12px;
}

.avoid-block h3 {
  color: var(--danger-text);
}

.split-blocks {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--line);
}

.split-blocks .result-block {
  border-top: 0;
}

.reply-list {
  display: grid;
  gap: 8px;
}

.reply-option {
  border: 1px solid var(--line);
  border-left: 4px solid var(--line-strong);
  border-radius: 9px;
  background: #ffffff;
  padding: 10px;
}

.reply-option[data-tone="calm"] {
  border-left-color: var(--blue);
}

.reply-option[data-tone="warm"] {
  border-left-color: #c77700;
}

.reply-option[data-tone="direct"] {
  border-left-color: #505057;
}

.reply-option strong {
  display: block;
  margin-bottom: 5px;
  color: var(--text);
  font-size: 0.9rem;
}

.reply-option[data-tone="calm"] strong {
  color: var(--blue-text);
}

.reply-option[data-tone="warm"] strong {
  color: var(--amber-text);
}

.reply-option[data-tone="direct"] strong {
  color: var(--text);
}

.reply-option p {
  margin: 0 0 9px;
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.42;
}

.feedback-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  padding-top: 12px;
  color: var(--secondary);
  font-size: 0.82rem;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(10px);
}

.modal {
  position: relative;
  width: min(100%, 420px);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--panel);
  padding: 18px;
  box-shadow: var(--shadow);
}

.modal h2 {
  margin-bottom: 8px;
  font-size: 1.12rem;
}

.modal p {
  color: var(--secondary);
  line-height: 1.45;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
  color: var(--secondary);
  font-weight: 700;
}

.section-kicker {
  margin: 0 0 6px;
  color: var(--tertiary);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.email-form {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.email-form label {
  font-size: 0.84rem;
  font-weight: 650;
}

.email-form input {
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 9px 10px;
}

.legal-links {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  margin-top: 14px;
  padding-top: 14px;
}

.legal-links a,
.legal-page a {
  color: var(--blue);
  font-weight: 650;
  text-decoration: none;
}

.legal-links a:hover,
.legal-page a:hover {
  text-decoration: underline;
}

.legal-page {
  max-width: 760px;
  padding: 28px;
}

.legal-page h1 {
  font-size: clamp(1.8rem, 5vw, 2.4rem);
}

.legal-page h2 {
  margin: 24px 0 8px;
  font-size: 1rem;
}

.legal-page p {
  color: var(--secondary);
  line-height: 1.55;
}

.full-width {
  width: 100%;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 30;
  transform: translateX(-50%) translateY(18px);
  max-width: calc(100vw - 32px);
  border-radius: 9px;
  background: rgba(29, 29, 31, 0.9);
  color: #ffffff;
  padding: 9px 12px;
  font-size: 0.84rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

[hidden] {
  display: none !important;
}

@media (min-width: 760px) {
  .app-shell {
    padding: 38px 24px;
  }

  .tool-header {
    padding: 28px 28px 16px;
  }

  .mode-tabs {
    width: calc(100% - 56px);
    margin: 0 28px 18px;
  }

  .workspace {
    grid-template-columns: minmax(0, 520px);
    justify-content: center;
    align-items: start;
    padding: 0 28px 28px;
  }

  .workspace:has(.result-card:not([hidden])) {
    grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
    justify-content: stretch;
  }

  .input-card {
    position: sticky;
    top: 18px;
  }

  .split-blocks {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }
}

@media (max-width: 520px) {
  .window-bar {
    grid-template-columns: 54px 1fr auto;
    padding: 0 10px;
  }

  .window-controls {
    gap: 6px;
  }

  .control {
    width: 10px;
    height: 10px;
  }

  .tool-header {
    grid-template-columns: 1fr;
    padding: 18px 14px 12px;
  }

  .usage-pill {
    width: fit-content;
  }

  .mode-tabs {
    width: calc(100% - 28px);
    margin: 0 14px 14px;
  }

  .workspace {
    padding: 0 14px 14px;
  }
}
