*{box-sizing:border-box;padding:0;margin:0}body,html{max-width:100vw;overflow-x:hidden;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}body{background:#f5f3f0;background-image:linear-gradient(90deg,rgba(0,0,0,.02) 1px,transparent 0),linear-gradient(rgba(0,0,0,.02) 1px,transparent 0);background-size:20px 20px;min-height:100vh;padding:0}.ios-standalone body{padding-top:env(safe-area-inset-top);padding-bottom:env(safe-area-inset-bottom);min-height:calc(100vh - env(safe-area-inset-top) - env(safe-area-inset-bottom))}.chronicle-app{min-height:100vh;display:flex;flex-direction:column}.story-header{background:#2c3e50;color:#fff;padding:20px 0;box-shadow:0 2px 8px rgba(0,0,0,.1);position:-webkit-sticky;position:sticky;top:0;z-index:100}.ios-standalone .story-header{padding-top:calc(20px + env(safe-area-inset-top))}.header-content{max-width:800px;margin:0 auto;padding:0 24px;display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap;gap:16px}.header-main{flex:1 1}.chronicle-title{font-size:28px;font-weight:700;margin:0 0 4px;letter-spacing:-.5px}.quest-subtitle{font-size:14px;opacity:.9;margin:0;font-weight:400}.header-meta{display:flex;align-items:center;gap:12px;flex-wrap:wrap}.character-chips{display:flex;gap:8px}.character-chip{background:hsla(0,0%,100%,.15);font-weight:500}.character-chip,.day-badge{padding:4px 12px;border-radius:12px;font-size:12px}.day-badge{background:hsla(0,0%,100%,.2);font-weight:600}.focus-toggle{display:flex;align-items:center;gap:6px;font-size:12px;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none}.focus-toggle input[type=checkbox]{width:16px;height:16px;cursor:pointer}.chronicle-main{flex:1 1;padding:32px 20px;display:flex;justify-content:center}.chronicle-content{width:100%;max-width:800px;display:flex;flex-direction:column;gap:24px}.story-snapshot{background:#fff;border-radius:12px;padding:24px;box-shadow:0 2px 8px rgba(0,0,0,.08);border:1px solid #e8e6e3;border-left:4px solid #667eea}.snapshot-header{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:16px;gap:16px;flex-wrap:wrap}.snapshot-title-section{flex:1 1}.snapshot-title{font-size:20px;font-weight:700;color:#2c3e50;margin:0 0 4px;letter-spacing:-.3px}.snapshot-subtitle{font-size:13px;color:#666;margin:0;font-weight:400}.snapshot-actions{display:flex;gap:8px;flex-shrink:0}.snapshot-action-button{padding:6px 12px;background:#f5f5f5;border:1px solid #e0e0e0;border-radius:6px;font-size:12px;color:#666;cursor:pointer;transition:all .2s;white-space:nowrap}.snapshot-action-button:hover{background:#eee;border-color:#ccc;color:#333}.snapshot-action-button:focus{outline:2px solid #667eea;outline-offset:2px}.snapshot-body{margin-bottom:12px}.snapshot-body.collapsed{max-height:3.6em;overflow:hidden;position:relative}.snapshot-body.collapsed:after{content:"";position:absolute;bottom:0;left:0;right:0;height:1.2em;background:linear-gradient(180deg,transparent,#fff)}.snapshot-body.expanded{max-height:none}.snapshot-summary{font-size:15px;line-height:1.8;color:#333;margin:0}.snapshot-empty-message{font-size:14px;color:#999;font-style:italic;margin:0;line-height:1.6}.snapshot-footer{padding-top:12px;border-top:1px solid #f0f0f0}.snapshot-timestamp{font-size:11px;color:#999}.composer-card{background:#fff;border-radius:12px;padding:24px;box-shadow:0 2px 8px rgba(0,0,0,.08);border:1px solid #e8e6e3}.composer-label{display:block;font-size:14px;font-weight:600;color:#333;margin-bottom:12px}.composer-textarea{width:100%;padding:12px 16px;border:2px solid #e8e6e3;border-radius:8px;font-size:15px;font-family:inherit;resize:vertical;outline:none;transition:border-color .2s;line-height:1.6;min-height:80px}.composer-textarea:focus{border-color:#667eea}.composer-textarea:disabled{background:#f5f5f5;cursor:not-allowed}.composer-footer{display:flex;justify-content:space-between;align-items:center;margin-top:16px;flex-wrap:wrap;gap:12px}.composer-meta{display:flex;align-items:center;gap:16px}.char-counter{font-size:12px;color:#666}.char-counter.over-limit{color:#d32f2f;font-weight:600}.final-chapter-checkbox{display:flex;align-items:center;gap:6px;font-size:13px;color:#666;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none}.final-chapter-checkbox input[type=checkbox]{width:16px;height:16px;cursor:pointer;accent-color:#667eea}.final-chapter-checkbox:has(input:disabled){opacity:.5;cursor:not-allowed}.generate-button{padding:12px 24px;background:linear-gradient(135deg,#667eea,#764ba2);color:#fff;border:none;border-radius:8px;font-size:15px;font-weight:600;cursor:pointer;transition:transform .2s,opacity .2s,box-shadow .2s;display:flex;align-items:center;gap:8px}.generate-button:hover:not(:disabled){transform:translateY(-1px);box-shadow:0 4px 12px rgba(102,126,234,.4)}.generate-button:active:not(:disabled){transform:translateY(0)}.generate-button:disabled{opacity:.6;cursor:not-allowed}.writing-indicator{animation:pulse 1.5s ease-in-out infinite}@keyframes pulse{0%,to{opacity:1}50%{opacity:.5}}.chronicle-feed{display:flex;flex-direction:column;gap:32px}.chronicle-entry{background:#fff;border-radius:12px;padding:32px;box-shadow:0 2px 8px rgba(0,0,0,.08);border:1px solid #e8e6e3;position:relative}.chronicle-entry:before{content:"";position:absolute;left:0;top:0;bottom:0;width:4px;background:linear-gradient(180deg,#667eea,#764ba2);border-radius:12px 0 0 12px}.entry-header{display:flex;justify-content:space-between;align-items:baseline;margin-bottom:16px;flex-wrap:wrap;gap:12px}.entry-day{font-size:24px;font-weight:700;color:#2c3e50;margin:0;letter-spacing:-.5px}.entry-meta{display:flex;flex-direction:column;align-items:flex-end;gap:4px}.entry-timestamp,.entry-word-count{font-size:12px;color:#999;font-weight:400}.entry-prompt{margin-bottom:20px;padding-bottom:16px;border-bottom:1px solid #f0f0f0}.entry-prompt em{font-size:14px;color:#666;font-style:italic}.entry-content{font-size:16px;line-height:1.9;color:#333;margin-bottom:24px}.entry-content p{margin-bottom:16px}.entry-content p:last-child{margin-bottom:0}.entry-actions{display:flex;gap:12px;padding-top:16px;border-top:1px solid #f0f0f0}.action-button{padding:8px 16px;background:#f5f5f5;border:1px solid #e0e0e0;border-radius:6px;font-size:13px;color:#666;cursor:pointer;transition:all .2s}.action-button:hover{background:#eee;border-color:#ccc;color:#333}.copy-button{background:#f0f7ff;border-color:#b3d9ff;color:#06c}.copy-button:hover{background:#e0efff;border-color:#9cf}.entry-anchors{margin-top:16px;padding-top:16px;border-top:1px solid #e8e6e3}.entry-anchors-label{font-size:12px;font-weight:600;color:#888;text-transform:uppercase;letter-spacing:.5px;margin-bottom:8px}.entry-anchors-list{display:flex;flex-direction:column;gap:6px;font-size:13px;color:#666;line-height:1.5}.entry-anchor-item{display:block}.entry-anchor-item strong{color:#555;margin-right:6px}.entry-suggestions{margin-top:24px;padding-top:20px;border-top:1px solid #f0f0f0}.suggestions-subtitle{font-size:14px;font-weight:600;color:#666;margin-bottom:12px}.suggestions-chips{display:flex;flex-wrap:wrap;gap:8px}.suggestion-chip{padding:8px 16px;background:#f5f5f5;border:1px solid #e0e0e0;border-radius:20px;font-size:13px;color:#333;cursor:pointer;transition:all .2s;white-space:nowrap;max-width:100%;overflow:hidden;text-overflow:ellipsis}.suggestion-chip:hover{background:#eee;border-color:#667eea;color:#667eea;transform:translateY(-1px);box-shadow:0 2px 4px rgba(0,0,0,.1)}.suggestion-chip:active{transform:translateY(0)}.suggestion-chip:focus{outline:2px solid #667eea;outline-offset:2px}.tomorrow-suggestions{background:#fff;border-radius:12px;padding:20px;box-shadow:0 2px 8px rgba(0,0,0,.08);border:1px solid #e8e6e3;margin-bottom:24px}.suggestions-title{font-size:16px;font-weight:600;color:#2c3e50;margin:0 0 16px}.rewrite-button{background:#fff3cd;border-color:#ffc107;color:#856404}.rewrite-button:hover{background:#ffe69c;border-color:#ffb300;color:#664d03}.revision-badge{padding:4px 10px;background:#e9ecef;border-radius:12px;font-size:11px;color:#666;font-weight:500;margin-left:auto}.modal-overlay{background:rgba(0,0,0,.5);display:flex;align-items:center;justify-content:center;z-index:1000;padding:20px}.modal-content{background:#fff;border-radius:12px;box-shadow:0 10px 40px rgba(0,0,0,.2);max-width:600px;width:100%;max-height:90vh;overflow-y:auto;display:flex;flex-direction:column}.modal-header{display:flex;justify-content:space-between;align-items:center;padding:20px 24px;border-bottom:1px solid #e8e6e3}.modal-title{font-size:20px;font-weight:700;color:#2c3e50;margin:0}.modal-close{background:none;border:none;font-size:28px;color:#999;cursor:pointer;padding:0;width:32px;height:32px;display:flex;align-items:center;justify-content:center;border-radius:4px;transition:all .2s}.modal-close:hover:not(:disabled){background:#f5f5f5;color:#333}.modal-close:disabled{opacity:.5;cursor:not-allowed}.modal-body{padding:24px;flex:1 1}.modal-label{display:block;font-size:14px;font-weight:600;color:#333;margin-bottom:12px}.modal-textarea{width:100%;padding:12px 16px;border:2px solid #e8e6e3;border-radius:8px;font-size:15px;font-family:inherit;resize:vertical;outline:none;transition:border-color .2s;line-height:1.6;min-height:80px}.modal-textarea:focus{border-color:#667eea}.modal-textarea:disabled{background:#f5f5f5;cursor:not-allowed}.modal-footer{display:flex;justify-content:space-between;align-items:center;margin-top:12px;gap:12px}.modal-error{font-size:13px;color:#d32f2f;flex:1 1;text-align:right}.modal-actions{display:flex;gap:12px;padding:20px 24px;border-top:1px solid #e8e6e3;justify-content:flex-end}.modal-button{padding:10px 20px;border-radius:8px;font-size:14px;font-weight:600;cursor:pointer;transition:all .2s;border:1px solid}.cancel-button{background:#fff;border-color:#e0e0e0;color:#666}.cancel-button:hover:not(:disabled){background:#f5f5f5;border-color:#ccc}.rewrite-button{background:linear-gradient(135deg,#667eea,#764ba2);border-color:transparent;color:#fff}.rewrite-button:hover:not(:disabled){transform:translateY(-1px);box-shadow:0 4px 12px rgba(102,126,234,.4)}.modal-button:disabled{opacity:.6;cursor:not-allowed}.empty-state{text-align:center;padding:60px 24px;background:#fff;border-radius:12px;box-shadow:0 2px 8px rgba(0,0,0,.08);border:1px solid #e8e6e3}.empty-icon{font-size:64px;margin-bottom:16px}.empty-title{font-size:24px;font-weight:700;color:#2c3e50;margin-bottom:12px}.empty-description{font-size:16px;color:#666;margin-bottom:32px;line-height:1.6}.empty-example{text-align:left;max-width:500px;margin:0 auto;padding:24px;background:#f9f9f9;border-radius:8px;border:1px solid #e8e6e3}.example-label{font-size:14px;font-weight:600;color:#333;margin-bottom:12px}.example-list{list-style:none;padding:0}.example-list li{font-size:14px;color:#666;padding:8px 0 8px 20px;position:relative;line-height:1.6}.example-list li:before{content:"•";position:absolute;left:0;color:#667eea;font-weight:700}.chronicle-loading{background:#fff;border-radius:12px;padding:32px;box-shadow:0 2px 8px rgba(0,0,0,.08);border:1px solid #e8e6e3;text-align:center}.writing-state{display:flex;align-items:center;justify-content:center;gap:12px;font-size:16px;color:#666}.writing-icon{font-size:20px;animation:pulse 1.5s ease-in-out infinite}.chronicle-error{background:#fff5f5;border:1px solid #fecaca;border-radius:8px;padding:16px;color:#c33;font-size:14px}.chronicle-feed::-webkit-scrollbar{width:8px}.chronicle-feed::-webkit-scrollbar-track{background:transparent}.chronicle-feed::-webkit-scrollbar-thumb{background:#ccc;border-radius:4px}.chronicle-feed::-webkit-scrollbar-thumb:hover{background:#999}@media (max-width:768px){.chronicle-main{padding:20px 12px}.header-content{padding:0 16px;flex-direction:column;align-items:flex-start}.chronicle-title{font-size:24px}.chronicle-content{gap:20px}.composer-card{padding:20px}.chronicle-entry{padding:24px 20px}.entry-day{font-size:20px}.entry-content{font-size:15px;line-height:1.8}.composer-footer{flex-direction:column;align-items:stretch}.generate-button{width:100%;justify-content:center}}.settings-overlay{left:0;background:rgba(0,0,0,.5);z-index:1000;animation:fadeIn .2s ease}.settings-drawer,.settings-overlay{position:fixed;top:0;right:0;bottom:0}.settings-drawer{width:90%;max-width:600px;background:#fff;box-shadow:-2px 0 12px rgba(0,0,0,.15);z-index:1001;display:flex;flex-direction:column;animation:slideInRight .3s ease}.ios-standalone .settings-drawer{bottom:env(safe-area-inset-bottom)}@keyframes slideInRight{0%{transform:translateX(100%)}to{transform:translateX(0)}}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}.settings-drawer-header{display:flex;align-items:center;justify-content:space-between;padding:20px 24px;border-bottom:1px solid #e5e5e5}.settings-drawer-title{font-size:20px;font-weight:600;color:#2c3e50;margin:0}.settings-back-btn,.settings-close-btn{background:none;border:none;font-size:24px;color:#666;cursor:pointer;padding:4px 8px;border-radius:4px;transition:background .2s}.settings-back-btn:hover,.settings-close-btn:hover{background:#f0f0f0}.settings-back-btn{font-size:16px;margin-right:12px}.settings-drawer-content{flex:1 1;overflow-y:auto;padding:24px}.settings-main{gap:32px}.settings-main,.settings-section{display:flex;flex-direction:column}.settings-section{gap:16px}.settings-section-title{font-size:16px;font-weight:600;color:#2c3e50;margin:0}.settings-field{display:flex;flex-direction:column;gap:8px}.settings-field label{font-size:14px;font-weight:500;color:#555}.settings-input{padding:10px 12px;border:1px solid #ddd;border-radius:6px;font-size:14px;font-family:inherit}.settings-input:focus{outline:none;border-color:#3498db;box-shadow:0 0 0 3px rgba(52,152,219,.1)}.settings-hint{font-size:12px;color:#888;margin:0}.settings-action-btn{padding:12px 20px;background:#3498db;color:#fff;border:none;border-radius:6px;font-size:14px;font-weight:500;cursor:pointer;transition:background .2s}.settings-action-btn:hover{background:#2980b9}.settings-disabled{color:#888;font-size:14px;margin:0}.world-badge{padding:4px 10px;border:1px solid hsla(0,0%,100%,.25);border-radius:12px;font-size:11px;color:hsla(0,0%,100%,.9);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:120px}.back-to-library-btn,.world-badge{background:hsla(0,0%,100%,.15);font-weight:500}.back-to-library-btn{padding:6px 12px;border:1px solid hsla(0,0%,100%,.3);border-radius:6px;color:#fff;font-size:13px;text-decoration:none;cursor:pointer;transition:all .2s;display:inline-flex;align-items:center;gap:4px}.back-to-library-btn:hover{background:hsla(0,0%,100%,.25);border-color:hsla(0,0%,100%,.4)}.settings-gear-btn{background:none;border:none;font-size:20px;cursor:pointer;padding:8px;border-radius:4px;transition:background .2s;color:#fff}.settings-gear-btn:hover{background:hsla(0,0%,100%,.1)}.logs-list{display:flex;flex-direction:column;height:100%}.logs-list-header{display:flex;align-items:center;justify-content:space-between;padding-bottom:16px;border-bottom:1px solid #e5e5e5;margin-bottom:16px}.logs-list-header h3{font-size:18px;font-weight:600;color:#2c3e50;margin:0}.logs-close-btn{padding:6px 12px;background:#e74c3c;color:#fff;border:none;border-radius:4px;font-size:12px;cursor:pointer}.logs-items{display:flex;flex-direction:column;gap:12px;flex:1 1;overflow-y:auto}.logs-item{padding:16px;border:1px solid #e5e5e5;border-radius:8px;cursor:pointer;transition:all .2s;background:#fff}.logs-item:hover{border-color:#3498db;box-shadow:0 2px 8px rgba(52,152,219,.1)}.logs-item-success{border-left:4px solid #27ae60}.logs-item-error{border-left:4px solid #e74c3c}.logs-item-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:8px}.logs-item-op{font-weight:600;color:#2c3e50;font-size:14px}.logs-item-status{padding:4px 8px;border-radius:4px;font-size:12px;font-weight:500;text-transform:uppercase}.logs-status-success{background:#d4edda;color:#155724}.logs-status-error{background:#f8d7da;color:#721c24}.logs-item-meta{display:flex;gap:12px;font-size:12px;color:#888;margin-bottom:4px;flex-wrap:wrap}.logs-item-route{font-size:12px;color:#666;font-family:Courier New,monospace}.logs-empty,.logs-loading{text-align:center;padding:40px 20px;color:#888}.logs-error{padding:20px;background:#f8d7da;color:#721c24;border-radius:6px;text-align:center}.logs-error button{margin-top:12px;padding:8px 16px;background:#e74c3c;color:#fff;border:none;border-radius:4px;cursor:pointer}.logs-load-more-btn{margin-top:16px;padding:12px;background:#ecf0f1;border:1px solid #ddd;border-radius:6px;cursor:pointer;font-size:14px;transition:background .2s}.logs-load-more-btn:hover:not(:disabled){background:#d5dbdb}.logs-load-more-btn:disabled{opacity:.6;cursor:not-allowed}.logs-detail{display:flex;flex-direction:column;height:100%}.logs-detail-header{display:flex;align-items:center;gap:12px;padding-bottom:16px;border-bottom:1px solid #e5e5e5;margin-bottom:16px}.logs-detail-header h3{font-size:18px;font-weight:600;color:#2c3e50;margin:0}.logs-back-btn{padding:6px 12px;background:#ecf0f1;border:1px solid #ddd;border-radius:4px;font-size:14px;cursor:pointer}.logs-detail-content{flex:1 1;overflow-y:auto}.logs-detail-meta{flex-direction:column;padding:16px;background:#f8f9fa;border-radius:8px;margin-bottom:16px}.logs-detail-meta,.logs-detail-meta-row{display:flex;gap:12px}.logs-detail-label{font-weight:600;color:#555;min-width:100px;font-size:14px}.logs-detail-value{color:#2c3e50;font-size:14px}.logs-detail-sections{display:flex;flex-direction:column;gap:16px}.logs-detail-section{border:1px solid #e5e5e5;border-radius:8px;overflow:hidden}.logs-detail-section-header{display:flex;align-items:center;justify-content:space-between;padding:12px 16px;background:#f8f9fa;border-bottom:1px solid #e5e5e5}.logs-detail-section-toggle{background:none;border:none;font-size:14px;font-weight:600;color:#2c3e50;cursor:pointer;padding:4px 8px}.logs-detail-copy-btn{padding:6px 12px;background:#3498db;color:#fff;border:none;border-radius:4px;font-size:12px;cursor:pointer}.logs-detail-code{padding:16px;background:#2c3e50;color:#ecf0f1;font-family:Courier New,monospace;font-size:12px;line-height:1.6;overflow-x:auto;margin:0;white-space:pre-wrap;word-wrap:break-word}.logs-detail-error{background:#2c1810;color:#f8d7da}@media (max-width:768px){.settings-drawer{width:100%;max-width:100%}}.modal-overlay{position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,.6);z-index:2000;animation:fadeIn .2s ease}.clear-all-modal{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);width:90%;max-width:500px;background:#fff;border-radius:12px;box-shadow:0 8px 32px rgba(0,0,0,.2);z-index:2001;display:flex;flex-direction:column;max-height:90vh;animation:slideInScale .3s ease}@keyframes slideInScale{0%{opacity:0;transform:translate(-50%,-50%) scale(.9)}to{opacity:1;transform:translate(-50%,-50%) scale(1)}}.clear-all-modal-header{display:flex;align-items:center;justify-content:space-between;padding:20px 24px;border-bottom:1px solid #e5e5e5}.clear-all-modal-title{font-size:20px;font-weight:600;color:#2c3e50;margin:0}.clear-all-modal-close{background:none;border:none;font-size:24px;color:#666;cursor:pointer;padding:4px 8px;border-radius:4px;transition:background .2s}.clear-all-modal-close:hover:not(:disabled){background:#f0f0f0}.clear-all-modal-close:disabled{opacity:.5;cursor:not-allowed}.clear-all-modal-content{padding:24px;overflow-y:auto;flex:1 1}.clear-all-warning{margin-bottom:24px}.clear-all-warning-text{font-size:14px;color:#555;margin-bottom:12px;line-height:1.6}.clear-all-warning-list{margin:12px 0;padding-left:24px;color:#666;font-size:14px;line-height:1.8}.clear-all-warning-list li{margin-bottom:6px}.clear-all-confirm-section{margin-bottom:16px}.clear-all-confirm-label{display:block;font-size:14px;font-weight:500;color:#555;margin-bottom:8px}.clear-all-confirm-input{width:100%;padding:12px;border:2px solid #ddd;border-radius:6px;font-size:16px;font-family:Courier New,monospace;text-transform:uppercase;transition:border-color .2s}.clear-all-confirm-input:focus{outline:none;border-color:#e74c3c;box-shadow:0 0 0 3px rgba(231,76,60,.1)}.clear-all-confirm-input:disabled{background:#f5f5f5;cursor:not-allowed}.clear-all-error{background:#fee;color:#c33}.clear-all-error,.clear-all-loading{padding:12px;border-radius:6px;font-size:14px;margin-bottom:16px}.clear-all-loading{background:#f0f7ff;color:#06c;text-align:center}.clear-all-modal-footer{display:flex;gap:12px;padding:20px 24px;border-top:1px solid #e5e5e5;justify-content:flex-end}.clear-all-btn{padding:10px 20px;border:none;border-radius:6px;font-size:14px;font-weight:500;cursor:pointer;transition:all .2s}.clear-all-btn:disabled{opacity:.5;cursor:not-allowed}.clear-all-btn-cancel{background:#ecf0f1;color:#555}.clear-all-btn-cancel:hover:not(:disabled){background:#d5dbdb}.clear-all-btn-confirm{background:#e74c3c;color:#fff}.clear-all-btn-confirm:hover:not(:disabled){background:#c0392b}.settings-danger-btn{background:#e74c3c;color:#fff}.settings-danger-btn:hover{background:#c0392b}