* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Meiryo", sans-serif;
  background: #f5f7fa;
  color: #333;
  min-height: 100vh;
  padding: 16px;
}

.container {
  max-width: 700px;
  margin: 0 auto;
}

h1 {
  font-size: 1.4rem;
  font-weight: 700;
  color: #1a2a4a;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid #2d6be4;
}

h2 {
  font-size: 1rem;
  font-weight: 600;
  color: #1a2a4a;
}

.form-section {
  background: #fff;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  margin-bottom: 16px;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #555;
  margin-bottom: 5px;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: inherit;
  color: #333;
  transition: border-color 0.2s;
  resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #2d6be4;
}

.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.btn-primary {
  flex: 1;
  padding: 11px 20px;
  background: #2d6be4;
  color: #fff;
  border: none;
  border-radius: 7px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  min-width: 140px;
}

.btn-primary:hover {
  background: #1a55c7;
}

.btn-secondary {
  padding: 11px 16px;
  background: #fff;
  color: #2d6be4;
  border: 1px solid #2d6be4;
  border-radius: 7px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-secondary:hover {
  background: #f0f4ff;
}

.output-section {
  background: #fff;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  margin-bottom: 16px;
}

.output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.btn-copy {
  padding: 7px 18px;
  background: #2d6be4;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-copy:hover {
  background: #1a55c7;
}

.btn-copy.copied {
  background: #28a745;
}

.mail-output {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Meiryo", sans-serif;
  font-size: 0.92rem;
  line-height: 1.75;
  color: #333;
  background: #f9fbff;
  border: 1px solid #e3e9f7;
  border-radius: 7px;
  padding: 16px;
}

.templates-section {
  background: #fff;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.templates-section h2 {
  margin-bottom: 12px;
}

.template-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #e8edf5;
  border-radius: 7px;
  margin-bottom: 8px;
  background: #fafbfd;
}

.template-item:last-child {
  margin-bottom: 0;
}

.template-info {
  flex: 1;
  min-width: 0;
}

.template-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: #1a2a4a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.template-subject {
  font-size: 0.8rem;
  color: #888;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.template-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.btn-load {
  padding: 5px 12px;
  background: #eef3ff;
  color: #2d6be4;
  border: 1px solid #c7d8f7;
  border-radius: 5px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-load:hover {
  background: #dce9ff;
}

.btn-delete {
  padding: 5px 10px;
  background: #fff0f0;
  color: #d9534f;
  border: 1px solid #f5c6c6;
  border-radius: 5px;
  font-size: 0.82rem;
  cursor: pointer;
}

.btn-delete:hover {
  background: #ffe0e0;
}

.empty-msg {
  color: #aaa;
  font-size: 0.88rem;
  text-align: center;
  padding: 16px 0;
}

@media (max-width: 480px) {
  h1 {
    font-size: 1.2rem;
  }

  .button-row {
    flex-direction: column;
  }

  .btn-primary,
  .btn-secondary {
    width: 100%;
  }

  .output-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}
