* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #0d1117; color: #e6edf3; }
.ps-main { padding: 2rem; }
h1 { text-align: center; font-size: 2.2rem; font-weight: 300; letter-spacing: 0.15em; text-transform: uppercase; margin-top: 1.5rem; margin-bottom: 0.5rem; }
.subtitle { text-align: center; color: #6fffe9; font-size: 0.85rem; letter-spacing: 0.3em; text-transform: uppercase; margin-bottom: 1rem; opacity: 0.7; }
.settings-wrapper { position: absolute; top: 4.2rem; right: 1rem; z-index: 101; }
.settings-btn { background: none; border: none; color: #8b949e; font-size: 1.4rem; cursor: pointer; padding: 0.3rem; width: auto; margin: 0; }
.settings-btn:hover { color: #e6edf3; }
.settings-menu { position: absolute; top: 2rem; right: 0; background: #161b22; border: 1px solid #30363d; border-radius: 6px; padding: 0.3rem; min-width: 140px; }
.settings-menu button { background: none; border: none; color: #e6edf3; padding: 0.5rem 0.75rem; width: 100%; text-align: left; cursor: pointer; font-size: 0.85rem; border-radius: 4px; margin: 0; }
.settings-menu button:hover { background: #1c2330; }

/* Setup panel */
#setup { max-width: 500px; margin: 0 auto; }
label { display: block; font-size: 0.85rem; color: #8b949e; margin-bottom: 0.3rem; margin-top: 1rem; }
.checkbox-group { background: #161b22; border: 1px solid #30363d; border-radius: 6px; padding: 0.5rem; max-height: 160px; overflow-y: auto; }
.checkbox-group.highlight { border-color: #f0883e; box-shadow: 0 0 6px rgba(240,136,62,0.4); transition: border-color 0.3s, box-shadow 0.3s; }
.checkbox-group label { display: flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0.5rem; margin: 0; border-radius: 4px; cursor: pointer; color: #e6edf3; font-size: 0.9rem; }
.checkbox-group label:hover { background: #1c2330; }
.checkbox-group input[type="checkbox"], .checkbox-group input[type="radio"] { accent-color: #6fffe9; width: 16px; height: 16px; }
.delete-btn { margin-left: auto; color: #f85149; cursor: pointer; font-size: 0.8rem; padding: 0 0.4rem; opacity: 0; transition: opacity 0.2s; }
.checkbox-group label:hover .delete-btn { opacity: 1; }
.empty-state { color: #8b949e; font-size: 0.85rem; margin: 0.5rem; font-style: italic; }
.not-found-box { background: #3d1f1f; border: 1px solid #f85149; border-radius: 6px; padding: 0.75rem 1rem; margin-bottom: 1rem; color: #f85149; font-size: 0.85rem; }
.no-match-section { background: #161b22; border: 1px solid #30363d; border-radius: 6px; padding: 0.75rem 1rem; margin-top: 1.5rem; color: #8b949e; font-size: 0.85rem; }
.no-match-section summary { cursor: pointer; color: #e6edf3; }
.no-match-section ul { margin: 0.5rem 0 0; padding-left: 1.5rem; columns: 2; }
.no-match-section li { padding: 0.15rem 0; }

/* Find bar */
.find-bar { position: fixed; top: 0; right: 0; background: #161b22; border: 1px solid #30363d; border-radius: 0 0 0 6px; padding: 0.4rem 0.6rem; display: flex; align-items: center; gap: 0.4rem; z-index: 999; }
.find-bar input { background: #0d1117; border: 1px solid #30363d; color: #e6edf3; padding: 0.3rem 0.5rem; border-radius: 4px; font-size: 0.85rem; width: 180px; }
.find-bar button { background: none; border: none; color: #8b949e; cursor: pointer; font-size: 0.85rem; padding: 0.2rem 0.4rem; margin: 0; width: auto; }
.find-bar button:hover { color: #e6edf3; }
.find-bar #find-count { color: #8b949e; font-size: 0.8rem; }
.find-highlight { background: rgba(255, 200, 0, 0.3); border-radius: 2px; }
.find-highlight-active { background: rgba(255, 200, 0, 0.7); }

/* Card selection & action bar */
.card { cursor: pointer; }
.card.selected img { outline: 3px solid #6fffe9; border-radius: 8px; }
.action-bar { position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%); background: #161b22; border: 1px solid #30363d; padding: 0.75rem 2rem; display: flex; align-items: center; gap: 1rem; z-index: 998; border-radius: 50px; box-shadow: 0 8px 24px rgba(0,0,0,0.4); animation: slideUp 0.3s ease; white-space: nowrap; }
.action-bar.hidden { display: none; }
@keyframes slideUp { from { transform: translateX(-50%) translateY(100%); opacity: 0; } to { transform: translateX(-50%) translateY(0); opacity: 1; } }
.action-bar span { color: #e6edf3; font-size: 0.9rem; white-space: nowrap; }
.action-bar button { width: auto; margin: 0; padding: 0.5rem 1rem; font-size: 0.85rem; background: #161b22; border: 1px solid #30363d; color: #e6edf3; border-radius: 50px; cursor: pointer; }
.action-bar button:hover { background: #1c2330; }
.action-bar .scryfall-btn { background: #238636; border-color: #238636; }
.action-bar .scryfall-btn:hover { background: #2ea043; }
.export-wrapper { position: relative; }
.export-btn { background: #161b22; border: 1px solid #6fffe9; color: #6fffe9; }
.export-btn:hover { background: #1c2330; }
.export-menu { position: absolute; bottom: 3rem; right: 0; background: #161b22; border: 1px solid #30363d; border-radius: 6px; padding: 0.3rem; min-width: 160px; }
.export-menu button { display: block; width: 100%; text-align: left; background: none; border: none; color: #e6edf3; padding: 0.5rem 0.75rem; font-size: 0.85rem; border-radius: 4px; cursor: pointer; margin: 0; }
.export-menu button:hover { background: #1c2330; }
.export-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.export-overlay span { background: #161b22; border: 1px solid #30363d; padding: 1rem 2rem; border-radius: 10px; color: #e6edf3; font-size: 1rem; }
.export-text { display: inline-block; text-align: left; }
.export-text::after { content: 'Generating PDF...'; visibility: hidden; height: 0; display: block; }
.export-text::before { content: 'Generating PDF.'; animation: dots 0.8s steps(3, end) infinite; }
@keyframes dots { 0% { content: 'Generating PDF.'; } 33% { content: 'Generating PDF..'; } 66% { content: 'Generating PDF...'; } }

/* Buttons */
button { margin-top: 1.5rem; width: 100%; padding: 0.7rem; background: #238636; border: none; color: #fff; border-radius: 6px; font-size: 1rem; cursor: pointer; }
button:hover { background: #2ea043; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

/* Import */
.import-row { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.import-row input { flex: 1; padding: 0.5rem; background: #161b22; border: 1px solid #30363d; color: #e6edf3; border-radius: 6px; font-size: 0.85rem; }
.import-row button { margin-top: 0; width: auto; padding: 0.5rem 1rem; font-size: 0.85rem; }
#import-status { font-size: 0.8rem; margin-top: 0.3rem; color: #6fffe9; }
.hint { font-size: 0.75rem; color: #8b949e; margin: 0.3rem 0 0; line-height: 1.4; }
.hint code { background: #161b22; padding: 0.1rem 0.3rem; border-radius: 3px; color: #e6edf3; }
#deck-save-status { font-size: 0.8rem; margin-top: 0.3rem; color: #6fffe9; }
.secondary-btn { background: #161b22; border: 1px solid #30363d; color: #e6edf3; margin-top: 0.5rem; }
.secondary-btn:hover { background: #1c2330; }
.tertiary-btn { background: none; border: 1px solid transparent; color: #8b949e; margin-top: 0.5rem; font-size: 0.8rem; padding: 0.4rem 0.75rem; cursor: pointer; width: auto; border-radius: 6px; }
.tertiary-btn:hover { background: #161b22; border-color: #30363d; color: #e6edf3; }
.sub-label { font-size: 0.8rem; color: #8b949e; margin-top: 0.75rem; margin-bottom: 0; }
#new-artist-form input[type="text"], #new-deck-form input[type="text"] { width: 100%; padding: 0.5rem; background: #161b22; border: 1px solid #30363d; color: #e6edf3; border-radius: 6px; font-size: 0.85rem; margin-top: 0.3rem; }
#new-artist-form textarea, #new-deck-form textarea { width: 100%; padding: 0.5rem; background: #161b22; border: 1px solid #30363d; color: #e6edf3; border-radius: 6px; font-size: 0.85rem; margin-top: 0.3rem; resize: vertical; font-family: inherit; }
.artist-entry { display: flex; gap: 0.5rem; margin-top: 0.4rem; align-items: center; }
.artist-entry input { flex: 1; padding: 0.5rem; background: #161b22; border: 1px solid #30363d; color: #e6edf3; border-radius: 6px; font-size: 0.85rem; }
.artist-entry .delete-btn { opacity: 1; position: static; margin-left: 0; }
#artist-entries { max-height: 200px; overflow-y: auto; }
#artist-list-status { font-size: 0.8rem; margin-top: 0.3rem; color: #6fffe9; }

/* Progress */
#progress { text-align: center; margin-top: 1rem; font-size: 0.85rem; color: #8b949e; }
.progress-bar { height: 4px; background: #21262d; border-radius: 2px; margin-top: 0.5rem; overflow: hidden; }
.progress-bar-fill { height: 100%; background: #6fffe9; transition: width 0.3s; }
.fetch-hint { color: #8b949e; font-size: 0.8rem; margin-top: 0.5rem; font-style: italic; }
.cancel-btn { background: none; border: 1px solid #30363d; color: #e6edf3; width: auto; padding: 0.3rem 0.75rem; font-size: 0.8rem; margin-top: 0.5rem; border-radius: 4px; }
.cancel-btn:hover { background: #da3633; border-color: #da3633; }

/* Sort */
#sort-select { display: none; }
.sort-control { position: absolute; left: 0; top: 50%; transform: translateY(-50%); display: flex; align-items: center; gap: 0.3rem; font-size: 0.8rem; }
.sort-label { color: #8b949e; }
.sort-option { color: #8b949e; cursor: pointer; padding: 0.25rem 0.5rem; border-radius: 4px; }
.sort-option:hover { color: #e6edf3; }
.sort-option.active { color: #6fffe9; }

/* Results */
#results { max-width: 1200px; margin: 0 auto; display: none; }
.filters { text-align: center; margin-bottom: 1.5rem; position: relative; }
.filters button { width: auto; display: inline-block; background: #161b22; border: 1px solid #30363d; color: #e6edf3; padding: 0.65rem 1.5rem; border-radius: 6px; cursor: pointer; font-size: 0.9rem; margin: 0 0.3rem; }
.filters button:hover { background: #1c2330; }
.filters button.active { border-color: #6fffe9; color: #6fffe9; }
details { margin-bottom: 1rem; border-radius: 10px; overflow: hidden; }
summary { cursor: pointer; list-style: none; background: #161b22; padding: 1.2rem 1.5rem; display: flex; align-items: center; justify-content: center; position: relative; border-radius: 10px; transition: background 0.2s; }
summary:hover { background: #1c2330; }
summary::-webkit-details-marker { display: none; }
summary h2 { margin: 0; font-size: 1.3rem; font-weight: 500; color: #6fffe9; letter-spacing: 0.05em; }
summary::after { content: "▼"; color: #6fffe9; font-size: 1.1rem; position: absolute; right: 1.5rem; transition: transform 0.2s; opacity: 0.8; }
details:not([open]) summary::after { transform: rotate(-90deg); }
details:not([open]) summary { border-radius: 10px; }
details[open] summary { border-radius: 10px 10px 0 0; border-bottom: 1px solid #21262d; }
.booth { font-size: 0.75rem; font-weight: 400; color: #8b949e; margin-left: 0.75rem; }
.card-count { font-size: 0.85rem; font-weight: 400; color: #8b949e; margin-left: 0.75rem; }
.deck-count { display: block; font-size: 0.75rem; color: #6fffe9; margin-top: 0.2rem; }
.grid { display: flex; flex-wrap: wrap; gap: 1rem; padding: 1.5rem; background: #0d1117; border: 1px solid #21262d; border-top: none; border-radius: 0 0 10px 10px; }
.card { text-align: center; width: 200px; }
.card img { width: 200px; border-radius: 8px; transition: transform 0.2s; }
.card img:hover { transform: scale(1.05); box-shadow: 0 4px 20px rgba(111,255,233,0.15); }
.card p { margin: .5rem 0; font-size: .85rem; }
.card.sideboard, .card.considering { opacity: 0.4; }
.card.sideboard:hover, .card.considering:hover { opacity: 0.7; }
.board-label { display: block; font-size: 0.7rem; color: #8b949e; font-style: italic; margin-top: 0.25rem; }
small { color: #7d8590; }
.hidden { display: none !important; }
.card.basicland { display: none; }
.lands-only { display: none; }
body.land-mode .lands-only { display: block; }
body.land-mode details:not(.lands-only):not(.has-lands) { display: none; }
body.land-mode .card:not(.basicland) { display: none !important; }
body.land-mode .card.basicland { display: block !important; }
.back-btn { display: inline-block; margin-bottom: 1.5rem; background: #161b22; border: 1px solid #30363d; color: #e6edf3; padding: 0.4rem 1rem; border-radius: 6px; cursor: pointer; font-size: 0.85rem; width: auto; }
.back-btn:hover { background: #1c2330; }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal-content { background: #161b22; border: 1px solid #30363d; border-radius: 10px; padding: 1.5rem; min-width: 300px; max-width: 400px; }
.modal-content h3 { color: #6fffe9; margin-bottom: 1rem; font-size: 1.1rem; text-align: center; }
.modal-content button { display: block; width: 100%; text-align: left; background: none; border: none; color: #e6edf3; padding: 0.6rem 0.75rem; font-size: 0.9rem; border-radius: 6px; cursor: pointer; margin-bottom: 0.3rem; }
.modal-content button:hover { background: #1c2330; }
.modal-new { display: flex; gap: 0.5rem; margin-top: 0.75rem; }
.modal-new input { flex: 1; padding: 0.5rem; background: #0d1117; border: 1px solid #30363d; color: #e6edf3; border-radius: 6px; font-size: 0.85rem; }
.modal-new button { width: auto; padding: 0.5rem 1rem; background: #238636; border: none; color: #fff; border-radius: 6px; margin: 0; }
.modal-close { margin-top: 0.75rem; color: #8b949e !important; text-align: center !important; }

/* Convention links on home */
.checklists-section { margin-top: 1.5rem; }
.checklists-divider { height: 1px; background: #21262d; margin-bottom: 1rem; }
.convention-links { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.5rem; }
.convention-link { background: #161b22; border: 1px solid #6fffe9; color: #6fffe9; padding: 0.4rem 1rem; border-radius: 50px; font-size: 0.85rem; cursor: pointer; width: auto; margin: 0; }
.convention-link:hover { background: #1c2330; }

/* Checklist view */
#checklist-view { max-width: 700px; margin: 0 auto; }
.checklist-title { color: #6fffe9; font-size: 1.5rem; margin-bottom: 0.3rem; }
.checklist-progress { color: #8b949e; font-size: 0.85rem; margin-bottom: 1.5rem; }
.delete-checklist-btn { background: none; border: 1px solid #30363d; color: #e6edf3; width: auto; padding: 0.3rem 0.75rem; font-size: 0.75rem; border-radius: 4px; margin-bottom: 1.5rem; margin-top: 0; cursor: pointer; }
.delete-checklist-btn:hover { background: #da3633; border-color: #da3633; }
.share-checklist-btn { background: none; border: 1px solid #6fffe9; color: #6fffe9; width: auto; padding: 0.3rem 0.75rem; font-size: 0.75rem; margin-bottom: 1.5rem; margin-top: 0; margin-left: 0.5rem; cursor: pointer; border-radius: 4px; }
.share-checklist-btn:hover { background: #1c2330; }
.share-export-btn { display: block; width: 100%; text-align: center !important; background: #161b22 !important; border: 1px solid #6fffe9 !important; color: #6fffe9 !important; padding: 0.6rem !important; border-radius: 50px !important; font-size: 0.9rem; cursor: pointer; margin-bottom: 0.75rem; transition: background 0.2s; }
.share-export-btn:hover { background: #1c2330 !important; }
.share-export-btn:active { background: #238636 !important; border-color: #238636 !important; color: #fff !important; }
.checklist-artist { margin-bottom: 1.2rem; }
.checklist-artist h3 { color: #e6edf3; font-size: 1rem; margin-bottom: 0.5rem; padding-bottom: 0.3rem; border-bottom: 1px solid #21262d; }
.checklist-artist .booth { color: #8b949e; font-size: 0.8rem; }
.checklist-card { display: flex; align-items: center; gap: 0.6rem; padding: 0.4rem 0.5rem; border-radius: 4px; cursor: pointer; color: #e6edf3; font-size: 0.9rem; }
.checklist-card:hover { background: #1c2330; }
.checklist-card input[type="checkbox"] { accent-color: #6fffe9; width: 16px; height: 16px; }
.checklist-card.signed span { text-decoration: line-through; color: #8b949e; }
.checklist-card small { margin-left: auto; color: #7d8590; font-size: 0.75rem; }
.checklist-card .remove-card { color: #f85149; font-size: 0.9rem; margin-left: 0.5rem; opacity: 0; transition: opacity 0.2s; cursor: pointer; padding: 0.2rem 0.4rem; }
.checklist-card:hover .remove-card { opacity: 0.6; }
.checklist-card .remove-card:hover { opacity: 1; }
.remove-artist { font-size: 0.7rem; font-weight: 400; color: #8b949e; margin-left: auto; cursor: pointer; opacity: 0; transition: opacity 0.2s, border-color 0.2s; border: 1px solid transparent; border-radius: 4px; padding: 0.2rem 0.5rem; }
.checklist-artist:hover .remove-artist { opacity: 0.5; border-color: #30363d; }
.remove-artist:hover { opacity: 1 !important; color: #f85149 !important; border-color: #f85149 !important; }
.checklist-artist h3:hover .remove-artist { opacity: 1; }
.checklist-artist h3 { display: flex; align-items: center; }

.app-credit { text-align: center; color: #8b949e; font-size: 0.7rem; margin-top: 2rem; opacity: 0.6; }
