body {
  margin: 0;
  font-family: "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  background: #f7f7f7;
  color: #333;
}

/* Header */

.header {
  background: #1a1a1a;
  color: white;
  padding: 15px 25px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.logo {
  font-size: 20px;
  font-weight: bold;
}

/* Buttons */

.btn-primary {
  background: #007aff;
  border: none;
  padding: 12px 20px;
  color: white;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  transition: all 0.2s;
}

.btn-primary:hover {
  background: #0051d5;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

.btn-secondary {
  background: #6c757d;
  border: none;
  padding: 10px 16px;
  color: white;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: #5a6268;
}

/* Auth container */

.auth-container {
  width: 90%;
  max-width: 420px;
  margin: 80px auto;
  background: white;
  padding: 35px;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.auth-container h2 {
  margin-top: 0;
  color: #1a1a1a;
  font-size: 24px;
}

.auth-container input {
  width: 100%;
  padding: 14px;
  margin: 10px 0;
  border-radius: 8px;
  border: 1px solid #ddd;
  font-size: 15px;
  box-sizing: border-box;
}

.auth-container input:focus {
  outline: none;
  border-color: #007aff;
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.auth-container button {
  width: 100%;
  margin-top: 10px;
  padding: 14px;
  font-size: 16px;
}

.auth-container a {
  color: #007aff;
  text-decoration: none;
}

.auth-container a:hover {
  text-decoration: underline;
}

.msg {
  color: red;
  margin-top: 15px;
  font-size: 14px;
}

/* Home Layout */

.container {
  width: 92%;
  max-width: 1400px;
  margin: 25px auto;
}

.section-title {
  font-size: 24px;
  margin: 30px 0 20px 0;
  color: #1a1a1a;
  font-weight: 700;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.category-card {
  background: white;
  padding: 30px 20px;
  border-radius: 12px;
  text-align: center;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.3s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.category-card:hover {
  background: #007aff;
  color: white;
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0, 122, 255, 0.3);
}

/* Workflow Section - 改善版 */

.workflow-section {
  margin-top: 30px;
}

.content-wrapper {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 25px;
  align-items: start;
}

.left-panel {
  position: sticky;
  top: 20px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}

.right-panel {
  background: white;
  padding: 25px;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.workflow-list {
  background: white;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.workflow-list h3 {
  margin-top: 0;
  font-size: 20px;
}

.workflow-item {
  background: #f8f9fa;
  padding: 15px 18px;
  margin-bottom: 12px;
  border-radius: 10px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s;
  font-size: 15px;
}

.workflow-item:hover {
  background: #e7f3ff;
  border-color: #007aff;
  transform: translateX(5px);
}

/* Form + Result */

.variable-form {
  margin-bottom: 25px;
  min-height: 100px;
}

.variable-form input {
  width: 100%;
  padding: 12px;
  margin: 8px 0;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 15px;
  box-sizing: border-box;
}

.variable-form input:focus {
  outline: none;
  border-color: #007aff;
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.result-panel {
  margin-top: 25px;
}

.result-panel h3 {
  margin-top: 0;
  margin-bottom: 15px;
  color: #1a1a1a;
  font-size: 18px;
}

.result-panel textarea {
  width: 100%;
  height: 300px;
  padding: 15px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-family: "Courier New", monospace;
  font-size: 14px;
  resize: vertical;
  box-sizing: border-box;
}

.result-panel textarea:focus {
  outline: none;
  border-color: #007aff;
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

/* RWD - 響應式設計 */

@media (max-width: 1024px) {
  .content-wrapper {
    grid-template-columns: 1fr;
  }
  
  .left-panel {
    position: static;
    max-height: none;
  }
}

@media (max-width: 768px) {
  .category-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
  }
  
  .container {
    width: 95%;
  }
  
  .right-panel {
    padding: 20px;
  }
  
  .result-panel textarea {
    height: 250px;
  }
}

@media (max-width: 480px) {
  .category-grid {
    grid-template-columns: 1fr;
  }
  
  .header {
    flex-direction: column;
    gap: 10px;
    text-align: center;
  }
  
  .logo {
    font-size: 18px;
  }
  
  #usageInfo {
    font-size: 13px !important;
  }
}

/* 滾動條美化 */

.left-panel::-webkit-scrollbar,
.result-panel textarea::-webkit-scrollbar {
  width: 8px;
}

.left-panel::-webkit-scrollbar-track,
.result-panel textarea::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

.left-panel::-webkit-scrollbar-thumb,
.result-panel textarea::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 10px;
}

.left-panel::-webkit-scrollbar-thumb:hover,
.result-panel textarea::-webkit-scrollbar-thumb:hover {
  background: #999;
}

/* 載入動畫 */

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.category-card,
.workflow-item {
  animation: fadeIn 0.3s ease-in-out;
}
