/* Madverse - Collaborative Puzzle Poetry
 * /madverse/style.css
 * 
 * A 2Spiral game
 */

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

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

/* Site Header */
.site-header {
    background: #fff;
    border-bottom: 1px solid #e5e5e5;
    padding: 16px 40px;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.header-left {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.brand-link {
    text-decoration: none;
    color: inherit;
}

.brand-name {
    font-size: 1.1rem;
    font-weight: 300;
    color: #666;
}

.brand-name strong {
    font-weight: 600;
    color: #1a1a1a;
}

.brand-link:hover .brand-name {
    color: #4ABDB5;
}

.brand-link:hover .brand-name strong {
    color: #4ABDB5;
}

.brand-sep {
    color: #ccc;
    font-weight: 300;
}

.game-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: #1a1a1a;
}

.game-tagline {
    font-size: 0.85rem;
    color: #888;
    font-style: italic;
}

/* Main Content */
main {
    flex: 1;
    padding: 30px 40px;
}

/* Controls */
.controls {
    display: flex;
    gap: 20px;
    margin-bottom: 28px;
    flex-wrap: wrap;
    align-items: flex-start;
}

.control-box {
    border-width: 2px;
    border-style: solid;
    border-radius: 8px;
    padding: 14px 18px;
    transition: border-color 0.2s ease;
}

.control-box label {
    font-size: 0.7rem;
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: color 0.2s ease;
}

.control-box.mood-box {
    background: #f8fafc;
}

.control-box.verse-box {
    background: #fffbf7;
}

.button-group {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.button-group button {
    padding: 7px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    font-family: inherit;
    transition: all 0.15s;
    border: 1px solid #ddd;
    background: #fff;
    color: #555;
}

.button-group button.active {
    color: #fff;
    font-weight: 500;
}

.action-btn {
    background: #fff;
    color: #666;
    border: 1px solid #ddd;
    padding: 10px 18px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    font-family: inherit;
    margin-top: 24px;
    transition: all 0.15s;
}

.action-btn:hover {
    border-color: #999;
    color: #333;
}

.action-btn.primary {
    border: none;
    color: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

.action-btn.primary:hover {
    opacity: 0.85;
}

/* Main Layout */
.main-content {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

.panel {
    flex: 1;
    min-width: 300px;
}

/* Grid Panel */
.grid-panel {
    background: #fafafa;
    border-width: 2px;
    border-style: solid;
    border-radius: 8px;
    padding: 20px;
    transition: border-color 0.2s ease;
}

.panel-header {
    font-size: 0.7rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 16px;
    font-weight: 600;
}

.panel-header span {
    color: #999;
    margin-left: 8px;
    font-weight: 400;
}

/* Grid */
.grid-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.grid-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.line-label {
    font-size: 0.7rem;
    color: #999;
    width: 50px;
    text-align: right;
    padding-right: 8px;
    font-weight: 500;
}

.grid-cell {
    width: 80px;
    height: 50px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    cursor: default;
}

.grid-cell.has-word {
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid rgba(0,0,0,0.1);
}

.grid-cell.has-word span {
    color: #fff;
    font-size: 0.85rem;
    font-style: italic;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.grid-cell.selected {
    background: #fff !important;
    transform: scale(1.05);
}

.grid-cell.selected span {
    font-weight: 600;
    text-shadow: none;
}

.grid-cell.empty {
    background: #fff;
    border: 1px dashed #ddd;
}

.grid-cell.drop-target {
    background: rgba(59, 130, 246, 0.08);
    border: 2px dashed #3b82f6;
    cursor: pointer;
}

/* Word Tray */
.word-tray {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #e5e5e5;
}

.word-tray h4 {
    font-size: 0.7rem;
    color: #666;
    text-transform: uppercase;
    margin-bottom: 10px;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.word-tray h4 span {
    color: #999;
    font-weight: 400;
}

.tray-words {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.tray-word {
    padding: 10px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-style: italic;
    color: #fff;
    transition: all 0.15s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
    opacity: 0.85;
}

.tray-word:hover {
    opacity: 1;
    transform: translateY(-1px);
}

.add-word-btn {
    width: 42px;
    height: 42px;
    background: #fff;
    border: 2px dashed #ddd;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.4rem;
    color: #bbb;
    transition: all 0.15s;
}

.add-word-btn:hover {
    border-color: #3b82f6;
    color: #3b82f6;
}

.custom-word-input {
    display: flex;
    gap: 4px;
    align-items: center;
}

.custom-word-input input {
    background: #fff;
    border: 1px solid #3b82f6;
    border-radius: 6px;
    padding: 8px 12px;
    color: #333;
    font-size: 0.85rem;
    font-style: italic;
    width: 100px;
    outline: none;
}

.custom-word-input button {
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
}

.custom-word-input .add-btn {
    background: #3b82f6;
    color: #fff;
}

.custom-word-input .cancel-btn {
    background: #f3f4f6;
    border: 1px solid #ddd;
    color: #666;
}

.tray-hint {
    color: #999;
    font-size: 0.85rem;
    font-style: italic;
}

/* Generate Button */
.generate-btn {
    margin-top: 20px;
    background: #10b981;
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-family: inherit;
    font-weight: 500;
    width: 100%;
    transition: all 0.15s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

.generate-btn:hover {
    background: #059669;
}

.generate-btn:disabled {
    opacity: 0.7;
    cursor: wait;
}

/* Poem Panel */
.poem-panel {
    background: #fff;
    border-width: 2px;
    border-style: solid;
    border-radius: 8px;
    padding: 24px;
    min-height: 300px;
    transition: border-color 0.2s ease;
}

.poem-panel h3 {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 16px;
    font-weight: 600;
    transition: color 0.2s ease;
}

.poem-text {
    font-size: 1.05rem;
    line-height: 2;
    font-style: italic;
    white-space: pre-line;
    margin-bottom: 24px;
    color: #1a1a1a;
    font-family: Georgia, "Times New Roman", serif;
}

.poem-placeholder {
    color: #bbb;
    font-style: italic;
    text-align: center;
    margin-top: 60px;
}

.prompt-details summary {
    font-size: 0.75rem;
    color: #888;
    cursor: pointer;
    margin-bottom: 8px;
    font-weight: 500;
}

.prompt-details pre {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 4px;
    white-space: pre-wrap;
    font-size: 0.7rem;
    line-height: 1.5;
    border: 1px solid #e5e5e5;
    color: #555;
}

/* States */
.loading {
    text-align: center;
    padding: 40px;
    color: #888;
}

.error-message {
    background: #fee2e2;
    color: #dc2626;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 0.85rem;
}

.hidden {
    display: none !important;
}

/* Tray Controls */
.tray-controls {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #e5e5e5;
}

.tray-controls .action-btn {
    margin-top: 0;
    padding: 8px 16px;
    font-size: 0.8rem;
}

/* Site Footer */
.site-footer {
    background: #f8f9fa;
    border-top: 1px solid #e5e5e5;
    padding: 24px 40px;
    margin-top: auto;
}

.footer-content {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.how-it-works {
    font-size: 0.85rem;
    color: #666;
    line-height: 1.6;
    margin-bottom: 16px;
}

.how-it-works strong {
    color: #555;
}

.footer-links {
    margin-bottom: 12px;
}

.footer-links a {
    color: #555;
    text-decoration: none;
    font-size: 0.8rem;
    margin-right: 20px;
    transition: color 0.15s;
}

.footer-links a:hover {
    color: #4ABDB5;
}

.copyright {
    font-size: 0.75rem;
    color: #999;
}

/* Responsive */
@media (max-width: 768px) {
    .site-header {
        padding: 14px 20px;
    }
    
    .game-tagline {
        width: 100%;
        margin-top: 4px;
    }
    
    main {
        padding: 20px;
    }
    
    .grid-cell {
        width: 65px;
        height: 42px;
    }
    
    .grid-cell.has-word span {
        font-size: 0.75rem;
    }
    
    .line-label {
        width: 40px;
        font-size: 0.65rem;
    }
    
    .site-footer {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .header-left {
        flex-wrap: wrap;
    }
    
    .brand-sep {
        display: none;
    }
    
    .game-title {
        width: 100%;
        font-size: 1.2rem;
    }
    
    .grid-cell {
        width: 55px;
        height: 38px;
    }
    
    .button-group button {
        padding: 6px 10px;
        font-size: 0.75rem;
    }
}