:root {
    --bg-color: #121212;
    --surface-color: #1e1e1e;
    --primary-color: #6a5acd;
    --primary-hover: #7b68ee;
    --text-color: #e0e0e0;
    --text-muted: #a0a0a0;
    --border-color: #333;
    --error-color: #ff5252;

    --font-body: 'Inter', sans-serif;
    --font-heading: 'Space Grotesk', sans-serif;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-body);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

header, main, footer {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

header {
    text-align: center;
    padding-top: 3rem;
    padding-bottom: 3rem;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    width: 80px;
    height: 80px;
    margin-bottom: 1.5rem;
}

h1, h2 {
    font-family: var(--font-heading);
    color: white;
    margin-bottom: 1rem;
    line-height: 1.3;
}

h1 {
    font-size: clamp(2.5rem, 5vw, 3.5rem);
}

h2 {
    font-size: clamp(1.8rem, 4vw, 2.2rem);
    border-left: 4px solid var(--primary-color);
    padding-left: 1rem;
    margin-top: 2rem;
}

.subtitle {
    font-size: 1.2rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 1rem auto 0;
}

#tutorial-btn {
    background: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease-in-out;
    margin-top: 1.5rem;
}

#tutorial-btn:hover {
    background-color: var(--primary-color);
    color: white;
}

strong, em {
    color: var(--primary-color);
    font-weight: 600;
}

section {
    margin-bottom: 3rem;
}

#history ol, #features ul {
    list-style-position: inside;
    padding-left: 0.5rem;
}

#history li, #features li {
    margin-bottom: 1rem;
    color: var(--text-muted);
}

#history li::marker, #features li::marker {
    color: var(--primary-color);
    font-weight: bold;
}

#history li strong, #features li strong {
    color: var(--text-color);
    font-weight: normal;
}

#comments {
    margin-top: 3rem;
}

#comments h2 {
    margin-top: 0;
    border: none;
    padding: 0;
}

#comment-form {
    margin: 1.5rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.comment-input-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem;
    transition: border-color 0.2s;
}

.comment-input-wrapper:focus-within {
     outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(106, 90, 205, 0.3);
}

#comment-input {
    flex-grow: 1;
    background-color: transparent;
    border: none;
    color: var(--text-color);
    font-family: var(--font-body);
    font-size: 1rem;
    resize: vertical;
    padding: 0.5rem;
}

#comment-input:focus {
    outline: none;
}

#post-comment-btn {
    align-self: flex-end;
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.2s;
}

#post-comment-btn:hover {
    background-color: var(--primary-hover);
}

#post-comment-btn:disabled {
    background-color: #555;
    cursor: not-allowed;
}

#comments-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.comment-item {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    position: relative;
    overflow: hidden;
}

.comment-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.comment-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
}

.comment-author {
    font-weight: 600;
    color: var(--text-color);
}

.comment-date {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-left: auto;
}

.comment-body {
    padding-left: calc(36px + 0.75rem); /* Align with author name */
}

.comment-body p:last-child {
    margin-bottom: 0;
}

.comment-body img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 6px;
    margin-top: 0.5rem;
}

.tip-comment {
    border-left: 4px solid gold;
}

.tip-banner {
    position: absolute;
    top: 0;
    right: 0;
    background-color: gold;
    color: #333;
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
    font-weight: bold;
    border-bottom-left-radius: 8px;
}

#tool {
    background-color: var(--surface-color);
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    margin-top: 2rem;
}

#tool h2 {
    margin-top: 0;
    border: none;
    padding: 0;
}

form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

fieldset {
    border: none;
    padding: 0;
}

legend {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: white;
}

.radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.radio-group label {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    background-color: var(--bg-color);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease-in-out;
}

.radio-group label:hover {
    border-color: var(--primary-color);
}

input[type="radio"] {
    margin-right: 0.5rem;
    accent-color: var(--primary-color);
}

.mode-info {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: block;
    margin-top: 0.5rem;
}

textarea {
    width: 100%;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    color: var(--text-color);
    font-family: var(--font-body);
    font-size: 1rem;
    resize: vertical;
    transition: border-color 0.2s;
}

textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(106, 90, 205, 0.3);
}

button[type="submit"] {
    background-color: var(--primary-color);
    color: white;
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: bold;
    border: none;
    padding: 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
}

button[type="submit"]:hover {
    background-color: var(--primary-hover);
}

#output-container {
    margin-top: 2rem;
    min-height: 50px;
}

#prompt-output {
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem 1.5rem;
    font-size: 0.95rem;
}

#prompt-output h3 {
    font-family: var(--font-heading);
    color: var(--primary-color);
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

#prompt-output ul {
    padding-left: 20px;
}

#prompt-output code {
    background-color: #2a2a2a;
    padding: 0.2em 0.4em;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
}

#prompt-output pre {
    background-color: #2a2a2a;
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.hidden {
    display: none !important;
}

#loader {
    width: 48px;
    height: 48px;
    border: 5px solid var(--text-color);
    border-bottom-color: var(--primary-color);
    border-radius: 50%;
    display: block;
    margin: 2rem auto;
    animation: rotation 1s linear infinite;
}

@keyframes rotation {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#error-message {
    background-color: rgba(255, 82, 82, 0.1);
    color: var(--error-color);
    border: 1px solid var(--error-color);
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
}

footer {
    text-align: center;
    margin-top: 2rem;
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Modal Styles */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-content {
    background-color: var(--surface-color);
    margin: auto;
    padding: 2rem 2.5rem;
    border: 1px solid var(--border-color);
    width: 100%;
    max-width: 650px;
    border-radius: 12px;
    position: relative;
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.close-button {
    color: var(--text-muted);
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.close-button:hover,
.close-button:focus {
    color: var(--text-color);
}

.modal-content h2 {
    margin-top: 0;
    border: none;
    padding: 0;
    font-size: 1.8rem;
    color: white;
}

.modal-content p {
    margin-bottom: 1rem;
}

.modal-content ol {
    list-style-type: decimal;
    padding-left: 20px;
}

.modal-content li {
    margin-bottom: 1.2rem;
    color: var(--text-muted);
}

.modal-content li strong {
    color: var(--text-color);
}

.modal-content ul {
    list-style-type: disc;
    padding-left: 20px;
    margin: 0.75rem 0;
}

.modal-content code {
     background-color: var(--bg-color);
    padding: 0.2em 0.4em;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    border: 1px solid var(--border-color);
}

.modal-tip {
    font-size: 0.9rem;
    background-color: var(--bg-color);
    padding: 0.75rem;
    border-radius: 6px;
    border-left: 3px solid var(--primary-color);
}

#comments-loader {
    width: 36px;
    height: 36px;
    border: 4px solid var(--text-muted);
    border-bottom-color: var(--primary-color);
}

#load-more-comments {
    display: block;
    margin: 2rem auto 0;
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 0.5rem 1.5rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

#load-more-comments:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.error-text {
    color: var(--error-color);
    text-align: center;
}