:root { --bg: #f4f4f4; --panel: #fff; --border: #000; }

html { scroll-behavior: smooth; }

body { 
    font-family: 'Comic Sans MS', 'Chalkboard SE', sans-serif; 
    background: var(--bg); 
    margin: 0; 
    display: flex; 
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* --- Header --- */
header {
    background: var(--panel);
    border-bottom: 3px solid var(--border);
    padding: 10px 30px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    flex-shrink: 0;
    z-index: 100;
    position: relative;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    height: 76px;
    box-sizing: border-box;
}

.header-brand { justify-self: start; text-align: left; white-space: nowrap; }
.header-brand h1 { margin: 0; font-size: 1.4rem; text-transform: uppercase; letter-spacing: 1px; line-height: 1.1; }
.header-brand p { margin: 2px 0 0 0; font-size: 0.8rem; color: #666; }

.main-nav { justify-self: center; display: flex; gap: 20px; }
.main-nav a {
    text-decoration: none; color: #000; font-weight: bold; font-size: 1rem;
    padding: 8px 15px; border: 2px solid transparent; border-radius: 6px;
    transition: all 0.2s; white-space: nowrap;
}
.main-nav a:hover { border-color: #000; background: #eee; transform: translateY(-2px); }

/* --- Main Scroll Area --- */
#main-scroll-area {
    flex: 1;
    overflow-y: auto;
    scroll-behavior: smooth;
}

/* --- App Container --- */
#app-container {
    display: flex;
    height: calc(100vh - 76px); 
    min-height: 550px;
    border-bottom: 3px solid var(--border);
    position: relative;
    overflow: hidden;
}

/* --- Sidebar --- */
.sidebar { 
    width: 400px;
    background: var(--panel); 
    padding: 15px; 
    border-right: 3px solid var(--border); 
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    align-content: start;
    overflow-y: auto;
    box-shadow: 4px 0 10px rgba(0,0,0,0.1); 
    z-index: 10;
}

.sidebar h2 { grid-column: 1 / -1; margin: 0 0 5px 0; text-align: center; border-bottom: 3px solid #000; padding-bottom: 5px; font-size: 1.4rem; }
.sidebar > .group:first-of-type { grid-column: 1 / -1; }
.sidebar > .row { grid-column: 1 / -1; }
.sidebar > button { grid-column: 1 / -1; }
.sidebar > .btn-row { grid-column: 1 / -1; }

.group { display: flex; flex-direction: column; gap: 5px; background: #fafafa; padding: 10px; border-radius: 6px; border: 1px solid #eee; }
.row { display: flex; gap: 10px; align-items: center; }
label { font-weight: bold; font-size: 0.75rem; display: flex; justify-content: space-between; color:#333; }
.val { font-weight: normal; font-size: 0.7rem; color: #666; }

select, input[type=range] { padding: 2px; border: 2px solid #000; border-radius: 4px; font-family: inherit; flex: 1; height: 28px;}
input[type=color] { border: 2px solid #000; width: 35px; height: 28px; padding: 0; border-radius: 4px; overflow: hidden; cursor: pointer; }

.btn-row { display: flex; gap: 10px; margin-top: 5px; }
button { flex: 1; background: #000; color: #fff; border: none; padding: 20px; font-weight: bold; cursor: pointer; border-radius: 6px; font-size: 0.9rem; transition: 0.1s; }
button:hover { background: #444; transform: scale(1.02); }
button.sec { background: #fff; color: #000; border: 3px solid #000; }

#canvas-box { flex: 1; display: flex; justify-content: center; align-items: center; background-image: radial-gradient(#ccc 1px, transparent 1px); background-size: 20px 20px; overflow: hidden; }
#canvas { background: white; border: 4px solid #000; box-shadow: 10px 10px 0 rgba(0,0,0,0.2); transition: all 0.1s; 
    max-width: 90%; max-height: 90%; width: auto; height: auto; aspect-ratio: 1/1; display:flex;
}
#canvas svg { width: 100%; height: 100%; }

optgroup { font-weight: bold; color: #444; }

/* --- Showcase --- */
.showcase-section { padding: 60px 20px; background: #fff8e1; border-bottom: 3px solid var(--border); }
.showcase-inner { max-width: 1000px; margin: 0 auto; }
.showcase-header { text-align: center; margin-bottom: 30px; }
.showcase-header h2 { border-bottom: none; font-size: 2rem; }
.showcase-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; }
.show-card { background: #fff; border: 3px solid #000; border-radius: 8px; overflow: hidden; display: flex; flex-direction: column; transition: transform 0.2s; }
.show-card:hover { transform: translateY(-5px); box-shadow: 5px 5px 0 rgba(0,0,0,0.2); }
.show-img { height: 200px; border-bottom: 3px solid #000; background: radial-gradient(#eee 1px, transparent 1px); background-size: 10px 10px; display: flex; justify-content: center; align-items: center; padding: 10px; }
.show-img svg { width: 100%; height: 100%; max-width: 180px; } 
.show-content { padding: 15px; text-align: center; background: #fff; flex: 1; display: flex; flex-direction: column; justify-content: center;}
.show-name { font-weight: bold; font-size: 1.1rem; display: block; margin-bottom: 5px;}
.show-desc { font-size: 0.85rem; color: #555; line-height: 1.4; }

/* --- SEO & Footer --- */
.seo-section { background: var(--bg); padding: 60px 20px; display: flex; justify-content: center; }
.seo-container { background: var(--panel); border: 3px solid var(--border); border-radius: 8px; box-shadow: 8px 8px 0 rgba(0,0,0,0.1); max-width: 900px; width: 100%; padding: 30px; }
.qa-item { margin-bottom: 20px; border-bottom: 1px dashed #ccc; padding-bottom: 20px; }
.qa-item:last-child { border-bottom: none; }
.qa-question { font-weight: bold; font-size: 1.1rem; margin-bottom: 10px; display: flex; align-items: center; }
.qa-question::before { content: "Q:"; background: #000; color: #fff; padding: 2px 6px; border-radius: 4px; margin-right: 10px; font-size: 0.9rem; }
.qa-answer { color: #444; line-height: 1.6; padding-left: 35px; }
.tag-cloud { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.tag { background: #eee; padding: 5px 10px; border: 1px solid #000; border-radius: 20px; font-size: 0.8rem; color: #333; }

footer { background: #222; color: #fff; padding: 30px 20px; text-align: center; border-top: 4px solid #000; }
.footer-content p { margin: 5px 0; font-size: 0.9rem; opacity: 0.8; }

@media (max-width: 900px) {
    header { display: flex; flex-direction: column; text-align: center; padding: 15px; gap: 15px; height: auto; }
    .header-brand { justify-self: center; text-align: center; }
    .main-nav { width: 100%; flex-wrap: wrap; justify-content: center; }
    #app-container { flex-direction: column; min-height: auto; height: auto; overflow: visible; }
    .sidebar { width: auto; border-right: none; border-bottom: 3px solid var(--border); display:flex; flex-direction: column; }
    #canvas-box { padding: 40px 0; min-height: 350px; }
    body { overflow: auto; height: auto; }
    #main-scroll-area { overflow: visible; }
}
