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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f8f9fa;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navbar */
.navbar {
    background: #2c3e50;
    padding: 0 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.nav-inner {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 3.5rem;
    flex-wrap: wrap;
}

.nav-brand {
    color: #fff;
    font-weight: 700;
    font-size: 1.15rem;
    text-decoration: none;
    letter-spacing: 0.03em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-brand img {
    height: 2rem;
}

.nav-links {
    display: flex;
    gap: 0.3rem;
}

.nav-links a {
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    padding: 0.45rem 0.9rem;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: background 0.15s, color 0.15s;
}

.nav-links a:hover {
    color: #fff;
    background: rgba(255,255,255,0.1);
}

.nav-links a.active {
    color: #fff;
    background: rgba(255,255,255,0.15);
}

.nav-logout {
    background: none;
    border: 1px solid rgba(255,255,255,0.3);
    color: rgba(255,255,255,0.7);
    padding: 0.3rem 0.7rem;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.nav-logout:hover {
    color: #fff;
    background: rgba(255,255,255,0.1);
}

/* Login */
.login-box {
    background: #fff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    max-width: 380px;
    margin: 4rem auto;
}

.login-box h2 {
    color: #2c3e50;
    margin-bottom: 1.2rem;
    text-align: center;
}

.login-error {
    color: #e74c3c;
    font-size: 0.9rem;
    text-align: center;
    margin-bottom: 1rem;
}

/* Layout */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem 2rem;
    flex: 1;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    font-size: 2rem;
    color: #2c3e50;
}

.subtitle {
    color: #666;
    margin-top: 0.4rem;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.section-header h2 {
    color: #2c3e50;
}

.back {
    display: inline-block;
    margin-bottom: 1rem;
    color: #3498db;
    text-decoration: none;
}

.back:hover {
    text-decoration: underline;
}

/* Form */
.create-form {
    background: #fff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 2rem;
}

.create-form h2 {
    margin-bottom: 1.5rem;
    color: #2c3e50;
}

.form-group {
    margin-bottom: 1.2rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.3rem;
    color: #444;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.form-group small {
    display: block;
    color: #888;
    margin-top: 0.2rem;
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-row .form-group {
    flex: 1;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.7rem 1.5rem;
    background: #3498db;
    color: #fff;
    border: 2px solid #3498db;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
    line-height: 1.4;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
    box-sizing: border-box;
}

a.btn, a.btn:visited { color: #fff; }
a.btn.btn-outline, a.btn.btn-outline:visited { color: #3498db; }
a.btn.btn-outline:hover { color: #fff; }

.btn:hover {
    background: #2980b9;
    border-color: #2980b9;
    color: #fff;
}

.btn-outline {
    background: transparent;
    color: #3498db;
}

.btn-outline:hover {
    background: #3498db;
    color: #fff;
}

.btn-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

.btn-danger {
    background: #e74c3c;
    border-color: #e74c3c;
    color: #fff;
}

a.btn.btn-danger, a.btn.btn-danger:visited { color: #fff; }

.btn-danger:hover {
    background: #c0392b;
    border-color: #c0392b;
}

.btn-disabled {
    opacity: 0.4;
    cursor: default;
    pointer-events: none;
}

.inline-form .btn {
    font-family: inherit;
    line-height: 1.4;
}

/* Puzzle cards */
.puzzle-list h2 {
    margin-bottom: 1rem;
    color: #2c3e50;
}

.tag-search {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.tag-search input {
    flex: 1;
    padding: 0.6rem 1rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.95rem;
}

.tag-search input:focus {
    outline: none;
    border-color: #3498db;
}

.puzzles {
    display: grid;
    gap: 1rem;
}

.puzzle-card {
    background: #fff;
    padding: 1.2rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.puzzle-card h3 a {
    color: #2c3e50;
    text-decoration: none;
}

.puzzle-card h3 a:hover {
    color: #3498db;
}

.puzzle-card .meta {
    color: #888;
    font-size: 0.9rem;
    margin: 0.3rem 0;
}

.puzzle-card .words {
    color: #555;
    font-size: 0.85rem;
    margin-bottom: 0.8rem;
}

/* Status badges */
.status-pending {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    background: #fef3cd;
    color: #856404;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-failed {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    background: #f8d7da;
    color: #721c24;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Tags */
.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.8rem;
}

.tag {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    background: #eef2f7;
    color: #3498db;
    border-radius: 12px;
    font-size: 0.8rem;
    text-decoration: none;
    transition: background 0.15s;
}

.tag:hover {
    background: #d5e4f2;
}

.puzzle-card .actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Manage table */
.manage-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.manage-table th,
.manage-table td {
    padding: 0.8rem 1rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.manage-table th {
    background: #f1f3f5;
    font-weight: 600;
    color: #444;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.manage-table td a {
    color: #3498db;
    text-decoration: none;
}

.manage-table td a:hover {
    text-decoration: underline;
}

.manage-table td a.btn {
    color: #fff;
}

.manage-table td a.btn.btn-outline {
    color: #3498db;
}

.manage-table td a.btn.btn-outline:hover {
    color: #fff;
}

.tags-cell {
    min-width: 160px;
}

.tags-form {
    display: flex;
    gap: 0.3rem;
    align-items: center;
}

.tags-input {
    width: 120px;
    padding: 0.3rem 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.8rem;
    font-family: inherit;
}

.tags-input:focus {
    outline: none;
    border-color: #3498db;
}

.action-cell {
    display: flex;
    gap: 0.4rem;
    align-items: center;
    flex-wrap: wrap;
}

.inline-form {
    display: inline;
    margin: 0;
    padding: 0;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e8e8e8;
}

.page-info {
    color: #666;
    font-size: 0.9rem;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #888;
}

.empty-state a {
    color: #3498db;
}

/* Puzzle view */
.puzzle-view {
    background: #fff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.grid {
    display: inline-block;
    margin: 0 auto;
    text-align: center;
    width: 100%;
}

.grid-row {
    display: flex;
    justify-content: center;
}

.cell {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.2rem;
    height: 2.2rem;
    font-family: "Courier New", monospace;
    font-size: 1.1rem;
    font-weight: bold;
    color: #2c3e50;
}

.word-list {
    margin-top: 1.5rem;
    text-align: center;
}

.word-list h3 {
    margin-bottom: 0.8rem;
    color: #2c3e50;
}

.word-list ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem 1.5rem;
}

.word-list li {
    font-size: 1rem;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Error box */
.error-box {
    background: #fff;
    border-left: 4px solid #e74c3c;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    text-align: center;
    max-width: 500px;
    margin: 3rem auto;
}

.error-box h2 {
    color: #e74c3c;
    margin-bottom: 0.8rem;
}

.error-box p {
    color: #555;
    margin-bottom: 1.5rem;
}

.error-actions {
    margin-bottom: 1.5rem;
}

.support-nudge {
    font-size: 0.85rem;
    color: #888;
    border-top: 1px solid #eee;
    padding-top: 1rem;
    margin-bottom: 0;
}

.support-nudge a {
    color: #3498db;
}

/* Support page */
.support-page {
    max-width: 700px;
    margin: 0 auto;
}

.support-story {
    background: #fff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 2rem;
}

.support-story h2 {
    color: #2c3e50;
    margin-bottom: 1rem;
}

.support-story p {
    color: #555;
    margin-bottom: 1rem;
}

.support-story p:last-child {
    margin-bottom: 0;
}

.support-tiers {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.tier-card {
    background: #fff;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    text-align: center;
    position: relative;
    border: 2px solid transparent;
}

.tier-card.featured {
    border-color: #3498db;
}

.tier-badge {
    position: absolute;
    top: -0.7rem;
    left: 50%;
    transform: translateX(-50%);
    background: #3498db;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.8rem;
    border-radius: 10px;
    white-space: nowrap;
}

.tier-card h3 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.tier-price {
    font-size: 1.4rem;
    font-weight: 700;
    color: #3498db;
    margin-bottom: 0.8rem;
}

.tier-card p {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.tier-card .btn {
    width: 100%;
}

.support-local {
    background: #fff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 2rem;
}

.support-local h2 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.support-local > p {
    color: #666;
    margin-bottom: 1.5rem;
}

.qr-main {
    text-align: center;
    margin-bottom: 1.5rem;
}

.qr-main img {
    width: 100%;
    max-width: 220px;
    border-radius: 8px;
    border: 1px solid #eee;
}

.qr-main h3 {
    color: #2c3e50;
    margin-top: 0.6rem;
    font-size: 1rem;
}

.qr-alt {
    text-align: center;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.qr-alt > p {
    color: #888;
    font-size: 0.9rem;
    margin-bottom: 0.8rem;
}

.qr-alt-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 1rem;
}

.qr-overlay img {
    width: 100%;
    max-width: 220px;
    border-radius: 8px;
    border: 1px solid #eee;
    margin-top: 0.5rem;
}

.qr-overlay h3 {
    color: #2c3e50;
    margin-top: 0.6rem;
    font-size: 1rem;
}

.support-cause {
    margin-bottom: 2rem;
}

.support-cause h2 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.support-cause > p {
    color: #666;
    margin-bottom: 1.5rem;
}

.support-other {
    background: #fff;
    padding: 1.5rem 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.support-other h3 {
    color: #2c3e50;
    margin-bottom: 0.8rem;
}

.support-other ul {
    list-style: disc;
    padding-left: 1.5rem;
    color: #555;
}

.support-other li {
    margin-bottom: 0.4rem;
}

/* Benefits page */
.benefits-page {
    max-width: 750px;
    margin: 0 auto;
}

.benefit-card {
    background: #fff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 1.5rem;
}

.benefit-card h2 {
    color: #2c3e50;
    margin-bottom: 0.8rem;
    font-size: 1.3rem;
}

.benefit-card p {
    color: #555;
    margin-bottom: 0.8rem;
    line-height: 1.7;
}

.benefit-card em {
    font-style: italic;
}

.benefit-sources {
    list-style: none;
    padding: 0;
    margin-top: 1rem;
    padding-top: 0.8rem;
    border-top: 1px solid #eee;
}

.benefit-sources li {
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
}

.benefit-sources a {
    color: #3498db;
    text-decoration: none;
}

.benefit-sources a:hover {
    text-decoration: underline;
}

.benefits-cta {
    background: #2c3e50;
    color: #fff;
    padding: 2.5rem;
    border-radius: 8px;
    text-align: center;
    margin-top: 2rem;
}

.benefits-cta h2 {
    color: #fff;
    margin-bottom: 0.5rem;
}

.benefits-cta p {
    color: rgba(255,255,255,0.8);
    margin-bottom: 1.5rem;
}

.benefits-cta-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.benefits-cta .btn-outline {
    border-color: rgba(255,255,255,0.5);
    color: #fff;
}

.benefits-cta .btn-outline:hover {
    background: rgba(255,255,255,0.15);
    border-color: #fff;
}

/* How To page */
.howto-page {
    max-width: 750px;
    margin: 0 auto;
}

.howto-step {
    display: flex;
    gap: 1.5rem;
    background: #fff;
    padding: 1.5rem 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 1.2rem;
}

.step-number {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    background: #3498db;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    margin-top: 0.2rem;
}

.step-content {
    flex: 1;
    min-width: 0;
}

.step-content h2 {
    color: #2c3e50;
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.step-content p {
    color: #555;
    margin-bottom: 0.5rem;
}

.step-content ul {
    padding-left: 1.2rem;
    color: #555;
    margin-bottom: 0.5rem;
    list-style-position: outside;
}

.step-content li {
    margin-bottom: 0.3rem;
}

.howto-tip {
    background: #fff8e1;
    padding: 1.5rem 2rem;
    border-radius: 8px;
    border-left: 4px solid #f0c040;
    margin-bottom: 1.5rem;
    margin-top: 1.5rem;
}

.howto-tip h2 {
    color: #2c3e50;
    font-size: 1.2rem;
    margin-bottom: 0.8rem;
}

.howto-tip ul {
    padding-left: 1.5rem;
    color: #555;
}

.howto-tip li {
    margin-bottom: 0.4rem;
}

/* Footer */
.site-footer {
    background: #2c3e50;
    padding: 1.8rem 1.5rem;
    margin-top: auto;
}

.footer-inner {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.8rem;
}

.footer-inner p {
    color: rgba(255,255,255,0.5);
    font-size: 0.85rem;
    margin: 0;
}

.footer-support {
    color: rgba(255,255,255,0.7);
    font-size: 0.85rem;
    text-decoration: none;
    padding: 0.35rem 0.9rem;
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 4px;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.footer-support:hover {
    color: #fff;
    border-color: rgba(255,255,255,0.5);
    background: rgba(255,255,255,0.1);
}

.footer-links a,
.footer-links a:visited {
    color: rgba(255,255,255,0.5);
    text-decoration: none;
    font-size: 0.8rem;
    margin-left: 0.5rem;
}

.footer-links a:hover {
    color: rgba(255,255,255,0.8);
}

.footer-support:visited {
    color: rgba(255,255,255,0.7);
}

/* Legal pages (privacy, terms) */
.legal-page {
    max-width: 750px;
    margin: 0 auto;
}

.legal-section {
    background: #fff;
    padding: 1.5rem 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 1.2rem;
}

.legal-section h2 {
    color: #2c3e50;
    font-size: 1.2rem;
    margin-bottom: 0.6rem;
}

.legal-section h3 {
    color: #2c3e50;
    font-size: 1rem;
    margin-top: 1rem;
    margin-bottom: 0.4rem;
}

.legal-section p {
    color: #555;
    margin-bottom: 0.6rem;
    line-height: 1.7;
}

.legal-section ul {
    padding-left: 1.2rem;
    color: #555;
    margin-bottom: 0.6rem;
}

.legal-section li {
    margin-bottom: 0.3rem;
    line-height: 1.6;
}

.legal-section a {
    color: #3498db;
}

/* Hamburger menu button */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
}

/* Mobile styles */
@media (max-width: 768px) {
    .nav-toggle {
        display: block;
    }

    .nav-inner {
        height: auto;
        padding: 0.75rem 0;
    }

    .nav-brand {
        font-size: 1rem;
    }

    .nav-brand img {
        height: 1.5rem;
    }

    .nav-links {
        display: none;
        width: 100%;
        flex-direction: column;
        gap: 0;
        padding-top: 0.5rem;
    }

    .nav-links.open {
        display: flex;
    }

    .nav-links a {
        padding: 0.6rem 0.5rem;
        border-radius: 0;
        font-size: 0.95rem;
    }

    .nav-links a:hover,
    .nav-links a.active {
        background: rgba(255,255,255,0.1);
    }

    .container {
        padding: 1.5rem 1rem;
    }

    .tag-search {
        flex-direction: column;
    }

    .puzzle-card .actions {
        flex-direction: column;
    }

    .puzzle-card .actions .btn {
        text-align: center;
    }

    .support-tiers {
        grid-template-columns: 1fr;
    }
}

/* Print styles */
@media print {
    body { background: #fff; }
    .navbar, .site-footer { display: none; }
    .container { max-width: 100%; padding: 0; }
    header a, .actions { display: none !important; }
    .puzzle-view { box-shadow: none; padding: 0; }
}
