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

body {
  font-family: "KaiTi", "STKaiti", "SimSun", serif;
  background: #f5f0e8;
  min-height: 100vh;
  padding: 20px;
}

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

h1 {
  text-align: center;
  color: #5a4a3a;
  margin-bottom: 30px;
  font-size: 32px;
  font-weight: normal;
}

.converter {
  background: white;
  border-radius: 12px;
  padding: 30px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  margin-bottom: 20px;
}

.convert-btns {
  display: flex;
  gap: 10px;
}

.input-area {
  margin-bottom: 20px;
}

.input-wrapper {
  position: relative;
  margin-bottom: 8px;
}

textarea {
  width: 100%;
  padding: 16px 40px 16px 16px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-size: 16px;
  resize: vertical;
  min-height: 120px;
  background: #fafafa;
  font-family: inherit;
}

textarea:focus {
  outline: none;
  border-color: #c9a96e;
  background: white;
}

.input-wrapper .clear-btn {
  position: absolute;
  right: 10px;
  top: 10px;
  width: 24px;
  height: 24px;
  border: none;
  background: #ccc;
  color: white;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
  display: none;
}

.input-wrapper .clear-btn.show {
  display: block;
}

.input-wrapper .clear-btn:hover {
  background: #999;
}

.char-count {
  text-align: right;
  font-size: 12px;
  color: #8b7355;
  margin-bottom: 12px;
}

.convert-btn {
  flex: 1;
  padding: 14px;
  background: #c9a96e;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.3s;
}

.convert-btn:hover {
  background: #b8985d;
}

.convert-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.result {
  background: #f5f5f5;
  border-radius: 8px;
  padding: 28px;
  margin-bottom: 12px;
  position: relative;
}

.output {
  font-size: 24px;
  font-weight: bold;
  color: #333;
  margin-bottom: 12px;
}

.reason {
  font-size: 14px;
  color: #666;
  line-height: 1.6;
}

.copy-btn {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 6px 12px;
  background: #4caf50;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}

.loading {
  text-align: center;
  padding: 40px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.error {
  background: #ffebee;
  color: #c62828;
  padding: 16px;
  border-radius: 8px;
  margin-top: 12px;
}

.hidden {
  display: none;
}

.history {
  background: white;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.history h2 {
  font-size: 20px;
  margin-bottom: 16px;
  color: #333;
}

.history-list {
  max-height: 300px;
  overflow-y: auto;
  margin-bottom: 12px;
}

.history-item {
  background: #f5f5f5;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.3s;
}

.history-item:hover {
  background: #e0e0e0;
}

.history-item .type {
  font-size: 12px;
  color: #8b7355;
  margin-bottom: 4px;
}

.history-item .content {
  font-size: 14px;
  color: #333;
}

.clear-btn {
  width: 100%;
  padding: 12px;
  background: #f44336;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  margin-top: 12px;
}

@media (max-width: 640px) {
  body {
    padding: 12px;
  }

  h1 {
    font-size: 24px;
  }

  .converter, .history {
    padding: 16px;
  }
}
