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

:root {
    --green: #10a37f;
    --green-hover: #0d8c6d;
    --red: #ef4444;
    --red-hover: #dc2626;
    --gray: #6b7280;
    --bg: #f7f7f8;
    --card: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --border: #e5e7eb;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

.container { max-width: 900px; margin: 0 auto; padding: 2rem 1rem; }

.header { text-align: center; margin-bottom: 2.5rem; }
.header h1 { font-size: 2rem; margin-bottom: 0.25rem; }
.subtitle { color: var(--muted); }

.card {
    background: var(--card);
    border-radius: 12px;
    padding: 1.75rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.card h2 { font-size: 1.25rem; margin-bottom: 1rem; }

.hint { font-size: .9rem; color: var(--muted); margin-bottom: 1rem; }
.hint a { color: var(--green); text-decoration: none; }
.hint a:hover { text-decoration: underline; }

.form-group { margin-bottom: 1rem; }
.form-group textarea {
    width: 100%;
    padding: .75rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-family: 'Consolas', monospace;
    font-size: .9rem;
    resize: vertical;
    min-height: 120px;
    transition: border-color .2s;
}
.form-group textarea:focus { outline: none; border-color: var(--green); }

.form-row { display: flex; gap: .75rem; }
.form-row input {
    flex: 1;
    padding: .75rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: .95rem;
    transition: border-color .2s;
}
.form-row input:focus { outline: none; border-color: var(--green); }

.count {
    display: inline-block;
    background: var(--green);
    color: white;
    font-size: .8rem;
    font-weight: 700;
    padding: .1rem .5rem;
    border-radius: 99px;
    vertical-align: middle;
}

.empty-state { text-align: center; padding: 2.5rem; color: var(--muted); }

.session-item {
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: .75rem;
    transition: border-color .2s, box-shadow .2s;
}
.session-item:hover { border-color: var(--green); box-shadow: 0 4px 12px rgba(16,163,127,.12); }

.session-info { display: flex; flex-direction: column; gap: .3rem; }
.session-nickname { font-size: 1.1rem; font-weight: 700; }
.session-email { color: var(--muted); font-size: .9rem; }

.badge {
    display: inline-block;
    padding: .2rem .6rem;
    border-radius: 6px;
    font-size: .8rem;
    font-weight: 600;
    width: fit-content;
}
.badge.valid { background: #d1fae5; color: #065f46; }
.badge.expired { background: #fee2e2; color: #991b1b; }

.session-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* Buttons */
.btn {
    padding: .65rem 1.25rem;
    border: none;
    border-radius: 8px;
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
}
.btn-sm { padding: .45rem .9rem; font-size: .85rem; }
.btn-primary { background: var(--green); color: white; }
.btn-primary:hover { background: var(--green-hover); transform: translateY(-1px); }
.btn-secondary { background: var(--gray); color: white; }
.btn-secondary:hover { background: #4b5563; }
.btn-danger { background: var(--red); color: white; }
.btn-danger:hover { background: var(--red-hover); }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 1000; }
.modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,.5); }
.modal-content {
    position: relative;
    background: var(--card);
    border-radius: 12px;
    max-width: 680px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    margin: 2rem auto;
    box-shadow: 0 20px 40px rgba(0,0,0,.2);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.75rem;
    border-bottom: 2px solid var(--border);
}
.modal-header h2 { font-size: 1.1rem; }
.close-btn { background: none; border: none; font-size: 1.75rem; color: var(--muted); cursor: pointer; line-height: 1; }
.close-btn:hover { color: var(--text); }
.modal-body { padding: 1.75rem; }

.modal-section { margin-bottom: 1.75rem; }
.modal-section h3 { color: var(--green); margin-bottom: .75rem; font-size: 1rem; }
.modal-section ol { margin-left: 1.25rem; }
.modal-section li { margin-bottom: .4rem; font-size: .95rem; }
.modal-section a { color: var(--green); }
.modal-section p { margin-bottom: .5rem; font-size: .95rem; }
.modal-section code {
    background: var(--bg);
    padding: .15rem .4rem;
    border-radius: 4px;
    font-family: 'Consolas', monospace;
    font-size: .85rem;
    color: var(--green);
}
.modal-section kbd {
    background: var(--text);
    color: white;
    padding: .15rem .4rem;
    border-radius: 4px;
    font-size: .8rem;
}

.code-block {
    width: 100%;
    min-height: 100px;
    padding: .75rem;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: 8px;
    font-family: 'Consolas', monospace;
    font-size: .82rem;
    margin: .5rem 0 .75rem;
    resize: vertical;
    cursor: text;
}
.code-block:focus { outline: none; border-color: var(--green); }

.bookmarklet {
    display: inline-block;
    padding: .75rem 1.25rem;
    background: var(--green);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    margin: .5rem 0;
    cursor: move;
    transition: all .2s;
}
.bookmarklet:hover { background: var(--green-hover); transform: translateY(-2px); }

.warning {
    background: #fef3c7;
    border-left: 4px solid #f59e0b;
    padding: .75rem 1rem;
    margin-bottom: 1.25rem;
    border-radius: 4px;
    color: #92400e;
    font-size: .9rem;
}
.warning code { background: #fde68a; color: #78350f; padding: .1rem .3rem; border-radius: 3px; }

/* Toast */
.toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    padding: .75rem 1.25rem;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    z-index: 2000;
    animation: slideIn .25s ease-out;
}
.toast.success { background: var(--green); }
.toast.error { background: var(--red); }

@keyframes slideIn {
    from { transform: translateX(120%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@media (max-width: 640px) {
    .session-item { flex-direction: column; align-items: flex-start; gap: .75rem; }
    .session-actions { width: 100%; }
    .session-actions .btn { flex: 1; text-align: center; }
    .form-row { flex-direction: column; }
    .modal-content { width: 95%; margin: .5rem auto; }
    .modal-header, .modal-body { padding: 1rem; }
    .toast { left: 1rem; right: 1rem; }
}
