/* ===== Reset & Base ===== */
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
html{font-size:16px;-webkit-text-size-adjust:100%;scroll-behavior:smooth}
body{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,'Helvetica Neue',Arial,sans-serif;line-height:1.6;color:#1e1e2f;background:#f8f9fc;min-height:100vh}
img,svg{max-width:100%;height:auto}
a{color:#4F46E5;text-decoration:none}
a:hover{text-decoration:underline}
ul,ol{padding-left:1.25rem}
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}

/* ===== Header ===== */
.site-header{background:#fff;border-bottom:1px solid #e2e5f1;position:sticky;top:0;z-index:100}
.header-inner{max-width:1200px;margin:0 auto;padding:.75rem 1.5rem;display:flex;align-items:center;justify-content:space-between;gap:1rem}
.logo{display:flex;align-items:center;gap:.5rem;font-weight:700;font-size:1.15rem;color:#1e1e2f;text-decoration:none}
.logo:hover{text-decoration:none}
.main-nav{display:flex;gap:1.5rem}
.main-nav a{font-size:.9rem;font-weight:500;color:#5a5f7a;text-decoration:none;padding:.25rem 0}
.main-nav a:hover{color:#4F46E5;text-decoration:none}

/* ===== Buttons ===== */
.btn{display:inline-flex;align-items:center;gap:.4rem;padding:.55rem 1.1rem;border-radius:8px;font-size:.9rem;font-weight:600;cursor:pointer;border:2px solid transparent;transition:background .15s,border-color .15s,color .15s;text-decoration:none;white-space:nowrap}
.btn:hover{text-decoration:none}
.btn-primary{background:#4F46E5;color:#fff;border-color:#4F46E5}
.btn-primary:hover{background:#4338ca;border-color:#4338ca}
.btn-secondary{background:#fff;color:#1e1e2f;border-color:#d1d5e8}
.btn-secondary:hover{background:#f0f1f7;border-color:#b8bdd4}
.btn-ghost{background:transparent;color:#5a5f7a;border-color:transparent}
.btn-ghost:hover{color:#1e1e2f;background:#f0f1f7}
.btn-icon{padding:.45rem .8rem;font-size:.85rem}
.btn-danger-text{color:#dc2626}

/* ===== Hero ===== */
.hero{max-width:1200px;margin:0 auto;padding:4rem 1.5rem 3rem;text-align:center}
.hero h1{font-size:clamp(1.8rem,4vw,2.8rem);font-weight:800;line-height:1.2;color:#1e1e2f;margin-bottom:1rem}
.hero-sub{font-size:1.1rem;color:#5a5f7a;max-width:600px;margin:0 auto 1.5rem}
.hero-actions{display:flex;gap:.75rem;justify-content:center;flex-wrap:wrap;margin-bottom:1rem}
.hero-note{font-size:.8rem;color:#8b8fa8}

/* ===== Workspace ===== */
.workspace-section{max-width:1200px;margin:0 auto;padding:0 1.5rem 3rem}
.workspace-layout{display:grid;grid-template-columns:1fr 300px;gap:1.5rem;align-items:start}
.workspace-main{background:#fff;border-radius:12px;border:1px solid #e2e5f1;padding:1.25rem}
.workspace-toolbar{display:flex;flex-wrap:wrap;gap:.75rem;align-items:center;padding-bottom:1rem;border-bottom:1px solid #eee;margin-bottom:1rem}
.toolbar-group{display:flex;align-items:center;gap:.35rem}
.toolbar-group label{font-size:.8rem;font-weight:600;color:#5a5f7a}
.toolbar-group select,.toolbar-group input[type=number]{padding:.35rem .5rem;border:1px solid #d1d5e8;border-radius:6px;font-size:.85rem;background:#fff;color:#1e1e2f}
.toolbar-group input[type=number]{width:60px}
.toolbar-actions{margin-left:auto}

/* ===== Staff ===== */
.staff-container{overflow-x:auto;margin-bottom:.75rem}
.staff-svg{width:100%;min-width:700px;height:auto;display:block}
.staff-line{stroke:#8b8fa8;stroke-width:1}
.note-head{fill:#1e1e2f}
.note-stem{stroke:#1e1e2f;stroke-width:1.5}
.note-beam{fill:#1e1e2f}
.rest-path{fill:#1e1e2f}
.clef-path{fill:#1e1e2f}
.accidental{fill:#1e1e2f;font-size:16px;font-family:serif}
.measure-line{stroke:#c4c7d8;stroke-width:1}

/* ===== Status & Actions ===== */
.workspace-status{font-size:.85rem;color:#5a5f7a;padding:.5rem .75rem;background:#f8f9fc;border-radius:6px;margin-bottom:1rem;min-height:2.25rem;display:flex;align-items:center}
.workspace-actions{display:flex;flex-wrap:wrap;gap:.5rem;align-items:center}
.workspace-actions-right{margin-left:auto;display:flex;gap:.5rem}

/* ===== Sidebar ===== */
.workspace-sidebar{display:flex;flex-direction:column;gap:1rem}
.sidebar-card{background:#fff;border-radius:12px;border:1px solid #e2e5f1;padding:1rem}
.sidebar-card h2{font-size:1rem;font-weight:700;margin-bottom:.5rem;color:#1e1e2f}
.sidebar-card ol,.sidebar-card ul{font-size:.85rem;color:#5a5f7a;padding-left:1.1rem}
.sidebar-card li{margin-bottom:.3rem}
.sidebar-note{font-size:.8rem;color:#8b8fa8;margin-top:.5rem}
.shortcuts-table{width:100%;border-collapse:collapse;font-size:.85rem}
.shortcuts-table td{padding:.25rem 0;color:#5a5f7a}
.shortcuts-table td:first-child{width:40px}
kbd{background:#f0f1f7;border:1px solid #d1d5e8;border-radius:4px;padding:.1rem .35rem;font-size:.8rem;font-family:monospace}

/* ===== Templates ===== */
.templates-section{max-width:1200px;margin:0 auto;padding:0 1.5rem 3rem}
.section-header{margin-bottom:1.5rem}
.section-header h2{font-size:1.5rem;font-weight:700;color:#1e1e2f;margin-bottom:.35rem}
.section-header p{color:#5a5f7a;font-size:.95rem}
.template-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:1rem}
.template-card{background:#fff;border:2px solid #e2e5f1;border-radius:12px;padding:1.25rem;text-align:left;cursor:pointer;transition:border-color .15s,box-shadow .15s;display:flex;flex-direction:column;gap:.35rem}
.template-card:hover{border-color:#4F46E5;box-shadow:0 4px 16px rgba(79,70,229,.1);text-decoration:none}
.template-icon{font-size:1.5rem}
.template-card h3{font-size:1rem;font-weight:700;color:#1e1e2f}
.template-card p{font-size:.85rem;color:#5a5f7a;line-height:1.5}

/* ===== Guide ===== */
.guide-section{max-width:1200px;margin:0 auto;padding:0 1.5rem 4rem}
.guide-layout{display:grid;grid-template-columns:1fr 300px;gap:2rem}
.guide-content h2{font-size:1.5rem;font-weight:700;color:#1e1e2f;margin-bottom:.75rem}
.guide-content h3{font-size:1.1rem;font-weight:700;color:#1e1e2f;margin:1.5rem 0 .5rem}
.guide-content p,.guide-content li{color:#3d3f54;font-size:.95rem;line-height:1.7}
.guide-content ul{margin-bottom:1rem}
.guide-content li{margin-bottom:.35rem}
.guide-faq{background:#fff;border-radius:12px;border:1px solid #e2e5f1;padding:1rem;position:sticky;top:80px}
.guide-faq h3{font-size:1rem;font-weight:700;color:#1e1e2f;margin-bottom:.75rem}
.guide-faq details{border-bottom:1px solid #eee;padding:.5rem 0}
.guide-faq details:last-child{border-bottom:none}
.guide-faq summary{font-size:.9rem;font-weight:600;color:#1e1e2f;cursor:pointer;list-style:none;display:flex;justify-content:space-between;align-items:center}
.guide-faq summary::-webkit-details-marker{display:none}
.guide-faq summary::after{content:'+';font-size:1.1rem;color:#8b8fa8}
.guide-faq details[open] summary::after{content:'−'}
.guide-faq details p{font-size:.85rem;color:#5a5f7a;margin-top:.4rem;line-height:1.6}

/* ===== Footer ===== */
.site-footer{background:#1e1e2f;color:#a0a3bd;margin-top:2rem}
.footer-inner{max-width:1200px;margin:0 auto;padding:2rem 1.5rem;display:flex;flex-wrap:wrap;align-items:center;gap:1rem}
.footer-brand{display:flex;flex-direction:column;gap:.15rem}
.footer-logo{font-weight:700;font-size:1rem;color:#fff}
.footer-tagline{font-size:.8rem;color:#a0a3bd}
.footer-nav{display:flex;gap:1.25rem;margin-left:auto}
.footer-nav a{font-size:.85rem;color:#a0a3bd;text-decoration:none}
.footer-nav a:hover{color:#fff}
.footer-copy{font-size:.8rem;color:#6b6e8a;width:100%;padding-top:1rem;border-top:1px solid #2d2f45;margin-top:1rem}
.footer-copy a{color:#a0a3bd}

/* ===== Responsive ===== */
@media(max-width:900px){
  .workspace-layout,.guide-layout{grid-template-columns:1fr}
  .workspace-sidebar{order:-1}
  .toolbar-actions{margin-left:0;width:100%}
  .workspace-actions-right{margin-left:0;width:100%}
  .guide-faq{position:static}
}
@media(max-width:600px){
  .header-inner{flex-direction:column;align-items:flex-start}
  .main-nav{gap:1rem;flex-wrap:wrap}
  .hero{padding:2.5rem 1rem 2rem}
  .workspace-toolbar{flex-direction:column;align-items:stretch}
  .toolbar-group{justify-content:space-between}
  .workspace-actions{flex-direction:column;align-items:stretch}
  .workspace-actions-right{flex-direction:column}
  .template-grid{grid-template-columns:1fr}
  .footer-inner{flex-direction:column;align-items:flex-start}
  .footer-nav{margin-left:0}
}

/* ===== Focus styles ===== */
:focus-visible{outline:2px solid #4F46E5;outline-offset:2px;border-radius:4px}
button:focus-visible,select:focus-visible,input:focus-visible{outline:2px solid #4F46E5;outline-offset:2px}

/* ===== Print ===== */
@media print{
  .site-header,.workspace-toolbar,.workspace-actions,.workspace-sidebar,.site-footer,.hero,.templates-section,.guide-section{display:none!important}
  .workspace-section{padding:0}
  .workspace-main{border:none;padding:0}
  .staff-container{overflow:visible}
}


/* Factory-injected deployment helpers. The AI owns the site design above this block. */
.ad-unit {
  width: min(100%, 720px);
  min-height: 120px;
  margin: 24px auto;
  display: block;
}

.legal-page {
  width: min(900px, calc(100% - 32px));
  margin: 40px auto;
}

.factory-fallback-nav {
  width: min(900px, calc(100% - 32px));
  margin: 24px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  font-size: 0.95rem;
}

.factory-fallback-nav a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
