/* ---------- Design tokens (shared with zoelin.me) ---------- */
:root {
  --bg: #ffffff;
  --bg-alt: #f4f9fd;
  --surface: #eaf3fb;
  --surface-border: #d3e6f5;
  --text: #0a2a43;
  --text-dim: #4a6178;
  --accent: #0a2a43;
  --accent-2: #2f6fad;
  --gradient: linear-gradient(135deg, var(--accent), var(--accent-2));
  --radius: 14px;
  --max-width: 880px;
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg-alt);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans TC", sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: Georgia, "Noto Serif TC", serif;
  line-height: 1.3;
  margin: 0 0 .5em;
  color: var(--text);
}

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

p { margin: 0 0 1em; color: var(--text-dim); }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- Header ---------- */
header.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--surface-border);
  padding: 14px 0;
}
.nav-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.logo {
  font-family: Georgia, serif;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--text);
}
.logo .sub {
  font-family: -apple-system, sans-serif;
  font-weight: 400;
  font-size: .8rem;
  color: var(--text-dim);
  display: block;
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .9rem;
}
.user-chip img {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--surface-border);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: 999px;
  font-size: .95rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: opacity .2s ease, transform .15s ease;
}
.btn:hover { opacity: .92; text-decoration: none; }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--gradient); color: #fff; }
.btn-ghost { background: transparent; border: 1px solid var(--surface-border); color: var(--text); }
.btn-google {
  background: #fff;
  color: #3c4043;
  border: 1px solid #dadce0;
  box-shadow: 0 1px 2px rgba(0,0,0,.08);
}
.btn-google svg { width: 18px; height: 18px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Hero (index page) ---------- */
.hero {
  padding: 72px 0 48px;
  text-align: center;
}
.hero h1 { font-size: 2.1rem; }
.hero .tagline { color: var(--accent-2); font-size: 1rem; margin-bottom: 24px; }
.hero p.lead { max-width: 560px; margin: 0 auto 30px; font-size: 1.02rem; }

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  max-width: 760px;
  margin: 40px auto 0;
  text-align: left;
}
.feature-card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  padding: 18px 20px;
  transition: border-color .15s ease, transform .15s ease;
}
a.feature-card:hover {
  border-color: var(--accent-2);
  transform: translateY(-2px);
  text-decoration: none;
}
.feature-card h3 { font-size: 1rem; margin-bottom: 6px; color: var(--text); }
.feature-card p { font-size: .88rem; margin: 0; }
.feature-card .subtitle {
  color: var(--accent-2);
  font-size: .8rem;
  margin-bottom: 8px;
}

/* ---------- Cards / forms (generator page) ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 20px;
}
.card h2 { font-size: 1.15rem; margin-bottom: 14px; }

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field label { font-size: .85rem; color: var(--text-dim); font-weight: 600; }
select, input[type="file"] {
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid var(--surface-border);
  background: #fff;
  color: var(--text);
  font-size: .92rem;
}
select:focus, input:focus { outline: 2px solid var(--accent-2); outline-offset: 1px; }

.source-toggle {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.divider { border: none; border-top: 1px solid var(--surface-border); margin: 20px 0; }

/* ---------- Processing overlay ---------- */
#processing-message {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 42, 67, 0.55);
  backdrop-filter: blur(2px);
  color: #fff;
  z-index: 999;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 10px;
}
#processing-message h2 { color: #fff; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .45; } }

/* ---------- Result area ---------- */
#music-sheet {
  width: 100%;
  overflow-x: auto;
}
/* 只有真的塞了樂譜內容才顯示卡片外框，避免產生結果之前先出現一個空白大方框 */
#music-sheet:not(:empty) {
  min-height: 300px;
  background: #fff;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  padding: 16px;
  margin: 20px 0;
}
#audioPlayer { display: none; width: 100%; margin: 10px 0 20px; }

.error-panel {
  display: none;
  background: #fdeeee;
  border: 1px solid #f3c6c6;
  border-radius: var(--radius);
  padding: 18px 22px;
  color: #7a2323;
}
.error-panel h3 { color: #7a2323; margin-bottom: 8px; }
.error-panel ol { margin: 10px 0 0; padding-left: 20px; }
.error-panel li { margin-bottom: 6px; }

footer.site-footer {
  padding: 30px 0 50px;
  text-align: center;
  color: var(--text-dim);
  font-size: .85rem;
}
