/* ===== Reset & Base ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0f0f1a;
  --surface: #1a1a2e;
  --surface-hover: #25254a;
  --primary: #e94560;
  --primary-light: #ff6b81;
  --accent: #00d2d3;
  --text: #eaeaea;
  --text-muted: #8888a0;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(0, 0, 0, .4);
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Noto Sans TC', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  touch-action: manipulation;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ===== Shared Layout ===== */
.page-wrapper {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* ===== Header / Nav ===== */
.site-header {
  text-align: center;
  padding: 2.5rem 1rem 1.5rem;
}

.site-header h1 {
  font-size: 2.2rem;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.site-header p {
  color: var(--text-muted);
  margin-top: .4rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  transition: color .2s;
}

.back-link:hover {
  color: var(--primary-light);
}

/* ===== Card Grid (Home) ===== */
.section-title {
  font-size: 1.3rem;
  margin-bottom: 1rem;
  padding-left: .25rem;
  border-left: 4px solid var(--primary);
  padding-left: .75rem;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  box-shadow: var(--shadow);
  transition: transform .2s, background .2s;
  display: flex;
  flex-direction: column;
  gap: .6rem;
}

.card:hover {
  transform: translateY(-4px);
  background: var(--surface-hover);
}

.card .icon {
  font-size: 2.4rem;
}

.card h3 {
  font-size: 1.15rem;
}

.card p {
  color: var(--text-muted);
  font-size: .9rem;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .65rem 1.4rem;
  border: none;
  border-radius: 8px;
  font-size: .95rem;
  font-family: inherit;
  cursor: pointer;
  transition: background .2s, transform .1s;
}

.btn:active {
  transform: scale(.97);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-light);
}

.btn-secondary {
  background: var(--surface-hover);
  color: var(--text);
  border: 1px solid #333;
}

.btn-secondary:hover {
  background: #2f2f55;
}

/* ===== Form Controls ===== */
textarea,
input[type="file"],
input[type="text"] {
  width: 100%;
  padding: .7rem 1rem;
  background: var(--surface);
  border: 1px solid #333;
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: .95rem;
  resize: vertical;
}

textarea:focus,
input:focus {
  outline: none;
  border-color: var(--primary);
}

label {
  display: block;
  margin-bottom: .35rem;
  font-size: .9rem;
  color: var(--text-muted);
}

/* ===== Utilities ===== */
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 1rem; }
.flex-row {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
  .site-header h1 { font-size: 1.6rem; }
  .card-grid { grid-template-columns: 1fr; }
  .page-wrapper { padding: 1.5rem 1rem 3rem; }

  .btn,
  .tab-btn,
  select,
  input[type="text"],
  input[type="number"],
  input[type="file"] {
    min-height: 44px;
  }

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