:root {
    --bg: #fafafa;
    --text: #222;
    --accent: #5e6ad2;
    --accent-hover: #4b55a8;
    --surface: #ffffff;
    --border: #e0e0e0;
    --action: #e74c3c;
    --dialogue: #f39c12;
    --description: #3498db;
    --font: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--font);
    line-height: 1.6;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--accent);
}

nav a {
    text-decoration: none;
    color: var(--text);
    margin-left: 1.5rem;
    font-size: 0.9rem;
}

nav a:hover {
    color: var(--accent);
}

section {
    margin-top: 4rem;
    margin-bottom: 4rem;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--accent);
}

.hero p {
    font-size: 1.1rem;
    max-width: 800px;
    margin-bottom: 2rem;
}

h2 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
}

h3 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
}

.app-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
    margin-top: 2rem;
}

.controls {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.chapter-input {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.chapter-input h4 {
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
}

.remove-btn {
    background: none;
    border: none;
    color: var(--action);
    cursor: pointer;
    font-size: 0.8rem;
}

.input-group {
    display: flex;
    margin-bottom: 0.5rem;
    align-items: center;
}

.input-group label {
    width: 80px;
    font-size: 0.85rem;
}

.input-group input {
    width: 60px;
    padding: 0.25rem;
    border: 1px solid var(--border);
    border-radius: 4px;
}

button {
    width: 100%;
    padding: 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    margin-top: 0.5rem;
    transition: background 0.2s;
}

button.primary {
    background: var(--accent);
    color: white;
    border: none;
    margin-top: 1rem;
}

button:hover {
    background: #f0f0f0;
}

button.primary:hover {
    background: var(--accent-hover);
}

.visualization {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.heatmap-container {
    flex-grow: 1;
    min-height: 250px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1rem;
    position: relative;
    overflow-x: auto;
}

.placeholder-text {
    align-self: center;
    color: #888;
}

.bar-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 40px;
    margin: 0 10px;
    justify-content: flex-end;
}

.bar-segment {
    width: 100%;
    transition: height 0.3s ease;
}

.bar-segment.action { background-color: var(--action); }
.bar-segment.dialogue { background-color: var(--dialogue); }
.bar-segment.description { background-color: var(--description); }

.bar-label {
    text-align: center;
    font-size: 0.75rem;
    margin-top: 5px;
}

.legend {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.legend-item {
    display: flex;
    align-items: center;
    font-size: 0.85rem;
}

.color-box {
    width: 12px;
    height: 12px;
    margin-right: 0.5rem;
    border-radius: 2px;
}

.color-box.action { background-color: var(--action); }
.color-box.dialogue { background-color: var(--dialogue); }
.color-box.description { background-color: var(--description); }

.guide p {
    margin-bottom: 1rem;
}

.guide-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.card {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border);
}

footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 2rem 0;
    margin-top: 4rem;
    text-align: center;
}

footer .container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

@media (max-width: 768px) {
    .app-grid {
        grid-template-columns: 1fr;
    }
}



/* 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;
}
