*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: #1a1a1a;
  background-color: #f5f5f5;
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.03) 1px, transparent 1px);
  background-size: 20px 20px;
  padding: 2rem 1rem;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.container {
  width: 100%;
  max-width: 560px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  padding: 1.75rem 1.5rem;
}

.intro {
  margin: 0 0 1.5rem;
  color: #555;
  font-size: 0.95rem;
}

.utm-form {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.field-group {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 0.25rem 0.75rem;
  margin-bottom: 1.25rem;
}

.field-label {
  grid-column: 1;
  grid-row: 1;
  font-weight: 600;
  font-size: 0.9rem;
  color: #333;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.required {
  grid-column: 2;
  grid-row: 1;
  font-size: 0.8rem;
  color: #888;
}

.help-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #e0e0e0;
  color: #666;
  font-size: 11px;
  font-weight: 600;
  cursor: help;
}

.input-wrap {
  grid-column: 1 / -1;
  grid-row: 2;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fff;
  padding: 0 0.75rem;
  min-height: 44px;
}

.input-wrap:focus-within {
  border-color: #333;
  outline: 2px solid rgba(0, 0, 0, 0.1);
  outline-offset: 0;
}

.input-icon {
  color: #888;
  font-size: 1rem;
  flex-shrink: 0;
}

.input-wrap input {
  flex: 1;
  min-width: 0;
  border: none;
  background: none;
  font-size: 0.95rem;
  padding: 0.5rem 0;
}

.input-wrap input:focus {
  outline: none;
}

.input-wrap--readonly {
  padding-right: 0.5rem;
}

.input-wrap output {
  flex: 1;
  min-width: 0;
  font-size: 0.9rem;
  color: #333;
  word-break: break-all;
  padding: 0.5rem 0;
}

.copy-btn {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: background 0.15s;
}

.copy-btn:hover {
  background: #f0f0f0;
}

.copy-btn.copied {
  background: #e8f5e9;
}

.section-heading {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  font-weight: 700;
  color: #1a1a1a;
}

.param-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.param-label {
  flex: 0 0 100px;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: #333;
}

.param-icon {
  font-size: 1rem;
  flex-shrink: 0;
}

.param-input {
  flex: 1;
  min-width: 0;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  font-size: 0.95rem;
  background: #fff;
}

.param-input:focus {
  border-color: #333;
  outline: 2px solid rgba(0, 0, 0, 0.08);
  outline-offset: 0;
}

.param-input::placeholder {
  color: #aaa;
}

.campaign-url-group {
  margin-top: 1.25rem;
  margin-bottom: 1.5rem;
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.templates-wrap {
  position: relative;
}

.templates-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fff;
  font-size: 0.9rem;
  color: #333;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.templates-btn:hover {
  border-color: #bbb;
  background: #fafafa;
}

.chevron {
  font-size: 0.7rem;
  color: #666;
  transition: transform 0.2s;
}

.templates-wrap.open .chevron {
  transform: rotate(180deg);
}

.templates-list {
  position: absolute;
  left: 0;
  bottom: 100%;
  margin: 0 0 0.25rem;
  padding: 0.35rem 0;
  list-style: none;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  min-width: 160px;
  z-index: 10;
}

.templates-list[hidden] {
  display: none;
}

.templates-list li {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.1s;
}

.templates-list li:hover {
  background: #f5f5f5;
}

.btn-primary {
  padding: 0.6rem 1.25rem;
  border: none;
  border-radius: 8px;
  background: #1a1a1a;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-primary:hover {
  background: #333;
}

.btn-primary:focus {
  outline: 2px solid #1a1a1a;
  outline-offset: 2px;
}
