.fbg-tool,
.fbg-tool * {
  box-sizing: border-box;
}

.fbg-tool {
  --fbg-bg: #ffffff;
  --fbg-soft: #f7f7fb;
  --fbg-border: #e8e8f0;
  --fbg-text: #151521;
  --fbg-muted: #65657a;
  --fbg-accent: #6c4cf6;
  --fbg-accent-dark: #5537db;
  --fbg-success: #108a55;
  width: 100%;
  max-width: 980px;
  margin: 24px auto;
  color: var(--fbg-text);
  font-family: inherit;
}

.fbg-card,
.fbg-section {
  background: var(--fbg-bg);
  border: 1px solid var(--fbg-border);
  border-radius: 22px;
  box-shadow: 0 12px 34px rgba(20, 20, 43, 0.08);
}

.fbg-main-card {
  padding: 18px;
}

.fbg-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.fbg-kicker {
  display: inline-block;
  margin-bottom: 4px;
  color: var(--fbg-accent);
  font-size: 13px;
  font-weight: 700;
}

.fbg-title {
  margin: 0;
  font-size: clamp(22px, 4vw, 34px);
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.fbg-badge {
  flex: 0 0 auto;
  padding: 8px 10px;
  border-radius: 999px;
  background: var(--fbg-soft);
  color: var(--fbg-muted);
  font-size: 12px;
  font-weight: 700;
}

.fbg-label {
  display: block;
  margin: 10px 0 8px;
  font-weight: 700;
}

.fbg-input-wrap {
  position: relative;
}

.fbg-input {
  width: 100%;
  min-height: 112px;
  resize: vertical;
  padding: 16px 46px 16px 16px;
  border: 1px solid var(--fbg-border);
  border-radius: 18px;
  background: var(--fbg-soft);
  color: var(--fbg-text);
  font-size: 18px;
  line-height: 1.45;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.fbg-input:focus {
  border-color: var(--fbg-accent);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(108, 76, 246, 0.12);
}

.fbg-clear {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: var(--fbg-muted);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(20, 20, 43, 0.08);
}

.fbg-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 14px 2px 2px;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.fbg-tab {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 9px 13px;
  border: 1px solid var(--fbg-border);
  border-radius: 999px;
  background: #fff;
  color: var(--fbg-muted);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.fbg-tab.is-active,
.fbg-tab:hover {
  border-color: var(--fbg-accent);
  background: var(--fbg-accent);
  color: #fff;
}

.fbg-results {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

.fbg-section {
  padding: 16px;
}

.fbg-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.fbg-section-head h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
}

.fbg-section-head span {
  flex: 0 0 auto;
  color: var(--fbg-muted);
  font-size: 13px;
  font-weight: 700;
}

.fbg-result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.fbg-result-card {
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--fbg-border);
  border-radius: 16px;
  background: var(--fbg-soft);
}

.fbg-preview {
  min-height: 34px;
  margin-bottom: 10px;
  color: var(--fbg-text);
  font-size: 20px;
  line-height: 1.45;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.fbg-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.fbg-style-name {
  min-width: 0;
  color: var(--fbg-muted);
  font-size: 13px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fbg-copy {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 9px 13px;
  border: 0;
  border-radius: 12px;
  background: var(--fbg-accent);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.fbg-copy:hover {
  background: var(--fbg-accent-dark);
  transform: translateY(-1px);
}

.fbg-copy.is-copied {
  background: var(--fbg-success);
}

.fbg-examples {
  margin-top: 16px;
  padding: 16px;
}

.fbg-examples h2 {
  margin: 0 0 12px;
  font-size: 20px;
}

.fbg-example-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.fbg-example-row {
  padding: 12px;
  border: 1px solid var(--fbg-border);
  border-radius: 14px;
  background: var(--fbg-soft);
}

.fbg-example-row span {
  display: block;
  margin-bottom: 5px;
  color: var(--fbg-muted);
  font-size: 13px;
  font-weight: 700;
}

.fbg-example-row strong {
  display: block;
  font-size: 18px;
  line-height: 1.4;
  word-break: break-word;
}

.fbg-tab:focus-visible,
.fbg-copy:focus-visible,
.fbg-clear:focus-visible,
.fbg-input:focus-visible {
  outline: 3px solid rgba(108, 76, 246, 0.35);
  outline-offset: 2px;
}

@media (max-width: 720px) {
  .fbg-tool {
    margin: 16px auto;
  }

  .fbg-main-card,
  .fbg-section,
  .fbg-examples {
    padding: 14px;
    border-radius: 18px;
  }

  .fbg-header {
    display: block;
  }

  .fbg-badge {
    display: inline-block;
    margin-top: 10px;
  }

  .fbg-input {
    min-height: 106px;
    font-size: 16px;
  }

  .fbg-result-grid,
  .fbg-example-grid {
    grid-template-columns: 1fr;
  }

  .fbg-preview {
    font-size: 19px;
  }

  .fbg-meta {
    align-items: stretch;
  }

  .fbg-copy {
    min-width: 92px;
  }
}

@media (max-width: 420px) {
  .fbg-tool {
    margin-left: -2px;
    margin-right: -2px;
  }

  .fbg-tab {
    min-height: 42px;
    padding: 9px 12px;
  }

  .fbg-result-card {
    padding: 12px;
  }
}
